/* ==========================================================================
   IT Asset & Technology Lifecycle Management — design system
   Enterprise / IT-operations visual language. Vanilla CSS, no framework.
   ========================================================================== */

:root {
    --sidebar-w: 264px;
    --topbar-h: 60px;

    --slate-950: #0b1220;
    --slate-900: #0f172a;
    --slate-850: #131c31;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --white: #ffffff;

    --blue-700: #1d4ed8;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --blue-50: #eff6ff;

    --green-600: #16a34a;
    --green-100: #dcfce7;
    --green-50: #f0fdf4;
    --amber-600: #d97706;
    --amber-100: #fef3c7;
    --amber-50: #fffbeb;
    --red-600: #dc2626;
    --red-100: #fee2e2;
    --red-50: #fef2f2;
    --violet-600: #7c3aed;
    --violet-100: #ede9fe;

    --bg: var(--slate-100);
    --panel: var(--white);
    --border: var(--slate-200);
    --text: var(--slate-800);
    --text-strong: var(--slate-900);
    --muted: var(--slate-500);

    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, .08);
    --shadow-lg: 0 18px 48px rgba(15, 23, 42, .16);

    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

    --transition: 150ms ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font: inherit; }
table { border-collapse: collapse; width: 100%; }

::selection { background: var(--blue-100); }

:focus-visible {
    outline: 2px solid var(--blue-500);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(380px, 46%) 1fr;
    background: var(--white);
}

.login-brand {
    position: relative;
    background:
        radial-gradient(1000px 500px at -10% -10%, rgba(59, 130, 246, .22), transparent 60%),
        radial-gradient(800px 600px at 110% 110%, rgba(124, 58, 237, .18), transparent 55%),
        linear-gradient(160deg, var(--slate-950), var(--slate-900) 55%, #12203b);
    color: var(--slate-300);
    padding: 56px 52px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
.login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .07) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(120% 90% at 30% 20%, #000 30%, transparent 75%);
    pointer-events: none;
}
.login-brand > * { position: relative; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .3px;
}
.brand-mark svg { flex: none; }

.login-brand .brand-alm {
    margin: 12px 0 0;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--slate-500);
}


.login-headline {
    margin-top: auto;
    padding-top: 64px;
}
.login-headline .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--blue-500);
}
.login-headline h1 {
    margin-top: 18px;
    font-size: clamp(28px, 3vw, 40px);
    line-height: 1.15;
    font-weight: 750;
    letter-spacing: -.02em;
    color: var(--white);
    max-width: 15ch;
}
.login-headline p {
    margin-top: 16px;
    max-width: 46ch;
    color: var(--slate-400);
    font-size: 15px;
}

.brand-features {
    margin-top: 34px;
    display: grid;
    gap: 12px;
    list-style: none;
    padding: 0;
}
.brand-features li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13.5px;
    color: var(--slate-400);
}
.brand-features li::before {
    content: "";
    flex: none;
    width: 7px; height: 7px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--blue-500);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, .18);
}

.login-foot {
    font-size: 12.5px;
    color: var(--slate-500);
    margin-top: 48px;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: var(--slate-50);
}
.login-card {
    width: 100%;
    max-width: 400px;
}
.login-card h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text-strong);
}
.login-card .sub {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}
.login-form { margin-top: 28px; display: grid; gap: 18px; }

/* Auth views swap in place (sign in <-> sign up) with a small entrance animation */
.login-card .auth-view.is-entering { animation: authViewIn .28s ease both; }
@keyframes authViewIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .login-card .auth-view.is-entering { animation: none; }
}

.login-card .login-signup {
    margin-top: 20px;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
}
.login-card .login-signup a { font-weight: 600; }
.login-card .signup-panel { text-align: left; }
.login-card .signup-panel .register-form { margin-top: 20px; }
.login-card .signup-panel .form-grid { grid-template-columns: 1fr; gap: 14px; }
.login-card .signup-panel .form-actions {
    margin-top: 18px;
    padding-top: 0;
    border-top: 0;
}
.login-card .signup-back { margin-top: 16px; text-align: center; font-size: 14px; }
.login-card .signup-back a { font-weight: 600; }
.login-card .legal {
    margin-top: 22px;
    font-size: 12.5px;
    color: var(--slate-400);
    text-align: center;
}

