:root {
    --ink: #0a0f1f;
    --ink-2: #060a15;
    --surface: #111b30;
    --surface-2: #16233d;
    --surface-3: #1c2c4a;
    --line: #223154;
    --accent: #3d6bff;
    --accent-soft: rgba(61, 107, 255, .16);
    --frost: #eef2ff;
    --muted: #8b95b3;
    --success: #2fd08a;
    --warning: #f5b84e;
    --danger: #ff6b6b;
}

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
    background:
        radial-gradient(1100px 500px at 85% -10%, rgba(61, 107, 255, .18), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(47, 208, 138, .08), transparent 60%),
        var(--ink);
    color: var(--frost);
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, .display-font {
    font-family: 'Sora', 'Inter', sans-serif;
    letter-spacing: -.01em;
}

.mono, .money, td.money {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */

.shell {
    display: flex;
    align-items: stretch;
    gap: 1.25rem;
    padding: 1.25rem;
    height: 100vh;
    overflow: hidden;
}

/* ---------- pill sidebar ---------- */

.pill-sidebar {
    width: 76px;
    flex: none;
    height: 100%;
    background: linear-gradient(180deg, var(--surface-2), var(--ink-2));
    border: 1px solid var(--line);
    border-radius: 999px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    gap: .35rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, .45);
}

.pill-sidebar .brand-dot {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 20px var(--accent-soft);
}

.pill-sidebar .nav-stack {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    flex: 1;
}

.pill-sidebar .nav-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}

.pill-sidebar .nav-icon:hover { color: var(--frost); background: rgba(255, 255, 255, .05); }

.pill-sidebar .nav-icon.active {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 8px 20px var(--accent-soft);
}

.pill-sidebar .nav-icon svg, .pill-sidebar .nav-icon i { width: 19px; height: 19px; font-size: 19px; }

/* ---------- content panel ---------- */

.content-panel {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    overflow: hidden;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.75rem;
    border-bottom: 1px solid var(--line);
    flex: none;
}

.content-inner {
    padding: 1.75rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* ---------- greeting ---------- */

.greeting-eyebrow {
    color: var(--accent);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.greeting-title { font-size: 1.9rem; font-weight: 700; margin: .15rem 0 .35rem; }
.greeting-sub { color: var(--muted); font-size: .92rem; }

/* ---------- stat cards ---------- */

.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1.15rem 1.3rem;
    height: 100%;
}

.stat-card .stat-icon {
    width: 38px; height: 38px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: .75rem;
}

.stat-card .stat-value { font-family: 'Sora', sans-serif; font-size: 1.5rem; font-weight: 700; }
.stat-card .stat-label { color: var(--muted); font-size: .82rem; }

/* ---------- value flow (signature element) ---------- */

.flow {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.flow-pill {
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .4rem .9rem;
    font-size: .82rem;
    display: flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
}

.flow-pill.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.flow-pill .flow-label { color: var(--muted); font-size: .72rem; }
.flow-pill.accent .flow-label { color: rgba(255, 255, 255, .75); }
.flow-arrow { color: var(--muted); }

/* ---------- panel card (tables etc) ---------- */

.panel-card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
}

.panel-card .panel-card-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ---------- tables ---------- */

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--frost);
    --bs-table-hover-bg: rgba(255, 255, 255, .03);
    margin-bottom: 0;
}

.table > thead {
    background: rgba(255, 255, 255, .02);
}

