/* =====================================================================
   Easy Tasks — portal styles
   Light, refined indigo accent, deep-navy sidebar.
   --brand = fill color (button/active, always safe with white text)
   --accent = text/icon/link color
   ===================================================================== */

:root {
    color-scheme: light;        /* native selects, date pickers, scrollbars */
    --brand:        #4f46e5;    /* indigo-600 — fills */
    --brand-dark:   #4338ca;    /* hover */
    --brand-soft:   #eef2ff;    /* tints (pills, icon badges) */
    --accent:       #4f46e5;    /* text / links / icons */
    --accent-ink:   #ffffff;    /* text on brand fills */
    --accent-glow:  0 6px 20px -8px rgba(79,70,229,.45);

    --bg:        #f5f7fb;
    --card:      #ffffff;
    --surface-2: #f1f4fa;
    --border:    #e4e9f2;
    --border-2:  #eef1f7;

    --ink:    #0f172a;   /* primary text */
    --ink-2:  #475569;   /* secondary */
    --muted:  #64748b;   /* tertiary / labels */

    --ok:        #16a34a; --ok-soft:     #dcfce7;
    --warn:      #b45309; --warn-soft:   #fef3c7;
    --danger:    #dc2626; --danger-soft: #fee2e2;
    --purple:    #7c3aed; --purple-soft: #f3e8ff;

    /* Sidebar — deep navy, indigo brand accent */
    --side-bg:         #111b32;
    --side-bg-2:       #0a0f1c;
    --side-ink:        #97a3b6;
    --side-ink-strong: #ffffff;
    --side-active-bg:  rgba(255,255,255,.14);
    --side-hover:      rgba(255,255,255,.06);
    --side-border:     rgba(255,255,255,.08);

    --radius: 14px;
    --shadow: 0 1px 2px rgba(16,24,40,.04), 0 10px 26px -14px rgba(16,24,40,.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.4px; }
h2 { font-size: 16px; margin: 0 0 14px; letter-spacing: -.2px; }
.muted { color: var(--muted); }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 244px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
    color: var(--side-ink);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    border-right: 1px solid var(--side-border);
    transition: width .2s ease;
}
.sidebar-toggle-btn {
    position: absolute; top: 30px; right: -13px;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--card); color: var(--ink-2);
    border: 1px solid var(--border); box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; z-index: 5;
}
.sidebar-toggle-btn svg { width: 13px; height: 13px; transition: transform .2s ease; }
.sidebar-toggle-btn:hover { color: var(--accent); }
html.sidebar-collapsed .sidebar-toggle-btn svg { transform: rotate(180deg); }

/* ---------- Collapsed sidebar (icon rail) ---------- */
html.sidebar-collapsed .sidebar { width: 78px; }
html.sidebar-collapsed .logo { justify-content: center; padding-left: 8px; padding-right: 8px; }
html.sidebar-collapsed .logo-text,
html.sidebar-collapsed .nav-item span:not(.nav-ico),
html.sidebar-collapsed .nav-sep,
html.sidebar-collapsed .sidebar-logout span,
html.sidebar-collapsed .sidebar-version { display: none; }
html.sidebar-collapsed .nav-item { justify-content: center; padding-left: 10px; padding-right: 10px; }
html.sidebar-collapsed .sidebar-logout { padding-left: 10px; padding-right: 10px; }
.logo {
    display: flex; align-items: center; gap: 12px;
    padding: 26px 20px 18px;
}
.logo-mark {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--brand-dark));
    color: var(--accent-ink); display: grid; place-items: center;
    font-weight: 800; font-size: 13px; letter-spacing: .5px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.logo-mark.lg { width: 54px; height: 54px; font-size: 18px; border-radius: 50%; }
.logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.logo-text strong { color: var(--side-ink-strong); font-size: 16px; letter-spacing: -.2px; }
.logo-text span { font-size: 10px; color: var(--side-ink); opacity: .75; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; margin-top: 1px; }

.nav { padding: 10px 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.nav-item {
    display: flex; align-items: center; gap: 13px;
    padding: 12px 16px; border-radius: 14px;
    color: var(--side-ink); font-weight: 600; font-size: 13.5px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--side-hover); color: var(--side-ink-strong); text-decoration: none; }
