:root {
    --bg: #edf3f8;
    --bg-accent: #d7e6f3;
    --panel: rgba(255, 255, 255, 0.94);
    --panel-strong: #ffffff;
    --panel-soft: #f7fbff;
    --text: #17212b;
    --muted: #5f6f82;
    --line: #d6e0ea;
    --line-strong: #c2d2e0;
    --primary: #0f766e;
    --primary-strong: #115e59;
    --primary-soft: #dff5f1;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --success: #166534;
    --warning: #92400e;
    --shadow-lg: 0 28px 60px rgba(20, 53, 90, 0.14);
    --shadow-md: 0 18px 40px rgba(27, 56, 86, 0.08);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.admin-dashboard {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 34%),
        radial-gradient(circle at top right, rgba(184, 214, 235, 0.75), transparent 28%),
        linear-gradient(180deg, #f6fbff 0%, var(--bg) 46%, #e6eef6 100%);
}

body.admin-dashboard a {
    color: inherit;
    text-decoration: none;
}

body.admin-dashboard a:hover {
    text-decoration: none;
}

.page-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 20px 56px;
}

.page-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 32px;
    border-radius: var(--radius-xl);
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.96) 0%, rgba(24, 96, 154, 0.92) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.page-header::after {
    content: "";
    position: absolute;
    inset: auto -60px -110px auto;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.page-header__content {
    position: relative;
    z-index: 1;
    max-width: 720px;
}

.page-kicker,
.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
}

.page-kicker {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
}

.page-header h1 {
    margin: 16px 0 10px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.08;
}

.page-subtitle {
    margin: 0;
    max-width: 620px;
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.82);
}

.quick-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.quick-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 600;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.quick-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.34);
}

.quick-link[aria-current="page"] {
    background: #ffffff;
    border-color: #ffffff;
    color: #0f5d68;
    box-shadow: 0 12px 28px rgba(13, 45, 78, 0.18);
}

.quick-link[aria-current="page"]:hover {
    background: #ffffff;
    border-color: #ffffff;
    color: #0f5d68;
}

.quick-link--strong {
    background: rgba(255, 255, 255, 0.2);
}

.msg {
    margin: 18px 0 0;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    box-shadow: var(--shadow-md);
    font-size: 14px;
    font-weight: 600;
}

.msg.success {
    color: var(--success);
    background: #effaf3;
    border-color: #bfdfca;
}

.msg.error {
    color: var(--danger);
    background: #fff2f1;
    border-color: #f4c7c1;
}

.section {
    margin-top: 20px;
    padding: 24px;
    border: 1px solid rgba(194, 210, 224, 0.78);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.section-hero {
    margin-top: 24px;
}

.section-emphasis {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 251, 255, 0.96) 100%);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.section-head--compact {
    margin-bottom: 16px;
}

.section-head h2,
.section-head h3,
.action-copy h4 {
    margin: 8px 0 0;
    color: var(--text);
}

.section-head h2 {
    font-size: 28px;
}

.section-head h3 {
    font-size: 22px;
}

.section-kicker {
    color: var(--primary);
}

.section-desc {
    margin: 0;
    max-width: 520px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.75;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.settings-grid .section {
    margin-top: 0;
}

.settings-grid .section-wide {
    grid-column: 1 / -1;
}

.inline-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.inline-form--account {
    margin-bottom: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field label,
.setting-row label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(24, 96, 154, 0.44);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    background: #fdfefe;
}

.form-actions {
    display: flex;
    align-items: stretch;
}

.setting-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.mini-input {
    width: 120px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: #e7eef5;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(20, 53, 90, 0.12);
    background: #dae7f1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #11857c 0%, #0f615b 100%);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-danger:hover {
    background: #f9d6d2;
    color: #8d1e14;
}

.btn-compact {
    min-height: 36px;
    padding: 0 14px;
    font-size: 13px;
}

.table-shell {
    overflow-x: auto;
    border: 1px solid rgba(214, 224, 234, 0.94);
    border-radius: 18px;
    background: var(--panel-strong);
}

.account-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0;
}

.account-table th,
.account-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e9eff5;
}

.account-table th {
    background: #f6f9fc;
    color: #445468;
    font-size: 13px;
    font-weight: 700;
}

.account-table tbody tr:last-child td {
    border-bottom: 0;
}

.account-table tbody tr:hover td {
    background: #fbfdff;
}

.inline-delete-form {
    margin: 0;
}

.permission-tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.permission-tag.auto {
    background: #e8f1ff;
    color: #175cd3;
}

.permission-tag.admin {
    background: #eaf7ec;
    color: #257a2e;
}

.current-account {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.action-panel {
    display: grid;
    gap: 22px;
}

.action-block {
    display: grid;
    gap: 14px;
}

.action-copy h4 {
    font-size: 18px;
}

.action-copy p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.75;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(194, 210, 224, 0.95) 12%, rgba(194, 210, 224, 0.95) 88%, transparent 100%);
}

.fetch-inline {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(140px, 0.7fr) auto;
    gap: 12px;
    align-items: end;
}

.status-text {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    font-size: 14px;
    color: var(--muted);
    font-weight: 600;
}

.status-text[data-state="loading"] {
    color: var(--warning);
}

.status-text[data-state="success"] {
    color: var(--success);
}

.status-text[data-state="error"] {
    color: var(--danger);
}

@media (max-width: 980px) {
    .page-header,
    .section-head {
        flex-direction: column;
    }

    .quick-actions {
        justify-content: flex-start;
    }

    .inline-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-actions {
        grid-column: 1 / -1;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .fetch-inline {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fetch-inline .btn,
    .status-text {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 18px 14px 36px;
    }

    .page-header,
    .section {
        padding: 20px;
        border-radius: 20px;
    }

    .page-header h1 {
        font-size: 30px;
    }

    .inline-form,
    .fetch-inline {
        grid-template-columns: 1fr;
    }

    .setting-row {
        align-items: stretch;
    }

    .setting-row .btn,
    .form-actions .btn,
    .fetch-inline .btn {
        width: 100%;
    }

    .mini-input {
        width: 100%;
    }
}
