/* =====================================================================
   Grandway — design system (neutral, single accent)
   Colour is reserved for meaning: the accent for actions/selection,
   green/amber/red for status, and small dots to tell leave types apart.
   ===================================================================== */
:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f1f3f5;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #6b7280;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --primary-ring: rgba(37, 99, 235, .22);

  --success: #15803d; --success-soft: #ecfdf3;
  --warning: #b45309; --warning-soft: #fffbeb;
  --danger:  #b91c1c; --danger-soft:  #fef2f2;
  --info:    #2563eb; --info-soft:    #eff4ff;
  --muted-soft: #f3f4f6;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow: 0 4px 12px rgba(17, 24, 39, .08);
  --shadow-lg: 0 16px 40px rgba(17, 24, 39, .16);
  --sidebar-w: 248px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #16181d;
  --surface-2: #1b1e24;
  --surface-3: #22252c;
  --border: #2a2e36;
  --border-strong: #3a3f49;
  --text: #f3f4f6;
  --text-2: #c2c7d0;
  --text-3: #8b929e;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, .14);
  --primary-ring: rgba(59, 130, 246, .35);
  --success: #4ade80; --success-soft: rgba(74, 222, 128, .10);
  --warning: #fbbf24; --warning-soft: rgba(251, 191, 36, .10);
  --danger:  #f87171; --danger-soft:  rgba(248, 113, 113, .10);
  --info:    #60a5fa; --info-soft:    rgba(96, 165, 250, .10);
  --muted-soft: rgba(148, 163, 184, .12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 4px 12px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; font-weight: 600; }
::selection { background: var(--primary-ring); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: var(--primary); color: #fff;
}
.brand-mark svg { width: 17px; height: 17px; stroke-width: 2; }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }

.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 1px 0;
  border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--surface-3); color: var(--text); font-weight: 600; }
