/* ==========================================================================
   FikarFix HRM — design system
   Soft-card UI · light/dark · brand colour injected as --brand from settings
   ========================================================================== */

:root {
    --brand: #6366f1;
    --brand-rgb: 99, 102, 241;
    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --border: #e7e9f2;
    --text: #1d2033;
    --text-2: #5b6079;
    --muted: #8b90a8;
    --shadow-sm: 0 1px 2px rgba(20, 24, 56, .04), 0 1px 3px rgba(20, 24, 56, .05);
    --shadow: 0 2px 6px rgba(20, 24, 56, .04), 0 12px 32px -12px rgba(20, 24, 56, .12);
    --radius: 18px;
    --radius-sm: 12px;

    --green: #10b981;  --green-soft: #e7f8f1;
    --amber: #f59e0b;  --amber-soft: #fef5e4;
    --red: #ef4444;    --red-soft: #fdecec;
    --blue: #3b82f6;   --blue-soft: #e9f1fe;
    --violet: #8b5cf6; --violet-soft: #f1ebfe;
    --pink: #ec4899;   --pink-soft: #fde9f3;
    --teal: #14b8a6;   --teal-soft: #e4f7f5;

    --sidebar-w: 264px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0e1020;
    --surface: #161a2e;
    --surface-2: #1c2038;
    --border: #272c47;
    --text: #e8eaf6;
    --text-2: #a9aecb;
    --muted: #7a80a3;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, .55);
    --green-soft: rgba(16, 185, 129, .14);
    --amber-soft: rgba(245, 158, 11, .14);
    --red-soft: rgba(239, 68, 68, .14);
    --blue-soft: rgba(59, 130, 246, .14);
    --violet-soft: rgba(139, 92, 246, .16);
    --pink-soft: rgba(236, 72, 153, .14);
    --teal-soft: rgba(20, 184, 166, .14);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
img { max-width: 100%; }
code { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mono { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; }
.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

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

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column;
    z-index: 40;
    transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; }
.sidebar-brand img { height: 36px; width: auto; max-width: 150px; object-fit: contain; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #ec4899));
    color: #fff; font-weight: 800; font-size: 17px; box-shadow: 0 8px 18px -6px rgba(var(--brand-rgb), .6);
}
.brand-name { font-weight: 750; font-size: 16px; letter-spacing: -.02em; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

.nav { flex: 1; overflow-y: auto; padding: 6px 14px 20px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; padding: 16px 12px 6px; }
.nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
    color: var(--text-2); font-weight: 520; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav a i { font-size: 19px; opacity: .85; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: rgba(var(--brand-rgb), .1); color: var(--brand); font-weight: 620; }
.nav a.active i { opacity: 1; }
.nav .badge { margin-left: auto; }

.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.tenant-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.tenant-chip img, .tenant-chip .avatar { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }

.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: 14px;
    padding: 14px 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar-title h1 { font-size: 20px; font-weight: 720; }
.topbar-title .crumb { font-size: 12.5px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
    display: grid; place-items: center; color: var(--text-2); cursor: pointer; font-size: 18px; transition: .15s;
}
.icon-btn:hover { color: var(--brand); border-color: rgba(var(--brand-rgb), .4); }
.menu-toggle { display: none; }

.content { padding: 8px 28px 40px; flex: 1; }
.page-foot { padding: 18px 28px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); }

/* User menu */
.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); padding: 8px; display: none; z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; animation: pop .15s ease; }
.dropdown-menu a, .dropdown-menu button {
    display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text);
    background: none; border: 0; font: inherit; cursor: pointer; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-btn { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); padding: 4px 12px 4px 4px; border-radius: 14px; cursor: pointer; color: var(--text); font: inherit; }
.user-btn .meta { text-align: left; line-height: 1.2; }
.user-btn .meta b { font-size: 13px; font-weight: 620; display: block; }
.user-btn .meta span { font-size: 11.5px; color: var(--muted); }

