:root {
    --font: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --bg: #fafafa;
    --surface: #ffffff;
    --surface-2: #f7f7f8;
    --border: #ededf0;
    --border-strong: #dcdce1;

    --text: #16171d;
    --text-2: #5c5f6b;
    --text-3: #9a9ca7;

    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-soft: #f1f1fd;
    --brand-ring: rgba(79, 70, 229, .18);

    --success: #15924e;
    --success-soft: #edf7f0;
    --warning: #a76a1a;
    --warning-soft: #fbf3e6;
    --danger: #d33b3b;
    --danger-soft: #fbeded;
    --muted: #6b7280;
    --muted-soft: #f0f0f2;

    --shadow-sm: 0 1px 2px rgba(20, 24, 40, .04);
    --shadow: 0 2px 8px rgba(20, 24, 40, .05);
    --shadow-lg: 0 10px 34px rgba(20, 24, 40, .1);

    --radius-sm: 7px;
    --radius: 10px;
    --radius-lg: 14px;

    --sidebar-w: 236px;
    --sidebar-collapsed-w: 64px;
    --header-h: 56px;

    --chart-grid: #ededf0;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0e0f14;
    --surface: #16181f;
    --surface-2: #1d1f28;
    --border: #262832;
    --border-strong: #333643;

    --text: #eceef4;
    --text-2: #a2a6b4;
    --text-3: #6b7080;

    --brand: #7c74f2;
    --brand-hover: #8f88f5;
    --brand-soft: #211f36;
    --brand-ring: rgba(124, 116, 242, .3);

    --success: #3dd07f;
    --success-soft: #17271e;
    --warning: #e0a44a;
    --warning-soft: #2a2114;
    --danger: #f06a6a;
    --danger-soft: #2c1719;
    --muted: #9096a4;
    --muted-soft: #22242e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 2px 10px rgba(0, 0, 0, .35);
    --shadow-lg: 0 12px 38px rgba(0, 0, 0, .5);

    --chart-grid: #262832;
    color-scheme: dark;
}

html { transition: none; }

body,
.sidebar,
.topbar,
.card,
.stat,
.input,
.select,
.textarea,
.btn,
.modal,
.dropdown-menu,
table.data th,
table.data td {
    transition: background-color .25s ease, border-color .25s ease, color .2s ease;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-variant-numeric: tabular-nums;
}

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

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -.01em;
    color: var(--text);
}

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
    transition: grid-template-columns .22s cubic-bezier(.4, 0, .2, 1);
}

.app.collapsed {
    grid-template-columns: var(--sidebar-collapsed-w) 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 14px 12px;
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 16px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--brand);
    display: grid;
    place-items: center;
    color: #fff;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 650;
    font-size: 14px;
    letter-spacing: -.02em;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 500;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 4px;
}

.nav-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-3);
    font-weight: 600;
    padding: 10px 10px 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 500;
    font-size: 13px;
    transition: background .13s, color .13s;
    position: relative;
}

.nav-item svg {
    width: 17px;
    height: 17px;
    stroke-width: 2;
    flex-shrink: 0;
    color: var(--text-3);
    transition: color .13s;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav-item:hover svg {
    color: var(--text-2);
}

.nav-item.active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 550;
}

.nav-item.active svg {
    color: var(--brand);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-item span,
.brand-text,
.user-chip .chip-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity .15s;
}

.collapsed .nav-item {
    justify-content: center;
    padding: 8px;
}

.collapsed .nav-item span,
.collapsed .brand-text,
.collapsed .nav-label,
.collapsed .user-chip .chip-text {
    opacity: 0;
    width: 0;
    pointer-events: none;
    display: none;
}

.collapsed .brand,
.collapsed .user-chip {
    justify-content: center;
}

.collapsed .nav-item {
    position: relative;
}

.collapsed .nav-item::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) scale(.9);
    background: var(--text);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 9px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .13s, transform .13s;
    z-index: 50;
}

.collapsed .nav-item:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.sidebar-toggle {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-3);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .13s, color .13s;
}

.sidebar-toggle:hover {
    background: var(--surface-2);
    color: var(--text);
}

.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform .22s;
}

.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    min-height: var(--header-h);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-title h1 {
    font-size: 16px;
    font-weight: 600;
}

.topbar-title p {
    margin: 1px 0 0;
    font-size: 12px;
    color: var(--text-3);
}

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

