@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap");

:root {
    --background: #f8fafc;
    --foreground: #0f172a;
    --card: #ffffff;
    --card-foreground: #0f172a;
    --popover: #ffffff;
    --popover-foreground: #0f172a;
    --primary: #0f172a;
    --primary-foreground: #f8fafc;
    --secondary: #f1f5f9;
    --secondary-foreground: #0f172a;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --accent: #ecfdf5;
    --accent-foreground: #047857;
    --destructive: #dc2626;
    --destructive-foreground: #fef2f2;
    --border: #e2e8f0;
    --input: #cbd5e1;
    --ring: #10b981;
    --sidebar-background: #fafafa;
    --sidebar-foreground: #3f3f46;
    --sidebar-primary: #18181b;
    --sidebar-primary-foreground: #fafafa;
    --sidebar-accent: #f4f4f5;
    --sidebar-accent-foreground: #18181b;
    --sidebar-border: #e4e4e7;
    --sidebar-ring: #3b82f6;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.success-badge {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}

.no-result-row {
    background: #fff1f2 !important;
    border-color: #fecdd3 !important;
}

.no-result-row:hover {
    background: #ffe4e6 !important;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.faq-stats {
    flex-wrap: wrap;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.check-label input {
    width: auto;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    background:
        radial-gradient(circle at top left, rgba(16, 185, 129, 0.08), transparent 28rem),
        var(--background);
    color: var(--foreground);
    font-family: Vazirmatn, Vazir, Tahoma, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.7;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    transition:
        border-color 0.16s ease,
        background-color 0.16s ease,
        color 0.16s ease,
        box-shadow 0.16s ease,
        transform 0.16s ease;
}

a {
    color: inherit;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 6px;
    color: var(--foreground);
    font-size: clamp(24px, 2vw, 32px);
    font-weight: 800;
    line-height: 1.25;
}

h2 {
    margin-bottom: 0;
    color: var(--card-foreground);
    font-size: 16px;
    font-weight: 700;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 14px;
    overflow: auto;
    border-left: 1px solid var(--sidebar-border);
    background: var(--sidebar-background);
    color: var(--sidebar-foreground);
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 8px;
}

.sidebar-content {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 8px;
}

.sidebar-group {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
}

.sidebar-group-label {
    display: flex;
    align-items: center;
    height: 32px;
    padding: 0 8px;
    color: #71717a;
    font-size: 12px;
    font-weight: 600;
}

.sidebar-menu {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-menu-item {
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin: 0;
    padding: 6px 8px;
    border-radius: var(--radius);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius);
    background: var(--sidebar-primary);
    color: var(--sidebar-primary-foreground);
    font-weight: 800;
    letter-spacing: 0;
}

.brand-copy {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.brand strong {
    display: block;
    color: var(--sidebar-accent-foreground);
    font-size: 14px;
    line-height: 1.45;
}

.brand small {
    display: block;
    margin-top: 2px;
    color: #71717a;
    font-size: 12px;
}

.sidebar-menu-button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 8px;
    border-radius: 6px;
    color: var(--sidebar-foreground);
    font-weight: 500;
    text-decoration: none;
}

.sidebar-menu-button:hover,
.sidebar-menu-button:focus-visible,
.sidebar-menu-button.is-active {
    background: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
    outline: none;
}

.sidebar-menu-button.is-active {
    font-weight: 700;
}

.sidebar-menu-button:focus-visible {
    box-shadow: 0 0 0 2px var(--sidebar-ring);
}

.nav-icon {
    display: inline-grid;
    width: 18px;
    min-width: 18px;
    height: 18px;
    place-items: center;
    line-height: 0;
}

iconsax-icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    line-height: 0;
}

.main {
    min-width: 0;
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.topbar p,
.muted {
    margin-bottom: 0;
    color: var(--muted-foreground);
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.status,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid rgba(16, 185, 129, 0.18);
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-foreground);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.danger-badge {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stats-grid article,
.panel,
.login-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    color: var(--card-foreground);
    box-shadow: var(--shadow);
}

.stats-grid article {
    min-height: 112px;
    padding: 16px;
}

.stats-grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--foreground);
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
}

.stats-grid small {
    color: var(--muted-foreground);
    font-weight: 500;
}