.avatar {
    width: 36px; height: 36px; border-radius: 11px; display: inline-grid; place-items: center; flex-shrink: 0;
    font-weight: 700; font-size: 13px; color: hsl(var(--h, 240) 55% 38%); background: hsl(var(--h, 240) 85% 93%); object-fit: cover;
}
:root[data-theme="dark"] .avatar:not(img) { color: hsl(var(--h, 240) 80% 80%); background: hsl(var(--h, 240) 40% 22%); }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11.5px; }

/* Tenant switcher */
.switcher select {
    appearance: none; border: 1px solid var(--border); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b90a8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    padding: 9px 34px 9px 14px; border-radius: 12px; font: inherit; color: var(--text); font-weight: 560; max-width: 260px; cursor: pointer;
}

/* ── Cards & 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, 2fr) minmax(0, 1fr); }
.mt { margin-top: 20px; }
.mt-sm { margin-top: 12px; }
.mb { margin-bottom: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 14px; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 22px;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 16px; font-weight: 680; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 20px 22px 0; }

/* ── Soft KPI cards ───────────────────────────────────────────────────── */
.kpi {
    position: relative; overflow: hidden; border-radius: var(--radius); padding: 20px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::after {
    content: ''; position: absolute; width: 140px; height: 140px; border-radius: 50%;
    right: -46px; top: -56px; background: var(--tone-soft); opacity: .9; pointer-events: none;
}
.kpi-top { display: flex; align-items: flex-start; gap: 12px; position: relative; z-index: 1; }
.kpi-icon {
    width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 21px;
    background: var(--tone-soft); color: var(--tone);
}
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 540; }
.kpi-value { font-size: 30px; font-weight: 760; letter-spacing: -.03em; margin-top: 14px; font-variant-numeric: tabular-nums; position: relative; z-index: 1; line-height: 1.1; }
.kpi-value small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); position: relative; z-index: 1; }
.kpi-spark { height: 38px; margin-top: 10px; position: relative; z-index: 1; }
.trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; padding: 1px 7px; border-radius: 20px; font-size: 12px; }
.trend.up { color: var(--green); background: var(--green-soft); }
.trend.down { color: var(--red); background: var(--red-soft); }
.trend.flat { color: var(--muted); background: var(--surface-2); }

.tone-brand  { --tone: var(--brand); --tone-soft: rgba(var(--brand-rgb), .11); }
.tone-green  { --tone: var(--green); --tone-soft: var(--green-soft); }
.tone-amber  { --tone: var(--amber); --tone-soft: var(--amber-soft); }
.tone-red    { --tone: var(--red); --tone-soft: var(--red-soft); }
.tone-blue   { --tone: var(--blue); --tone-soft: var(--blue-soft); }
.tone-violet { --tone: var(--violet); --tone-soft: var(--violet-soft); }
.tone-pink   { --tone: var(--pink); --tone-soft: var(--pink-soft); }
.tone-teal   { --tone: var(--teal); --tone-soft: var(--teal-soft); }