@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-brand { padding: 36px 28px; min-height: auto; }
    .login-headline { padding-top: 34px; }
    .login-headline h1 { font-size: 26px; }
    .brand-features { display: none; }
    .login-foot { margin-top: 28px; }
    .login-panel { padding: 34px 22px; }
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--slate-950), var(--slate-900) 30%, var(--slate-900));
    color: var(--slate-400);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(15, 23, 42, .6);
    z-index: 40;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--slate-800); border-radius: 8px; }

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px 20px 16px;
    color: var(--white);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .2px;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}
.sidebar .brand small {
    display: block;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--slate-500);
    margin-top: 1px;
}

.nav { padding: 14px 12px; flex: 1; }
.nav-section {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--slate-600);
    padding: 16px 10px 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--slate-400);
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.nav-item svg { flex: none; opacity: .85; }
.nav-item:hover { background: rgba(148, 163, 184, .1); color: var(--slate-200); text-decoration: none; }
.nav-item.active {
    background: rgba(37, 99, 235, .18);
    color: #dbeafe;
    box-shadow: inset 2px 0 0 var(--blue-500);
}
.nav-item.soon {
    opacity: .5;
    cursor: default;
    pointer-events: none;
}
.nav-item .chip {
    margin-left: auto;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--slate-500);
    background: rgba(148, 163, 184, .12);
    border: 1px solid rgba(148, 163, 184, .18);
    padding: 1px 6px;
    border-radius: 20px;
}
.nav-item.active .chip { color: var(--blue-100); }

.sidebar .side-foot {
    padding: 14px 18px;
    border-top: 1px solid rgba(148, 163, 184, .12);
    font-size: 11.5px;
    color: var(--slate-600);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar .crumbs {
    font-size: 13px;
    color: var(--muted);
}
.topbar .crumbs strong { color: var(--text-strong); font-weight: 600; }
.topbar .spacer { flex: 1; }

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
    cursor: pointer;
    color: var(--text);
}

.user-menu { position: relative; }
.user-menu summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--slate-50); border-color: var(--border); }
.avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-600), var(--violet-600));
    color: var(--white);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
}
.user-meta { line-height: 1.2; }
.user-meta .name { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.user-meta .role { font-size: 11px; color: var(--muted); }
.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 240px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 50;
}
.user-dropdown .dd-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.user-dropdown .dd-head .name { font-weight: 600; font-size: 13.5px; color: var(--text-strong); }
.user-dropdown .dd-head .email { font-size: 12px; color: var(--muted); word-break: break-all; }
.user-dropdown a, .user-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    font-size: 13.5px;
    color: var(--text);
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--slate-100); text-decoration: none; }
.user-dropdown button.danger { color: var(--red-600); }

.content { padding: 24px 32px 48px; width: 100%; box-sizing: border-box; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-head h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.015em;
    color: var(--text-strong);
}
.page-head .desc { margin-top: 4px; color: var(--muted); font-size: 13.5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Flash / toasts ---------- */
.flash-stack {
    position: fixed;
    top: 74px;
    right: 24px;
    display: grid;
    gap: 10px;
    z-index: 90;
    max-width: min(420px, calc(100vw - 48px));
}
.flash {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--slate-400);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px 14px;
    font-size: 13.5px;
    animation: flash-in .18s ease;
}
.flash.success { border-left-color: var(--green-600); }
.flash.error { border-left-color: var(--red-600); }
.flash.warning { border-left-color: var(--amber-600); }
.flash.info { border-left-color: var(--blue-600); }
.flash .x {
    margin-left: auto;
    background: none;
    border: 0;
    color: var(--slate-400);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Panels & KPI ---------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 14.5px; font-weight: 650; color: var(--text-strong); }