.content {
    padding: 20px;
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    transition: background .13s, border-color .13s, box-shadow .13s, transform .05s;
    white-space: nowrap;
    line-height: 1.3;
}

.btn:active {
    transform: translateY(.5px);
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-hover);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text-2);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-danger {
    background: var(--surface);
    color: var(--danger);
    border-color: var(--border-strong);
}

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

.btn-sm {
    padding: 5px 10px;
    font-size: 12.5px;
}

.btn-icon {
    padding: 7px;
    width: 32px;
    height: 32px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card-pad {
    padding: 16px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.card-head h3 {
    font-size: 13.5px;
    font-weight: 600;
}

.grid {
    display: grid;
    gap: 12px;
}

.stat-grid {
    grid-template-columns: repeat(4, 1fr);
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px 16px;
    display: flex;
    align-items: center;
    gap: 13px;
    transition: border-color .15s;
}

.stat:hover {
    border-color: var(--border-strong);
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 19px;
    height: 19px;
    stroke-width: 2;
}

.stat-icon.i-brand { background: var(--brand-soft); color: var(--brand); }
.stat-icon.i-success { background: var(--success-soft); color: var(--success); }
.stat-icon.i-warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.i-muted { background: var(--muted-soft); color: var(--muted); }

.stat-body {
    min-width: 0;
}

.stat-value {
    font-size: 21px;
    font-weight: 650;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.stat-label {
    color: var(--text-3);
    font-size: 12px;
    font-weight: 500;
    margin-top: 1px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px 2px 7px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 550;
    line-height: 1.5;
    border: 1px solid transparent;
}

.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge.success { color: var(--success); background: var(--success-soft); border-color: rgba(21, 146, 78, .12); }
.badge.warning { color: var(--warning); background: var(--warning-soft); border-color: rgba(167, 106, 26, .12); }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(211, 59, 59, .12); }
.badge.muted { color: var(--muted); background: var(--muted-soft); border-color: var(--border); }
.badge.brand { color: var(--brand); background: var(--brand-soft); border-color: rgba(79, 70, 229, .1); }

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

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data th {
    text-align: left;
    padding: 9px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-3);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.data tbody tr:last-child td {
    border-bottom: none;
}

table.data tbody tr {
    transition: background .1s;
}

table.data tbody tr:hover {
    background: var(--surface-2);
}

.cell-main {
    font-weight: 550;
    color: var(--text);
}

.cell-sub {
    color: var(--text-3);
    font-size: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field label {
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-2);
}

.field .hint {
    font-size: 11.5px;
    color: var(--text-3);
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.textarea {
    resize: vertical;
    min-height: 90px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.switch input {
    display: none;
}

.switch .track {
    width: 40px;
    height: 23px;
    border-radius: 999px;
    background: var(--border-strong);
    position: relative;
    transition: background .18s;
    flex-shrink: 0;
}

.switch .track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform .18s;
}

.switch input:checked + .track {
    background: var(--brand);
}

.switch input:checked + .track::after {
    transform: translateX(17px);
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 380px;
}

.search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    color: var(--text-3);
}

.search .input {
    padding-left: 38px;
}

.filter-select {
    min-width: 150px;
    width: auto;
}

.type-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.type-card {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: border-color .13s, background .13s;
    background: var(--surface);
    display: flex;
    gap: 11px;
    align-items: flex-start;
}

.type-card:hover {
    border-color: var(--brand);
}

.type-card.selected {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.type-card .tc-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--muted-soft);
    color: var(--text-2);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.type-card .tc-icon svg { width: 17px; height: 17px; }

.type-card.selected .tc-icon {
    background: var(--brand);
    color: #fff;
}

.type-card h4 {
    font-size: 13px;
    font-weight: 600;
}

.type-card p {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: var(--text-3);
    line-height: 1.35;
}

.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-3);
}

.empty svg {
    width: 46px;
    height: 46px;
    stroke-width: 1.6;
    margin-bottom: 14px;
    color: var(--border-strong);
}

.empty h3 {
    color: var(--text-2);
    font-size: 16px;
    margin-bottom: 6px;
}

.pagination {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    margin-top: 14px;
    align-items: center;
}

.pagination a,
.pagination span {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
}

.pagination a:hover {
    background: var(--surface-2);
}