.nav-item.active {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: var(--side-ink-strong);
    box-shadow: 0 6px 16px -6px rgba(79,70,229,.8), inset 0 1px 0 rgba(255,255,255,.14);
}
.nav-ico {
    width: 18px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    color: inherit; opacity: .9;
}
.nav-ico svg { width: 17px; height: 17px; }
.nav-sep {
    display: flex; align-items: center; gap: 8px;
    font-size: 10px; text-transform: uppercase; letter-spacing: 1.3px;
    color: var(--side-ink); opacity: .6; padding: 18px 16px 6px; font-weight: 700;
}
.nav-sep::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.08); }
.sidebar-foot { padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 9px; }
.sidebar-logout {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; padding: 12px 16px; border-radius: 999px;
    background: var(--side-ink-strong); color: var(--side-bg-2);
    font-weight: 700; font-size: 13.5px;
    box-shadow: 0 8px 20px -8px rgba(0,0,0,.45);
    transition: transform .12s, box-shadow .12s;
}
.sidebar-logout:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 10px 22px -8px rgba(0,0,0,.5); }
.sidebar-logout svg { width: 16px; height: 16px; }
.sidebar-version { display: block; text-align: center; font-size: 10.5px; color: var(--side-ink); opacity: .55; font-weight: 600; }

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

.topbar {
    height: 66px; background: color-mix(in srgb, var(--card) 60%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 10;
}
.search { flex: 1; max-width: 520px; position: relative; }
.search input {
    width: 100%; padding: 11px 16px 11px 40px;
    border: 1px solid var(--border); border-radius: 11px;
    background: var(--card); color: var(--ink); font-size: 13px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--brand-soft); }
.search::before {
    content: ""; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px; opacity: .5;
    background: currentColor; color: var(--muted);
    -webkit-mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
}

.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--ink-2); cursor: pointer;
    display: grid; place-items: center; position: relative; transition: all .12s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--card); }
.topbar-divider { width: 1px; height: 28px; background: var(--border); margin: 0 6px; }

.dropdown-wrap { position: relative; }
.dropdown-panel {
    position: absolute; top: calc(100% + 10px); right: 0; width: 340px; max-width: calc(100vw - 32px); max-height: 400px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); z-index: 30; overflow: hidden; flex-direction: column;
}
.dropdown-panel[hidden] { display: none; }
.dropdown-panel:not([hidden]) { display: flex; }
.dropdown-head { padding: 12px 16px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--border-2); }
.dropdown-body { overflow-y: auto; max-height: 340px; }
.dropdown-empty { padding: 16px; margin: 0; font-size: 13px; }
.dropdown-item {
    display: flex; flex-direction: column; gap: 3px; padding: 11px 16px;
    border-bottom: 1px solid var(--border-2); font-size: 12.5px; color: var(--ink);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item-type { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; color: var(--accent); }

.user-chip {
    display: flex; align-items: center; gap: 10px; background: none; border: none;
    padding: 4px; border-radius: 12px; cursor: pointer; font: inherit; transition: background .12s;
}
.user-chip:hover { background: var(--surface-2); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-meta strong { font-size: 13px; }
.user-meta small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }

.profile-body { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.profile-name { font-weight: 700; font-size: 14px; }
.profile-email { font-size: 12.5px; }
.profile-roles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.profile-signout { margin-top: 14px; align-self: flex-start; }
.profile-bypass-note { font-size: 11.5px; margin: 12px 0 0; }
.avatar {
    width: 40px; height: 40px; border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--brand-dark));
    color: var(--accent-ink); display: grid; place-items: center; font-weight: 800;
}