.panel-head .hint { font-size: 12.5px; color: var(--muted); }
.panel-body { padding: 24px; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.kpi::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--blue-500);
    opacity: .9;
}
.kpi.green::after { background: var(--green-600); }
.kpi.amber::after { background: var(--amber-600); }
.kpi.violet::after { background: var(--violet-600); }
.kpi.slate::after { background: var(--slate-400); }
.kpi .label {
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.kpi .value {
    margin-top: 8px;
    font-size: 30px;
    font-weight: 750;
    letter-spacing: -.02em;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.kpi .meta { margin-top: 6px; font-size: 12.5px; color: var(--muted); }

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 24px;
}
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table th, .table td {
    text-align: left;
    padding: 12px 18px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table thead th {
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--slate-50);
    white-space: nowrap;
    position: sticky;
    top: 0;
    padding: 12px 18px;
}
.table tbody tr:hover { background: var(--slate-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.mono, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 650;
    padding: 3px 9px;
    border-radius: 20px;
    background: var(--slate-100);
    color: var(--slate-600);
    border: 1px solid var(--slate-200);
    white-space: nowrap;
}
.badge.blue { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-100); }
.badge.green { background: var(--green-50); color: var(--green-600); border-color: var(--green-100); }
.badge.amber { background: var(--amber-50); color: var(--amber-600); border-color: var(--amber-100); }
.badge.red { background: var(--red-50); color: var(--red-600); border-color: var(--red-100); }
.badge.violet { background: #f5f3ff; color: var(--violet-600); border-color: var(--violet-100); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
}
.btn:hover { background: var(--slate-50); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary {
    background: var(--blue-600);
    border-color: var(--blue-600);
    color: var(--white);
    box-shadow: 0 1px 2px rgba(37, 99, 235, .35);
}
.btn-primary:hover { background: var(--blue-700); border-color: var(--blue-700); }
.btn-block { width: 100%; }
.btn-lg { padding: 11px 18px; font-size: 14.5px; }
.btn-danger { background: var(--red-600); border-color: var(--red-600); color: var(--white); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--slate-100); }

/* ---------- Forms ---------- */
.form-row { display: grid; align-content: start; gap: 6px; }
.form-row + .form-row { margin-top: 16px; }
.label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    min-height: 20px;
    line-height: 20px;
    display: inline-flex;
    align-items: center;
}
.label .req { color: var(--red-600); margin-left: 2px; }
.input, .select, .textarea {
    width: 100%;
    padding: 10px 14px;
    font: inherit;
    font-size: 14px;
    color: var(--text-strong);
    background: var(--white);
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--slate-400); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}
.input::placeholder { color: var(--slate-400); }
.input-icon { position: relative; }
.input-icon .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate-400);
    pointer-events: none;
    display: flex;
}
.input-icon .input { padding-left: 38px; }
.input-icon .toggle-pw {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    color: var(--slate-400);
    cursor: pointer;
    padding: 4px;
    display: flex;
}
.hint { font-size: 12.5px; color: var(--muted); }
.form-error { font-size: 12.5px; color: var(--red-600); }

/* ---------- Empty state ---------- */
.empty {
    text-align: center;
    padding: 44px 24px;
    color: var(--muted);
}
.empty .icon {
    width: 52px; height: 52px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: var(--slate-100);
    border: 1px dashed var(--slate-300);
    display: grid;
    place-items: center;
    color: var(--slate-400);
}
.empty h3 { font-size: 15px; font-weight: 650; color: var(--text-strong); }
.empty p { margin-top: 6px; font-size: 13.5px; max-width: 46ch; margin-inline: auto; }
.empty .btn { margin-top: 16px; }

/* ---------- Error page ---------- */
.error-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--slate-100);
    padding: 24px;
}
.error-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 40px 44px;
    max-width: 480px;
    text-align: center;
}
.error-card .code {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--text-strong);
    line-height: 1;
}
.error-card h1 { margin-top: 14px; font-size: 18px; font-weight: 700; color: var(--text-strong); }
.error-card p { margin-top: 8px; color: var(--muted); font-size: 14px; }
.error-card .ref { margin-top: 18px; font-size: 12px; color: var(--slate-400); font-family: var(--mono); }
.error-card .btn { margin-top: 22px; }