.pagination .active span,
.pagination span[aria-current] {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.pagination .disabled span {
    opacity: .45;
}

.alert {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    background: var(--success-soft);
    color: var(--success);
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 14px;
    border: 1px solid rgba(21, 146, 78, .16);
}

.alert svg {
    width: 18px;
    height: 18px;
}

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

.page-head .sub {
    color: var(--text-3);
    font-size: 13px;
    margin-top: 3px;
}

.section-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 12px;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

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

.bar {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
    flex: 1;
}

.bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), #7c6cf0);
}

.mono {
    font-variant-numeric: tabular-nums;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 20, 38, .44);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 100;
    opacity: 0;
    transition: opacity .18s ease;
}

.modal-backdrop.open {
    display: flex;
    opacity: 1;
}

.modal-backdrop:nth-of-type(n) { z-index: 100; }
.modal-backdrop.open ~ .modal-backdrop.open { z-index: 110; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    transform: translateY(12px) scale(.97);
    opacity: 0;
    transition: transform .22s cubic-bezier(.34, 1.3, .64, 1), opacity .18s;
}

.modal-backdrop.open .modal {
    transform: none;
    opacity: 1;
}

.modal-sm { max-width: 420px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 920px; }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-head h3 {
    font-size: 15px;
    font-weight: 600;
}

.modal-head .modal-sub {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 2px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.q-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--surface);
    transition: border-color .13s;
}

.q-item:hover {
    border-color: var(--border-strong);
}

.q-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.q-num {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 650;
    font-size: 12.5px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.q-body {
    display: flex;
    gap: 12px;
    flex: 1;
}

.q-text {
    font-weight: 550;
}

.q-meta {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.option-row .input {
    flex: 1;
}

.opt-correct {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border-strong);
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--surface);
    color: transparent;
    transition: all .12s;
}

.opt-correct.on {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.opt-correct svg {
    width: 14px;
    height: 14px;
    stroke-width: 3;
}

@media (max-width: 1080px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .section-grid { grid-template-columns: 1fr; }
}

.mobile-only { display: none; }
.desktop-only { display: inline-flex; }

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.nav-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(18, 20, 38, .4);
    z-index: 29;
    opacity: 0;
    transition: opacity .22s;
}

.profile-menu { position: relative; }

.profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: background .13s, border-color .13s;
}

.profile-trigger:hover { background: var(--surface-2); }

.profile-trigger .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.profile-name {
    font-size: 13px;
    font-weight: 550;
    color: var(--text);
}

.profile-trigger svg { color: var(--text-3); transition: transform .18s; }
.profile-menu.open .profile-trigger svg { transform: rotate(180deg); }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    opacity: 0;
    transform: translateY(-6px) scale(.98);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity .16s, transform .16s;
    z-index: 60;
}

.profile-menu.open .dropdown-menu {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.dropdown-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    text-align: left;
    transition: background .12s, color .12s;
}

.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item svg { color: var(--text-3); }
.dropdown-item:hover svg { color: var(--text-2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

@media (max-width: 1080px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .section-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .mobile-only { display: inline-flex; }
    .desktop-only { display: none; }
    .app,
    .app.collapsed { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        transition: transform .25s cubic-bezier(.4, 0, .2, 1);
        width: var(--sidebar-w);
        box-shadow: var(--shadow-lg);
    }
    .app.nav-open .sidebar { transform: none; }
    .app.nav-open .nav-scrim { display: block; opacity: 1; }
    .collapsed .nav-item span,
    .collapsed .brand-text,
    .collapsed .nav-label { opacity: 1; width: auto; display: block; }
    .collapsed .nav-item { justify-content: flex-start; padding: 7px 10px; }
    .collapsed .nav-item::after { display: none; }
    .field-row { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr; }
    .type-cards,
    .type-cards-4 { grid-template-columns: 1fr; }
    .content { padding: 14px; }
    .topbar { padding: 8px 14px; }
    .topbar-title p { display: none; }
}

.toast-wrap {
    position: fixed;
    top: 18px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
    pointer-events: none;
    max-width: calc(100vw - 36px);
}

.toast {
    --toast-accent: var(--brand);
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    width: 340px;
    max-width: 100%;
    padding: 13px 13px 13px 14px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(20, 24, 40, .14), 0 2px 6px rgba(20, 24, 40, .06);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateX(120%) scale(.96);
    transition: transform .42s cubic-bezier(.21, 1.02, .35, 1), opacity .3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.toast.hide {
    opacity: 0;
    transform: translateX(120%) scale(.96);
    transition: transform .34s cubic-bezier(.5, 0, .75, 0), opacity .3s ease;
}

.toast::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--toast-accent);
}

.toast-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: #fff;
    background: var(--toast-accent);
    animation: toast-pop .4s cubic-bezier(.34, 1.56, .64, 1) .08s both;
}

