/* ---------- design tokens ---------- */
:root {
  --bg: #f4f6fb;
  --bg-accent: radial-gradient(1200px 500px at 100% -10%, rgba(99, 102, 241, .10), transparent 60%),
               radial-gradient(900px 400px at -10% 110%, rgba(6, 182, 212, .08), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e9edf5;
  --border: #e3e8f0;
  --border-strong: #cfd6e3;
  --text: #121826;
  --muted: #64708a;
  --primary: #4f46e5;
  --primary-2: #06b6d4;
  --primary-ink: #ffffff;
  --primary-soft: #eef0ff;
  --grad: linear-gradient(135deg, #6366f1 0%, #4f46e5 45%, #0891b2 100%);
  --ok: #138a52;
  --ok-soft: #e3f6ec;
  --warn: #b45309;
  --warn-soft: #fdf2dd;
  --bad: #d22f3b;
  --bad-soft: #fde8ea;
  --info: #6d4fd6;
  --info-soft: #f0ebfe;
  /* sidebar stays dark in both themes */
  --side-bg: linear-gradient(180deg, #111735 0%, #0c1129 100%);
  --side-text: #c9cfe6;
  --side-muted: #8a93b5;
  --side-hover: rgba(255, 255, 255, .06);
  --side-active: rgba(129, 140, 248, .18);
  --side-border: rgba(255, 255, 255, .08);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 16px -4px rgba(17, 24, 39, .08);
  --shadow-lg: 0 24px 60px -12px rgba(17, 24, 39, .28);
  --radius: 14px;
  --radius-sm: 10px;
  --ring: 0 0 0 4px rgba(79, 70, 229, .16);
  /* chart series (projects), fixed order */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948; --s-other: #9aa1ad;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e1a;
    --bg-accent: radial-gradient(1200px 500px at 100% -10%, rgba(99, 102, 241, .16), transparent 60%),
                 radial-gradient(900px 400px at -10% 110%, rgba(6, 182, 212, .10), transparent 60%);
    --surface: #121829; --surface-2: #192036; --surface-3: #222a43; --border: #242c45; --border-strong: #323b5a;
    --text: #e8ebf5; --muted: #95a0bf;
    --primary: #8b8cf8; --primary-2: #22d3ee; --primary-ink: #0a0e1a; --primary-soft: #1f2347;
    --ok: #4ade80; --ok-soft: #10301f; --warn: #fbbf24; --warn-soft: #36290c; --bad: #f87171; --bad-soft: #3a1619;
    --info: #b9a5ff; --info-soft: #2a2150;
    --side-bg: linear-gradient(180deg, #0d1226 0%, #080b17 100%); --side-border: rgba(255, 255, 255, .06);
    --shadow-sm: none; --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7); --ring: 0 0 0 4px rgba(139, 140, 248, .22);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s-other: #6b7280;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0e1a;
  --bg-accent: radial-gradient(1200px 500px at 100% -10%, rgba(99, 102, 241, .16), transparent 60%),
               radial-gradient(900px 400px at -10% 110%, rgba(6, 182, 212, .10), transparent 60%);
  --surface: #121829; --surface-2: #192036; --surface-3: #222a43; --border: #242c45; --border-strong: #323b5a;
  --text: #e8ebf5; --muted: #95a0bf;
  --primary: #8b8cf8; --primary-2: #22d3ee; --primary-ink: #0a0e1a; --primary-soft: #1f2347;
  --ok: #4ade80; --ok-soft: #10301f; --warn: #fbbf24; --warn-soft: #36290c; --bad: #f87171; --bad-soft: #3a1619;
  --info: #b9a5ff; --info-soft: #2a2150;
  --side-bg: linear-gradient(180deg, #0d1226 0%, #080b17 100%); --side-border: rgba(255, 255, 255, .06);
  --shadow-sm: none; --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7); --ring: 0 0 0 4px rgba(139, 140, 248, .22);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s-other: #6b7280;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg-accent), var(--bg); background-attachment: fixed; color: var(--text);
  font: 14px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 750; letter-spacing: -.02em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-border);
  padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; padding: 2px 10px 18px; }
.sidebar .brand { color: #fff; }
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand-sub {
  font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin-top: 3px;
  background: linear-gradient(90deg, #a5b4fc, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-wrap .brand-sub { background-image: linear-gradient(90deg, var(--primary), var(--primary-2)); }
/* Logo image (public/brand): rounded square with a warm glow to match the sun. */
img.logo, .brand .logo { width: 34px; height: 34px; border-radius: 9px; display: block; flex: none; object-fit: cover; background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 6px 16px -4px rgba(230, 120, 23, .55); }
.login-hero .brand .logo { width: 44px; height: 44px; border-radius: 12px; }
.login .brand .logo { width: 38px; height: 38px; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 10px; background: var(--grad); color: #fff; display: grid; place-items: center;
  font-weight: 800; box-shadow: 0 6px 16px -4px rgba(79, 70, 229, .6);
}
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--side-text); font-weight: 500;
  position: relative; transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(#818cf8, #22d3ee); }
.nav a.active svg { color: #a5b4fc; }
.nav a .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar .spacer { flex: 1; min-height: 12px; }
.theme-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--side-border); background: rgba(255, 255, 255, .04);
  color: var(--side-text); border-radius: 10px; padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; margin: 0 2px 10px;
  transition: background .15s ease;
}
.theme-btn:hover { background: var(--side-hover); color: #fff; }
.theme-btn svg { width: 16px; height: 16px; }
.userbox { border-top: 1px solid var(--side-border); padding: 12px 6px 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.userbox .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.userbox .meta { min-width: 0; line-height: 1.35; }
.userbox .name { font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .muted { color: var(--side-muted); }
.userbox .btn { grid-column: 1 / -1; justify-content: center; background: rgba(255, 255, 255, .05); border-color: var(--side-border); color: var(--side-text); }
.userbox .btn:hover { background: var(--side-hover); color: #fff; }
.main { padding: 28px 32px 56px; min-width: 0; max-width: 1600px; animation: fade-in .25s ease; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .muted { margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; position: sticky; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--side-border); }
  .brand { padding: 0; margin-right: auto; }
  .nav { order: 3; width: 100%; display: flex; overflow-x: auto; gap: 2px; padding-top: 8px; }
  .nav a { white-space: nowrap; padding: 6px 10px; }
  .nav a.active::before { display: none; }
  .sidebar .spacer { display: none; }
  .theme-btn { margin: 0; padding: 6px 8px; }
  .theme-btn span { display: none; }
  .userbox { border: 0; padding: 0; display: flex; align-items: center; gap: 8px; }
  .userbox .meta, .userbox .avatar { display: none; }
  .main { padding: 18px 16px 40px; }
  h1 { font-size: 20px; }
}

/* ---------- components ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: baseline; gap: 8px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px 15px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); opacity: .85; }
.kpi:nth-child(4n+2)::before { background: linear-gradient(90deg, #10b981, #06b6d4); }
.kpi:nth-child(4n+3)::before { background: linear-gradient(90deg, #f59e0b, #f97316); }
.kpi:nth-child(4n+4)::before { background: linear-gradient(90deg, #ec4899, #8b5cf6); }
.kpi a { display: block; text-decoration: none; }
.kpi:has(a):hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi { transition: transform .15s ease, border-color .15s ease; }
.kpi .label { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: 26px; font-weight: 750; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stack { display: grid; gap: 18px; }
.stack > *, .grid > * { min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .15s ease, border-color .15s ease, transform .05s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .65); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.ok { color: var(--ok); }
.btn.ok:hover { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; box-shadow: 0 6px 16px -6px rgba(210, 47, 59, .6); }
.btn.danger-solid:hover { filter: brightness(1.08); background: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 18px; overflow-x: auto; max-width: 100%; }
.tabs button {
  background: none; border: 0; padding: 7px 14px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer;
  white-space: nowrap; border-radius: 9px; transition: background .15s ease, color .15s ease;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 11px; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.filters input, .filters select { width: auto; min-width: 150px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
thead th:first-child { border-top-left-radius: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); }
td .actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.empty { padding: 36px 28px; text-align: center; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 650;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; line-height: 1.6;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }

.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s ease; }
.bar.ok > span { background: linear-gradient(90deg, #10b981, #22c55e); }
.bar.warn > span { background: linear-gradient(90deg, #f59e0b, #f97316); }
.bar.bad > span { background: linear-gradient(90deg, #f43f5e, #dc2626); }

.list { display: grid; }
.list-item { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; justify-content: space-between; transition: background .12s ease; }
.list-item:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.list-item:last-child { border-bottom: 0; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; }

.rating { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 26px; border-radius: 8px; font-weight: 750; font-variant-numeric: tabular-nums; }
.rating.r-2 { background: var(--bad-soft); color: var(--bad); }
.rating.r-1 { background: var(--warn-soft); color: var(--warn); }
.rating.r0 { background: var(--surface-2); color: var(--text); }
.rating.r1 { background: var(--primary-soft); color: var(--primary); }
.rating.r2 { background: var(--ok-soft); color: var(--ok); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.week .day { padding: 12px 10px; text-align: center; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; }
.week .day .d { font-size: 12px; color: var(--muted); font-weight: 500; }
.week .day .h { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.week .day.today { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.week .day.today .h { color: var(--primary); }
.week .day.low .h { color: var(--warn); }
@media (max-width: 560px) { .week { grid-template-columns: repeat(4, 1fr); } }

/* ---------- dashboards (expenses, leave) ---------- */
.dash-grid { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.chart svg.cols { min-width: 480px; }
/* Ring above the legend in narrow cards, side by side when there is room. */
.donut-wrap { display: flex; flex-wrap: wrap; gap: 16px 22px; align-items: center; justify-content: center; }
.chart svg.donut { width: 170px; min-width: 0; height: 170px; display: block; overflow: visible; flex: none; }
.donut-wrap .donut-legend { flex: 1 1 220px; }
.kpi .value .kpi-text { font-size: 18px; display: block; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-arc { transition: stroke-width .15s ease; cursor: default; }
.donut-arc:hover { stroke-width: 30; }
.donut-value { fill: var(--text); font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.donut-label { fill: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.donut-legend { display: grid; gap: 8px; min-width: 0; width: 100%; }
.donut-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 40px; gap: 8px; align-items: center; font-size: 13px; }
.donut-row > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-row b { font-variant-numeric: tabular-nums; }
.donut-row .small { text-align: right; }
.hbar { cursor: default; padding: 2px 0; border-radius: 8px; }
.hbar:hover .hbar-track { filter: brightness(1.08); }
.hbar-label b { margin-right: 4px; }
.hbar-track.stacked { display: flex; gap: 2px; background: none; }
.hbar-track.stacked { width: var(--w); min-width: 6px; }
.hbar-track.stacked > span { height: 100%; border-radius: 3px; min-width: 3px; }
.util { display: grid; gap: 14px; }
.util-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) 84px; gap: 12px; align-items: center; }
.util-label { display: flex; align-items: center; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.util-track { height: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.util-track .used { height: 100%; }
.util-track .pend { height: 100%; background: repeating-linear-gradient(135deg, var(--c) 0 3px, transparent 3px 6px); opacity: .7; }
.util-row .num { text-align: right; }
.dot.hatch { background: repeating-linear-gradient(135deg, var(--text) 0 2px, transparent 2px 4px); }

/* ---------- bills, clients ---------- */
.field.file input[type="file"] { padding: 10px; border-style: dashed; background: var(--surface-2); cursor: pointer; }
.field.file input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 6px 12px; margin-right: 10px; cursor: pointer;
  background: var(--primary-soft); color: var(--primary);
}
.files { display: grid; gap: 8px; margin-bottom: 14px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.file-meta { flex: 1; min-width: 0; }
.file-meta a { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; }
.file-icon.pdf { background: var(--bad-soft); color: var(--bad); }
.file-icon.img { background: var(--info-soft); color: var(--info); }
.bill-count { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.bill-count b { color: var(--text); }
.dropzone {
  display: grid; place-items: center; gap: 2px; padding: 18px; border: 2px dashed var(--border-strong); border-radius: 14px;
  cursor: pointer; text-align: center; color: var(--primary); transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { display: none; }
.client-cell { display: flex; align-items: center; gap: 10px; }
.client-avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none;
  background: var(--primary-soft); color: var(--primary);
}

.allot-cell { display: inline-block; text-align: right; font-weight: 400; }
.allot-cell:hover { background: var(--primary-soft); }

/* ---------- attendance charts & calendar ---------- */
.text-bad { color: var(--bad); }
.month-nav { gap: 4px; align-items: end; }
.month-nav .btn { padding: 8px 11px; }
.att-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 1100px) { .att-grid { grid-template-columns: minmax(0, 1fr); } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-bottom: 12px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; flex: none; vertical-align: 0; }
.legend .dot { margin-right: 0; }
.tick { display: inline-block; width: 14px; height: 2px; background: var(--text); }

.chart { position: relative; }
.chart-scroll { overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 620px; height: auto; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .axis.off { opacity: .55; }
.chart .axis.today { fill: var(--primary); font-weight: 700; }
.chart .off-day { fill: var(--surface-2); opacity: .7; }
.chart .login-tick { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: var(--primary); opacity: .07; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 190px; max-width: 300px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 12px; line-height: 1.5;
}
.row-tip { display: flex; align-items: center; gap: 4px; justify-content: space-between; }
.row-tip > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tip > b { font-variant-numeric: tabular-nums; }

.hbars { display: grid; gap: 14px; }
.hbar { display: grid; gap: 5px; }
.hbar-label { display: flex; align-items: center; min-width: 0; }
.hbar-label a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.hbar-track > span { display: block; height: 100%; border-radius: 99px; }
.hbar .num { text-align: left; }

.st-present { background: var(--ok); }
.st-leave { background: var(--info); }
.st-leave_pending { background: var(--info-soft); box-shadow: inset 0 0 0 1px var(--info); }
.st-absent { background: var(--bad); }
.st-holiday { background: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--warn); }
.st-weekend { background: var(--surface-3); }
.st-not_yet, .st-future, .st-before_join, .st-exited { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-dow { font-size: 11.5px; font-weight: 650; color: var(--muted); padding: 0 4px; text-transform: uppercase; letter-spacing: .05em; }
.cal-cell {
  min-height: 112px; border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; background: var(--surface);
  text-align: left; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0;
  transition: border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.cal-cell:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.cal-cell.blank { border: 0; background: transparent; cursor: default; box-shadow: none; transform: none; }
.cal-cell.today { box-shadow: 0 0 0 2px var(--primary); }
.cal-cell .small { font-size: 11px; }
.cal-cell .bar { min-width: 0; height: 5px; margin: 3px 0; }
.cal-date { font-weight: 750; font-variant-numeric: tabular-nums; }
.cal-status { font-size: 11px; font-weight: 650; }
.cal-count { font-size: 12px; }
.cal-proj { display: flex; align-items: center; gap: 2px; font-size: 11px; }
.cal-proj > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-bg-present { background: var(--ok-soft); } .st-bg-present .cal-status { color: var(--ok); }
.st-bg-leave, .st-bg-leave_pending { background: var(--info-soft); } .st-bg-leave .cal-status, .st-bg-leave_pending .cal-status { color: var(--info); }
.st-bg-leave_pending { border-style: dashed; border-color: var(--info); }
.st-bg-absent { background: var(--bad-soft); } .st-bg-absent .cal-status { color: var(--bad); }
.st-bg-holiday { background: var(--warn-soft); } .st-bg-holiday .cal-status { color: var(--warn); }
.st-bg-weekend { background: var(--surface-2); } .st-bg-weekend .cal-status { color: var(--muted); }
.st-bg-future, .st-bg-not_yet, .st-bg-before_join, .st-bg-exited { color: var(--muted); }
@media (max-width: 700px) {
  .cal { gap: 3px; }
  .cal-cell { min-height: 64px; padding: 4px; border-radius: 8px; }
  .cal-cell > :not(.cal-date):not(.cal-status) { display: none; }
  .cal-status { font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cal-dow { font-size: 10px; }
}

.strips { overflow-x: auto; }
.strip-head, .strip-row {
  display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(300px, 3fr) repeat(5, minmax(56px, auto)) minmax(90px, 1fr);
  gap: 10px; align-items: center; min-width: 900px;
}
.strip-head { font-size: 11px; color: var(--muted); font-weight: 650; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.strip-row { padding: 11px 0; border-bottom: 1px solid var(--border); }
.strip-row:last-of-type { border-bottom: 0; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; }
.strip i { display: block; height: 18px; border-radius: 4px; font-style: normal; text-align: center; cursor: pointer; }
.strip-head .strip i { height: auto; font-size: 10px; cursor: default; }
.strip-head .strip i.off { opacity: .5; }
.strip-row .strip i:hover { outline: 2px solid var(--text); outline-offset: 1px; }

/* ---------- modal & toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 11, 23, .55); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s ease;
}
.modal {
  background: var(--surface); border-radius: 18px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop .18s ease;
}
.modal header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal header h2 { font-size: 17px; }
.modal .body { padding: 18px 22px; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); position: sticky; bottom: 0; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 12px; font-weight: 650; color: var(--muted); }
.field .help { font-size: 12px; color: var(--muted); }
.field.check { display: flex; align-items: center; gap: 9px; padding: 4px 0; }
.field.check > span { color: var(--text); font-weight: 500; font-size: 14px; }
.req { color: var(--bad); }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.callout { background: var(--warn-soft); color: var(--warn); padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.callout.info { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 22%, transparent); }

#toast-root { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 60; }
.toast {
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: 380px;
  font-weight: 500; animation: pop .2s ease;
}
.toast.bad { background: var(--bad); color: #fff; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 48px;
  padding: 32px clamp(16px, 6vw, 96px); position: relative;
  background: radial-gradient(900px 600px at 0% 0%, rgba(99, 102, 241, .22), transparent 60%),
              radial-gradient(700px 500px at 100% 100%, rgba(6, 182, 212, .18), transparent 60%), var(--bg);
}
.login-theme { position: absolute; top: 18px; right: 18px; }
.login-theme .theme-btn { color: var(--text); border-color: var(--border); background: var(--surface); margin: 0; }
.login-theme .theme-btn:hover { color: var(--text); background: var(--surface-2); }
.login-hero { max-width: 460px; justify-self: end; }
.login-hero .brand { padding: 0 0 28px; font-size: 20px; }
.login-hero h2 { font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; }
.login-hero h2 { background: linear-gradient(120deg, var(--text) 30%, var(--primary) 70%, var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; color: var(--muted); font-size: 15px; }
.login-hero li { display: flex; align-items: center; gap: 10px; }
.login-hero li::before { content: "✓"; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; background: var(--grad); flex: none; }
.login { width: min(420px, 100%); padding: 32px; border-radius: 20px; box-shadow: var(--shadow-lg); }
.login-wrap > .login:only-child, .login-wrap > .login-theme + .login { grid-column: 1 / -1; justify-self: center; }
.login h1 { margin-bottom: 4px; }
.login form { display: grid; gap: 16px; margin-top: 22px; }
.login .field > span { font-size: 12.5px; }
.login .btn.primary { padding: 11px 14px; font-size: 14.5px; }
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 72px; }
  .login-hero { justify-self: center; text-align: center; }
  .login-hero .brand { justify-content: center; padding-bottom: 14px; }
  .login-hero ul { display: none; }
  .login { justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