/* Progress / meters */
.meter { height: 8px; border-radius: 10px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.meter > span { display: block; height: 100%; border-radius: 10px; background: var(--tone, var(--brand)); transition: width .6s ease; }
.ring { --p: 0; --size: 120px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--tone, var(--brand)) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring > div { width: calc(var(--size) - 22px); height: calc(var(--size) - 22px); border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 24px; font-weight: 760; letter-spacing: -.02em; display: block; }

/* ── Clock-in hero ─────────────────────────────────────────────────────── */
.clock-card {
    position: relative; overflow: hidden; border-radius: 22px; padding: 26px; color: #fff;
    background:
        radial-gradient(600px 220px at 100% 0%, rgba(255,255,255,.18), transparent 60%),
        linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 50%, #0ea5e9));
    box-shadow: 0 24px 50px -24px rgba(var(--brand-rgb), .7);
}
.clock-card .time { font-size: 46px; font-weight: 780; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.clock-card .date { opacity: .85; margin-top: 6px; }
.clock-card .net { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 7px 12px; border-radius: 30px; background: rgba(255,255,255,.16); font-size: 13px; font-weight: 560; backdrop-filter: blur(4px); }
.clock-card .net.bad { background: rgba(239, 68, 68, .9); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .25); }
.net.bad .dot { background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.25); }
.clock-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.punch-btn {
    flex: 1; min-width: 150px; border: 0; border-radius: 16px; padding: 16px 18px; font: inherit; font-weight: 700; font-size: 16px;
    display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; transition: transform .15s, box-shadow .15s, opacity .15s;
}
.punch-btn i { font-size: 22px; }
.punch-btn.in { background: #fff; color: #0f172a; box-shadow: 0 10px 24px -10px rgba(0,0,0,.4); }
.punch-btn.out { background: rgba(15, 23, 42, .28); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.punch-btn:hover:not(:disabled) { transform: translateY(-2px); }
.punch-btn:disabled { opacity: .45; cursor: not-allowed; }
.clock-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.clock-stats div { background: rgba(255,255,255,.13); border-radius: 14px; padding: 10px 12px; }
.clock-stats span { font-size: 11.5px; opacity: .8; display: block; }
.clock-stats b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ── Buttons & forms ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px;
    border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; transition: .15s; white-space: nowrap; text-decoration: none !important;
}
.btn i { font-size: 17px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px -8px rgba(var(--brand-rgb), .8); }
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-light:hover { border-color: rgba(var(--brand-rgb), .45); color: var(--brand); }
.btn-soft { background: rgba(var(--brand-rgb), .1); color: var(--brand); }
.btn-soft:hover { background: rgba(var(--brand-rgb), .16); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field .err { font-size: 12.5px; color: var(--red); margin-top: 5px; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number],
.field input[type=date], .field input[type=time], .field input[type=month], .field input[type=url], .field select, .field textarea, .input-plain {
    width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .input-plain:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .14);
}
.field.has-error input, .field.has-error select { border-color: var(--red); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; pointer-events: none; }
.input-icon input { padding-left: 42px !important; }
.input-icon .toggle-pw { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; font-size: 18px; pointer-events: auto; }
.field input[type=color] { width: 54px; height: 44px; border-radius: 12px; border: 1px solid var(--border); padding: 4px; background: var(--surface); cursor: pointer; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 44px; height: 25px; border-radius: 20px; background: var(--border); position: relative; transition: .2s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; width: 19px; height: 19px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { left: 22px; }

.check-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pills label { cursor: pointer; }
.check-pills input { display: none; }
.check-pills span { display: inline-block; padding: 7px 13px; border-radius: 10px; border: 1px solid var(--border); font-size: 13px; font-weight: 560; color: var(--text-2); transition: .15s; }
.check-pills input:checked + span { background: rgba(var(--brand-rgb), .12); border-color: rgba(var(--brand-rgb), .5); color: var(--brand); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 200px; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 12px 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 .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person b { font-weight: 620; display: block; }
.person span { font-size: 12.5px; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 620; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-present, .b-active, .b-sent { color: var(--green); background: var(--green-soft); }
.b-late, .b-on_leave, .b-pending { color: var(--amber); background: var(--amber-soft); }
.b-absent, .b-suspended, .b-failed, .b-inactive, .b-resigned { color: var(--red); background: var(--red-soft); }
.b-half_day { color: var(--violet); background: var(--violet-soft); }
.b-leave { color: var(--blue); background: var(--blue-soft); }
.b-neutral { color: var(--text-2); background: var(--surface-2); }
.b-brand { color: var(--brand); background: rgba(var(--brand-rgb), .1); }

.pagination { display: flex; gap: 6px; align-items: center; padding: 16px 22px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination a, .pagination span.cur { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; display: inline-grid; place-items: center; border: 1px solid var(--border); color: var(--text-2); font-weight: 560; }
.pagination span.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty i { font-size: 42px; display: block; margin-bottom: 8px; color: var(--border); }

/* ── Alerts / toasts ───────────────────────────────────────────────────── */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 14px; margin-bottom: 18px; font-weight: 520; border: 1px solid transparent; }
.alert i { font-size: 19px; margin-top: 1px; }
.alert-success { background: var(--green-soft); color: color-mix(in srgb, var(--green) 75%, var(--text)); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.alert-error { background: var(--red-soft); color: color-mix(in srgb, var(--red) 80%, var(--text)); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.alert-warning { background: var(--amber-soft); color: color-mix(in srgb, var(--amber) 70%, var(--text)); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.alert-info { background: var(--blue-soft); color: color-mix(in srgb, var(--blue) 75%, var(--text)); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.alert .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; font-size: 18px; }

.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--tone, var(--brand)); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); animation: slideIn .25s ease; font-weight: 520; }
.toast i { color: var(--tone); font-size: 20px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(10, 12, 30, .5); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 90; padding: 20px; }
.modal.open { display: flex; animation: fade .15s ease; }
.modal-box { background: var(--surface); border-radius: 20px; width: 100%; max-width: 520px; box-shadow: var(--shadow); border: 1px solid var(--border); max-height: calc(100vh - 40px); overflow-y: auto; animation: pop .2s ease; }
.modal-head { display: flex; align-items: center; padding: 20px 22px 0; }
.modal-head h3 { font-size: 17px; }
.modal-head button { margin-left: auto; }
.modal-body { padding: 18px 22px 22px; }

/* Lists */
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; margin: 28px 0 12px; }

.code-block { background: #0f1226; color: #c9d1ff; border-radius: 14px; padding: 14px 16px; font-family: 'JetBrains Mono', Consolas, monospace; font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding: 0 0 16px 42px; color: var(--text-2); }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: rgba(var(--brand-rgb), .12); color: var(--brand); }
.steps li b { color: var(--text); }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; width: fit-content; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 9px; color: var(--text-2); font-weight: 580; font-size: 13.5px; }
.tabs a.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.tabs a:hover { text-decoration: none; color: var(--text); }

.plan-card { position: relative; }
.plan-card .price { font-size: 32px; font-weight: 780; letter-spacing: -.03em; margin: 10px 0 2px; }
.plan-card ul { list-style: none; padding: 0; margin: 14px 0 0; }
.plan-card li { padding: 5px 0; display: flex; gap: 8px; color: var(--text-2); }
.plan-card li i { color: var(--green); }

.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 220px; }

/* ── Auth (split screen) ───────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); background: var(--surface); }
.auth-visual {
    position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column;
    background:
        radial-gradient(700px 400px at 10% 110%, rgba(236, 72, 153, .45), transparent 60%),
        radial-gradient(600px 400px at 100% 0%, rgba(14, 165, 233, .45), transparent 60%),
        linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #111827));
}
.auth-visual.has-image { background-size: cover; background-position: center; }
.auth-visual.has-image::before { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(var(--brand-rgb), .82), rgba(15, 23, 42, .78)); }
.auth-visual > * { position: relative; z-index: 1; }
.auth-visual .brand { display: flex; align-items: center; gap: 12px; font-weight: 750; font-size: 18px; }
.auth-visual .brand img { height: 42px; background: rgba(255,255,255,.95); padding: 6px 10px; border-radius: 12px; }
.auth-visual .brand .brand-mark { background: rgba(255,255,255,.2); box-shadow: none; backdrop-filter: blur(6px); }
.auth-hero { margin-top: auto; margin-bottom: auto; max-width: 520px; padding: 40px 0; }
.auth-hero h2 { font-size: 40px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; }
.auth-hero p { font-size: 16.5px; opacity: .88; margin-top: 16px; }
.auth-feats { display: grid; gap: 12px; margin-top: 30px; }
.auth-feat { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(8px); }
.auth-feat i { font-size: 22px; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.16); flex-shrink: 0; }
.auth-feat b { display: block; }
.auth-feat span { font-size: 13px; opacity: .8; }
.auth-visual .foot { font-size: 12.5px; opacity: .7; }
.float-card { position: absolute; right: 40px; top: 36px; background: rgba(255,255,255,.95); color: #111827; border-radius: 18px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; box-shadow: 0 20px 40px -12px rgba(0,0,0,.35); animation: floaty 5s ease-in-out infinite; }
.float-card .ic { width: 40px; height: 40px; border-radius: 12px; background: #dcfce7; color: #16a34a; display: grid; place-items: center; font-size: 20px; }
.float-card small { color: #6b7280; display: block; font-size: 12px; }

.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 410px; }
.auth-box h1 { font-size: 28px; font-weight: 780; letter-spacing: -.03em; }
.auth-box .sub { color: var(--muted); margin: 8px 0 28px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font: inherit; cursor: pointer; transition: .15s; text-decoration: none !important; }
.google-btn:hover { border-color: #c5cae0; box-shadow: var(--shadow-sm); background: var(--surface-2); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 22px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-box .field { margin-bottom: 16px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 20px; font-size: 13.5px; }
.auth-alt { text-align: center; margin-top: 24px; color: var(--text-2); font-size: 14px; }
/* Demo accounts (local only) */
.demo-box { margin-top: 28px; padding: 16px; border-radius: 18px; border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow-sm); }
.demo-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.demo-title { font-size: 13px; font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.demo-title i { color: var(--brand); font-size: 16px; }
.demo-tag { font-size: 11px; font-weight: 650; color: var(--amber); background: var(--amber-soft); padding: 2px 9px; border-radius: 20px; }
.demo-grid { display: grid; gap: 8px; }
.demo-card {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 13px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left;
    cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.demo-card:hover, .demo-card:focus-visible { transform: translateY(-1px); border-color: var(--tone); box-shadow: 0 8px 20px -12px var(--tone); outline: none; }
.demo-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; background: var(--tone-soft); color: var(--tone); flex-shrink: 0; }
.demo-text { flex: 1; min-width: 0; line-height: 1.3; }
.demo-text b { display: block; font-size: 14px; font-weight: 650; }
.demo-text small { font-size: 12px; color: var(--muted); }
.demo-go { color: var(--muted); font-size: 17px; transition: color .15s, transform .15s; }
.demo-card:hover .demo-go { color: var(--tone); transform: translate(2px, -2px); }
.demo-card.loading { opacity: .7; pointer-events: none; }
.demo-foot { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }
[dir="rtl"] .demo-card { text-align: right; }

/* Error page */
.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.error-page .code { font-size: 110px; font-weight: 850; letter-spacing: -.05em; background: linear-gradient(135deg, var(--brand), #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }

/* Animations */
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.fade-up { animation: fadeUp .45s ease both; }
.fade-up:nth-child(2) { animation-delay: .05s; } .fade-up:nth-child(3) { animation-delay: .1s; } .fade-up:nth-child(4) { animation-delay: .15s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .float-card { display: none; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
    .auth { grid-template-columns: 1fr; }
    .auth-visual { padding: 28px 24px; min-height: auto; }
    .auth-hero { padding: 26px 0 6px; }
    .auth-hero h2 { font-size: 28px; }
    .auth-feats, .float-card, .auth-visual .foot { display: none; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(10,12,30,.4); z-index: 35; }
    .main { margin-left: 0; }
    .menu-toggle { display: grid; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .topbar { padding: 12px 16px; }
    .content { padding: 6px 16px 30px; }
    .user-btn .meta, .switcher { display: none; }
    .page-foot { padding: 16px; }
}
@media (max-width: 560px) {
    .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
    .kpi { padding: 16px; }
    .kpi-value { font-size: 24px; }
    .kpi-icon { width: 38px; height: 38px; font-size: 18px; }
    .form-grid { grid-template-columns: 1fr; }
    .clock-card { padding: 20px; }
    .clock-card .time { font-size: 38px; }
    .card { padding: 18px; }
    .topbar-title h1 { font-size: 17px; }
    .topbar-title .crumb { display: none; }
}

.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Notification bell */
.bell { position: relative; }
.bell-count { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.notif-menu { width: 330px; max-width: calc(100vw - 32px); }
.notif-menu a { align-items: flex-start; }
.notif-menu a i { font-size: 18px; color: var(--brand); margin-top: 2px; }
.notif-menu a.unread { background: rgba(var(--brand-rgb), .06); }

/* Roster grid */
.roster-cell { width: 100%; min-width: 108px; padding: 7px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 560; cursor: pointer; }
.roster-cell:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .14); }

/* ── Urdu / right-to-left ─────────────────────────────────────────────── */
[dir="rtl"] body { font-family: 'Inter', 'Noto Nastaliq Urdu', system-ui, sans-serif; line-height: 2; } /* Latin → Inter, Urdu → Nastaliq */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .kpi-label, [dir="rtl"] .nav a, [dir="rtl"] .btn { line-height: 1.9; }
[dir="rtl"] .nav-label { letter-spacing: 0; text-transform: none; font-size: 12px; }
[dir="rtl"] .mono, [dir="rtl"] .tabular, [dir="rtl"] .kpi-value, [dir="rtl"] .clock-card .time, [dir="rtl"] code, [dir="rtl"] input[type=email], [dir="rtl"] input[type=password], [dir="rtl"] .num {
    font-family: 'Inter', system-ui, sans-serif; direction: ltr; unicode-bidi: isolate;
}
[dir="rtl"] .clock-card .time, [dir="rtl"] .kpi-value { text-align: right; }
[dir="rtl"] .sidebar { inset: 0 0 0 auto; border-right: 0; border-left: 1px solid var(--border); }
[dir="rtl"] .main { margin-left: 0; margin-right: var(--sidebar-w); }
[dir="rtl"] .topbar-actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .dropdown-menu { right: auto; left: 0; }
[dir="rtl"] .nav .badge, [dir="rtl"] .alert .close { margin-left: 0; margin-right: auto; }
[dir="rtl"] .table th, [dir="rtl"] .table td { text-align: right; }
[dir="rtl"] .table .num { text-align: left; }
[dir="rtl"] .kpi::after { right: auto; left: -46px; }
[dir="rtl"] .input-icon i { left: auto; right: 14px; }
[dir="rtl"] .input-icon input { padding-left: 14px !important; padding-right: 42px !important; }
[dir="rtl"] .input-icon .toggle-pw { right: auto; left: 8px; }
[dir="rtl"] .toast-wrap { right: auto; left: 20px; }
[dir="rtl"] .toast { border-left: 1px solid var(--border); border-right: 4px solid var(--tone, var(--brand)); }
[dir="rtl"] .bell-count { right: auto; left: -5px; }
[dir="rtl"] .steps li { padding: 0 42px 16px 0; }
[dir="rtl"] .steps li::before { left: auto; right: 0; }
[dir="rtl"] .float-card { right: auto; left: 40px; }
[dir="rtl"] .ri-arrow-left-line, [dir="rtl"] .ri-arrow-right-line, [dir="rtl"] .ri-arrow-left-s-line, [dir="rtl"] .ri-arrow-right-s-line, [dir="rtl"] .ri-arrow-go-back-line { display: inline-block; transform: scaleX(-1); }
@media (max-width: 900px) {
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    [dir="rtl"] body.nav-open .sidebar { transform: none; }
    [dir="rtl"] .main { margin-right: 0; }
}

.lang-switch { display: inline-flex; gap: 4px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.lang-switch button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.lang-switch button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.dropdown-menu .lang-switch button { display: inline-block; width: auto; padding: 5px 10px; }