.table > thead th {
    color: var(--muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
    border-bottom: 1px solid var(--line);
    padding: .85rem 1.4rem;
}

.table > tbody td {
    padding: .85rem 1.4rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

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

/* ---------- badges ---------- */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .65rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-badge.success { background: rgba(47, 208, 138, .14); color: var(--success); border-color: rgba(47, 208, 138, .3); }
.status-badge.warning { background: rgba(245, 184, 78, .14); color: var(--warning); border-color: rgba(245, 184, 78, .3); }
.status-badge.info { background: var(--accent-soft); color: #93aeff; border-color: rgba(61, 107, 255, .3); }
.status-badge.danger { background: rgba(255, 107, 107, .14); color: var(--danger); border-color: rgba(255, 107, 107, .3); }
.status-badge.neutral { background: rgba(255, 255, 255, .06); color: var(--muted); border-color: var(--line); }

/* ---------- forms / buttons ---------- */

.form-control, .form-select {
    background: var(--surface-3);
    border: 1px solid var(--line);
    color: var(--frost);
}

.form-control:focus, .form-select:focus {
    background: var(--surface-3);
    color: var(--frost);
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem var(--accent-soft);
}

.form-select.status-select {
    background-color: var(--surface-3);
    border-radius: 999px;
    font-size: .78rem;
    padding-top: .3rem;
    padding-bottom: .3rem;
    width: auto;
}

.form-label { color: var(--muted); font-size: .82rem; font-weight: 500; }

.btn-accent {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
}

.btn-accent:hover { background: #2f5be0; color: #fff; }

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

/* ---------- misc ---------- */

.text-muted-soft { color: var(--muted) !important; }
.view-toggle {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .25rem;
    gap: .15rem;
}

.view-toggle a {
    padding: .4rem .9rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.view-toggle a.active { background: var(--accent); color: #fff; }

.kanban {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    align-items: flex-start;
}

.kanban-col {
    flex: 0 0 280px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: .85rem;
    min-height: 120px;
}

.kanban-col.drag-over { border-color: var(--accent); background: var(--accent-soft); }

.kanban-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
    padding: 0 .2rem;
}

.kanban-col-title { font-size: .82rem; font-weight: 600; }
.kanban-col-count {
    background: rgba(255, 255, 255, .08);
    color: var(--muted);
    border-radius: 999px;
    padding: .05rem .55rem;
    font-size: .72rem;
}

.kanban-card {
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .75rem .85rem;
    margin-bottom: .6rem;
    cursor: grab;
    transition: box-shadow .15s, transform .15s;
}

.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .4; }
.kanban-card:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, .3); }
.kanban-card.readonly { cursor: default; }

.kanban-card-title { font-weight: 600; font-size: .85rem; margin-bottom: .15rem; }
.kanban-card-sub { color: var(--muted); font-size: .74rem; margin-bottom: .5rem; }
.kanban-card-value { font-family: 'JetBrains Mono', monospace; font-size: .82rem; }

.search-box {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: .4rem .7rem;
    display: flex;
    align-items: center;
    gap: .55rem;
    flex: 1 1 0;
    min-width: 0;
    max-width: 420px;
    transition: border-color .15s;
}

.search-box:focus-within { border-color: var(--accent); }

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--frost);
    font-size: .85rem;
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
}

.search-box input::placeholder { color: var(--muted); }

.search-kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: .68rem;
    color: var(--muted);
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: .1rem .4rem;
    flex: none;
}

.notif-bell {
    position: relative;
    height: 38px;
    padding: 0 .55rem 0 .65rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: .35rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--muted);
    transition: background .15s, border-color .15s, color .15s;
}

.notif-bell:hover { background: var(--surface-3); border-color: var(--accent); color: var(--frost); }
.notif-bell[aria-expanded="true"] { border-color: var(--accent); color: var(--frost); }

.notif-caret { font-size: .65rem; }

.notif-dot {
    position: static;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: none;
}

.notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--surface);
}

.notif-panel {
    width: 340px;
    max-width: calc(100vw - 2rem);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0, 0, 0, .45);
}

.notif-panel-header {
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-panel-header .title { font-weight: 600; font-size: .85rem; }
.notif-panel-header .count { color: var(--muted); font-size: .74rem; }

.notif-list { max-height: 320px; overflow-y: auto; padding: .4rem; }

.notif-item {
    display: flex;
    gap: .7rem;
    padding: .65rem .7rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--frost);
    transition: background .15s;
}

.notif-item:hover { background: var(--surface-3); color: var(--frost); }

.notif-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    font-size: .85rem;
}

.notif-item-title { font-size: .82rem; font-weight: 500; margin-bottom: .1rem; }
.notif-item-sub { font-size: .74rem; color: var(--muted); }

.notif-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--muted);
}

.notif-empty i { font-size: 1.6rem; opacity: .5; display: block; margin-bottom: .5rem; }
.notif-empty span { font-size: .82rem; }

.alert-panel {
    display: flex;
    gap: .8rem;
    padding: .9rem 1.1rem;
    border-radius: 14px;
    border: 1px solid;
    margin-bottom: 1.25rem;
    animation: alert-in .2s ease-out;
}