.toast-icon svg { width: 15px; height: 15px; }

@keyframes toast-pop {
    from { transform: scale(0); }
    60% { transform: scale(1.18); }
    to { transform: scale(1); }
}

.toast-content { flex: 1; min-width: 0; padding-top: 1px; }

.toast-title {
    font-size: 12.5px;
    font-weight: 650;
    color: var(--text);
    line-height: 1.3;
}

.toast-msg {
    font-size: 12.5px;
    font-weight: 450;
    color: var(--text-2);
    margin-top: 1px;
    line-height: 1.4;
    word-break: break-word;
}

.toast-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    color: var(--text-3);
    cursor: pointer;
    border-radius: 6px;
    display: grid;
    place-items: center;
    transition: background .12s, color .12s;
    margin: -2px -2px 0 0;
}

.toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast-close svg { width: 14px; height: 14px; }

.toast-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background: var(--toast-accent);
    opacity: .35;
    transform-origin: left;
    animation: toast-countdown linear forwards;
}

.toast.paused .toast-bar { animation-play-state: paused; }

@keyframes toast-countdown {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.toast-success { --toast-accent: var(--success); }
.toast-error { --toast-accent: var(--danger); }
.toast-info { --toast-accent: var(--brand); }

@media (max-width: 560px) {
    .toast-wrap {
        top: auto;
        bottom: 14px;
        left: 14px;
        right: 14px;
    }
    .toast { width: 100%; }
}

.field-error {
    font-size: 11.5px;
    color: var(--danger);
    font-weight: 500;
    animation: shake .3s;
}

.input.invalid,
.select.invalid,
.textarea.invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(211, 59, 59, .12);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.btn.loading {
    color: transparent !important;
    pointer-events: none;
    position: relative;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    color: #fff;
    animation: spin .6s linear infinite;
}

.btn-ghost.loading::after { color: var(--text-2); }

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

.pw-wrap {
    position: relative;
}

.pw-wrap .input {
    padding-right: 40px;
}

.pw-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: none;
    background: none;
    color: var(--text-3);
    cursor: pointer;
    border-radius: 6px;
    transition: color .13s, background .13s;
}

.pw-toggle:hover {
    color: var(--text-2);
    background: var(--surface-2);
}

.pw-toggle svg { width: 17px; height: 17px; }
.pw-toggle .icon-off { display: none; }
.pw-toggle[data-state="on"] .icon-on { display: none; }
.pw-toggle[data-state="on"] .icon-off { display: block; }

.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 550;
    color: var(--text-3);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .13s, border-color .13s;
    font-family: inherit;
}

.tab svg { width: 16px; height: 16px; }

.tab:hover {
    color: var(--text-2);
}

.tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.tab-panel {
    display: none;
    animation: fade-in .25s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.avatar-edit {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-weight: 650;
    font-size: 24px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.avatar-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.session-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.session-row:last-child { border-bottom: none; }

.session-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text-2);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.content > * {
    animation: page-in .3s ease;
}

@keyframes page-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
    .app.collapsed { grid-template-columns: 1fr; }
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f6f6fc 0%, #fafafa 60%, #f4f7fb 100%);
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
    animation: float 14s ease-in-out infinite;
}

.orb-1 {
    width: 380px;
    height: 380px;
    background: #c7c4f5;
    top: -80px;
    left: -60px;
}

.orb-2 {
    width: 320px;
    height: 320px;
    background: #b9d4f0;
    bottom: -100px;
    right: -40px;
    animation-delay: -5s;
}

.orb-3 {
    width: 260px;
    height: 260px;
    background: #d9c9f0;
    top: 40%;
    left: 55%;
    animation-delay: -9s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -25px) scale(1.06); }
    66% { transform: translate(-20px, 20px) scale(.96); }
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(30, 30, 70, .12);
    animation: card-in .5s cubic-bezier(.34, 1.2, .64, 1);
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: none; }
}

.auth-brand {
    margin-bottom: 20px;
}