.nav a.active svg { color: var(--primary); }
.nav .count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center;
}
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.me-card .meta { min-width: 0; flex: 1; }
.me-card .name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card .role { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 28px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); background: var(--surface); }
.topbar .title h1 { font-size: 19px; }
.topbar .title p { margin: 1px 0 0; color: var(--text-3); font-size: 13px; }
.topbar .spacer { flex: 1; }
.btn.menu-btn { display: none; }
.content { padding: 8px 28px 40px; max-width: 1360px; width: 100%; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible, .input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn.primary, .btn.success { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover, .btn.success:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.soft-success { color: var(--success); }
.btn.soft-danger { color: var(--danger); }
.btn.soft-success:hover { background: var(--success-soft); }
.btn.soft-danger:hover { background: var(--danger-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: var(--radius-sm); }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn { position: relative; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%;
  background: #dc2626; border: 1.5px solid var(--bg);
}

/* ---------------------------------------------------------------- cards & grid */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.dash { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt { margin-top: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); min-width: 0;
}
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h3 { font-size: 14.5px; }
.card-h .sub { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.card-h .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 16px 18px 18px; }
.card-b.flush { padding: 6px 0 4px; }

/* page header block */
.hero {
  position: relative; border-radius: var(--radius-lg); padding: 22px 24px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.hero .blob { display: none; }
.hero h2 { font-size: 20px; }
.hero h2 svg { width: 18px; height: 18px; vertical-align: -2px; color: var(--primary); }
.hero p { margin: 4px 0 0; color: var(--text-2); max-width: 620px; }
.hero .hero-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.hero .hero-actions .btn:first-child:not(.glass) { background: var(--primary); color: #fff; border-color: var(--primary); }
.hero .hero-actions .btn:first-child:not(.glass):hover { background: var(--primary-hover); }
.hero-stats { display: flex; gap: 32px; position: absolute; right: 24px; top: 50%; transform: translateY(-50%); }
.hero-stats > div { text-align: right; }
.hero-stats .v { font-size: 24px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-stats .l { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* balance cards */
.balances { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 12px; }
.bal {
  position: relative; padding: 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: border-color .12s;
}
.bal:hover { border-color: var(--border-strong); }
.bal .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bal .name { font-weight: 500; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.bal .name::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.bal .code { font-size: 11px; font-weight: 600; color: var(--text-3); }
.bal .val { margin-top: 10px; display: flex; align-items: baseline; gap: 6px; }
.bal .val b { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.bal .val span { color: var(--text-3); font-size: 13px; }
.bal .foot { margin-top: 12px; display: flex; gap: 12px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.bal .foot strong { color: var(--text-2); font-weight: 600; }
.bal .warn { color: var(--warning); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.bal .warn svg { width: 13px; height: 13px; }
.ring { position: absolute; right: 16px; top: 44px; width: 36px; height: 36px; }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--surface-3); }
.ring .bar { stroke: var(--primary); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .6s var(--ease); }

/* stat tile */
.stat { padding: 16px 18px; display: flex; gap: 12px; align-items: center; }
.stat .ic { width: 36px; height: 36px; border-radius: var(--radius); display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.stat .ic svg { width: 18px; height: 18px; }
.stat .v { font-size: 22px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--text-3); font-size: 12.5px; }

/* ---------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--border); }
.li:first-child { border-top: none; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .s { color: var(--text-3); font-size: 12.5px; }

.date-chip {
  width: 42px; flex: none; text-align: center; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface);
}
.date-chip .m { background: var(--surface-3); color: var(--text-3); font-size: 10px; font-weight: 600; letter-spacing: .04em; padding: 2px 0; text-transform: uppercase; }
.date-chip .d { font-weight: 600; font-size: 15px; padding: 2px 0 3px; }

/* ---------------------------------------------------------------- avatar & badges */
.av {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 12px; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border);
}
.av.sm { width: 26px; height: 26px; font-size: 10.5px; }
.av.lg { width: 44px; height: 44px; font-size: 15px; }
.av-stack { display: flex; }
.av-stack .av { border: 2px solid var(--surface); margin-left: -6px; }
.av-stack .av:first-child { margin-left: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--muted-soft); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.pending { background: var(--warning-soft); color: var(--warning); }
.badge.approved { background: var(--success-soft); color: var(--success); }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }
.badge.cancelled, .badge.expired { background: var(--muted-soft); color: var(--text-3); }
.type-pill {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 12.5px; padding: 2px 8px; border-radius: var(--radius-sm);
  color: var(--text-2); background: var(--surface-3);
}
.type-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.role-pill { font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
.t th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3);
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.t th:first-child { padding-left: 18px; }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t td:first-child { padding-left: 18px; }
.t tr:last-child td { border-bottom: none; }
.t tbody tr:hover { background: var(--surface-2); }
.t .num { font-variant-numeric: tabular-nums; font-weight: 500; }
.t .pos { color: var(--success); }
.t .neg { color: var(--danger); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .n { font-weight: 500; }
.who .e { color: var(--text-3); font-size: 12.5px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.clip { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- tabs & filters */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--border); }
.tabs button {
  border: none; background: transparent; height: 30px; padding: 0 12px; border-radius: var(--radius-sm); font-weight: 500; color: var(--text-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs .n { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--border); color: var(--text-2); font-weight: 600; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  height: 36px; padding: 0 11px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; width: 100%; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input:disabled { background: var(--surface-3); color: var(--text-3); }
.input.search { padding-left: 34px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }

/* leave type selector */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type-opt {
  position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.type-opt:hover { border-color: var(--text-3); }
.type-opt input { position: absolute; opacity: 0; }
.type-opt .nm { font-weight: 500; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.type-opt .nm i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.type-opt .bl { margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.type-opt .bl b { color: var(--text); font-size: 14px; font-weight: 600; }
.type-opt.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-soft); }
.type-opt.disabled { opacity: .45; pointer-events: none; }

.summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-radius: var(--radius); overflow: hidden; background: var(--border); border: 1px solid var(--border);
}
.summary > div { background: var(--surface-2); padding: 10px 12px; }
.summary .l { font-size: 12px; color: var(--text-3); }
.summary .v { font-size: 18px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.alert { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; border: 1px solid transparent; }
.alert svg { margin-top: 2px; }
.alert.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.alert.info { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.alert.warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 20%, transparent); }
.alert.success { background: var(--success-soft); color: var(--success); }

/* ---------------------------------------------------------------- modal / drawer */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(17, 24, 39, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s ease;
}
.overlay.drawer { justify-content: flex-end; padding: 0; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 540px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: pop .18s var(--ease);
}
.modal.wide { max-width: 700px; }
.overlay.drawer .modal { height: 100vh; max-height: none; border-radius: 0; max-width: 520px; animation: slideIn .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } }
.modal-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 4px; }
.modal-h h3 { font-size: 16px; }
.modal-h p { margin: 3px 0 0; color: var(--text-3); font-size: 13px; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-f { padding: 14px 20px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.overlay.drawer .modal-f { border-radius: 0; }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; min-width: 280px; max-width: 400px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toastIn .2s var(--ease);
}
.toast .ti { width: 18px; height: 18px; display: grid; place-items: center; flex: none; margin-top: 1px; }
.toast.success .ti { color: var(--success); }
.toast.error .ti { color: var(--danger); }
.toast.info .ti { color: var(--text-3); }
.toast .ti svg { width: 16px; height: 16px; stroke-width: 2.5; }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- notifications popover */
.popover {
  position: absolute; top: 58px; right: 28px; width: 360px; max-height: 500px; overflow: hidden; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 60; animation: pop .15s var(--ease);
}
.popover .ph { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.popover .ph h4 { font-size: 14px; }
.popover .pb { overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--primary-soft); }
.notif .ni { width: 28px; height: 28px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.notif .ni svg { width: 15px; height: 15px; }
.notif.success .ni { color: var(--success); }
.notif.danger .ni { color: var(--danger); }
.notif.warning .ni { color: var(--warning); }
.notif .nt { font-weight: 500; font-size: 13px; }
.notif .nb { color: var(--text-2); font-size: 12.5px; }
.notif .nd { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }

/* ---------------------------------------------------------------- empty / skeleton */
.empty { text-align: center; padding: 36px 20px; color: var(--text-3); }
.empty .ei { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: var(--radius); display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.empty .ei svg { width: 20px; height: 20px; }
.empty h4 { color: var(--text); font-size: 14px; margin-bottom: 2px; }
.skel { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: 220px; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .gl { stroke: var(--border); }
.chart g.col:hover rect.b { opacity: .8; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--text-3); transition: width .6s var(--ease); }

/* ---------------------------------------------------------------- calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .dow { padding: 8px 10px; font-size: 12px; font-weight: 500; color: var(--text-3); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal .day { min-height: 110px; padding: 6px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day:nth-child(7n) { border-right: none; }
.cal .day.out .dn { color: var(--text-3); opacity: .6; }
.cal .day.weekend, .cal .day.out, .cal .day.holiday { background: var(--surface-2); }
.cal .dn { font-weight: 500; font-size: 13px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .dn { background: var(--primary); color: #fff; }
.cal .hol { font-size: 11.5px; font-weight: 500; color: var(--text-2); display: flex; gap: 4px; align-items: center; }
.cal .hol svg { width: 12px; height: 12px; }
.cal .ev {
  font-size: 11.5px; font-weight: 500; padding: 2px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--surface-3); color: var(--text); border-left: 3px solid var(--c);
}
.cal .ev.pending { background: transparent; border: 1px dashed var(--border-strong); border-left: 3px solid var(--c); color: var(--text-2); }
.cal .more { font-size: 11px; color: var(--text-3); padding-left: 4px; }

/* comp-off cards */
.co-card { padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.co-card .co-top { display: flex; gap: 12px; align-items: center; }
.co-card .days-left { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.co-card.urgent { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.co-card.urgent .meter > span { background: var(--warning); }

/* team cards */
.team-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.team-card .tc-h { display: flex; align-items: center; gap: 12px; }
.team-card .tc-ic { width: 38px; height: 38px; border-radius: var(--radius); display: grid; place-items: center; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); font-weight: 600; font-size: 15px; }
.team-card h3 { font-size: 15px; }
.team-card .lead { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.member-pick { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.member-pick label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.member-pick label:last-child { border-bottom: none; }
.member-pick label:hover { background: var(--surface-2); }

/* policies */
.policy { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.policy .ph { display: flex; gap: 10px; align-items: center; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kv > div { padding: 9px 11px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.kv .k { font-size: 12px; color: var(--text-3); }
.kv .v { font-weight: 600; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art {
  position: relative; color: #e5e7eb; padding: 40px 48px; display: flex; flex-direction: column;
  background: #111827;
}
.login-art .brand-name { color: #fff; }
.login-art .brand-sub { color: #9ca3af; }
.login-art h1 { font-size: 34px; line-height: 1.2; font-weight: 600; color: #fff; margin-top: auto; max-width: 520px; }
.login-art p.lead { font-size: 15px; color: #9ca3af; max-width: 460px; margin: 14px 0 28px; }
.float-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.fcard { padding: 12px 14px; border-radius: var(--radius-lg); background: #1f2937; border: 1px solid #374151; min-width: 160px; }
.fcard .l { font-size: 12px; color: #9ca3af; }
.fcard .v { font-size: 19px; font-weight: 600; color: #fff; margin-top: 2px; }
.fcard .bar { height: 4px; border-radius: 99px; background: #374151; margin-top: 10px; overflow: hidden; }
.fcard .bar span { display: block; height: 100%; border-radius: inherit; background: #60a5fa; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--surface); }
.login-form .box { width: 100%; max-width: 380px; }
.login-form h2 { font-size: 24px; }
.login-form .sub { color: var(--text-3); margin: 4px 0 24px; }
.demo { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.demo .lbl { font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }
.demo .lbl code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }
.demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.demo-grid button {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius); padding: 8px 10px; cursor: pointer; text-align: left;
}
.demo-grid button:hover { border-color: var(--primary); background: var(--primary-soft); }
.demo-grid .r { font-size: 11.5px; color: var(--text-3); }
.demo-grid .n { font-weight: 500; font-size: 13px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.dash { grid-template-columns: 1fr; }
  .hero-stats { position: static; transform: none; margin-top: 18px; }
  .hero-stats > div { text-align: left; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s var(--ease); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .btn.menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .cal .day { min-height: 76px; }
  .topbar .title p { display: none; }
  .apply-label { display: none; }
}
@media (max-width: 600px) {
  .grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .popover { right: 12px; left: 12px; width: auto; }
  .summary { grid-template-columns: 1fr; }
}
