:root {
    --bg:          #f8fafc;
    --surface:     #ffffff;
    --surface-hover: #f1f5f9;
    --border:      #e2e8f0;
    --text:        #0f172a;
    --muted:       #64748b;
    --muted-2:     #94a3b8;
    --primary:     #4f46e5;
    --primary-d:   #4338ca;
    --primary-bg:  #eef2ff;
    --accent:      #8b5cf6;
    --accent-bg:   #f3e8ff;
    --success:     #059669;
    --success-bg:  #d1fae5;
    --danger:      #dc2626;
    --danger-bg:   #fee2e2;
    --warning:     #d97706;
    --warning-bg:  #fef3c7;
    --info:        #0ea5e9;
    --info-bg:     #e0f2fe;

    --sidebar-bg:     #0f172a;
    --sidebar-text:   #cbd5e1;
    --sidebar-active: #4f46e5;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow:    0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --shadow-md: 0 4px 12px rgba(15,23,42,.08);
    --shadow-lg: 0 20px 40px rgba(15,23,42,.2);

    --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0 0 .5em; color: var(--text); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
small { font-size: 12px; }

/* ============ Layout ============ */
.app { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; width: 210px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px; }
.brand span { display: block; font-weight: 700; font-size: 15px; color: #fff; white-space: nowrap; }
.brand svg { flex: 0 0 auto; }

.nav { display: flex; flex-direction: column; padding: 6px 8px; gap: 2px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-item { display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--sidebar-text); font-weight: 500; font-size: 13px; position: relative; white-space: nowrap; }
.nav-item span:last-child { display: block; }
.nav-item:hover { background: rgba(255,255,255,0.08); color:#fff; text-decoration: none; }
.nav-item:hover::after { display: none; }
.nav-item.active { background: var(--sidebar-active); color:#fff; box-shadow: 0 2px 6px rgba(79,70,229,.4); }
.nav-icon { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.06); border-radius: 8px; font-size: 16px; flex: 0 0 auto; }
.nav-item.active .nav-icon { background: rgba(255,255,255,.15); }

/* ---- Nav groups (collapsible sections) ---- */
.nav-group-header {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border-radius: var(--radius-sm);
    background: none; border: none; cursor: pointer; text-align: left;
    color: var(--sidebar-text); font-weight: 600; font-size: 13px; white-space: nowrap;
    transition: background .15s, color .15s;
}
.nav-group-header:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-group.open > .nav-group-header { color: rgba(255,255,255,.9); }
.nav-group-arrow {
    margin-left: auto; font-size: 18px; opacity: .45; flex-shrink: 0;
    display: inline-flex; align-items: center; transition: transform .22s ease;
    line-height: 1;
}
.nav-group.open > .nav-group-header .nav-group-arrow { transform: rotate(90deg); opacity: .75; }
.nav-group-items { overflow: hidden; max-height: 0; transition: max-height .28s ease; }
.nav-group.open > .nav-group-items { max-height: 900px; }
.nav-sub-item { padding-left: 18px !important; font-size: 12.5px; }
.nav-sub-item .nav-icon { width: 24px; height: 24px; font-size: 14px; }

@media (max-width: 700px) {
    .nav-group { display: contents; }
    .nav-group-header { display: none; }
    .nav-group-items { display: contents; max-height: none !important; }
    .nav-sub-item { padding-left: 8px !important; font-size: 11px; }
    .nav-sub-item .nav-icon { width: 24px; height: 24px; font-size: 13px; }
}

.sidebar-footer { padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.08); display: flex; justify-content: flex-start; }
.user-chip { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,#6366f1,#8b5cf6); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.u-name { display: block; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.u-role { display: block; font-size: 11px; color: var(--sidebar-text); }

.main { display: flex; flex-direction: column; min-width: 0; width: 100%; }
.topbar { display: flex; align-items: center; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); gap: 12px; position: sticky; top: 0; z-index: 5; }
.topbar-left { flex: 1; display: flex; align-items: center; }
.topbar-right { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.rest-picker { display: flex; align-items: center; gap: 10px; }
.rest-picker-lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
.rest-picker select { min-width: 200px; padding: 8px 12px; font-size: 14px; font-weight: 600; border: 1px solid var(--border); border-radius: var(--radius-sm); background:#fff; color: var(--text); }

/* Online users widget */
.topbar-online { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.online-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.online-avatars { display: flex; align-items: center; gap: 4px; }
.online-avatar { position: relative; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; cursor: default; border: 2px solid var(--surface); box-shadow: 0 0 0 1px rgba(99,102,241,.3); transition: transform .15s; }
.online-avatar:hover { transform: scale(1.15); z-index: 2; }
.online-avatar-me { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 0 0 1px rgba(5,150,105,.4); }
.online-avatar-click { cursor: pointer; }
.online-avatar-click:focus-visible { outline: 2px solid var(--primary, #6366f1); outline-offset: 2px; }
/* Prozor „gde je korisnik" (klik na ikonicu aktivnog korisnika) */
.ut-meta { font-size: 12.5px; margin-bottom: 14px; }
.ut-small { font-size: 12px; }
.ut-now { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 12px 14px; margin-bottom: 18px; }
.ut-now-lbl { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #16a34a; margin-bottom: 6px; }
.ut-now-page { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--text); text-decoration: none; margin-bottom: 4px; }
.ut-now-page:hover span { text-decoration: underline; }
.ut-sub { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.ut-list { list-style: none; margin: 0; padding: 0; }
.ut-list li { display: flex; align-items: center; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.ut-list li:last-child { border-bottom: 0; }
.ut-list a { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.ut-list a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ut-list a:hover span { text-decoration: underline; }
.ut-list svg, .ut-now-page svg { flex-shrink: 0; color: var(--muted); }
.ut-hits { font-size: 11px; color: var(--muted); }
.ut-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ut-foot { margin-top: 14px; text-align: right; }
.online-dot { position: absolute; bottom: -1px; right: -1px; width: 9px; height: 9px; background: #22c55e; border-radius: 50%; border: 2px solid var(--surface); animation: pulse-dot 2s ease-in-out infinite; }
.online-dot-off { display: inline-block; width: 8px; height: 8px; background: var(--muted-2); border-radius: 50%; margin-right: 4px; flex-shrink: 0; }
.online-empty { font-size: 12px; color: var(--muted-2); }
.online-admin-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.online-admin-yes { color: #059669; background: #d1fae5; }
.online-admin-no  { color: var(--muted); background: var(--bg); border: 1px solid var(--border); }

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
    50%       { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.lang-btn { padding: 7px 12px; border: none; background: transparent; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); text-decoration: none; }
.lang-btn.active { background: var(--primary); color: #fff; }

.content { padding: 16px 16px; max-width: 100%; width: 100%; box-sizing: border-box; }

@media (max-width: 700px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; width: 100%; }
    .brand { display: none; }
    .nav { flex-direction: row; overflow-x: auto; padding: 6px 8px; gap: 2px; scrollbar-width: none; }
    .nav::-webkit-scrollbar { display: none; }
    .nav-item {
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 6px 8px;
        min-width: max-content;
        font-size: 11px;
    }
    .nav-item span:last-child { font-size: 10px; line-height: 1; }
    .nav-icon { width: 24px; height: 24px; font-size: 13px; }
    .sidebar-footer { display: none; }
    .content { padding: 16px; }
    .topbar { flex-direction: column; align-items: stretch; padding: 12px 16px; }
    .topbar-left { flex: none; }
    .topbar-right { flex: none; justify-content: flex-start; }
    .rest-picker select { min-width: 0; width: 100%; }
    .topbar-online { display: none; }
}

/* ============ Page head ============ */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============ Cards ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { }
.card-body.p-0 { padding: 0; margin: -20px; overflow-x: auto; }

/* ============ Grids ============ */
.grid-2     { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.grid-2-1   { display: grid; gap: 16px; grid-template-columns: 2fr 1fr; margin-bottom: 16px; }
@media (max-width: 1000px) {
    .grid-2, .grid-2-1 { grid-template-columns: 1fr; }
}

.stats-grid   { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .stats-grid, .stats-grid-3 { grid-template-columns: 1fr; } }

/* ============ Stat cards ============ */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex: 0 0 auto; font-weight: 700; }
.stat-icon-success { background: var(--success-bg); color: var(--success); }
.stat-icon-danger  { background: var(--danger-bg);  color: var(--danger); }
.stat-icon-primary { background: var(--primary-bg); color: var(--primary); }
.stat-icon-accent  { background: var(--accent-bg);  color: var(--accent); }
.stat-icon-warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon-info    { background: var(--info-bg);    color: var(--info); }
.stat-body { min-width: 0; }
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; margin-bottom: 3px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.stat-value small { font-weight: 500; font-size: 13px; }

/* ============ Tables ============ */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 10px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: #f8fafc; font-weight: 600; color: #475569; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover td { background: #f8fafc; }
.table tfoot th { background: #f1f5f9; }
.ta-right { text-align: right !important; }
.table .ta-right { font-variant-numeric: tabular-nums; }
.row-deleted td { opacity: .55; text-decoration: line-through; }
.row-muted td { opacity: .6; }

/* ============ Buttons ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; transition: transform .12s, background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color:#fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-lg { padding: 12px 18px; font-size: 15px; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11px; }

/* ============ Badges & dots ============ */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-accent  { background: var(--accent-bg);  color: var(--accent); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-muted   { background: #f1f5f9; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }

/* ============ Forms ============ */
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; padding: 20px; }
.form-vertical { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.form-grid label, .form-vertical label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--text); }
.form-grid .col-2 { grid-column: 1 / -1; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=color], input[type=search],
select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--text);
}
input[type=color] { padding: 4px; height: 38px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }

.chk { flex-direction: row !important; align-items: center !important; gap: 8px !important; cursor: pointer; }
.chk input[type=checkbox] { width: auto; margin: 0; }
.checks { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: #f8fafc; max-height: 220px; overflow: auto; }
.block-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; }
.inline { display: inline-block; }

/* ============ Filters ============ */
.filters { padding: 14px 20px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; min-width: 140px; }
.filter-row label.grow { flex: 1 1 220px; }
.filter-row label.chk { flex-direction: row; align-items: center; }
.filter-actions { display: flex; gap: 6px; margin-left: auto; }

/* ============ Period picker & tabs ============ */
.period-picker { display: inline-flex; gap: 4px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; flex-wrap: wrap; align-items: center; }
.period-btn { padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--muted); border-radius: calc(var(--radius-sm) - 2px); }
.period-btn:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.period-btn.active { background: var(--primary); color: #fff; }

.tabs { display: inline-flex; border: 1px solid var(--border); background: #fff; border-radius: var(--radius-sm); overflow: hidden; }
.tab { padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tab:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.tab.active { background: var(--primary); color: #fff; }
.year-input { width: 90px; }

/* ============ Flash ============ */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; font-weight: 500; }
.flash-success { background: var(--success-bg); border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: var(--danger-bg);  border-color: #fecaca; color: #991b1b; }
.flash-info    { background: var(--info-bg);    border-color: #bae6fd; color: #075985; }
.flash-warning { background: var(--warning-bg); border-color: #fde68a; color: #92400e; }

/* ============ Auth (login / setup) ============ */
.auth-body { background: linear-gradient(135deg, #4f46e5 0%, #8b5cf6 100%); min-height: 100vh; margin: 0; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card-wide { max-width: 500px; }
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo svg { display: inline-block; }
.auth-logo h1 { margin: 12px 0 4px; letter-spacing: -0.02em; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.auth-lang { text-align: center; margin-top: 18px; display: flex; justify-content: center; gap: 6px; }
.auth-lang .lang-btn { border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); }

/* ============ Timeline & definition list ============ */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: 12px; font-weight: 500; padding: 4px 0; }
.dl dd { margin: 0; padding: 4px 0; color: var(--text); font-weight: 500; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--border); margin-left: 8px; }
.timeline li:last-child { border-left-color: transparent; }
.t-dot { position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; background: var(--primary); border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.t-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.t-head .muted { font-size: 12px; }
.details-pre { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: auto; }

/* ============ Cost analysis range bar ============ */
.range-bar { position: relative; height: 20px; background: #f1f5f9; border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.range-target { position: absolute; top: 0; height: 100%; background: rgba(5,150,105,.18); }
.range-actual { position: absolute; top: 0; left: 0; height: 100%; border-radius: 999px; }
.range-actual--in  { background: var(--success); }
.range-actual--out { background: var(--danger); }

/* ============ Print ============ */
.print-header { display: none; }
.print-only   { display: none; }

@media print {
    @page { margin: 14mm 12mm; size: A4 landscape; }

    .sidebar, .topbar, .period-picker, .print-hide,
    .flash, .page-actions { display: none !important; }

    .print-header { display: block; margin-bottom: 18px; border-bottom: 2px solid #0f172a; padding-bottom: 12px; }
    .print-header-top { display: flex; justify-content: space-between; align-items: flex-start; }
    .print-brand { font-size: 20px; font-weight: 800; color: #0f172a; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
    .print-title { font-size: 15px; font-weight: 600; color: #475569; margin-top: 2px; }
    .print-meta { font-size: 11px; color: #475569; text-align: right; line-height: 1.7; }
    .print-meta strong { color: #0f172a; }

    .app   { display: block; }
    .main  { display: block; }
    .content { padding: 0; max-width: 100%; width: 100%; }

    body, html { background: #fff !important; font-size: 11px; color: #0f172a; }
    h1 { font-size: 16px; }
    h3 { font-size: 12px; }

    .card { box-shadow: none !important; border: 1px solid #d1d5db; break-inside: avoid; margin-bottom: 12px; padding: 12px; }
    .card-body.p-0 { margin: -12px; }

    .stats-grid { grid-template-columns: repeat(5, 1fr) !important; gap: 8px; }
    .stat-card  { box-shadow: none !important; border: 1px solid #d1d5db; padding: 10px; }
    .stat-icon  { width: 32px; height: 32px; font-size: 14px; }
    .stat-value { font-size: 14px; }

    .grid-2 { grid-template-columns: 1fr 1fr; gap: 10px; }

    .table th, .table td { padding: 6px 8px; font-size: 10px; }
    .range-bar { height: 14px; }

    canvas { max-height: 220px !important; }

    .page-head h1 { margin: 0 0 12px; }
}

/* ============ Modal ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 16px 20px 20px; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }

/* ============ Utility ============ */
.muted       { color: var(--muted); }
.empty       { color: var(--muted); font-style: italic; padding: 24px; text-align: center; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.actions     { display: flex; gap: 4px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.actions form { margin: 0; }

hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