.panel {
    margin-bottom: 18px;
    padding: 18px;
}

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

.panel-head a {
    color: var(--accent-foreground);
    font-weight: 600;
    text-decoration: none;
}

.panel-head a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.panel-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    gap: 18px;
}

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

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 58px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.list-row strong {
    color: var(--foreground);
    font-weight: 700;
}

.list-row span {
    color: var(--muted-foreground);
    direction: ltr;
    font-size: 13px;
}

.list-row-button {
    width: 100%;
    color: var(--foreground);
    text-align: right;
    cursor: pointer;
}

.list-row-button:hover,
.list-row-button:focus-visible {
    border-color: #94a3b8;
    background: #f8fafc;
    filter: none;
    outline: none;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    background: var(--card);
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: var(--muted-foreground);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: #fcfcfd;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:focus {
    outline: none;
}

.clickable-row:focus td {
    background: var(--sidebar-accent);
    box-shadow: inset 0 0 0 1px var(--sidebar-ring);
}

code {
    display: inline-block;
    direction: ltr;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--foreground);
    outline: none;
}

textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.9;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

label {
    color: var(--foreground);
    font-weight: 600;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    background: var(--primary);
    color: var(--primary-foreground);
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

button:hover,
.button-link:hover {
    background: #1e293b;
    border-color: #1e293b;
    filter: none;
}

button:focus-visible,
.button-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

button:active,
.button-link:active {
    transform: translateY(1px);
}

button.danger,
.logout-button {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--destructive);
}

button.danger:hover,
.logout-button:hover {
    border-color: #fca5a5;
    background: #fee2e2;
}

.button-link.secondary {
    border-color: var(--border);
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.button-link.secondary:hover {
    border-color: #cbd5e1;
    background: #e2e8f0;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--foreground);
    font-size: 18px;
    line-height: 1;
}

.icon-button:hover {
    border-color: #cbd5e1;
    background: var(--secondary);
    color: var(--foreground);
}

.icon-button.is-loading {
    animation: spin 0.8s linear infinite;
}

.toolbar {
    justify-content: flex-start;
}

.toolbar input {
    max-width: 420px;
}

.toolbar button {
    min-width: 112px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr)) 140px;
    gap: 10px;
    align-items: center;
}

.form-grid.wide {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
}

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

.edit-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 1fr) auto 100px 86px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.department-card {
    grid-template-columns: repeat(7, minmax(120px, 1fr)) 90px 82px;
}

.chart-card {
    grid-template-columns: minmax(160px, 0.8fr) minmax(260px, 1.5fr) 110px 90px 82px;
}

.faq-form {
    grid-template-columns: minmax(180px, 0.8fr) minmax(320px, 1.6fr) 140px;
    align-items: stretch;
}

.faq-card {
    grid-template-columns: minmax(180px, 0.8fr) minmax(320px, 1.6fr) auto 90px 82px;
    align-items: stretch;
}

.stack-form {
    display: grid;
    gap: 12px;
}

.confirm-box {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
}

.confirm-box p {
    margin: 0;
    white-space: pre-wrap;
}

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

.check-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    background: var(--card);
}

.check-line input {
    width: auto;
    min-height: auto;
}

.term-form {
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) 120px 110px 1.6fr 130px;
    align-items: stretch;
}

.term-card {
    grid-template-columns: minmax(160px, 0.9fr) minmax(220px, 1.1fr) 95px 105px minmax(260px, 1.5fr) 85px 75px;
    align-items: stretch;
}

.academic-form {
    grid-template-columns: minmax(180px, 1fr) 120px 110px minmax(320px, 1.8fr) 130px;
    align-items: stretch;
}

.academic-card {
    grid-template-columns: minmax(180px, 0.9fr) 95px 105px minmax(300px, 1.7fr) auto 85px 75px;
    align-items: stretch;
}

.form-footer {
    display: flex;
    justify-content: flex-start;
    margin-top: 14px;
}

.flash-wrap {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.flash {
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--foreground);
    font-weight: 500;
}

.flash.success {
    border-color: rgba(16, 185, 129, 0.26);
    background: var(--accent);
    color: var(--accent-foreground);
}

.flash.error,
.error-panel {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

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

.metric-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 14px 0;
}

.metric-line strong {
    font-size: 34px;
    line-height: 1.1;
}