/* ---------- Pending-module notice ---------- */
.notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--amber-50);
    border: 1px solid var(--amber-100);
    border-radius: var(--radius);
    padding: 13px 16px;
    font-size: 13.5px;
    color: #92400e;
    margin-bottom: 20px;
}
.notice strong { font-weight: 700; }

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt-0 { margin-top: 0; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none !important; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.avatar-sm {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--slate-200);
    color: var(--slate-600);
    display: inline-grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: none; }
    .menu-toggle { display: inline-flex; }
    .content { padding: 20px 16px 40px; }
    .topbar { padding: 0 14px; }
    .user-meta { display: none; }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .45);
        z-index: 35;
    }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---------- Master data (Phase 4) ---------- */
.mono, code.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}
.btn-sm { padding: 4px 9px; font-size: 12.5px; line-height: 1.4; }
.badge.slate { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 20px;
    flex-wrap: wrap;
}
.toolbar > form,
.search-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.toolbar > form .input,
.search-form .input {
    width: 220px;
    max-width: 100%;
    flex: 0 1 auto;
}
.toolbar > form input[type="date"],
.search-form input[type="date"] {
    width: 145px;
    max-width: 100%;
    flex: 0 1 auto;
}
.toolbar > form .select,
.toolbar > form select,
.search-form .select,
.search-form select {
    width: auto;
    min-width: 130px;
    max-width: 180px;
    flex: 0 1 auto;
}
.toolbar > form .check-line,
.search-form .check-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    cursor: pointer;
    margin: 0 4px;
    flex: none;
}
.toolbar > form .btn,
.search-form .btn {
    flex: none;
    white-space: nowrap;
}

.dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
    background: var(--slate-400);
}

.row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.row-actions form { display: inline; margin: 0; }

.tree-cell { display: inline-block; }
.tree-branch { color: var(--slate-400); margin-right: 6px; }
.tree-cell a { font-weight: 600; color: var(--text-strong); }
.tree-cell a:hover { color: var(--blue-600); }

.form-card { width: 100%; box-sizing: border-box; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px 24px;
    align-items: start;
}
.form-grid .form-row + .form-row { margin-top: 0; }

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 8px;
}
.check-row input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--blue-600); }
.check-row .hint { display: block; margin-top: 2px; }

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--slate-200);
    flex-wrap: wrap;
}

.stack { display: flex; flex-direction: column; gap: 12px; }

.badge.ok { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.badge.muted { background: var(--slate-100); color: var(--slate-500); border-color: var(--slate-200); }

.notice-warning { border-color: var(--amber-300); background: var(--amber-50); color: var(--amber-900); }

.kv { margin: 0; display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 0; }
.kv > div {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    padding: 9px 0;
    border-bottom: 1px solid var(--slate-100);
}
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--slate-500); font-size: 13px; }
.kv dd { margin: 0; color: var(--text-strong); font-weight: 500; word-break: break-word; }
@media (max-width: 620px) {
    .kv { grid-template-columns: 1fr; }
    .kv > div { display: block; }
    .kv dd { margin-top: 2px; }
}

.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--slate-200); }
.tl > li { position: relative; padding-left: 26px; padding-bottom: 16px; }
.tl > li:last-child { padding-bottom: 0; }
.tl-dot {
    position: absolute; left: 0; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--blue-600); border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--blue-100);
}
.tl > li:first-child .tl-dot { background: var(--green-600); box-shadow: 0 0 0 2px var(--green-200); }
.tl-title { font-weight: 600; color: var(--text-strong); }
.tl-reason { margin-top: 2px; font-size: 13px; color: var(--text); }

.check-stack { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 8px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check-line input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--blue-600); }

/* Toggle switch — prominent on/off control for boolean settings. */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; width: max-content; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.switch .switch-track {
    position: relative; flex: none;
    width: 50px; height: 28px; border-radius: 999px;
    background: var(--slate-300);
    transition: background var(--transition);
}
.switch .switch-track::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--white); box-shadow: var(--shadow-sm);
    transition: transform var(--transition);
}
.switch input:checked + .switch-track { background: var(--green-600); }
.switch input:checked + .switch-track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--blue-100); }
.switch .switch-on,
.switch .switch-off { font-size: 13.5px; font-weight: 600; }
.switch .switch-on { display: none; color: var(--green-600); }
.switch .switch-off { display: inline; color: var(--slate-500); }
.switch input:checked ~ .switch-on { display: inline; }
.switch input:checked ~ .switch-off { display: none; }
.switch .switch-label { font-size: 12.5px; font-weight: 600; color: var(--slate-600); }