.content { padding: 28px 32px 80px; width: 100%; max-width: 100%; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 + p, .page-head .muted { font-size: 14px; }
.page-head-actions { display: flex; gap: 10px; }

/* ---------- Cards ---------- */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px 24px;
    box-shadow: var(--shadow); margin-bottom: 20px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 22px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi-tile { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; color: inherit; transition: border-color .12s, transform .12s; }
.kpi-tile:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.kpi-num { font-size: 24px; font-weight: 800; letter-spacing: -.5px; color: var(--accent); }
.kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.stat-card {
    display: block; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
    position: relative; overflow: hidden; color: inherit; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.stat-card::after { content:""; position:absolute; inset:0 0 auto auto; width:120px; height:120px;
    background: radial-gradient(circle at top right, var(--brand-soft), transparent 70%); pointer-events:none; }
a.stat-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 14px -6px rgba(79,70,229,.35), var(--shadow); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.stat-ico {
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
    background: var(--brand-soft); color: var(--accent);
}
.stat-ico svg { width: 22px; height: 22px; }
.stat-ico.ok { background: var(--ok-soft); color: var(--ok); }
.stat-ico.warn { background: var(--warn-soft); color: var(--warn); }
.stat-ico.danger { background: var(--danger-soft); color: var(--danger); }
.stat-ico.purple { background: var(--purple-soft); color: var(--purple); }
.stat-pill { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); }
.stat-pill.up { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.stat-pill.down { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.stat-pill.live { color: var(--ok); background: var(--ok-soft); border-color: transparent; display: inline-flex; align-items: center; gap: 5px; }
.stat-pill.live::before { content:""; width:7px; height:7px; border-radius:50%; background: var(--ok); }
.stat-num { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.stat-label { color: var(--muted); font-size: 11px; margin-top: 8px; text-transform: uppercase; letter-spacing: .7px; font-weight: 700; }

/* ---------- Bars ---------- */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 34px; align-items: center; gap: 12px; }
.bar-label { font-size: 12.5px; color: var(--ink-2); }
.bar-track { background: var(--surface-2); border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-dark), var(--accent)); border-radius: 6px; }
.bar-val { text-align: right; font-weight: 700; font-size: 12.5px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border-2); }
.list li:last-child { border-bottom: none; }
.list li[onclick] { cursor: pointer; border-radius: 8px; margin: 0 -8px; padding: 12px 8px; }
.list li[onclick]:hover { background: var(--surface-2); }
.list li[onclick] a { position: relative; z-index: 1; }
.task-key { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 11.5px; color: var(--accent); font-weight: 700; margin-right: 8px; }

/* ---------- Pills / badges ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--accent); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--surface-2); color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 12px 13px; text-align: left; border-bottom: 1px solid var(--border-2); }
table.data th { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: var(--surface-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 17px; border-radius: 10px; font-weight: 700; font-size: 13px; border: 1px solid transparent; cursor: pointer; background: none; transition: all .12s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: var(--accent-ink); box-shadow: var(--accent-glow); }
.btn-primary:hover { background: var(--brand-dark); color: var(--accent-ink); }
.btn-outline { border-color: var(--border); color: var(--ink-2); background: var(--card); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; }

/* Floating action button */
.fab {
    position: fixed; right: 30px; bottom: 30px; z-index: 20;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--brand); color: var(--accent-ink); border: none; cursor: pointer;
    display: grid; place-items: center; box-shadow: var(--accent-glow);
    transition: transform .12s;
}
.fab:hover { transform: translateY(-2px) scale(1.03); }
.fab svg { width: 24px; height: 24px; }

/* Toast notifications (live hand-off alerts, top-right) */
#toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.toast-item {
    display: block; background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--accent);
    border-radius: 10px; box-shadow: var(--shadow); padding: 12px 14px; font-size: 12.5px; color: var(--ink);
    animation: toast-in .25s ease-out;
}
.toast-item:hover { text-decoration: none; border-color: var(--accent); }
.toast-item strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); margin-bottom: 3px; }
.toast-item.toast-out { animation: toast-out .3s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(24px); } }

/* ---------- Forms ---------- */
.form label { display: block; margin-bottom: 15px; }
.form label > span { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.form input[type=text], .form input[type=email], .form input[type=password],
.form input[type=date], .form input[type=number], .form select, .form textarea,
input.field, select.field, textarea.field {
    width: 100%; padding: 10px 13px; border: 1px solid var(--border);
    border-radius: 10px; font-size: 13px; font-family: inherit;
    background: var(--card); color: var(--ink);
}
.form textarea { min-height: 92px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus,
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* Native controls — keep readable in both themes */
select, select.field { color: var(--ink); background: var(--card); }
select option, select optgroup { background: var(--card); color: var(--ink); }
input[type=date] { color: var(--ink); }
input[type=file] { color: var(--ink-2); padding: 7px 10px; }
input[type=file]::file-selector-button,
input[type=file]::-webkit-file-upload-button {
    background: var(--brand-soft); color: var(--accent);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 6px 12px; margin-right: 12px; cursor: pointer; font-weight: 600;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; font-weight: 600; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--brand-soft); color: var(--accent); }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; background: var(--bg); }
.auth-page { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100vh; }
@media (max-width: 860px) { .auth-page { grid-template-columns: 1fr; } .auth-hero { display: none; } }