@keyframes alert-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-panel-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    font-size: 1rem;
}

.alert-panel-title { font-weight: 600; font-size: .88rem; margin-bottom: .15rem; }
.alert-panel-body { font-size: .84rem; }
.alert-panel-body ul { margin: 0; padding-left: 1.1rem; }
.alert-panel-body li + li { margin-top: .15rem; }

.alert-panel.success { background: rgba(47, 208, 138, .1); border-color: rgba(47, 208, 138, .3); }
.alert-panel.success .alert-panel-icon { background: rgba(47, 208, 138, .18); color: var(--success); }
.alert-panel.success .alert-panel-title { color: var(--success); }

.alert-panel.danger { background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .3); }
.alert-panel.danger .alert-panel-icon { background: rgba(255, 107, 107, .18); color: var(--danger); }
.alert-panel.danger .alert-panel-title { color: var(--danger); }

.alert-panel.warning { background: rgba(245, 184, 78, .1); border-color: rgba(245, 184, 78, .3); }
.alert-panel.warning .alert-panel-icon { background: rgba(245, 184, 78, .18); color: var(--warning); }
.alert-panel.warning .alert-panel-title { color: var(--warning); }

.alert-panel.info { background: var(--accent-soft); border-color: rgba(61, 107, 255, .3); }
.alert-panel.info .alert-panel-icon { background: rgba(61, 107, 255, .18); color: var(--accent); }
.alert-panel.info .alert-panel-title { color: #93aeff; }

.alert-panel-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    align-self: flex-start;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: .55rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: .25rem .6rem .25rem .25rem;
    transition: background .15s, border-color .15s;
}

.user-menu-toggle:hover { background: var(--surface-2); border-color: var(--line); }
.user-menu-toggle[aria-expanded="true"] { background: var(--surface-2); border-color: var(--accent); }

.user-menu-panel {
    min-width: 200px;
    max-width: calc(100vw - 2rem);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .4rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, .45);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .55rem .7rem;
    border-radius: 10px;
    border: none;
    background: none;
    color: var(--frost);
    font-size: .84rem;
    text-align: left;
    text-decoration: none;
}

.user-menu-item:hover { background: var(--surface-3); color: var(--frost); }
.user-menu-item.danger { color: var(--danger); }
.user-menu-item.danger:hover { background: rgba(255, 107, 107, .12); }

.avatar-chip {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .8rem;
}

/* ---------- mobile tab bar (replaces pill sidebar under 768px) ---------- */

.mobile-tabbar { display: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 767.98px) {
    .pill-sidebar { display: none; }

    .shell { padding: .6rem; gap: 0; }

    .content-panel { border-radius: 18px; }

    .content-inner { padding-bottom: 6rem; }

    .mobile-tabbar {
        display: flex;
        position: fixed;
        left: .75rem;
        right: .75rem;
        bottom: .75rem;
        z-index: 40;
        justify-content: space-around;
        align-items: center;
        gap: .25rem;
        padding: .5rem;
        background: linear-gradient(180deg, var(--surface-2), var(--ink-2));
        border: 1px solid var(--line);
        border-radius: 999px;
        box-shadow: 0 20px 44px rgba(0, 0, 0, .5);
    }

    .mobile-tab {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--muted);
        text-decoration: none;
    }

    .mobile-tab.active { color: #fff; background: var(--accent); box-shadow: 0 8px 20px var(--accent-soft); }
    .mobile-tab svg, .mobile-tab i { width: 19px; height: 19px; font-size: 19px; }
}

@media (max-width: 575.98px) {
    .content-inner { padding: 1rem; padding-bottom: 6rem; }
    .greeting-title { font-size: 1.5rem; }
    .card-surface.p-4 { padding: 1.15rem !important; }

    .topbar { padding: .75rem .9rem; gap: .5rem; }
    .search-box { max-width: none; padding: .35rem .6rem; }
    .search-kbd { display: none; }

    .view-toggle { flex-wrap: wrap; justify-content: center; }
    .view-toggle a { padding: .35rem .55rem; font-size: .74rem; }

    .kanban-col { flex-basis: 240px; }

    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.3rem; }

    .flow { gap: .35rem; }
    .flow-pill { padding: .3rem .65rem; font-size: .76rem; }
}