/* Compact variant + top-bar quick-toggle placement */
.switch-sm { gap: 8px; }
.switch-sm .switch-track { width: 40px; height: 22px; }
.switch-sm .switch-track::after { width: 16px; height: 16px; top: 3px; left: 3px; }
.switch-sm input:checked + .switch-track::after { transform: translateX(18px); }

.topbar-signup { position: relative; display: flex; align-items: center; }
.topbar-signup .switch {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.topbar-signup .switch:hover { background: var(--slate-50); }
.topbar-signup .switch-status {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 9px;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    z-index: 40;
}
.topbar-signup .switch-status:not(:empty) { opacity: 1; }
@media (max-width: 720px) { .topbar-signup .switch-label { display: none; } }

.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--slate-200); }

/* ==========================================================================
   PROCUREMENT & SUPPLIERS (Phase 6)
   ========================================================================== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--slate-200);
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.tab {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tab:hover { color: var(--text-strong); text-decoration: none; }
.tab.active { color: var(--blue-700); border-bottom-color: var(--blue-600); }

.badge.warn { background: var(--amber-50); color: var(--amber-600); border-color: var(--amber-100); }
.badge.danger { background: var(--red-50); color: var(--red-600); border-color: var(--red-100); }

.input-sm { padding: 6px 9px; font-size: 13px; }

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.stat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
}
.stat-label {
    display: block;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.stat-value {
    display: block;
    margin-top: 8px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
}

.totals {
    margin-left: auto;
    max-width: 320px;
    padding: 14px 18px 4px;
    display: grid;
    gap: 8px;
}
.totals-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 13.5px;
    color: var(--text);
}
.totals-line .label { font-size: 13px; }
.totals-line .input-sm { width: 110px; }
.totals-grand {
    border-top: 1px solid var(--slate-200);
    padding-top: 8px;
    font-weight: 700;
    color: var(--text-strong);
    font-size: 14.5px;
}

.register-asset { margin-top: 6px; }
.register-asset summary {
    cursor: pointer;
    font-size: 12.5px;
    color: var(--blue-600);
    font-weight: 600;
}
.register-asset summary:hover { text-decoration: underline; }

/* ==========================================================================
   PHASE 13 — QR codes, labels, scanner & public quick view
   ========================================================================== */

/* ---------- Table selection column (bulk label export) ---------- */
.table th.check,
.table td.check { width: 36px; text-align: center; }
.check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue-600); vertical-align: middle; }

/* ---------- QR panel on the asset detail page ---------- */
.qr-panel-body { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.qr-preview svg { width: 160px; height: 160px; display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.qr-details { flex: 1; min-width: 240px; display: grid; gap: 10px; }
.qr-url { word-break: break-all; font-size: 12.5px; color: var(--slate-600); }
.qr-details .row-actions { justify-content: flex-start; }

/* ---------- Printable label (single + A4 sheet) ---------- */
.print-body { background: var(--slate-100); margin: 0; }
.print-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 20px; background: var(--white); border-bottom: 1px solid var(--border);
}
.print-toolbar .hint { display: block; margin-top: 2px; }
.print-toolbar-actions { display: flex; gap: 8px; }
.print-body .label-sheet,
.print-body .label-sheet-single {
    background: var(--white); margin: 18px auto; padding: 10mm;
    max-width: 210mm; box-shadow: var(--shadow-sm);
}
.label-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8mm; }
.label-sheet-single { display: block; }
.asset-label {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border: 1px solid var(--slate-300); border-radius: 6px; padding: 10px 12px;
    background: var(--white); break-inside: avoid; page-break-inside: avoid;
}
.al-body { min-width: 0; display: grid; gap: 2px; }
.al-inst { font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--slate-500); }
.al-name { font-size: 13.5px; font-weight: 700; color: var(--slate-900); }
.al-meta { font-size: 12px; color: var(--slate-700); }
.al-url { font-size: 9.5px; color: var(--slate-500); word-break: break-all; }
.al-qr { flex: 0 0 auto; }
.al-qr img { display: block; width: 110px; height: 110px; }