.auth-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(160deg, var(--side-bg) 0%, var(--side-bg-2) 65%, #171034 100%);
    color: #fff; padding: 48px 56px; display: flex; flex-direction: column;
}
.auth-hero-glow {
    position: absolute; top: -140px; right: -120px; width: 420px; height: 420px; border-radius: 50%;
    background: radial-gradient(circle, rgba(129,140,248,.35), transparent 70%); pointer-events: none;
}
.auth-hero-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-hero-org { font-size: 11px; font-weight: 800; letter-spacing: 1.6px; color: #b3aed0; text-transform: uppercase; }
.auth-wordmark {
    font-size: 56px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.02;
    margin: 40px 0 18px; position: relative; z-index: 1;
}
.auth-wordmark span { display: block; background: linear-gradient(90deg, #a5b4fc, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero-tag { font-size: 15px; line-height: 1.6; color: #cbd2e8; max-width: 380px; position: relative; z-index: 1; }
.auth-flow { display: flex; align-items: center; gap: 10px; margin-top: 28px; flex-wrap: wrap; position: relative; z-index: 1; }
.auth-flow-step { font-size: 12px; font-weight: 700; padding: 7px 14px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); }
.auth-flow-arrow { width: 14px; height: 14px; color: #8b93b8; flex-shrink: 0; }
.auth-illustration { width: 100%; max-width: 440px; margin-top: auto; align-self: center; position: relative; z-index: 1; }

.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 400px; max-width: 100%; }
.auth-card-head { margin-bottom: 22px; }
.auth-card-head h2 { font-size: 24px; margin-bottom: 4px; letter-spacing: -.3px; }
.auth-form label { display: block; margin-bottom: 15px; }
.auth-form label span { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; color: var(--ink-2); }
.auth-form input { width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; background: var(--card); color: var(--ink); }
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth-foot { text-align: center; font-size: 12px; margin-top: 20px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 64px 20px; }
.empty-code { font-size: 56px; font-weight: 800; color: var(--accent); opacity: .35; }
.empty-state h1 { margin: 8px 0; }

/* ---------- Misc ---------- */
code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin: 22px 0 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.card-head h2 { margin: 0; }

/* ---------------------------------------------------------------- rich text editor */
.rte { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.rte:focus-within { border-color: #2f6fed; box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.rte-bar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
           padding: 6px 8px; background: #f7f9fc; border-bottom: 1px solid var(--border); }
.rte-btn { min-width: 28px; height: 28px; padding: 0 7px; font-size: 12.5px; line-height: 1;
           background: transparent; border: 1px solid transparent; border-radius: 6px;
           cursor: pointer; color: #3c4658; }
.rte-btn:hover { background: #e6ecf6; border-color: #d3ddec; }
.rte-btn:active { background: #d8e3f5; }
.rte-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.rte-area { min-height: 130px; max-height: 460px; overflow-y: auto; padding: 11px 13px;
            font-size: 14px; line-height: 1.6; outline: none; }
.rte-area:empty::before { content: attr(data-placeholder); color: #9aa4b5; }
.rte-area p { margin: 0 0 9px; }
.rte-area p:last-child { margin-bottom: 0; }
.rte-area ul, .rte-area ol { margin: 0 0 9px; padding-left: 22px; }
.rte-area h3 { font-size: 15.5px; margin: 12px 0 7px; }
.rte-area blockquote { margin: 0 0 9px; padding: 5px 0 5px 12px; border-left: 3px solid var(--border); color: #55607a; }
.rte-area pre { background: #f4f6fa; border-radius: 7px; padding: 9px 11px; overflow-x: auto;
                font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; margin: 0 0 9px; }
.rte-area code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.rte-area a { color: #2f6fed; }
.rte-hidden { display: none !important; }
/* Rendered rich text outside the editor */
.rich-content { font-size: 14px; line-height: 1.65; }
.rich-content p { margin: 0 0 9px; }
.rich-content p:last-child { margin-bottom: 0; }
.rich-content ul, .rich-content ol { margin: 0 0 9px; padding-left: 22px; }
.rich-content h3, .rich-content h4 { margin: 13px 0 7px; font-size: 15px; }
.rich-content blockquote { margin: 0 0 9px; padding: 5px 0 5px 12px; border-left: 3px solid var(--border); color: #55607a; }
.rich-content pre { background: #f4f6fa; border-radius: 7px; padding: 9px 11px; overflow-x: auto; font-size: 12.5px; }
.rich-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---------------------------------------------------------------- dashboards */
.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 4px 0 20px; }
.kpi-tile { display: flex; flex-direction: column; gap: 4px; padding: 15px 17px; background: #fff;
            border: 1px solid var(--border); border-left: 3px solid #d6dde8; border-radius: 11px;
            text-decoration: none; color: inherit; transition: border-color .12s, transform .12s; }
a.kpi-tile:hover { border-color: #b9cbea; border-left-color: #2f6fed; transform: translateY(-1px); }
.kpi-tile.wide { grid-column: span 2; }
.kpi-tile.is-bad { border-left-color: #d93a2b; }
.kpi-tile.is-warn { border-left-color: #e08a00; }
.kpi-tile.is-good { border-left-color: #1a9d54; }
.kt-v { font-size: 25px; font-weight: 700; line-height: 1.05; letter-spacing: -.02em; }
.kt-l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 20px; align-items: start; }
.dash-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; margin-bottom: 20px; align-items: start; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center;
           text-decoration: none; color: inherit; padding: 2px 0; }
a.bar-row:hover .bar-lbl { color: #2f6fed; }
.bar-lbl { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: #eef1f6; border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #4f86f2, #2f6fed); border-radius: 5px; min-width: 2px; }
.bar-fill.alt { background: linear-gradient(90deg, #8b7ef0, #6d5de0); }
.bar-num { font-size: 12.5px; font-weight: 600; min-width: 30px; text-align: right; }
.bar-num em { font-style: normal; font-weight: 500; font-size: 11px; }
.lnk { font-size: 12.5px; color: #2f6fed; text-decoration: none; }
.lnk:hover { text-decoration: underline; }
.table.compact td, .table.compact th { padding: 7px 10px; font-size: 12.5px; }
.bad { color: #b3261e; }
.good { color: #1a7f43; }

/* Whole-row click targets (task list, dashboards) */
.table.row-link tbody tr { cursor: pointer; }
.table.row-link tbody tr:hover { background: #f6f9ff; }

/* ---------------------------------------------------------------- filter panel */
.filters { border: 1px solid var(--border); border-radius: 12px; background: #fff; margin-bottom: 18px; overflow: hidden; }
.filters-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.filters-search { position: relative; flex: 1; min-width: 220px; }
.filters-search input { width: 100%; padding-left: 34px; }
.filters-search::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
                          font-size: 15px; color: #98a2b3; pointer-events: none; }
.filters-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer;
                  padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #3c4658; }
.filters-toggle:hover { border-color: #b9cbea; }
.filters-toggle .cnt { background: #2f6fed; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.filters-body { display: none; padding: 4px 14px 14px; border-top: 1px solid var(--border); }
.filters.is-open .filters-body { display: block; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px 14px; padding-top: 12px; }
.ff { display: flex; flex-direction: column; gap: 5px; }
.ff > span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ff select, .ff input { width: 100%; }
.filters-foot { display: flex; align-items: center; gap: 12px; padding-top: 13px; margin-top: 13px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.filters-foot .grow { flex: 1; }
.chipbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 11px;
           border: 1px solid var(--border); border-radius: 20px; cursor: pointer; background: #fff; }
.chipbox:hover { border-color: #b9cbea; }
.chipbox input { margin: 0; }
.chipbox.on { background: #eaf1ff; border-color: #2f6fed; color: #1c4fbd; font-weight: 600; }
.active-chips { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 0 14px 12px; }
.active-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px;
               background: #eef2f8; border-radius: 20px; color: #3c4658; }
.active-chip a { color: #8592a8; text-decoration: none; font-weight: 700; }
.active-chip a:hover { color: #b3261e; }

/* ---------------------------------------------------------------- detail tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none;
       border-bottom: 2px solid transparent; white-space: nowrap; background: none; border-top: none;
       border-left: none; border-right: none; cursor: pointer; }
.tab:hover { color: #2f3b52; }
.tab.on { color: #2f6fed; border-bottom-color: #2f6fed; }
.tab .tab-n { display: inline-block; margin-left: 5px; background: #eef1f6; border-radius: 9px;
              padding: 0 6px; font-size: 11px; color: #55607a; }
.tab.on .tab-n { background: #dfe9ff; color: #1c4fbd; }
.tab-panel { display: none; }
.tab-panel.on { display: block; }
.parent-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- table base (unified)
   The previous style set a rule only for the legacy `table.data`; `.table` inherited body
   text at 14px but with cramped padding, so it read as small and airless on the list pages.
   The rules below apply to every list table (tasks, BRDs, dashboards). */
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th, table.table td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
table.table th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; background: #fafbfd; }
table.table tbody tr { transition: background .1s; }
table.table tbody tr:hover { background: var(--surface-2); }

/* Clickable column headers — the sort arrows the user asked for. */
th.sortable { cursor: pointer; user-select: none; }
th.sortable > a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; text-transform: inherit; letter-spacing: inherit; font-weight: inherit; }
th.sortable:hover > a { color: #2f6fed; }
th.sortable .arrow { font-size: 10px; opacity: .35; }
th.sortable.on .arrow { opacity: 1; color: #2f6fed; }