.auth-brand .brand-logo {
    box-shadow: 0 10px 24px rgba(79, 70, 229, .3);
}

.auth-title {
    font-size: 23px;
    font-weight: 650;
    letter-spacing: -.02em;
}

.auth-sub {
    margin: 6px 0 26px;
    color: var(--text-3);
    font-size: 13.5px;
    line-height: 1.5;
}

.auth-form .field label {
    font-size: 12.5px;
}

.input-icon {
    position: relative;
}

.input-icon svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    pointer-events: none;
}

.input-icon .input {
    padding-left: 38px;
}

.test-modal-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

.test-modal-questions {
    border-left: 1px solid var(--border);
    padding-left: 20px;
    position: sticky;
    top: 0;
}

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

.q-col-head h4 {
    font-size: 13.5px;
    font-weight: 600;
}

.q-list-scroll {
    max-height: 420px;
    overflow-y: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.q-list-scroll .q-item {
    padding: 10px 12px;
}

.q-empty-hint {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 12px;
    color: var(--text-3);
    gap: 8px;
}

.q-empty-hint svg { color: var(--border-strong); }
.q-empty-hint p { margin: 0; font-size: 12.5px; }

.test-modal-questions.locked .q-col-head button { pointer-events: none; }

@media (max-width: 780px) {
    .test-modal-grid { grid-template-columns: 1fr; }
    .test-modal-questions {
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 18px;
    }
}

.set-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.set-row:last-child { border-bottom: none; }
.set-row > span:first-child { color: var(--text-2); }
.set-row b { font-weight: 550; }

.type-cards-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .type-cards-4 { grid-template-columns: repeat(2, 1fr); } }

.answer-zone {
    margin-top: 6px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-strong);
}

.answer-panel {
    animation: fade-in .25s ease;
}

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

.answer-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.answer-title svg { color: var(--brand); }

.answer-desc {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 3px;
}

.answer-tools {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.mini-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 550;
    color: var(--text-2);
}

.seg-picker {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.seg-picker .seg {
    border: none;
    background: none;
    padding: 6px 11px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 550;
    color: var(--text-2);
    cursor: pointer;
    font-family: inherit;
    transition: background .13s, color .13s, box-shadow .13s;
}

.seg-picker .seg.on {
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--shadow-sm);
}

.answer-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.answer-progress .bar {
    height: 6px;
    flex: 1;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}

.answer-progress .bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), #7c6cf0);
    transition: width .25s ease;
}

.answer-progress small { color: var(--text-3); }

.key-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.key-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    transition: border-color .13s;
}

.key-cell.filled { border-color: var(--brand-soft); background: var(--brand-soft); }

.key-num {
    font-size: 12px;
    font-weight: 650;
    color: var(--text-2);
    min-width: 20px;
    text-align: center;
}

.letters {
    display: flex;
    gap: 3px;
    flex: 1;
}

.letters .lt {
    flex: 1;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 0;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all .1s;
    font-family: inherit;
}

.letters .lt:hover { border-color: var(--brand); color: var(--brand); }

.letters .lt.on {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 2px 6px var(--brand-ring);
}

.closed-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.closed-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.closed-row .num {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 650;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.closed-row .input { flex: 1; }

.block-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.block-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fade-in .2s ease;
}

.block-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.block-badge {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--brand);
    color: #fff;
    font-size: 12px;
    font-weight: 650;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.block-card-head .input { flex: 1; }
.block-card-body { padding: 12px; }

.block-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 30px;
    gap: 8px;
    color: var(--text-3);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

.block-empty svg { color: var(--border-strong); }
.block-empty p { margin: 0; font-size: 12.5px; }

.rasch-top {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    margin-bottom: 14px;
}

.rasch-progress-card {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.rasch-ring {
    width: 64px;
    height: 64px;
    transform: rotate(-90deg);
}

.rasch-ring .ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 4;
}

.rasch-ring .ring-fill {
    fill: none;
    stroke: var(--brand);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 119.4;
    stroke-dashoffset: 119.4;
    transition: stroke-dashoffset .35s ease;
}

.rasch-progress-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-2);
}

.rasch-progress-num b { color: var(--text); font-weight: 700; }

.rasch-tools { display: flex; gap: 8px; }

.rasch-config {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
}

.rasch-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
}

.rasch-sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 13px;
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
}

