/* ==========================================================================
   HumanizeBot Agent — design system
   Hand-written so the app deploys without a Node build step.
   ========================================================================== */

:root {
    --brand: #4f46e5;
    --brand-600: #4338ca;
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --blue: #2563eb;
    --teal: #14b8a6;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #2563eb 55%, #14b8a6 100%);

    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e5e7ef;
    --border-strong: #d4d8e3;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;

    --green: #059669;   --green-bg: #ecfdf5;  --green-bd: #a7f3d0;
    --amber: #b45309;   --amber-bg: #fffbeb;  --amber-bd: #fde68a;
    --red: #dc2626;     --red-bg: #fef2f2;    --red-bd: #fecaca;
    --sky: #0369a1;     --sky-bg: #f0f9ff;    --sky-bd: #bae6fd;
    --violet: #7c3aed;  --violet-bg: #f5f3ff; --violet-bd: #ddd6fe;
    --tealc: #0f766e;   --teal-bg: #f0fdfa;   --teal-bd: #99f6e4;
    --slate: #475569;   --slate-bg: #f1f5f9;  --slate-bd: #e2e8f0;

    --sidebar: #0b1120;
    --sidebar-2: #131c31;
    --sidebar-text: #a5b0c6;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px -6px rgba(15, 23, 42, .08);
    --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .25);
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --font: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55;
    color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[x-cloak], [hidden] { display: none !important; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
    background: var(--sidebar); color: var(--sidebar-text);
    display: flex; flex-direction: column;
    transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px; height: var(--topbar-h); }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px; background: var(--gradient);
    display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 18px;
    box-shadow: 0 6px 16px -4px rgba(79, 70, 229, .6); flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { color: #fff; font-weight: 800; font-size: 16px; line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: #7c89a6; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; scrollbar-width: thin; scrollbar-color: #253048 transparent; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: #5b6784; padding: 16px 12px 6px; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 2px 0;
    border-radius: 10px; color: var(--sidebar-text); font-weight: 600; font-size: 14px;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--sidebar-2); color: #fff; }