@page { size: A4; margin: 8mm; }
@media print {
    :root { --shadow-sm: none; --shadow-md: none; }
    body { background: #fff; }
    .no-print { display: none !important; }
    .print-body .label-sheet,
    .print-body .label-sheet-single { margin: 0; padding: 0; max-width: none; box-shadow: none; }
    .asset-label { border-color: #94a3b8; }
}
@media (max-width: 620px) {
    .label-sheet { grid-template-columns: 1fr; }
}

/* ---------- Public quick view shell ---------- */
.public-body { background: var(--slate-100); min-height: 100vh; display: flex; flex-direction: column; }
.public-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 20px; background: var(--white); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.public-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text-strong); }
.public-brand:hover { text-decoration: none; }
.public-head-actions { display: flex; gap: 8px; }
.public-main { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 20px; display: grid; gap: 16px; align-content: start; }
.public-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 20px; color: var(--muted); font-size: 12.5px;
    border-top: 1px solid var(--border); background: var(--white);
}

/* ---------- Quick view content ---------- */
.qv-card .qv-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 18px; border-bottom: 1px solid var(--border);
}
.qv-inst { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.qv-head h1 { font-size: 20px; margin-top: 2px; }
.qv-cta { margin-top: 14px; display: grid; gap: 10px; justify-items: start; }
.qv-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.qv-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.qv-docs li { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.qv-qr { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.qv-qr-img svg { width: 168px; height: 168px; display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.qv-section .table-wrap { margin: 0; }

/* ---------- Camera scanner ---------- */
.scan-stage {
    position: relative; width: 100%; max-width: 480px; aspect-ratio: 4 / 3;
    background: var(--slate-950); border-radius: var(--radius); overflow: hidden;
    margin: 0 auto 12px;
}
#qr-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
    position: absolute; inset: 12%; border: 3px solid rgba(255, 255, 255, .85);
    border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); pointer-events: none;
}
#qr-scanner .hint { display: block; margin-top: 8px; }
.scan-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.scan-recent li { display: flex; gap: 10px; align-items: baseline; }
.scan-recent li a { min-width: 130px; }
.scan-recent li span { color: var(--text); }

/* ---------- Notifications (Phase 14 — ) ---------- */
.badge.teal { background: #ecfeff; color: #0e7490; border-color: #cffafe; }

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--slate-600);
    cursor: pointer;
}
.icon-btn:hover { background: var(--slate-50); color: var(--text-strong); text-decoration: none; }
.icon-btn .bell-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--red-600);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    border-radius: 20px;
    border: 2px solid var(--white);
}

.notif-title { font-weight: 650; color: var(--text-strong); }
.notif-msg { color: var(--slate-600); font-size: 12.5px; margin-top: 3px; }
.notif-cat { display: inline-flex; align-items: center; gap: 6px; color: var(--slate-600); }
.notif-cat svg { opacity: .8; }
.dot.read { background: var(--slate-300); }
.dot.unread { background: var(--blue-600); }
tr.is-unread { background: var(--blue-50); }
tr.is-unread .notif-title { font-weight: 700; }

.rule-desc { color: var(--slate-600); font-size: 12.5px; margin-top: 2px; }
.rule-sub { display: grid; gap: 6px; justify-items: end; text-align: right; }
.rule-channels { display: inline-flex; gap: 14px; align-items: center; }
.rule-channels label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--slate-600); }
.rule-channels input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--blue-600); }

.mail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.mail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.queue-error { color: var(--red-600); font-size: 12px; }
.smtp-status { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }


/* ==========================================================================
   PHASE 15 — Reports
   ========================================================================== */

/* ---------- Report directory ---------- */
.report-group { margin-top: 22px; }
.report-group-title {
    font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted); margin: 0 0 10px;
}
.report-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.report-card {
    display: grid; gap: 6px; align-content: start;
    padding: 16px 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}