.rasch-sec-head.sec-blue { background: linear-gradient(90deg, #4f46e5, #6366f1); }
.rasch-sec-head.sec-amber { background: linear-gradient(90deg, #b45309, #d97706); }
.rasch-sec-head.sec-green { background: linear-gradient(90deg, #15803d, #16a34a); }

.rasch-badge {
    background: rgba(255, 255, 255, .22);
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: .06em;
}

.rasch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
    padding: 12px;
}

.rasch-q {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 9px;
    transition: border-color .13s, background .13s;
}

.rasch-q.filled { border-color: var(--brand-soft); background: var(--brand-soft); }
.rasch-q .rq-num { font-size: 11.5px; font-weight: 650; color: var(--text-2); min-width: 18px; }

.rasch-q .letters .lt { padding: 4px 0; font-size: 11px; }

.rasch-written {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rasch-w-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    transition: border-color .13s;
}

.rasch-w-card.is-file {
    border-color: rgba(21, 146, 78, .3);
    background: var(--success-soft);
}

.rasch-w-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.rasch-w-card.is-file .rasch-w-head {
    background: rgba(21, 146, 78, .08);
    border-bottom-color: rgba(21, 146, 78, .18);
}

.rasch-w-head .rq-badge {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--success);
    color: #fff;
    font-size: 11.5px;
    font-weight: 650;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.rasch-w-title {
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-2);
    flex: 1;
}

.rasch-w-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.esse-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
    font-size: 11.5px;
    font-weight: 550;
    color: var(--text-2);
}

.esse-toggle input { display: none; }

.esse-toggle .esse-track {
    width: 32px;
    height: 18px;
    border-radius: 999px;
    background: var(--border-strong);
    position: relative;
    transition: background .16s;
}

.esse-toggle .esse-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform .16s;
}

.esse-toggle input:checked + .esse-track { background: var(--success); }
.esse-toggle input:checked + .esse-track::after { transform: translateX(14px); }

.rasch-w-body { padding: 12px; }

.esse-answers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.esse-answer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.esse-answer .ea-num {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 11px;
    font-weight: 650;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.esse-answer .input { flex: 1; }

.esse-note {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--success);
}

.esse-note svg { flex-shrink: 0; }
.esse-note b { display: block; font-size: 13px; }
.esse-note span { font-size: 11.5px; color: var(--text-2); }

.settings-tabs {
    overflow-x: auto;
    scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tabs .tab { white-space: nowrap; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.loader-line {
    padding: 24px;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
}

.act-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.act-row:last-child { border-bottom: none; }

.act-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.act-icon.brand { background: var(--brand-soft); color: var(--brand); }
.act-icon.success { background: var(--success-soft); color: var(--success); }
.act-icon.danger { background: var(--danger-soft); color: var(--danger); }
.act-icon.muted { background: var(--muted-soft); color: var(--muted); }

.act-main { flex: 1; min-width: 0; }
.act-title { font-size: 13px; font-weight: 550; }
.act-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }

.act-changes {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 7px;
    padding: 8px 10px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.act-change {
    font-size: 11.5px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

.act-change b { color: var(--text); font-weight: 600; }

.act-ago {
    font-size: 11.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.activity-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    border-top: 1px solid var(--border);
}

@media (max-width: 620px) {
    .act-ago { display: none; }
    .settings-tabs .tab span { display: none; }
    .settings-tabs .tab { padding: 9px 12px; }
}

.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
    transition: background .13s, color .13s, border-color .13s;
    flex-shrink: 0;
}

.theme-toggle:hover { background: var(--surface-2); color: var(--text); }

.theme-toggle span {
    grid-area: 1 / 1;
    display: grid;
    place-items: center;
    transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), opacity .3s;
}

.theme-toggle .ic-sun { transform: rotate(0) scale(1); opacity: 1; }
.theme-toggle .ic-moon { transform: rotate(-90deg) scale(.4); opacity: 0; }

[data-theme="dark"] .theme-toggle .ic-sun { transform: rotate(90deg) scale(.4); opacity: 0; }
[data-theme="dark"] .theme-toggle .ic-moon { transform: rotate(0) scale(1); opacity: 1; }

.chart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.chart-card { overflow: hidden; }
.chart-card.span-2 { grid-column: span 2; }
.chart-card .card-pad { padding: 10px 14px 14px; }

.stat-anim { animation: stat-in .5s cubic-bezier(.34, 1.3, .64, 1) both; }
.stat-anim:nth-child(2) { animation-delay: .06s; }
.stat-anim:nth-child(3) { animation-delay: .12s; }
.stat-anim:nth-child(4) { animation-delay: .18s; }

@keyframes stat-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.chart-card { animation: card-rise .5s ease both; }

@keyframes card-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 1080px) {
    .chart-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-card.span-2 { grid-column: span 2; }
}

@media (max-width: 760px) {
    .chart-grid { grid-template-columns: 1fr; }
    .chart-card.span-2 { grid-column: span 1; }
}

.fin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 4px 0 14px;
    flex-wrap: wrap;
}

.fin-title { font-size: 15px; font-weight: 650; }

.approval-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.apl-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-2);
}

