:root {
    --primary: #091426;
    --primary-container: #1e293b;
    --primary-fixed: #d8e3fb;
    --secondary: #505f76;
    --secondary-container: #d0e1fb;
    --surface: #fbf8fa;
    --surface-low: #f5f3f4;
    --surface-container: #f0edef;
    --outline: #c5c6cd;
    --text: #1b1b1d;
    --muted: #45474c;
    --danger: #ba1a1a;
    --danger-bg: #ffdad6;
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

body {
    margin: 0;
    background: var(--surface);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    line-height: 1;
}

.login-body {
    min-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 4% 2%, rgba(216, 227, 251, 0.2), transparent 30%),
        radial-gradient(circle at 96% 100%, rgba(208, 225, 251, 0.12), transparent 36%),
        var(--primary);
    color: white;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
    position: relative;
    z-index: 1;
}

.login-panel {
    width: min(480px, 100%);
}

.brand-mark {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--primary-fixed);
    color: #111c2d;
}

.login-title {
    margin: 0;
    font-size: 32px;
    line-height: 1.25;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0;
}

.login-subtitle {
    margin: 6px 0 24px;
    color: rgba(228, 226, 227, 0.72);
    text-align: center;
}

.login-card {
    padding: 24px;
    border: 1px solid rgba(197, 198, 205, 0.22);
    border-radius: 12px;
    background: var(--primary-container);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
}

.login-card h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
}

.hint,
.login-card p {
    color: rgba(228, 226, 227, 0.72);
}

.alert {
    margin: 18px 0;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--danger-bg);
    color: #93000a;
    font-weight: 600;
    font-size: 14px;
}

.alert-success {
    background: #e9f7ee;
    color: #216e39;
}

.field {
    margin-top: 22px;
}

.field label {
    display: block;
    margin: 0 0 8px 4px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(228, 226, 227, 0.78);
}

.input-icon {
    position: relative;
}

.input-icon .material-symbols-outlined {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #75777d;
}

.login-input,
.form-control,
.form-select,
textarea {
    width: 100%;
    border: 1px solid rgba(117, 119, 125, 0.32);
    border-radius: 8px;
    outline: none;
    font: inherit;
    transition: border-color 160ms, box-shadow 160ms, background 160ms;
}

.login-input {
    padding: 14px 16px 14px 44px;
    background: rgba(9, 20, 38, 0.35);
    color: white;
}

.login-input:focus,
.form-control:focus,
.form-select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(9, 20, 38, 0.16);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    transition: transform 120ms, opacity 120ms, background 120ms;
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active {
    transform: scale(0.98);
}

.login-submit {
    width: 100%;
    margin-top: 24px;
    padding: 14px 16px;
    background: var(--primary-fixed);
    color: #111c2d;
}

.shell {
    min-height: 100vh;
    display: flex;
    background: #fbf8fa;
}

.mobile-topbar,
.mobile-bottom-nav,
.mobile-scrim,
.mobile-client-list {
    display: none;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 256px;
    display: flex;
    flex-direction: column;
    background: var(--primary);
    color: var(--primary-fixed);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.sidebar-brand {
    padding: 32px 24px;
}

.sidebar-brand h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
    color: white;
}

.sidebar-brand p {
    margin: 4px 0 0;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.62;
}

.side-nav {
    flex: 1;
    padding: 0 8px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 8px;
    padding: 12px 16px;
    border-radius: 8px;
    color: #bcc7de;
    font-size: 14px;
    font-weight: 600;
}

.side-link.active {
    background: var(--secondary-container);
    color: #54647a;
}

.side-action {
    padding: 16px;
}