.report-card:hover {
    text-decoration: none;
    border-color: var(--blue-500);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.report-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.report-card-name { font-weight: 650; color: var(--text-strong); }
.report-card-desc { font-size: 12.5px; color: var(--slate-600); }

/* ---------- Filter toolbar ---------- */
.report-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    width: 100%;
}
.field-inline { display: grid; gap: 5px; flex: 0 1 auto; }
.field-inline .field-label {
    font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted);
}
.field-inline .input { width: 180px; max-width: 100%; }
.field-inline input[type="date"] { width: 140px; }
.field-inline .select,
.field-inline select {
    width: auto;
    min-width: 130px;
    max-width: 180px;
}
.field-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 2px; flex: none; }

/* ---------- Summary strip ---------- */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin: 16px 0;
}

/* ---------- Report table ---------- */
.table-report { white-space: nowrap; }
.table-report td { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Printable report sheet ---------- */
.report-sheet {
    background: var(--white);
    margin: 18px auto;
    padding: 14mm;
    max-width: 297mm;
    box-shadow: var(--shadow-sm);
}
.report-sheet-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
    padding-bottom: 12px; margin-bottom: 14px; border-bottom: 2px solid var(--slate-300);
}
.report-sheet-inst { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate-500); }
.report-sheet-title { font-size: 20px; margin: 3px 0 2px; color: var(--slate-900); }
.report-sheet-sub { font-size: 12px; color: var(--slate-600); margin: 0; }
.report-sheet-meta { text-align: right; font-size: 11.5px; color: var(--slate-600); line-height: 1.5; }
.report-sheet-filters { font-size: 12px; color: var(--slate-700); margin-bottom: 10px; }
.report-sheet-table { width: 100%; font-size: 11.5px; }
.report-sheet-table th,
.report-sheet-table td { padding: 6px 8px; border-bottom: 1px solid var(--slate-200); }
.report-sheet-foot {
    margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--slate-200);
    font-size: 10.5px; color: var(--slate-500); text-align: center;
}

@media print {
    .print-toolbar { display: none !important; }
    .report-sheet { margin: 0; padding: 0; max-width: none; box-shadow: none; }
    .report-sheet-table { font-size: 10px; }
    .report-sheet-table thead { display: table-header-group; }
    .report-sheet-table tr { break-inside: avoid; page-break-inside: avoid; }
}