.nav-link.active { background: linear-gradient(135deg, rgba(79,70,229,.95), rgba(37,99,235,.9)); color: #fff; box-shadow: 0 6px 18px -8px rgba(79,70,229,.9); }
.nav-link .count { margin-left: auto; background: #ef4444; color: #fff; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.nav-link.active .count { background: rgba(255,255,255,.25); }
.sidebar-foot { padding: 14px; border-top: 1px solid #1a2438; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.sidebar-user .name { color: #fff; font-weight: 700; font-size: 13.5px; line-height: 1.2; }
.sidebar-user .meta { font-size: 12px; color: #7c89a6; }
.sidebar-overlay { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
    display: flex; align-items: center; gap: 12px; padding: 0 28px;
    background: rgba(245, 246, 251, .85); backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar-title { font-weight: 800; font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn.menu-btn { display: none; }
.icon-btn {
    position: relative; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
    background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
    transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--brand); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); }
.clock-chip { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 40px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.content { flex: 1; padding: 8px 28px 40px; width: 100%; max-width: 1440px; }

.bottom-nav { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 12px 0 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 800; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2, .card-header h3 { font-size: 15.5px; font-weight: 800; }
.card-header .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 8px 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card + .card { margin-top: 20px; }
.grid > .card + .card, .stack > .card + .card { margin-top: 0; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid-main-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 28px; }
.mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 13px; } .xs { font-size: 12px; }
.bold { font-weight: 700; } .strong { font-weight: 800; }
.text-right { text-align: right; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-brand { color: var(--brand); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-line; }
.w-full { width: 100%; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); overflow: hidden; display: block; color: inherit; }
a.stat:hover { border-color: var(--brand-100); box-shadow: var(--shadow); color: inherit; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 10px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-foot { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.tone-brand { background: var(--brand-50); color: var(--brand); }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-sky { background: var(--sky-bg); color: var(--sky); }
.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tone-teal { background: var(--teal-bg); color: var(--tealc); }
.tone-slate { background: var(--slate-bg); color: var(--slate); }

/* ---------- Hero / attendance card ---------- */
.hero {
    position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; color: #fff;
    background: var(--gradient); box-shadow: 0 18px 40px -18px rgba(79, 70, 229, .7);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero::before { content: ""; position: absolute; right: 80px; bottom: -90px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.06); }
.hero > * { position: relative; z-index: 1; }
.hero h2 { font-size: 22px; font-weight: 800; }
.hero p { opacity: .88; }
.hero-grid { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero-clock { font-size: 40px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.hero-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hero-pill { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.hero .btn-white { background: #fff; color: var(--brand); border-color: #fff; }
.hero .btn-white:hover { background: #f1f5ff; color: var(--brand-600); }
.hero .btn-ghost-white { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }
.hero .btn-ghost-white:hover { background: rgba(255,255,255,.22); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
    border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 14px;
    cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
    text-decoration: none; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px -4px rgba(79,70,229,.6); }
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-gradient { background: var(--gradient); color: #fff; box-shadow: 0 6px 16px -6px rgba(37,99,235,.7); }
.btn-gradient:hover { filter: brightness(1.06); color: #fff; }
.btn-light { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-light:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.btn-soft { background: var(--brand-50); color: var(--brand); }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-600); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-danger-soft { background: var(--red-bg); color: var(--red); }
.btn-danger-soft:hover { background: #fee2e2; color: #b91c1c; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; height: 34px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; border: 1px solid transparent; white-space: nowrap; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-green { background: var(--green-bg); color: var(--green); border-color: var(--green-bd); }
.b-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-bd); }
.b-red { background: var(--red-bg); color: var(--red); border-color: var(--red-bd); }
.b-sky { background: var(--sky-bg); color: var(--sky); border-color: var(--sky-bd); }
.b-violet { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-bd); }
.b-teal { background: var(--teal-bg); color: var(--tealc); border-color: var(--teal-bd); }
.b-slate { background: var(--slate-bg); color: var(--slate); border-color: var(--slate-bd); }
.b-brand { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }

/* ---------- Avatar ---------- */
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0; background: var(--gradient); letter-spacing: .02em; }
.avatar-sm { width: 30px; height: 30px; font-size: 11.5px; border-radius: 9px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
.avatar-xl { width: 112px; height: 112px; font-size: 36px; border-radius: 28px; }
.avatar-img { object-fit: cover; background: var(--slate-bg); }
.hero .avatar { box-shadow: 0 0 0 4px rgba(255,255,255,.35); }
.hero-person { display: flex; align-items: center; gap: 18px; }
.photo-edit { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.photo-edit .file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.av-1 { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.av-2 { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
.av-3 { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.av-4 { background: linear-gradient(135deg, #db2777, #f472b6); }
.av-5 { background: linear-gradient(135deg, #ea580c, #f59e0b); }
.av-6 { background: linear-gradient(135deg, #16a34a, #4ade80); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .name { font-weight: 700; color: var(--text); line-height: 1.25; }
.person .meta { font-size: 12.5px; color: var(--muted); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.label .req { color: var(--red); }
.input, .select, .textarea {
    width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface); color: var(--text); font: inherit; font-size: 14.5px;
    transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.textarea { height: auto; min-height: 104px; padding: 11px 13px; resize: vertical; line-height: 1.55; }
.select { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.input-sm, .select-sm { height: 36px; font-size: 13.5px; border-radius: 9px; }
.is-invalid { border-color: var(--red) !important; }
.is-invalid:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, .1) !important; }
.error { color: var(--red); font-size: 12.5px; font-weight: 600; }
.help { color: var(--muted); font-size: 12.5px; }
.input-group { position: relative; }
.input-group .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-group .input { padding-left: 38px; }
.input-group .addon { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; font-size: 14px; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 24px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; height: 44px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 10px; font-weight: 700; font-size: 13.5px; color: var(--text-2); transition: all .15s; background: var(--surface); }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-50); color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.choice input:focus-visible + span { box-shadow: 0 0 0 4px rgba(79,70,229,.2); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.filters .input-group { flex: 1; min-width: 200px; }
.filters .select, .filters .input { width: auto; min-width: 140px; }
.pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.pills::-webkit-scrollbar { display: none; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 700; font-size: 13px; white-space: nowrap; }
.pill:hover { border-color: var(--border-strong); color: var(--text); }
.pill.active { background: var(--text); color: #fff; border-color: var(--text); }
.pill .n { background: var(--slate-bg); color: var(--slate); border-radius: 99px; padding: 0 7px; font-size: 11.5px; }
.pill.active .n { background: rgba(255,255,255,.18); color: #fff; }
.segmented { display: inline-flex; background: var(--slate-bg); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented a { padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--muted); white-space: nowrap; }
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #fafbff; }
.table tr[data-href] { cursor: pointer; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--border); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--border); color: inherit; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #fafbff; color: inherit; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; line-height: 1.3; }
.list-item .meta { font-size: 12.5px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Timeline ---------- */
.timeline { position: relative; list-style: none; margin: 0; padding: 4px 0 4px 6px; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 22px; bottom: -2px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); background: var(--faint); }
.timeline .tl-dot.sale { background: var(--green); box-shadow: 0 0 0 1px var(--green-bd); }
.timeline .tl-dot.ownership, .timeline .tl-dot.reassigned { background: var(--violet); box-shadow: 0 0 0 1px var(--violet-bd); }
.timeline .tl-dot.created { background: var(--brand); box-shadow: 0 0 0 1px var(--brand-100); }
.timeline .tl-dot.status { background: var(--amber); box-shadow: 0 0 0 1px var(--amber-bd); }
.timeline .tl-dot.note { background: var(--sky); box-shadow: 0 0 0 1px var(--sky-bd); }
.timeline .tl-head { font-size: 12.5px; color: var(--muted); }
.timeline .tl-head b { color: var(--text); }
.timeline .tl-body { margin-top: 3px; font-size: 14px; white-space: pre-line; }

/* ---------- Chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; position: relative; }
.bar { width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #6366f1, #3b82f6); min-height: 3px; transition: filter .15s; position: relative; }
.bar.zero { background: var(--slate-bd); }
.bar.today { background: linear-gradient(180deg, #14b8a6, #0d9488); }
.bar-col:hover .bar { filter: brightness(1.1); }
.bar-label { font-size: 11px; color: var(--muted); margin-top: 8px; font-weight: 600; white-space: nowrap; }
.bar-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; font-size: 11.5px; font-weight: 700; padding: 5px 8px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 2; }
.bar-col:hover .bar-tip { opacity: 1; }
.progress { height: 8px; background: var(--slate-bg); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--gradient); border-radius: 99px; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; background: var(--slate-bg); color: var(--slate); flex-shrink: 0; }
.rank.r1 { background: #fef3c7; color: #b45309; }
.rank.r2 { background: #e2e8f0; color: #334155; }
.rank.r3 { background: #ffedd5; color: #c2410c; }

/* ---------- Alerts / toasts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; border: 1px solid; font-size: 14px; font-weight: 500; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--green-bg); border-color: var(--green-bd); color: #065f46; }
.alert-error { background: var(--red-bg); border-color: var(--red-bd); color: #991b1b; }
.alert-warn { background: var(--amber-bg); border-color: var(--amber-bd); color: #92400e; }
.alert-info { background: var(--sky-bg); border-color: var(--sky-bd); color: #075985; }
.alert a { font-weight: 700; text-decoration: underline; color: inherit; }
.toasts { position: fixed; top: 76px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); }
.toast { box-shadow: var(--shadow-lg); animation: toast-in .3s ease; background-clip: padding-box; }
.toast.hide { animation: toast-out .3s ease forwards; }
.toast .close { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--slate-bg); color: var(--faint); display: grid; place-items: center; margin: 0 auto 14px; }
.empty h3 { font-size: 15.5px; color: var(--text); font-weight: 800; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; display: none; }
.dropdown.open .dropdown-menu { display: block; animation: toast-in .15s ease; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 14px; background: none; border: 0; font-family: inherit; cursor: pointer; text-align: left; }
.dropdown-item:hover { background: var(--slate-bg); color: var(--text); }
.dropdown-item.danger { color: var(--red); }
.dropdown-head { padding: 10px 11px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-lg); animation: toast-in .2s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; font-weight: 800; }
.modal-body { padding: 22px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination .pg { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--text-2); border: 1px solid var(--border); background: var(--surface); }
.pagination .pg:hover { border-color: var(--border-strong); }
.pagination .pg.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .pg.disabled { opacity: .45; pointer-events: none; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-side { position: relative; overflow: hidden; background: var(--sidebar); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side::before { content: ""; position: absolute; width: 560px; height: 560px; border-radius: 50%; background: radial-gradient(circle, rgba(79,70,229,.55), transparent 65%); top: -160px; right: -200px; }
.auth-side::after { content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, rgba(20,184,166,.35), transparent 65%); bottom: -200px; left: -140px; }
.auth-side > * { position: relative; z-index: 1; }
.auth-side h1 { font-size: 40px; font-weight: 800; line-height: 1.12; letter-spacing: -.025em; max-width: 520px; }
.auth-side h1 span { background: linear-gradient(90deg, #a5b4fc, #5eead4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-side p.lead { color: #a5b0c6; font-size: 16px; margin-top: 16px; max-width: 460px; }
.auth-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 36px; max-width: 520px; }
.auth-feature { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); padding: 12px 14px; border-radius: 12px; font-weight: 600; font-size: 13.5px; color: #dbe2f0; }
.auth-feature .icon { color: #5eead4; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; font-weight: 800; }
.auth-logo-m { display: none; }

/* ---------- Letter (leave application) ---------- */
.letter { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 44px; box-shadow: var(--shadow-sm); font-size: 15px; line-height: 1.75; }
.letter .lh { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 18px; border-bottom: 2px solid var(--text); margin-bottom: 24px; }
.letter .subject { font-weight: 800; margin: 18px 0; }
.letter .sig { margin-top: 36px; }
.stamp { display: inline-block; border: 3px solid; border-radius: 10px; padding: 6px 14px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; transform: rotate(-6deg); font-size: 15px; }
.stamp.approved { color: var(--green); }
.stamp.rejected { color: var(--red); }
.stamp.pending { color: var(--amber); }
.stamp.cancelled { color: var(--slate); }

/* ---------- Notifications ---------- */
.notif { display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); position: relative; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: linear-gradient(90deg, rgba(79,70,229,.05), transparent 60%); }
.notif.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.notif .grow { flex: 1; min-width: 0; }
.notif .title { font-weight: 800; }
.notif .body { color: var(--text-2); margin-top: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.notif .meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Quick actions ---------- */
.quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-weight: 700; font-size: 13px; text-align: center; transition: all .15s; }
.quick a:hover { border-color: var(--brand-100); box-shadow: var(--shadow); color: var(--brand); transform: translateY(-1px); }
.quick .qi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }

/* ---------- Error pages ---------- */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 40px 16px; }
.error-code { font-size: 88px; font-weight: 900; line-height: 1; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: -.04em; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-open .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 45; backdrop-filter: blur(2px); }
    .sidebar-open { overflow: hidden; }
    .main { margin-left: 0; }
    .icon-btn.menu-btn { display: grid; }
    .topbar { padding: 0 16px; }
    .content { padding: 4px 16px 100px; }
    .grid-main, .grid-main-wide { grid-template-columns: minmax(0, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .auth-logo-m { display: flex; }
    .clock-chip { display: none; }

    .bottom-nav {
        display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
        background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    }
    .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; font-size: 11px; font-weight: 700; color: var(--muted); background: none; border: 0; font-family: inherit; cursor: pointer; border-radius: 10px; position: relative; }
    .bottom-nav .active { color: var(--brand); }
    .bottom-nav .fab { margin-top: -22px; }
    .bottom-nav .fab span.fab-ic { width: 50px; height: 50px; border-radius: 16px; background: var(--gradient); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 22px -8px rgba(79,70,229,.8); border: 4px solid var(--bg); }
    .bottom-nav .bn-dot { position: absolute; top: 2px; right: calc(50% - 18px); width: 8px; height: 8px; background: #ef4444; border-radius: 50%; }
    .toasts { top: 72px; right: 16px; }
}

@media (max-width: 720px) {
    body { font-size: 14px; }
    .stats { gap: 12px; }
    .stat { padding: 14px; }
    .stat-value { font-size: 21px; }
    .stat-icon { width: 34px; height: 34px; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .grid { gap: 16px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .page-head { margin: 8px 0 16px; align-items: flex-start; }
    .page-head h1 { font-size: 21px; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .card-header, .card-body { padding-left: 16px; padding-right: 16px; }
    .list-item, .notif { padding-left: 16px; padding-right: 16px; }
    .filters { padding: 12px 16px; }
    .filters .select, .filters .input, .filters .input-group { flex: 1 1 100%; min-width: 0; width: 100%; }
    .filters .btn { flex: 1; }
    .hero { padding: 22px 20px; border-radius: 18px; }
    .hero-clock { font-size: 34px; }
    .hero .actions { width: 100%; }
    .hero .actions .btn { flex: 1; }
    .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .quick a { padding: 14px 6px; font-size: 12px; }
    .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
    .kv dd { margin-bottom: 10px; }
    .letter { padding: 24px 20px; font-size: 14.5px; }
    .bars { gap: 3px; height: 160px; }
    .bar-label { font-size: 9.5px; }
    .pagination { justify-content: center; }
    .pagination .summary { width: 100%; text-align: center; }
    .form-actions .btn { flex: 1; }

    /* Tables collapse into stacked cards */
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
    .table-stack tbody tr:last-child { border-bottom: 0; }
    .table-stack td { border: 0; padding: 4px 0 !important; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
    .table-stack td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: left; flex-shrink: 0; }
    .table-stack td.cell-main { display: block; text-align: left; padding-bottom: 8px !important; }
    .table-stack td.cell-main::before { display: none; }
    .table-stack td[data-label=""]::before { display: none; }
    .table-stack td .actions { justify-content: flex-end; width: 100%; }
    .table-stack tfoot { display: block; }
    .table-stack tfoot tr { display: flex; justify-content: space-between; background: var(--surface-2); }
    .table-stack tfoot td { width: auto; }
    .table-stack tfoot td::before { display: none; }
    .hide-sm { display: none !important; }
}

@media (min-width: 721px) {
    .show-sm { display: none !important; }
}

@media print {
    .sidebar, .topbar, .bottom-nav, .no-print, .toasts { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    body { background: #fff; }
    .letter { border: 0; box-shadow: none; padding: 0; }
}