.apl-item b { margin-left: auto; color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }

.apl-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.apl-dot.success { background: var(--success); }
.apl-dot.danger { background: var(--danger); }
.apl-dot.muted { background: var(--muted); }

.date-range {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-3);
}

.date-range .input {
    border: none;
    padding: 4px 2px;
    width: auto;
    background: transparent;
    font-size: 12.5px;
    color: var(--text);
}

.date-range .input:focus { box-shadow: none; }
.date-range .date-sep { color: var(--text-3); font-size: 12px; }

.row-actions {
    display: inline-flex;
    gap: 5px;
    justify-content: flex-end;
    width: 100%;
}

.act-btn {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
    flex-shrink: 0;
}

.act-btn:hover { background: var(--surface-2); color: var(--text); }
.act-btn.ok:hover { background: var(--success-soft); color: var(--success); border-color: rgba(21, 146, 78, .3); }
.act-btn.no:hover { background: var(--warning-soft); color: var(--warning); border-color: rgba(167, 106, 26, .3); }
.act-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: rgba(211, 59, 59, .3); }
.act-btn svg { width: 15px; height: 15px; }

.pm-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 22px;
    align-items: start;
}

.pm-info { min-width: 0; }

.pm-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.pm-field:last-child { border-bottom: none; }
.pm-field > span { color: var(--text-3); flex-shrink: 0; }
.pm-field > b { font-weight: 600; text-align: right; word-break: break-word; }

.pm-hr { border: none; border-top: 1px dashed var(--border-strong); margin: 8px 0; }

.pm-note {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.pm-note > span { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.pm-note > p { margin: 5px 0 0; font-size: 13px; color: var(--text-2); white-space: pre-line; word-break: break-word; }

.pm-receipt {
    position: sticky;
    top: 0;
}

.pm-receipt-label {
    font-size: 11.5px;
    color: var(--text-3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 8px;
}

.pm-receipt-box {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-2);
    cursor: zoom-in;
    display: block;
}

.pm-receipt-box img {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    display: block;
    background: #0e0f14;
}

.pm-receipt-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px;
    font-size: 11.5px;
    font-weight: 550;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, .68), transparent);
}

.pm-receipt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 44px 16px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-3);
    text-align: center;
}

.pm-receipt-empty svg { color: var(--border-strong); }
.pm-receipt-empty p { margin: 0; font-size: 12.5px; }

.pm-callout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.pm-callout svg { flex-shrink: 0; margin-top: 1px; }
.pm-callout b { font-weight: 650; }
.pm-callout.success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(21, 146, 78, .16); }
.pm-callout.success div { color: var(--text-2); }
.pm-callout.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(211, 59, 59, .16); }
.pm-callout.danger div { color: var(--text-2); }
.pm-callout b { color: var(--text); }

@media (max-width: 720px) {
    .pm-grid { grid-template-columns: 1fr; }
    .pm-receipt { position: static; }
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(8, 9, 14, .92);
    display: none;
    flex-direction: column;
}

.lightbox.open { display: flex; animation: fade-in .2s ease; }

.lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    z-index: 2;
}

.lb-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .06);
    color: #e9ebf2;
    cursor: pointer;
    transition: background .13s, color .13s;
}

.lb-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }

.lightbox-stage {
    flex: 1;
    overflow: hidden;
    display: grid;
    place-items: center;
    cursor: grab;
    user-select: none;
}

.lightbox-stage.grabbing { cursor: grabbing; }

.lightbox-stage img {
    max-width: 90vw;
    max-height: 80vh;
    transition: transform .05s linear;
    will-change: transform;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
    border-radius: 6px;
}