/* ---------- Dashboard & intelligence (Phase 16 — ) ---------- */
.kpi.red::after { background: var(--red-600); }
.kpi.teal::after { background: #0d9488; }

a.kpi.kpi-click { display: block; color: inherit; text-decoration: none; transition: var(--transition); }
a.kpi.kpi-click:hover { border-color: var(--blue-500); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.dash-cols {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 16px;
    align-items: start;
}
@media (max-width: 1180px) { .dash-cols { grid-template-columns: 1fr; } }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.dash-side { display: grid; gap: 16px; }

.chart-svg { width: 100%; height: auto; display: block; }
.chart-gridline { stroke: var(--slate-200); stroke-width: 1; }
.chart-axis { font-size: 10px; fill: var(--slate-500); }
.chart-value { font-size: 10px; fill: var(--slate-600); font-weight: 600; }
.chart-empty {
    display: flex; align-items: center; gap: 10px; justify-content: center;
    min-height: 150px; color: var(--muted); font-size: 13px;
    border: 1px dashed var(--border); border-radius: var(--radius-sm);
    background: var(--slate-50); padding: 12px;
}
.chart-empty svg { color: var(--slate-400); flex: none; }

.chart-hbar { display: grid; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 10px; }
.hbar-label { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 12px; background: var(--slate-100); border-radius: 20px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 20px; min-width: 2px; }
.hbar-value { font-size: 12.5px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.chart-donut { width: 150px; height: 150px; flex: none; }
.donut-total { font-size: 20px; font-weight: 700; fill: var(--text-strong); }
.donut-caption { font-size: 10px; fill: var(--slate-500); text-transform: uppercase; letter-spacing: .08em; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1; min-width: 160px; }
.donut-legend li { display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 8px; font-size: 12.5px; }
.donut-legend .dot { margin: 0; width: 10px; height: 10px; }
.legend-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.legend-pct { color: var(--muted); width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

.alert-priority { display: grid; gap: 8px; }
.alert-priority-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.alert-count { font-size: 18px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.alert-feed { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--border); display: grid; gap: 9px; }
.alert-feed li { display: flex; align-items: center; gap: 4px; font-size: 12.5px; }
.alert-feed a { color: var(--text); text-decoration: none; }
.alert-feed a:hover { color: var(--blue-600); text-decoration: underline; }
.alert-feed time { margin-left: auto; font-size: 11px; white-space: nowrap; }
.dot-critical { background: var(--red-600); }
.dot-high { background: var(--amber-600); }
.dot-medium { background: var(--blue-600); }
.dot-low { background: var(--slate-400); }
.dot-info { background: #0d9488; }

.stat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.stat-list a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px; text-decoration: none; border-bottom: 1px solid var(--border); }
.stat-list li:last-child a { border-bottom: 0; }
.stat-list a:hover { background: var(--slate-50); }
.stat-num { font-size: 16px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }

.insights { display: grid; gap: 8px; }
.insight {
    display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
    border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-sm);
    text-decoration: none; color: inherit; transition: var(--transition);
}
.insight:hover { background: var(--slate-50); }
.insight-body { display: grid; gap: 2px; font-size: 12.5px; line-height: 1.45; }
.insight-body strong { color: var(--text-strong); font-size: 12.5px; }
.insight-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--slate-400); }
.insight-red { border-left-color: var(--red-600); }
.insight-red .insight-dot { background: var(--red-600); }
.insight-amber { border-left-color: var(--amber-600); }
.insight-amber .insight-dot { background: var(--amber-600); }
.insight-blue { border-left-color: var(--blue-600); }
.insight-blue .insight-dot { background: var(--blue-600); }
.insight-green { border-left-color: var(--green-600); }
.insight-green .insight-dot { background: var(--green-600); }




/* ==========================================================================
   Quick-create dialog
   Progressive enhancement: every trigger is a real link to a real page, so
   the flow still works with JavaScript disabled or blocked.
   ========================================================================== */
.modal {
    width: min(720px, calc(100% - 32px));
    max-height: min(98vh, 900px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal[open] { display: flex; flex-direction: column; }

.modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    background: var(--panel); flex: none;
}
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 650; color: var(--text-strong); }

.modal-x {
    min-width: 36px; min-height: 36px;
    display: grid; place-items: center;
    border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--slate-500);
    font-size: 20px; line-height: 1; cursor: pointer;
}
.modal-x:hover { background: var(--slate-100); color: var(--text-strong); }

.modal-body { padding: 10px; overflow-y: auto; overscroll-behavior: contain; }
.modal-body .modal-card { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.modal-body .panel { margin: 0 0 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: none; }
.modal-body .panel-head { padding: 6px 10px; }
.modal-body .panel-head h2 { font-size: 13px; margin: 0; }
.modal-body .panel-body { padding: 8px 10px; }
.modal-body .form-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 8px; }
.modal-body .form-row { gap: 3px; }
.modal-body .form-row + .form-row { margin-top: 4px; }
.modal-body .input, .modal-body .select, .modal-body .textarea { padding: 5px 8px; font-size: 13px; }
.modal-body .label { font-size: 12px; min-height: 16px; line-height: 16px; }
.modal-body .form-actions { margin-top: 6px; }
.modal-body .hint { display: block; font-size: 11px; }

@media (max-width: 480px) {
    .modal {
        width: 100%; max-width: none;
        height: 100dvh; max-height: 100dvh;
        margin: 0; border: 0; border-radius: 0;
    }
    .modal-body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* Inline "+ New" trigger next to a form label. */
.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 20px;
    height: 20px;
    line-height: 20px;
}
.label-row .label {
    margin: 0;
    min-height: 20px;
    line-height: 20px;
}
.btn-mini {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 20px;
    min-height: 20px;
    max-height: 20px;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--slate-50);
    color: var(--blue-700);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    vertical-align: middle;
}
.btn-mini:hover {
    background: var(--blue-50);
    border-color: var(--blue-200);
    color: var(--blue-800);
}
.btn-mini:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 1px; }