.main-wrap {
    margin-left: 256px;
    width: calc(100% - 256px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 64px;
    display: flex;
    justify-content: center;
    background: var(--surface);
    border-bottom: 1px solid var(--outline);
}

.topbar-inner {
    width: 100%;
    max-width: 1280px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.search {
    position: relative;
}

.search .material-symbols-outlined {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.search input {
    width: 260px;
    height: 40px;
    padding: 0 16px 0 42px;
    border: 0;
    border-radius: 999px;
    background: var(--surface-low);
    outline: none;
    font-weight: 600;
}

.topbar-user-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.content {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.page-head h2 {
    margin: 0;
    font-size: 26px;
    line-height: 1.25;
    color: var(--primary);
}

.page-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.stat-card {
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stat-card.danger {
    background: var(--danger-bg);
    border-color: rgba(186, 26, 26, 0.2);
}

.stat-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(9, 20, 38, 0.05);
    color: var(--primary);
}

.stat-label {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-value {
    margin: 4px 0 0;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 700;
}

.filter-bar,
.table-card,
.form-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.filter-bar {
    padding: 8px 10px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filter-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.floating-field {
    position: relative;
    min-width: 220px;
}

.floating-field label {
    position: absolute;
    top: -7px;
    left: 12px;
    padding: 0 4px;
    background: white;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.form-control,
.form-select,
textarea {
    padding: 11px 12px;
    border-color: #cbd5e1;
    background: white;
    color: var(--text);
}

.primary-button {
    padding: 0 16px;
    background: var(--primary);
    color: white;
}

.secondary-button {
    padding: 0 16px;
    background: var(--primary-fixed);
    color: #111c2d;
}

.ghost-button {
    padding: 0 16px;
    border: 1px solid #cbd5e1;
    background: white;
    color: var(--text);
}

.danger-button {
    padding: 0 16px;
    background: var(--danger);
    color: white;
}

.icon-button {
    width: 36px;
    min-height: 36px;
    background: transparent;
    color: var(--muted);
}

.icon-button:hover {
    background: var(--surface-low);
    color: var(--primary);
}

.table-head {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-head h3 {
    margin: 0;
    font-size: 20px;
    color: var(--primary);
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 1120px;
    border-collapse: collapse;
    text-align: left;
}

thead {
    position: sticky;
    top: 0;
    background: var(--surface-low);
}

th {
    padding: 7px 12px;
    border-bottom: 1px solid #e2e8f0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    font-size: 14px;
}

tbody tr:nth-child(even) {
    background: rgba(245, 243, 244, 0.36);
}

tbody tr:hover {
    background: #fff;
}

.customer-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--primary-fixed);
    color: #111c2d;
    font-size: 12px;
    font-weight: 800;
}

.strong {
    font-weight: 700;
    color: var(--text);
}

.muted {
    color: var(--muted);
}

.mono {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
}

.copy-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.copy-field--mobile {
    width: 100%;
    justify-content: space-between;
}

.copy-value {
    min-width: 0;
    overflow-wrap: anywhere;
}

.copy-button {
    width: 28px;
    height: 28px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    background: #fff;
    color: var(--muted);
    flex: 0 0 auto;
}

.copy-button:hover {
    background: var(--surface-low);
    color: var(--primary);
}

.copy-button.is-copied {
    background: #eaf4e8;
    border-color: #b5d9af;
    color: #216e39;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(208, 225, 251, 0.45);
    color: var(--secondary);
    font-size: 11px;
    font-weight: 800;
}

.badge.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge.warn {
    background: var(--tertiary-fixed, #fadfb8);
    color: #564427;
}

.table-footer {
    padding: 8px 12px;
    background: rgba(245, 243, 244, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

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

.form-card {
    padding: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.form-field.full {
    grid-column: 1 / -1;
}

.form-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.date-picker {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.date-picker__input {
    flex: 1;
}

.date-picker__button {
    width: 40px;
    min-height: 40px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--muted);
    flex: 0 0 auto;
}

.date-picker__button:hover,
.date-picker__nav:hover,
.date-picker__footer .ghost-button:hover {
    background: var(--surface-low);
}

.date-picker__panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    left: 0;
    width: min(328px, 100%);
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.date-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.date-picker__title {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
}

.date-picker__nav {
    width: 32px;
    min-height: 32px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--muted);
}

.date-picker__nav--year {
    opacity: 0.95;
}

.date-picker__nav--month {
    opacity: 1;
}

.date-picker__weekdays,
.date-picker__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.date-picker__weekdays {
    margin-top: 10px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.date-picker__grid {
    margin-top: 8px;
}

.date-picker__day {
    aspect-ratio: 1;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.date-picker__day:hover:not(:disabled) {
    border-color: #cbd5e1;
    background: var(--surface-low);
}

.date-picker__day:disabled {
    color: #cbd5e1;
    cursor: default;
}

.date-picker__day.is-today {
    border-color: #cbd5e1;
}

.date-picker__day.is-selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.date-picker__footer {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.date-picker__footer .ghost-button {
    min-height: 34px;
    padding: 0 12px;
}

.empty {
    padding: 28px 14px;
    text-align: center;
    color: var(--muted);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

.panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.panel-pad {
    padding: 12px;
}

.span-4 {
    grid-column: span 4;
}

.span-5 {
    grid-column: span 5;
}

.span-7 {
    grid-column: span 7;
}

.span-8 {
    grid-column: span 8;
}

.span-12 {
    grid-column: span 12;
}

.chart-card {
    min-height: 420px;
}

.line-chart {
    width: 100%;
    height: 260px;
    margin-top: 14px;
}

.progress-list {
    display: grid;
    gap: 14px;
}

.progress-row {
    display: grid;
    gap: 8px;
}

.progress-meta {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.progress-track {
    height: 8px;
    background: var(--surface-container);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
}

.hero-help {
    position: relative;
    padding: 20px;
    margin-bottom: 14px;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-container));
    color: #fff;
    text-align: center;
}

.hero-help h2 {
    margin: 0 0 8px;
    font-size: 36px;
    line-height: 1.2;
}

.hero-help p {
    max-width: 720px;
    margin: 0 auto 14px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 18px;
    line-height: 1.5;
}

.quick-tiles {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-tile {
    width: 160px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
}

.faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 14px 16px;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    color: var(--primary);
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.faq-answer {
    display: none;
    padding: 0 16px 14px;
    color: var(--muted);
    line-height: 1.6;
}

.faq-item.active .faq-answer {
    display: block;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.resource-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.resource-media {
    height: 120px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #f5f7fb, #d8e3fb);
    color: var(--primary);
}

.settings-list {
    display: grid;
    gap: 12px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #e2e8f0;
}

.setting-row:last-child {
    border-bottom: 0;
}

.toggle {
    width: 48px;
    height: 28px;
    padding: 3px;
    border-radius: 999px;
    background: var(--primary);
    display: flex;
    justify-content: flex-end;
}

.toggle::after {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #fff;
}

.report-list {
    display: grid;
    gap: 14px;
}

.report-item {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

.report-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--primary-fixed);
    color: #111c2d;
}

@media (max-width: 980px) {
    body {
        padding-bottom: 72px;
    }

    .mobile-topbar {
        position: sticky;
        top: 0;
        z-index: 60;
        height: 60px;
        padding: 0 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        background: rgba(251, 248, 250, 0.94);
        border-bottom: 1px solid #e2e8f0;
        backdrop-filter: blur(14px);
    }

    .mobile-topbar strong,
    .mobile-topbar span {
        display: block;
    }

    .mobile-topbar strong {
        color: var(--primary);
        font-size: 14px;
        line-height: 1.1;
    }

    .mobile-topbar div > span {
        margin-top: 3px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
    }

    .mobile-menu-button,
    .mobile-add-button {
        width: 40px;
        height: 40px;
        border: 0;
        border-radius: 10px;
        display: grid;
        place-items: center;
        background: var(--primary);
        color: #fff;
    }

    .mobile-add-button {
        background: var(--primary-fixed);
        color: #111c2d;
    }

    .mobile-scrim {
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgba(9, 20, 38, 0.42);
    }

    body.nav-open .mobile-scrim {
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 70;
        width: min(82vw, 312px);
        height: 100vh;
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .main-wrap {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        display: none;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 55;
        height: 66px;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
        backdrop-filter: blur(16px);
    }

    .mobile-bottom-nav a {
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: var(--muted);
    }

    .mobile-bottom-nav a.active {
        color: var(--primary);
        font-weight: 800;
    }

    .mobile-bottom-nav .material-symbols-outlined {
        font-size: 22px;
    }

    .mobile-bottom-nav small {
        font-size: 10px;
        line-height: 1;
        white-space: nowrap;
    }

    .content {
        padding-top: 10px;
    }

    .page-head h2 {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 10px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-value {
        font-size: 21px;
    }

    .filter-bar {
        padding: 10px;
    }

    .filter-fields,
    .filter-bar > div {
        width: 100%;
    }

    .table-scroll {
        display: none;
    }

    .mobile-client-list {
        display: grid;
        gap: 10px;
        padding: 10px;
        background: var(--surface-low);
    }

    .mobile-client-card {
        padding: 12px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }

.mobile-client-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.mobile-select-row {
    width: 24px;
    height: 32px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

    .mobile-client-meta {
        margin: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .mobile-client-meta div {
        min-width: 0;
    }

    .mobile-client-meta dt {
        margin: 0 0 4px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 800;
    }

    .mobile-client-meta dd {
        margin: 0;
        overflow-wrap: anywhere;
        font-size: 13px;
        font-weight: 700;
    }

    .mobile-client-actions {
        margin-top: 16px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .mobile-client-actions .ghost-button,
    .mobile-client-actions .danger-button {
        width: 100%;
    }

    .copy-field--mobile .copy-button {
        width: 32px;
        height: 32px;
    }

    .span-4,
    .span-5,
    .span-7,
    .span-8,
    .span-12 {
        grid-column: 1 / -1;
    }

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

    .filter-bar,
    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .report-item,
    .setting-row {
        grid-template-columns: 40px 1fr;
    }

    .report-item {
        align-items: start;
    }

    .report-item .ghost-button,
    .report-item .badge {
        grid-column: 2;
        justify-self: start;
    }

    .setting-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 640px) {
    .topbar-inner,
    .content {
        padding-left: 12px;
        padding-right: 12px;
    }

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

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

    .stat-card {
        min-height: 144px;
    }

    .stat-top {
        margin-bottom: 8px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-card .muted,
    .stat-card p:not(.stat-label):not(.stat-value) {
        font-size: 12px;
    }

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

    .hero-help {
        padding: 16px 12px;
    }

    .hero-help h2 {
        font-size: 26px;
    }

    .search input,
    .floating-field {
        width: 100%;
        min-width: 0;
    }

    .form-actions,
    .table-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions .ghost-button,
    .form-actions .primary-button,
    .table-footer .danger-button {
        width: 100%;
    }

    .mobile-client-meta {
        grid-template-columns: 1fr;
    }

    .quick-tile {
        width: calc(50% - 8px);
    }

    .hero-help p {
        font-size: 15px;
    }
}


body.dialog-open {
    overflow: hidden;
}

.system-dialog {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
    z-index: 1200;
}

.system-dialog.open {
    opacity: 1;
    pointer-events: auto;
}

.system-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 20, 38, 0.56);
    backdrop-filter: blur(10px);
}

.system-dialog__panel {
    position: relative;
    width: min(440px, 100%);
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f8fb 100%);
    box-shadow: 0 32px 80px rgba(9, 20, 38, 0.28);
    border: 1px solid rgba(197, 198, 205, 0.6);
    transform: translateY(8px) scale(0.98);
    transition: transform 160ms ease;
}

.system-dialog.open .system-dialog__panel {
    transform: translateY(0) scale(1);
}

.system-dialog__icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    background: var(--primary-fixed);
    color: var(--primary);
}

.system-dialog__icon.is-warning {
    background: #fff4cc;
    color: #8a5b00;
}

.system-dialog__icon.is-danger {
    background: var(--danger-bg);
    color: #93000a;
}

.system-dialog__panel h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.3;
}

.system-dialog__panel p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.system-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.system-dialog .ghost-button,
.system-dialog .danger-button {
    min-width: 104px;
    padding: 0 18px;
}


.settings-page {
    max-width: 1440px;
}

.settings-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f4f7fc 48%, #eef4ff 100%);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    margin-bottom: 16px;
}

.settings-hero__bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 10%, rgba(9, 20, 38, 0.08), transparent 24%),
        radial-gradient(circle at 20% 100%, rgba(80, 95, 118, 0.10), transparent 28%);
    pointer-events: none;
}

.settings-hero__content {
    position: relative;
    padding: 16px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--secondary);
}

.settings-hero h2 {
    margin: 0;
    font-size: 32px;
    line-height: 1.2;
    color: var(--primary);
}

.hero-copy {
    margin: 10px 0 0;
    max-width: 720px;
    color: var(--muted);
    line-height: 1.6;
}

.settings-hero__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.settings-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.metric-card.warning {
    background: linear-gradient(180deg, #fff7ec, #fff2db);
    border-color: rgba(186, 26, 26, 0.14);
}

.metric-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-fixed);
    color: var(--primary);
}

.metric-card.warning .metric-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.metric-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 4px;
}

.metric-card strong {
    font-size: 24px;
    line-height: 1;
    color: var(--primary);
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 14px;
    align-items: start;
}

.settings-left-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
}

.settings-compact-panel {
    padding: 12px;
}

.settings-compact-panel--password {
    min-width: 0;
}

.panel-head--tight {
    margin-bottom: 12px;
}

.panel {
    position: relative;
    border-radius: 20px;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel-pad {
    padding: 12px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-head h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
    color: var(--primary);
}

.panel-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.panel-head.compact-head {
    margin-bottom: 12px;
}

.platform-create {
    padding: 12px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    margin-bottom: 12px;
}

.platform-create__title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.platform-create__title span {
    color: var(--muted);
    font-size: 13px;
}

.platform-create__form {
    display: flex;
    gap: 10px;
}

.platform-create__form .form-control {
    min-width: 0;
}

.platform-create__form .primary-button {
    flex: 0 0 auto;
    min-width: 84px;
    white-space: nowrap;
}

.admin-password-form {
    padding: 12px;
    margin-bottom: 0;
}

.admin-password-form .form-field + .form-field {
    margin-top: 10px;
}

.admin-password-actions {
    margin-top: 12px;
}

.platform-list {
    display: grid;
    gap: 10px;
}

.platform-item {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid transparent;
    transition: background 120ms, border-color 120ms, transform 120ms;
}

.platform-item__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.platform-item__main--edit {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
}

.platform-item__edit-info {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.platform-edit-input {
    width: 100%;
}

.platform-item__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
}

.inline-form {
    margin: 0;
}

.danger-icon {
    color: var(--danger);
}

.platform-item strong {
    display: block;
    font-size: 15px;
    color: var(--text);
}

.platform-item span {
    color: var(--muted);
    font-size: 12px;
}

.platform-item.active {
    background: #eef4ff;
    border-color: rgba(9, 20, 38, 0.10);
}

.platform-item:hover {
    transform: translateY(-1px);
}

.platform-item--edit {
    align-items: center;
}

.settings-main {
    padding: 16px;
}

.settings-search {
    display: flex;
    gap: 10px;
    align-items: center;
}

.settings-search .form-control {
    width: 280px;
}

.server-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fafc, #eef4ff);
    border: 1px solid #e2e8f0;
    margin-bottom: 12px;
}

.server-create {
    padding: 12px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    background: #fbfcff;
    margin-bottom: 12px;
}

.server-create .form-field {
    min-width: 0;
}

.server-create__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.server-create .form-field.full {
    grid-column: 1 / -1;
}

.server-create textarea {
    min-height: 98px;
}

.server-toolbar strong {
    display: block;
    font-size: 16px;
    color: var(--primary);
}

.server-toolbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.server-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.server-card {
    padding: 14px;
    border-radius: 16px;
    background: #fbfcff;
    border: 1px solid #e2e8f0;
}

.server-card__top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.server-card__top strong {
    display: block;
    font-size: 16px;
    color: var(--primary);
}

.server-card__top span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.server-card dl {
    margin: 0;
    display: grid;
    gap: 10px;
}

.server-card dl div {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
}

.server-card dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.server-card dd {
    margin: 0;
    color: var(--text);
    font-size: 13px;
}

.empty-state,
.empty-large {
    padding: 16px;
    border-radius: 16px;
    background: #f8fafc;
    color: var(--muted);
    text-align: center;
}

.empty-large {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 280px;
}

.empty-large.compact {
    min-height: 180px;
    margin-top: 12px;
}

.empty-large .material-symbols-outlined {
    font-size: 36px;
    color: var(--secondary);
}

.settings-notes .panel {
    overflow: hidden;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.doc-card {
    padding: 14px;
    border-radius: 16px;
    background: #fbfcff;
    border: 1px solid #e2e8f0;
    display: grid;
    gap: 10px;
}

.doc-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-fixed);
    color: var(--primary);
}

.doc-card strong {
    display: block;
    font-size: 15px;
    color: var(--text);
}

.doc-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.doc-state {
    display: inline-flex;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--secondary);
    font-size: 12px;
    font-weight: 700;
}

.card-surface {
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

@media (max-width: 1200px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }

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

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

@media (max-width: 980px) {
    .settings-hero__content,
    .server-toolbar,
    .panel-head,
    .settings-search,
    .platform-create__form,
    .settings-hero__actions {
        flex-direction: column;
        align-items: stretch;
    }

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

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

    .server-grid,
    .doc-grid {
        grid-template-columns: 1fr;
    }

    .settings-search .form-control {
        width: 100%;
    }
}