.login-page {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 20% 0%, rgba(16, 185, 129, 0.12), transparent 26rem),
        var(--background);
}

.login-card {
    width: min(420px, 100%);
    padding: 26px;
}

.login-brand {
    margin-bottom: 22px;
    padding: 0;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form button {
    width: 100%;
    margin-top: 4px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(6px);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    width: min(620px, 100%);
    max-height: min(720px, calc(100vh - 48px));
    overflow: auto;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

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

.modal-head h2 {
    margin: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.detail-grid dt,
.detail-grid dd {
    margin: 0;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.detail-grid dt {
    background: #f8fafc;
    color: var(--muted-foreground);
    font-weight: 700;
}

.detail-grid dd {
    overflow-wrap: anywhere;
}

.detail-grid dt:last-of-type,
.detail-grid dd:last-of-type {
    border-bottom: 0;
}

.result-matches {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
}

.result-matches:empty {
    display: none;
}

.result-matches ul {
    margin: 8px 0 0;
    padding-inline-start: 22px;
}

@keyframes spin {
    to {
        transform: rotate(-360deg);
    }
}

@media (max-width: 1100px) {
    body {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-left: 0;
        border-bottom: 1px solid var(--sidebar-border);
    }

    nav {
        grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    }

    .stats-grid,
    .two-col,
    .form-grid,
    .form-grid.wide,
    .term-form,
    .academic-form {
        grid-template-columns: 1fr 1fr;
    }

    .edit-card,
    .department-card,
    .chart-card,
    .faq-card,
    .faq-form,
    .term-card,
    .academic-card {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 680px) {
    body {
        font-size: 13px;
    }

    .main {
        padding: 18px;
    }

    .sidebar {
        padding: 14px;
    }

    .topbar,
    .toolbar,
    .panel-head {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-actions {
        justify-content: stretch;
    }

    .topbar-actions form,
    .topbar-actions button,
    .status {
        width: 100%;
    }

    .stats-grid,
    .two-col,
    .form-grid,
    .form-grid.wide,
    .edit-card,
    .department-card,
    .chart-card,
    .faq-card,
    .faq-form,
    .term-form,
    .term-card,
    .academic-form,
    .academic-card {
        grid-template-columns: 1fr;
    }

    .action-row {
        flex-direction: column;
        align-items: stretch;
    }

    .action-row button,
    .action-row .button-link,
    .toolbar input,
    .toolbar button,
    .form-grid button,
    .edit-card button,
    .button-link {
        width: 100%;
        max-width: none;
    }

    .list-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

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

    .detail-grid dt {
        border-bottom: 0;
        padding-bottom: 4px;
    }
}

/* Product UI refinement: compact, consistent, functional */
:root {
    --background: #f7f8fa;
    --foreground: #172033;
    --card: #ffffff;
    --card-foreground: #172033;
    --primary: #2563eb;
    --primary-foreground: #ffffff;
    --secondary: #ffffff;
    --secondary-foreground: #344054;
    --muted: #f3f4f6;
    --muted-foreground: #667085;
    --accent: #eff6ff;
    --accent-foreground: #1d4ed8;
    --destructive: #c93636;
    --border: #e4e7ec;
    --input: #d7dce3;
    --ring: #2563eb;
    --sidebar-background: #ffffff;
    --sidebar-foreground: #475467;
    --sidebar-accent: #f1f5f9;
    --sidebar-accent-foreground: #1d4ed8;
    --sidebar-border: #e7e9ee;
    --radius: 9px;
    --shadow: none;
}

body:not(.login-page) {
    grid-template-columns: 244px minmax(0, 1fr);
    background: var(--background);
    font-size: 16px;
    letter-spacing: -0.01em;
}

.main {
    max-width: none;
    padding: 24px 28px 40px;
}

.sidebar {
    padding: 16px 12px 12px;
    box-shadow: none;
}

.sidebar-header {
    padding: 0 4px 12px;
}

.sidebar-content {
    padding-top: 6px;
}

.sidebar-group {
    padding: 6px 4px;
}

.sidebar-group + .sidebar-group {
    margin-top: 2px;
    padding-top: 8px;
}

.sidebar-group-label {
    height: 24px;
    padding-inline: 8px;
    color: #98a2b3;
    font-size: 12px;
}

.sidebar-menu-button {
    min-height: 36px;
    padding: 7px 8px;
    border-radius: 7px;
    color: #475467;
    font-size: 14.5px;
}

.sidebar-menu-button:hover,
.sidebar-menu-button:focus-visible {
    background: #f7f8fa;
    color: #1d2939;
}

.sidebar-menu-button.is-active {
    background: #eff4ff;
    color: #1d4ed8;
}

.sidebar-menu-button.is-active::before {
    top: 7px;
    right: -4px;
    bottom: 7px;
    width: 2px;
}

.sidebar-footer {
    margin: 8px 4px 0;
    padding: 12px 8px 2px;
    border: 0;
    border-top: 1px solid var(--sidebar-border);
    border-radius: 0;
    background: transparent;
}

.sidebar-status-dot,
.live-dot {
    width: 6px;
    height: 6px;
    box-shadow: none;
}

.topbar {
    min-height: 54px;
    margin-bottom: 20px;
    padding-bottom: 16px;
}

.topbar h1 {
    margin-bottom: 3px;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.topbar p {
    color: #667085;
    font-size: 13px;
}

.topbar-date,
.profile-chip {
    min-height: 36px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.topbar-date {
    padding-inline: 8px;
    color: #667085;
    font-size: 12.5px;
}

.profile-chip {
    padding: 0 8px;
    border-right: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.profile-chip > b {
    border-radius: 7px;
    background: #f2f4f7;
    color: #475467;
}

.logout-button {
    min-height: 36px;
    border-color: transparent;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    color: #475467;
}

.logout-button:hover {
    border-color: transparent;
    background: #f2f4f7;
    color: #1d2939;
}

.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.stats-grid article {
    min-height: 112px;
    padding: 16px 18px;
    border: 0;
    border-left: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}

.stats-grid article:last-child {
    border-left: 0;
}

.metric-card::after {
    display: none;
}

.metric-blue,
.metric-violet,
.metric-orange {
    --metric-color: #2563eb;
    --metric-soft: #eff4ff;
}

.metric-card-head small {
    color: #475467;
    font-size: 13px;
    font-weight: 600;
}

.metric-card-head i {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.stats-grid .metric-card > span {
    margin: 8px 0 2px;
    font-size: 28px;
    font-weight: 700;
}

.metric-card p {
    color: #98a2b3;
    font-size: 12px;
}

.panel,
.login-card {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: none;
}

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

.section-heading {
    padding-bottom: 12px;
    border-bottom: 1px solid #eef0f3;
}

.section-heading h2,
.panel-head h2,
.analytics-head h2 {
    margin: 0;
    color: #1d2939;
    font-size: 16px;
    font-weight: 600;
}

.section-heading p,
.analytics-head p {
    margin: 3px 0 0;
    color: #667085;
    font-size: 12.5px;
}

.dashboard-charts-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr);
    gap: 16px;
}

.analytics-card {
    min-height: 380px;
}

.chart-range-filter {
    display: inline-flex;
    width: auto;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #f8f9fb;
}

.chart-range {
    min-width: 48px;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 5px;
    color: #667085;
    font-size: 12px;
}

.chart-range:hover,
.chart-range.is-active {
    background: #fff;
    color: #1d4ed8;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .07);
}

.dashboard-chart {
    min-height: 264px;
}

.dashboard-chart svg {
    min-height: 250px;
}

.chart-grid-line {
    stroke: #e9ecf0;
}

.two-col {
    gap: 16px;
}

.list {
    gap: 0;
    border-top: 1px solid var(--border);
}

.list-row {
    min-height: 52px;
    padding: 10px 4px;
    border: 0;
    border-bottom: 1px solid #eef0f3;
    border-radius: 0;
    background: transparent;
}

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

.list-row-button:hover,
.list-row-button:focus-visible {
    border-color: transparent;
    background: #f8fafc;
}

.list-row strong {
    font-size: 14px;
    font-weight: 600;
}

.list-row span {
    font-size: 12.5px;
}

.table-wrap {
    border: 1px solid var(--border);
    border-radius: 7px;
}

table {
    font-size: 14px;
}

th,
td {
    height: 46px;
    padding: 9px 12px;
}

th {
    background: #f8f9fb;
    color: #667085;
    font-size: 12.5px;
    font-weight: 600;
}

tbody tr:hover td {
    background: #f8fafc;
}

.no-result-row,
.no-result-row td {
    background: #fff8f7 !important;
}

.no-result-row:hover,
.no-result-row:hover td {
    background: #fff3f1 !important;
}

.field {
    display: grid;
    min-width: 0;
    gap: 6px;
    color: #344054;
    font-size: 13px;
    font-weight: 600;
}

.field > span {
    line-height: 1.4;
}

.field textarea,
.field input,
.field select {
    font-weight: 400;
}

.toolbar-field {
    width: min(440px, 100%);
}

.form-grid {
    align-items: end;
    gap: 12px;
}

.create-form button {
    margin-bottom: 0;
}

input,
select,
textarea {
    min-height: 40px;
    padding: 8px 11px;
    border-color: var(--input);
    border-radius: 7px;
    background: #fff;
    font-size: 14px;
}

textarea {
    min-height: 96px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

button,
.button-link {
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--primary);
    border-radius: 7px;
    background: var(--primary);
    box-shadow: none;
    font-size: 13.5px;
    font-weight: 600;
}

button:hover,
.button-link:hover {
    border-color: #1d4ed8;
    background: #1d4ed8;
}

button.secondary,
.button-link.secondary {
    border-color: #d0d5dd;
    background: #fff;
    color: #344054;
}

button.secondary:hover,
.button-link.secondary:hover {
    border-color: #b9c0ca;
    background: #f8f9fb;
    color: #1d2939;
}

button.danger {
    border-color: transparent;
    background: transparent;
    color: var(--destructive);
}

button.danger:hover {
    border-color: #fed7d7;
    background: #fff5f5;
}

button.danger-solid {
    border-color: #c93636;
    background: #c93636;
    color: #fff;
}

button.danger-solid:hover {
    border-color: #a92d2d;
    background: #a92d2d;
}

.icon-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    border-color: transparent;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    color: #475467;
}

.icon-button:hover {
    border-color: transparent;
    background: #f2f4f7;
}

.badge,
.status {
    gap: 5px;
    min-height: 24px;
    padding: 2px 7px;
    border-color: #e4e7ec;
    border-radius: 6px;
    background: #f8f9fb;
    color: #475467;
    font-size: 12px;
    font-weight: 500;
}

.success-badge {
    border-color: #ccebd8;
    background: #f2fbf5;
    color: #187443;
}

.danger-badge {
    border-color: #f4cece;
    background: #fff6f6;
    color: #b42323;
}

.cards-list {
    gap: 0;
    border-top: 1px solid var(--border);
}

.edit-card {
    padding: 12px 0;
    border: 0;
    border-bottom: 1px solid #eef0f3;
    border-radius: 0;
    background: transparent;
}

.edit-card:last-child {
    border-bottom: 0;
}

.check-line,
.check-label {
    font-size: 13px;
    font-weight: 500;
}

.check-line {
    min-height: 40px;
    border-color: #d7dce3;
    border-radius: 7px;
}

.empty {
    padding: 28px 16px;
    color: #667085;
    font-size: 13.5px;
}

.flash {
    border-radius: 7px;
    box-shadow: none;
}

.modal {
    border-radius: 10px;
    box-shadow: 0 20px 48px rgba(16, 24, 40, .16);
}

.metric-line strong {
    font-size: 28px;
    font-weight: 700;
}

@media (max-width: 1100px) {
    body:not(.login-page) {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 9px 12px 7px;
    }

    .dashboard-charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .main {
        padding: 16px;
    }

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

    .stats-grid article {
        min-height: 100px;
        border-left: 0;
        border-bottom: 1px solid var(--border);
    }

    .stats-grid article:last-child {
        border-bottom: 0;
    }

    .section-heading {
        align-items: flex-start;
    }

    .panel {
        padding: 14px;
    }
}

.dashboard-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.analytics-card {
    min-width: 0;
}

.analytics-head p {
    margin: 6px 0 0;
    color: var(--muted-foreground);
    font-size: 0.86rem;
}

.chart-total {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

.chart-total strong {
    color: var(--primary);
    font-size: 1.65rem;
}

.chart-total span {
    color: var(--muted-foreground);
    font-size: 0.78rem;
}

.chart-range-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 16px 0 10px;
}

.chart-range {
    width: auto;
    min-width: 58px;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--secondary-foreground);
    background: var(--secondary);
    font-size: 0.76rem;
}

.chart-range:hover,
.chart-range.is-active {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.dashboard-chart {
    min-height: 290px;
    direction: ltr;
    overflow: hidden;
}

.dashboard-chart svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 260px;
}

.dashboard-chart.is-loading {
    opacity: 0.55;
}

.chart-grid-line {
    stroke: #e5e7eb;
    stroke-width: 1;
}

.chart-axis-label {
    fill: #64748b;
    font-family: inherit;
    font-size: 11px;
}

.chart-bar {
    transition: opacity 150ms ease;
}

.chart-bar:hover {
    opacity: 0.72;
}

.danger-text {
    color: var(--destructive);
}

@media (max-width: 1100px) {
    .dashboard-charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .chart-range-filter {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .chart-range {
        width: 100%;
        min-width: 0;
    }
}

/* 2026 light analytics redesign */
:root {
    --background: #f3f6fb;
    --foreground: #162033;
    --card: #ffffff;
    --card-foreground: #172033;
    --primary: #2878f0;
    --primary-foreground: #ffffff;
    --secondary: #f3f6fa;
    --secondary-foreground: #344054;
    --muted: #f5f7fa;
    --muted-foreground: #7a8495;
    --accent: #edf5ff;
    --accent-foreground: #1767d2;
    --border: #e7ebf1;
    --input: #dfe5ed;
    --ring: #2878f0;
    --sidebar-background: #ffffff;
    --sidebar-foreground: #536075;
    --sidebar-primary: #2878f0;
    --sidebar-primary-foreground: #ffffff;
    --sidebar-accent: #edf5ff;
    --sidebar-accent-foreground: #1767d2;
    --sidebar-border: #edf0f4;
    --sidebar-ring: #2878f0;
    --radius: 14px;
    --shadow: 0 8px 28px rgba(27, 46, 78, 0.045), 0 1px 2px rgba(27, 46, 78, 0.035);
}

html {
    background: #e9edf3;
}

body:not(.login-page) {
    grid-template-columns: 248px minmax(0, 1fr);
    background: var(--background);
    letter-spacing: -0.012em;
    font-size: 16px;
}

.sidebar {
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 18px 14px 14px;
    border-left-color: var(--sidebar-border);
    background: var(--sidebar-background);
    box-shadow: -1px 0 0 rgba(20, 35, 60, 0.01);
    scrollbar-width: thin;
}

.sidebar-header {
    padding: 0 5px 14px;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand {
    gap: 11px;
    padding: 4px;
}

.brand:hover {
    background: transparent;
}

.brand-mark {
    position: relative;
    width: 38px;
    min-width: 38px;
    height: 38px;
    overflow: hidden;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(145deg, #2a83ff, #135dd0);
    box-shadow: 0 8px 18px rgba(40, 120, 240, 0.24);
    font-size: 13px;
}

.brand-mark i {
    position: absolute;
    top: 5px;
    left: 6px;
    width: 8px;
    height: 8px;
    border: 2px solid rgba(255, 255, 255, 0.62);
    border-radius: 3px;
    transform: rotate(35deg);
}

.brand strong {
    color: #111b2e;
    font-size: 15px;
    font-weight: 800;
}

.brand small {
    color: #9099a7;
    font-size: 12px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-group {
    gap: 3px;
    padding: 5px;
}

.sidebar-group + .sidebar-group {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #f2f4f7;
}

.sidebar-group-label {
    height: 26px;
    padding: 0 10px;
    color: #a0a8b5;
    font-size: 12.5px;
    font-weight: 700;
}

.sidebar-menu {
    gap: 1px;
}

.sidebar-menu-button {
    position: relative;
    min-height: 35px;
    padding: 7px 10px;
    border-radius: 9px;
    color: #596579;
    font-size: 14.5px;
    font-weight: 500;
}

.sidebar-menu-button:hover,
.sidebar-menu-button:focus-visible {
    background: #f5f7fa;
    color: #26354d;
}

.sidebar-menu-button.is-active {
    background: #eaf3ff;
    color: #1767d2;
    font-weight: 700;
}

.sidebar-menu-button.is-active::before {
    position: absolute;
    top: 8px;
    right: -5px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: #2878f0;
    content: "";
}

.nav-icon {
    width: 18px;
    min-width: 18px;
    height: 18px;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 8px 5px 0;
    padding: 11px;
    border: 1px solid #dcecdf;
    border-radius: 12px;
    background: #f4fbf6;
    color: #1f6334;
}

.sidebar-footer > span:nth-child(2) {
    display: grid;
    gap: 1px;
}

.sidebar-footer strong,
.sidebar-footer small {
    line-height: 1.4;
}

.sidebar-footer strong {
    font-size: 13.5px;
}

.sidebar-footer small {
    color: #6b8c74;
    font-size: 12px;
}

.sidebar-status-dot,
.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #25b864;
    box-shadow: 0 0 0 4px rgba(37, 184, 100, 0.11);
}

.main {
    width: 100%;
    max-width: 1600px;
    padding: 24px 28px 38px;
}

.topbar {
    align-items: center;
    min-height: 58px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8ecf2;
}

.topbar h1 {
    margin-bottom: 4px;
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.035em;
}

.topbar p {
    font-size: 14px;
}

.topbar-actions {
    flex-wrap: nowrap;
    gap: 8px;
}

.topbar-date,
.profile-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    color: #667085;
}

.topbar-date {
    direction: ltr;
    gap: 7px;
    padding: 0 11px;
    font-size: 13px;
}

.topbar-date svg,
.logout-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.profile-chip {
    gap: 8px;
    padding: 4px 6px 4px 10px;
}

.profile-chip > b {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border-radius: 9px;
    background: #edf5ff;
    color: #1767d2;
    font-size: 10px;
}

.profile-chip > span {
    display: grid;
    color: #26354d;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.profile-chip small {
    color: #25a25b;
    font-size: 11.5px;
    font-weight: 500;
}

.logout-button {
    gap: 6px;
    min-height: 38px;
    padding: 0 11px;
    border-color: var(--border);
    border-radius: 11px;
    background: #fff;
    color: #697386;
    font-size: 13px;
}

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

.stats-grid article,
.panel,
.login-card {
    border-color: var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.stats-grid article {
    min-height: 126px;
    padding: 17px 18px 14px;
}

.metric-card {
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--metric-color);
    opacity: 0.8;
    content: "";
}

.metric-blue { --metric-color: #2878f0; --metric-soft: #eaf3ff; }
.metric-violet { --metric-color: #7c5ce7; --metric-soft: #f1edff; }
.metric-orange { --metric-color: #f59e42; --metric-soft: #fff4e7; }

.metric-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-card-head small {
    color: #515d70;
    font-size: 14px;
    font-weight: 700;
}

.metric-card-head i {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border-radius: 9px;
    background: var(--metric-soft);
    color: var(--metric-color);
}

.metric-card-head svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stats-grid .metric-card > span {
    margin: 10px 0 3px;
    color: #121a2b;
    font-size: 29px;
    font-weight: 800;
    letter-spacing: -0.045em;
}

.metric-card p {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: #98a0ad;
    font-size: 12.5px;
}

.dashboard-charts-grid {
    grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.75fr);
    gap: 16px;
    margin-bottom: 16px;
}

.panel {
    margin-bottom: 16px;
    padding: 17px;
}

.analytics-card {
    min-height: 405px;
}

.panel-head,
.toolbar {
    margin-bottom: 15px;
}

.panel-head h2,
.analytics-head h2 {
    color: #202a3d;
    font-size: 16px;
    font-weight: 800;
}

.analytics-head p {
    margin-top: 4px;
    font-size: 12.5px;
}

.chart-total strong {
    color: #1e2a40;
    font-size: 22px;
    letter-spacing: -0.04em;
}

.chart-total span {
    font-size: 12px;
}

.chart-range-filter {
    gap: 5px;
    margin: 13px 0 8px;
    padding: 3px;
    border-radius: 10px;
    background: #f4f6f9;
}

.chart-range {
    min-width: 50px;
    min-height: 28px;
    padding: 4px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #7b8493;
    font-size: 12.5px;
    font-weight: 600;
}

.chart-range:hover,
.chart-range.is-active {
    border-color: transparent;
    background: #fff;
    color: #1767d2;
    box-shadow: 0 2px 9px rgba(37, 64, 105, 0.09);
}

.dashboard-chart {
    min-height: 276px;
}

.dashboard-chart svg {
    min-height: 260px;
}

.chart-grid-line {
    stroke: #edf0f4;
    stroke-dasharray: 4 5;
}

.chart-axis-label {
    fill: #9ba4b2;
    font-size: 12.5px;
}

.chart-bar {
    rx: 5px;
}

.chart-dot {
    cursor: pointer;
    transition: r 120ms ease;
}

.chart-dot:hover {
    r: 6px;
}

.two-col {
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.65fr);
    gap: 16px;
}

.list {
    gap: 7px;
}

.list-row {
    min-height: 52px;
    padding: 10px 11px;
    border-color: #edf0f4;
    border-radius: 10px;
}

.list-row strong {
    font-size: 14px;
}

.list-row span {
    font-size: 12.5px;
}

.table-wrap {
    border-color: #edf0f4;
    border-radius: 11px;
}

table {
    color: #4a566a;
    font-size: 14px;
}

th,
td {
    padding: 11px 12px;
    border-bottom-color: #edf0f4;
}

th {
    background: #f8fafc;
    color: #8a94a3;
    font-size: 12.5px;
}

tbody tr:hover td {
    background: #f8fbff;
}

input,
select,
textarea {
    border-color: #e1e6ed;
    border-radius: 10px;
    background: #fbfcfe;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #80b3fa;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(40, 120, 240, 0.1);
}

button,
.button-link {
    min-height: 38px;
    border-color: #2878f0;
    border-radius: 10px;
    background: #2878f0;
    box-shadow: 0 5px 12px rgba(40, 120, 240, 0.14);
    font-size: 14px;
}

button:hover,
.button-link:hover {
    border-color: #1767d2;
    background: #1767d2;
}

.icon-button {
    border-color: #e5e9ef;
    background: #fff;
    box-shadow: none;
}

.badge,
.status {
    min-height: 25px;
    padding: 3px 8px;
    font-size: 12.5px;
}

.login-page {
    background:
        radial-gradient(circle at 15% 10%, rgba(40, 120, 240, 0.14), transparent 25rem),
        radial-gradient(circle at 85% 90%, rgba(124, 92, 231, 0.1), transparent 24rem),
        #f2f5fa;
}

.login-card {
    padding: 30px;
    box-shadow: 0 24px 70px rgba(28, 45, 75, 0.1);
}

@media (max-width: 1100px) {
    body:not(.login-page) {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 0;
        height: auto;
        max-height: none;
        padding: 9px 12px 7px;
        border-left: 0;
        border-bottom: 1px solid var(--sidebar-border);
        box-shadow: 0 6px 20px rgba(32, 48, 75, 0.06);
    }

    .sidebar-header {
        padding: 0 2px 7px;
        border-bottom: 0;
    }

    .brand-mark {
        width: 32px;
        min-width: 32px;
        height: 32px;
        border-radius: 9px;
    }

    .brand small {
        display: none;
    }

    .sidebar-content {
        display: flex;
        flex-direction: row;
        gap: 3px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 0 3px;
        scrollbar-width: none;
    }

    .sidebar-content::-webkit-scrollbar {
        display: none;
    }

    .sidebar-group {
        display: block;
        flex: 0 0 auto;
        padding: 0;
    }

    .sidebar-group-label {
        display: none;
    }

    .sidebar-menu {
        flex-direction: row;
    }

    .sidebar-menu-button {
        min-height: 32px;
        padding: 6px 9px;
        white-space: nowrap;
    }

    .sidebar-menu-button.is-active::before {
        display: none;
    }

    .sidebar-group + .sidebar-group {
        margin: 0;
        padding-top: 5px;
        border-top: 0;
    }

    .sidebar-footer {
        display: none;
    }

    .dashboard-charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .main {
        padding: 16px;
    }

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

    .topbar {
        align-items: stretch;
    }

    .topbar-actions {
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .topbar-date {
        display: none;
    }

    .topbar-actions form,
    .topbar-actions button {
        width: auto;
    }

    .profile-chip {
        width: 100%;
    }

    .dashboard-charts-grid {
        display: block;
    }

    .analytics-card {
        min-height: 0;
    }
}
