﻿body {
    margin: 0;
    font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
    background: #f8fafc;
    color: #1f2937;
}

* {
    box-sizing: border-box;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 248px;
    background: #0f172a;
    color: #fff;
    padding: 24px 16px;
    box-sizing: border-box;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
}

.admin-sidebar .brand {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #f8fafc;
}

.brand-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: #94a3b8;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    transition: all 0.15s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.nav-link.active {
    background: rgba(37, 99, 235, 0.18);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.16);
}

.admin-main {
    flex: 1;
    padding: 24px 32px;
    box-sizing: border-box;
}

.topbar-minimal {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.topbar-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: #334155;
}

.topbar-user-name {
    font-size: 14px;
    font-weight: 700;
}

.topbar-user-account {
    font-size: 12px;
    color: #64748b;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.2;
    color: #0f172a;
}

.page-header p {
    margin: 0;
    color: #64748b;
    line-height: 1.7;
}

.page-message,
.card,
.form-card,
.table-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    margin-bottom: 20px;
}

.page-message {
    border-left: 4px solid #2563eb;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: end;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-row label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.input {
    min-width: 180px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
}

.input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    border: 0;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

th {
    font-size: 13px;
    color: #475569;
    font-weight: 700;
}

tbody tr:hover {
    background: #f8fafc;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-actions {
    display: flex;
    gap: 8px;
}

.action-row {
    display: flex;
    gap: 12px;
}

.single-column {
    grid-template-columns: 1fr;
}

.detail-list {
    margin: 0;
    padding-left: 20px;
}

.detail-list li {
    margin-bottom: 8px;
}

.detail-block {
    margin-bottom: 16px;
    line-height: 1.6;
}

.textarea-large {
    min-height: 140px;
}

.textarea-medium {
    min-height: 96px;
}

.option-block {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 16px;
}

.inline-row {
    display: flex;
    gap: 16px;
    align-items: end;
}

.input-small {
    min-width: 100px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    min-height: 42px;
}

.two-column-layout {
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
}

.inline-form {
    display: inline;
}

.link-button {
    background: none;
    border: 0;
    color: #2563eb;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.api-notice {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
}

.table-muted {
    color: #6b7280;
    font-size: 12px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 13px;
}

.tag-chip.subtle {
    background: #f3f4f6;
    color: #374151;
}

.reason-block {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.reason-block:last-child {
    border-bottom: 0;
}

.json-preview {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, monospace;
    font-size: 12px;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
}

.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.validation-summary {
    margin: 0 0 16px;
    padding: 12px;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
}

.login-body {
    min-height: 100vh;
    margin: 0;
    font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
    padding: 32px;
}

.login-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.login-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
}

.login-card-header h1 {
    margin: 0 0 4px;
    font-size: 24px;
    color: #0f172a;
}

.login-card-header p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.login-actions {
    margin-top: 20px;
}

.login-submit {
    width: 100%;
}

.login-footer {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #94a3b8;
    font-size: 12px;
}

.dashboard-hero-block {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.dashboard-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-stat-card {
    min-height: 160px;
}

.dashboard-stat-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 12px;
}

.dashboard-stat-value {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
}

.dashboard-stat-note {
    color: #64748b;
    line-height: 1.7;
    font-size: 14px;
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 20px;
}

.dashboard-link-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-link-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.dashboard-link-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
    color: #0f172a;
}

.dashboard-link-card span {
    color: #64748b;
    line-height: 1.6;
    font-size: 14px;
}

.dashboard-link-card:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.dashboard-list {
    margin: 0;
    padding-left: 20px;
    color: #475569;
    line-height: 1.8;
}

.dashboard-list li {
    margin-bottom: 8px;
}

@media (max-width: 900px) {
    .admin-shell {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
    }

    .admin-main {
        padding: 20px;
    }

    .card-grid,
    .two-column-layout,
    .dashboard-stats-grid,
    .dashboard-main-grid,
    .dashboard-link-list {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 24px;
    }

    .login-footer {
        flex-direction: column;
    }

    .dashboard-hero-block {
        flex-direction: column;
    }
}
