/* ==========================================================================
   Kalvyai ERP — design tokens
   ========================================================================== */
:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --accent: #06b6d4;

    --success: #10b981;
    --success-600: #059669;
    --danger: #ef4444;
    --danger-600: #dc2626;
    --warning: #f59e0b;

    --sidebar-w: 260px;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, .05), 0 10px 24px -6px rgba(15, 23, 42, .08);
    --shadow-lg: 0 20px 40px -12px rgba(79, 70, 229, .25);
    --gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 45%, #06b6d4 100%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 14px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.inline { display: inline; }
.icon { flex-shrink: 0; vertical-align: middle; }

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

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    color: #cbd5e1;
    padding: 20px 14px;
    transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; color: #fff; }
.brand:hover { color: #fff; }
.logo {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
    background: var(--gradient); color: #fff; font-weight: 800; font-size: 19px;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .45);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; letter-spacing: -.01em; }
.brand-text small { color: #a5b4fc; font-size: 11.5px; margin-top: 2px; }

.side-nav { flex: 1; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 14px 12px 6px; font-weight: 600; }
.side-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: #cbd5e1; font-weight: 500;
    transition: background .15s, color .15s;
}
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.active {
    background: rgba(99, 102, 241, .22); color: #fff;
    box-shadow: inset 3px 0 0 #818cf8;
}
.side-nav a.active .icon { color: #a5b4fc; }

.side-user {
    display: flex; align-items: center; gap: 10px;
    padding: 12px; margin-top: 12px;
    background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); border-radius: 12px;
}
.side-user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.side-user-info strong { color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-info small { color: #94a3b8; font-size: 12px; }
.side-user .icon-btn { color: #94a3b8; }
.side-user .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 16px;
    height: 64px; padding: 0 28px;
    background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-date { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.menu-toggle { display: none; }

.icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
    border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.timer-pill {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 6px 5px 14px; border-radius: 999px;
    background: #ecfdf5; border: 1px solid #a7f3d0;
    max-width: 520px;
}
.timer-task { color: #065f46; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.timer-pill .live-timer { color: #047857; }
.timer-stop {
    display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    border: 0; background: var(--danger); color: #fff; cursor: pointer;
    box-shadow: 0 4px 10px rgba(239, 68, 68, .35);
}
.timer-stop:hover { background: var(--danger-600); }
.timer-idle { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

.live-timer { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-weight: 700; font-variant-numeric: tabular-nums; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--success); flex-shrink: 0; animation: pulse 1.6s infinite; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.content { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px; }
.site-footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 6px 28px 24px; }
.sidebar-backdrop { display: none; }

/* ==========================================================================
   Page header
   ========================================================================== */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .subtitle { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }

/* ==========================================================================
   Cards, grids, stats
   ========================================================================== */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 18px 20px 0; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.mb { margin-bottom: 20px; }

.stat {
    display: flex; align-items: center; gap: 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.tone-indigo { background: #eef2ff; color: #4f46e5; }
.tone-cyan   { background: #ecfeff; color: #0891b2; }
.tone-green  { background: #ecfdf5; color: #059669; }
.tone-amber  { background: #fffbeb; color: #d97706; }
.tone-rose   { background: #fff1f2; color: #e11d48; }
.tone-violet { background: #f5f3ff; color: #7c3aed; }

/* Welcome banner */
.hero {
    position: relative; overflow: hidden;
    display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
    padding: 26px 28px; margin-bottom: 22px; border-radius: 18px;
    background: var(--gradient); color: #fff; box-shadow: var(--shadow-lg);
}
.hero::after {
    content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}
.hero h1 { color: #fff; font-size: 26px; }
.hero p { margin: 6px 0 0; color: rgba(255, 255, 255, .85); }
.hero .btn { position: relative; z-index: 1; }

/* ==========================================================================
   Avatars
   ========================================================================== */
.avatar {
    width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
    color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.c0 { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.avatar.c1 { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.avatar.c2 { background: linear-gradient(135deg, #10b981, #059669); }
.avatar.c3 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.avatar.c4 { background: linear-gradient(135deg, #ec4899, #db2777); }
.avatar.c5 { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.avatar.c6 { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.avatar.c7 { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.avatar-none { background: #e2e8f0; color: #64748b; }
.person { display: inline-flex; align-items: center; gap: 8px; }

/* ==========================================================================
   Employee cards (manager task overview)
   ========================================================================== */
.emp-card {
    display: block; color: inherit;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.emp-card:hover { color: inherit; transform: translateY(-3px); box-shadow: var(--shadow); border-color: #c7d2fe; }
.emp-card .head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.emp-card .name { font-weight: 650; font-size: 15px; }
.emp-card .arrow { margin-left: auto; color: var(--border-strong); transition: color .15s, transform .15s; }
.emp-card:hover .arrow { color: var(--primary); transform: translateX(3px); }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-stats div { background: var(--surface-2); border-radius: 10px; padding: 8px; text-align: center; }
.mini-stats b { display: block; font-size: 17px; font-weight: 700; }
.mini-stats span { font-size: 11px; color: var(--muted); }
.emp-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--muted); }
.working { display: inline-flex; align-items: center; gap: 6px; color: var(--success-600); font-weight: 600; max-width: 60%; }
.working span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Project cards
   ========================================================================== */
.project-card {
    display: flex; flex-direction: column; gap: 16px; color: inherit;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.project-card:hover { color: inherit; transform: translateY(-3px); box-shadow: var(--shadow); border-color: #c7d2fe; }
.pc-head { display: flex; align-items: flex-start; gap: 12px; }
.pc-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px; flex-shrink: 0; }
.pc-title { flex: 1; min-width: 0; }
.pc-name { font-weight: 650; font-size: 15.5px; line-height: 1.3; }
.pc-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 12.5px; }
.pc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.pc-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.progress-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.progress-row b { color: var(--text); }

.c-bg0 { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.c-bg1 { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.c-bg2 { background: linear-gradient(135deg, #10b981, #059669); }
.c-bg3 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.c-bg4 { background: linear-gradient(135deg, #ec4899, #db2777); }
.c-bg5 { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.c-bg6 { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.c-bg7 { background: linear-gradient(135deg, #14b8a6, #0d9488); }

/* ==========================================================================
   Kanban board
   ========================================================================== */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 6px; }
.column { background: #eef1f7; border-radius: var(--radius); padding: 12px; min-height: 140px; }
.column-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; font-weight: 650; }
.column-head .count { background: #fff; color: var(--muted); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.column-head .dot { margin-right: 8px; }
.kcard {
    display: block; color: inherit; background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px;
    border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s;
}
.kcard:hover { color: inherit; box-shadow: var(--shadow); transform: translateY(-2px); }
.kcard-title { font-weight: 600; margin-bottom: 10px; line-height: 1.35; }
.kcard-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.kcard-meta span { display: inline-flex; align-items: center; gap: 4px; }
.kcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.kcard.running { border-color: #6ee7b7; box-shadow: 0 0 0 3px rgba(16, 185, 129, .12); }
.column-empty { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 0; }
.text-danger { color: var(--danger-600) !important; font-weight: 600; }

.view-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.view-toggle a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 13px; }
.view-toggle a.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
    font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); background: var(--surface-2);
}
th:first-child { border-top-left-radius: 10px; }
th:last-child { border-top-right-radius: 10px; }
tbody tr, table tr { transition: background .1s; }
tr:hover td { background: #fafbff; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.task-title { font-weight: 600; color: var(--text); }
.task-title:hover { color: var(--primary); }
.sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.sub:hover { color: var(--primary); }
.kv-table td { padding: 10px 4px; }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap; letter-spacing: .01em;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: #e0f2fe; color: #0369a1; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #ffe4e6; color: #be123c; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.dot-gray, .progress span.dot-gray { background: #94a3b8; }
.dot-blue, .progress span.dot-blue { background: #0ea5e9; }
.dot-green, .progress span.dot-green { background: #22c55e; }
.dot-red, .progress span.dot-red { background: #f43f5e; }
.dot-orange, .progress span.dot-orange { background: #f97316; }
.dot-purple, .progress span.dot-purple { background: #8b5cf6; }

/* ==========================================================================
   Status bar (Odoo style arrows)
   ========================================================================== */
.statebar-wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.statebar { display: flex; flex-wrap: wrap; filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .06)); }
.statebar form { margin: 0 0 0 -8px; }
.statebar form:first-child { margin-left: 0; }
.statebar button {
    position: relative; border: 0; background: #fff; color: var(--muted);
    padding: 9px 22px 9px 26px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
    background-clip: padding-box;
    box-shadow: inset 0 0 0 1px var(--border);
    transition: background .15s, color .15s;
}
.statebar form:first-child button { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 10px 0 0 10px; padding-left: 18px; }
.statebar button:not(.current):not(:disabled):hover { background: var(--primary-50); color: var(--primary); }
.statebar button.current { background: var(--gradient); color: #fff; cursor: default; }
.statebar button:disabled:not(.current) { cursor: not-allowed; opacity: .55; }
.statebar button { background-color: #f1f5f9; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
    background: var(--primary); color: #fff; font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; white-space: nowrap; line-height: 1.2;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .12);
    transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--primary-600); color: #fff; box-shadow: 0 6px 14px -4px rgba(79, 70, 229, .5); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-light { background: #fff; color: var(--text-2); border-color: var(--border); }
.btn-light:hover { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-ghost-white { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .3); }
.btn-ghost-white:hover { background: rgba(255, 255, 255, .28); box-shadow: none; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-600); box-shadow: 0 6px 14px -4px rgba(239, 68, 68, .5); }
.btn-success { background: var(--success); }
.btn-success:hover { background: var(--success-600); box-shadow: 0 6px 14px -4px rgba(16, 185, 129, .5); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Round play/stop button in task lists */
.play-btn {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
    border: 0; cursor: pointer; color: #fff; background: var(--success);
    box-shadow: 0 4px 10px -2px rgba(16, 185, 129, .5); transition: transform .1s, background .15s;
}
.play-btn:hover { background: var(--success-600); transform: scale(1.06); }
.play-btn.stop { background: var(--danger); box-shadow: 0 4px 10px -2px rgba(239, 68, 68, .5); }
.play-btn.stop:hover { background: var(--danger-600); }

/* Timer panel on task page */
.timer-panel {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    padding: 18px 20px; border-radius: var(--radius); margin-bottom: 20px;
    background: linear-gradient(135deg, #f8fafc, #eef2ff); border: 1px solid #e0e7ff;
}
.timer-panel.running { background: linear-gradient(135deg, #ecfdf5, #f0fdfa); border-color: #a7f3d0; }
.timer-panel .big-time { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.timer-panel .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.timer-panel form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.timer-panel input[type=text] { width: 280px; max-width: 100%; }

.timer-hint { flex-basis: 100%; display: flex; align-items: center; gap: 8px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 500; }

/* ==========================================================================
   Comments & followers
   ========================================================================== */
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.comments { display: flex; flex-direction: column; gap: 14px; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 10px 14px; }
.comment.mine .comment-body { background: var(--primary-50); border-color: var(--primary-100); }
.comment-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; flex-wrap: wrap; }
.comment-text { white-space: pre-wrap; word-wrap: break-word; color: var(--text-2); }
.comment-form { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.comment-form textarea { min-height: 64px; flex: 1; }

/* ==========================================================================
   Forms
   ========================================================================== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=datetime-local], select, textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border-strong); border-radius: 10px;
    font: inherit; color: var(--text); background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
textarea { min-height: 110px; resize: vertical; }
.form-actions { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 170px; flex: 0 1 220px; }
.form-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 14px; }

/* ==========================================================================
   Alerts, details, misc
   ========================================================================== */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; border: 1px solid; font-weight: 500;
}
.alert .icon { margin-top: 1px; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.details { display: grid; grid-template-columns: 150px 1fr; gap: 12px 16px; margin: 0; }
.details dt { color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.details dd { margin: 0; font-weight: 500; }
.desc { white-space: pre-wrap; font-weight: 400 !important; color: var(--text-2); }

.progress { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; min-width: 80px; }
.progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #10b981, #06b6d4); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .icon { color: var(--border-strong); margin-bottom: 8px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 13px; font-weight: 500; }
.chip:hover { border-color: #c7d2fe; color: var(--primary); }
.chip b { color: var(--text); }
.chip.active { background: var(--primary-50); border-color: #c7d2fe; color: var(--primary); }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-item .row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar-item .row span:last-child { font-weight: 600; }

/* ==========================================================================
   Auth pages (login / setup)
   ========================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.auth-brand {
    position: relative; overflow: hidden; color: #fff;
    display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
    background: radial-gradient(circle at 20% 20%, rgba(6, 182, 212, .35), transparent 45%),
                radial-gradient(circle at 80% 80%, rgba(139, 92, 246, .45), transparent 45%),
                linear-gradient(135deg, #1e1b4b, #312e81 50%, #4338ca);
}
.auth-brand::before {
    content: ""; position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 40px 40px; mask-image: linear-gradient(180deg, #000, transparent);
}
.auth-brand > * { position: relative; }
.auth-logo { display: flex; align-items: center; gap: 14px; }
.auth-logo .logo { width: 48px; height: 48px; font-size: 22px; border-radius: 14px; }
.auth-logo strong { display: block; font-size: 20px; }
.auth-logo small { color: #c7d2fe; }
.auth-brand h2 { font-size: 36px; line-height: 1.15; letter-spacing: -.03em; font-weight: 800; margin: 0 0 14px; max-width: 460px; }
.auth-brand p { color: #c7d2fe; font-size: 15px; max-width: 440px; margin: 0; }
.auth-features { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-features li { display: flex; align-items: center; gap: 12px; color: #e0e7ff; }
.auth-features .icon-wrap { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 28px; }
.auth-card .lead { color: var(--muted); margin: 6px 0 26px; }
.auth-card .field { margin-bottom: 16px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 40px; height: 46px; }
.auth-card .btn { width: 100%; height: 46px; margin-top: 8px; font-size: 15px; }
.auth-foot { margin-top: 28px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* Simple centred box (setup page) */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, rgba(6, 182, 212, .3), transparent 45%), linear-gradient(135deg, #1e1b4b, #4338ca); }
.login-box { width: 100%; max-width: 420px; background: #fff; padding: 32px; border-radius: 20px; box-shadow: 0 30px 60px rgba(0, 0, 0, .3); }
.login-box ul { padding-left: 18px; color: var(--text-2); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.login-brand .logo { width: 48px; height: 48px; font-size: 22px; }
.login-brand h1 { font-size: 20px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
    .split { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); box-shadow: 20px 0 40px rgba(0, 0, 0, .3); }
    .nav-open .sidebar { transform: none; }
    .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-grid; }
    .auth { grid-template-columns: 1fr; }
    .auth-brand { padding: 32px 24px; }
    .auth-brand h2 { font-size: 26px; }
    .auth-features { display: none; }
}
@media (max-width: 640px) {
    .content { padding: 18px 16px; }
    .topbar { padding: 0 16px; gap: 10px; }
    .topbar-date { display: none; }
    .timer-task { max-width: 110px; }
    .details { grid-template-columns: 1fr; gap: 4px 0; }
    .details dd { margin-bottom: 8px; }
    .hero { padding: 22px; }
    h1 { font-size: 21px; }
}
