/* =========================================================
   Signity HRMS - Prototype styles
   Brand colours taken from the Signity logo (blue + orange)
   ========================================================= */
:root {
  --brand: #1677c8;
  --brand-600: #0f63a8;
  --brand-50: #eaf3fb;
  --brand-100: #d3e6f7;
  --accent: #f0592a;
  --accent-50: #fdeee8;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --text: #1c2433;
  --text-2: #546173;
  --text-3: #8a95a5;

  --good: #12805c;   --good-bg: #e3f5ee;
  --warn: #a15c00;   --warn-bg: #fff3dc;
  --bad:  #c4321f;   --bad-bg:  #fde9e6;
  --info: #5b4bc4;   --info-bg: #eeebfc;
  --muted-bg: #eef1f5;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --sidebar-w: 248px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); border-color: #cfd6e0; }
.btn:focus-visible, .input:focus-visible, .nav a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #d94b1e; border-color: #d94b1e; }
.btn-good { background: var(--good-bg); border-color: transparent; color: var(--good); }
.btn-good:hover { background: #cdeee1; border-color: transparent; }
.btn-bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.btn-bad:hover { background: #fad5cf; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--muted-bg); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px 14px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 50%; position: relative; }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: 13px; color: var(--text-2); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
textarea.input { resize: vertical; min-height: 80px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
.form-error { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--text-3); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--muted-bg); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad  { background: var(--bad-bg);  color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-50); color: var(--brand-600); }
.badge.accent { background: var(--accent-50); color: #b8401a; }

/* ---------- Avatar ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; color: #fff; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.login-hero { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(circle at 85% 10%, rgba(240, 89, 42, .55), transparent 42%), linear-gradient(150deg, #0d4f8b 0%, #1677c8 55%, #2a8fdc 100%); }
.login-hero::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .07); }
.login-hero .tag { display: inline-block; background: rgba(255, 255, 255, .16); padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.login-hero h1 { font-size: 38px; font-weight: 700; margin: 18px 0 14px; letter-spacing: -.02em; max-width: 520px; }
.login-hero p { font-size: 16px; opacity: .88; max-width: 460px; margin: 0; }
.hero-features { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 520px; position: relative; z-index: 1; }
.hero-feature { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); border-radius: var(--radius); padding: 14px; backdrop-filter: blur(4px); }
.hero-feature strong { display: block; font-size: 14px; margin-bottom: 2px; }
.hero-feature span { font-size: 12.5px; opacity: .82; }
.hero-foot { font-size: 12px; opacity: .7; position: relative; z-index: 1; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.login-card { width: 100%; max-width: 400px; }
.login-card .logo { height: 52px; margin-bottom: 28px; }
.login-card h2 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.login-card .sub { color: var(--text-2); margin: 6px 0 26px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 12px; cursor: pointer; padding: 6px 8px; }
.login-meta { display: flex; justify-content: space-between; align-items: center; margin: 2px 0 20px; font-size: 13px; }
.check { display: inline-flex; gap: 8px; align-items: center; color: var(--text-2); cursor: pointer; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.login-divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 22px 0; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 28px; }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 24px; }
  .login-hero h1 { font-size: 28px; }
  .hero-features, .hero-foot { display: none; }
}

/* =========================================================
   DEMO LOGINS BUBBLE
   ========================================================= */
.demo-fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; background: var(--accent); color: #fff; font-weight: 600; padding: 12px 18px 12px 14px; border-radius: 999px; box-shadow: 0 8px 24px rgba(240, 89, 42, .4); transition: transform .15s; }
.demo-fab:hover { transform: translateY(-2px); }
.demo-fab .pulse { width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }
.demo-panel { position: fixed; right: 20px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); z-index: 61; width: 370px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.demo-head { padding: 14px 16px; background: linear-gradient(120deg, #0f63a8, #1677c8); color: #fff; display: flex; justify-content: space-between; align-items: center; }
.demo-head strong { font-size: 15px; }
.demo-head span { font-size: 12px; opacity: .85; display: block; }
.demo-head button { background: rgba(255, 255, 255, .18); border: 0; color: #fff; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 16px; }
.demo-list { padding: 8px; max-height: 60vh; overflow: auto; }
.demo-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.demo-item:hover { background: var(--brand-50); border-color: var(--brand-100); }
.demo-item.current { background: var(--surface-2); border-color: var(--border); cursor: default; }
.demo-item .who { min-width: 0; }
.demo-item .who b { display: block; font-size: 13.5px; }
.demo-cred { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11.5px; color: var(--text-2); line-height: 1.5; word-break: break-all; }
.demo-foot { border-top: 1px solid var(--border); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-3); }

/* =========================================================
   APP SHELL
   ========================================================= */
.app { display: flex; min-height: 100vh; }
/* ---------- Sidebar drawer (see js/nav.js) ---------- */
:root { --rail-w: 76px; }
.sidebar { width: var(--sidebar-w); 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: width .22s ease, transform .2s ease; }
.sidebar .brand { height: 68px; flex: none; display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--border); position: relative; }
.sidebar .brand img { height: 40px; width: 97px; object-fit: cover; object-position: left center; transition: width .22s ease; }
.sb-toggle { position: absolute; right: -13px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); z-index: 2; padding: 0; }
.sb-toggle:hover { color: var(--brand); border-color: var(--brand-100); background: var(--brand-50); }
.sb-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sb-toggle svg { width: 14px; height: 14px; transition: transform .22s ease; }
.sidebar .role-pill { margin: 14px 14px 4px; padding: 9px 12px; border-radius: 10px; background: var(--brand-50); color: var(--brand-600); font-size: 12px; font-weight: 600; display: flex; gap: 8px; align-items: center; white-space: nowrap; overflow: hidden; flex: none; }
.sidebar .role-pill svg { width: 16px; height: 16px; }

.nav-search { margin: 8px 14px 2px; position: relative; flex: none; }
.nav-search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.nav-search input { width: 100%; height: 36px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 9px; padding: 0 30px 0 33px; font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.nav-search input::-webkit-search-cancel-button { display: none; }
.nav-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); background: var(--surface); }
.nav-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 11px ui-monospace, Consolas, monospace; color: var(--text-3); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); pointer-events: none; }
.nav-search input:focus ~ kbd { display: none; }
.nav-search-btn { display: none; }

.nav { padding: 4px 10px 16px; overflow-y: auto; overflow-x: hidden; flex: 1; scrollbar-width: thin; scrollbar-color: #d5dce5 transparent; }
.nav-heading { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; padding: 14px 12px 6px; white-space: nowrap; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: 9px; color: var(--text-2); font: inherit; font-weight: 500; font-size: 13.5px; border: 0; background: none; cursor: pointer; text-align: left; text-decoration: none; position: relative; min-height: 38px; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.nav-item > svg { width: 19px; height: 19px; flex: none; }
.nav-lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-lbl mark { background: #ffe7a8; color: inherit; border-radius: 3px; padding: 0 1px; }
.nav-chev { display: flex; }
.nav-chev svg { width: 15px; height: 15px; color: var(--text-3); transition: transform .22s ease; }
.nav-group.open > .nav-item .nav-chev svg { transform: rotate(180deg); }
.nav-count { background: var(--accent); color: #fff; font-size: 11px; border-radius: 999px; padding: 0 7px; font-weight: 600; line-height: 18px; flex: none; }
.nav-tag { font-size: 10px; font-weight: 600; color: var(--text-3); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; line-height: 16px; flex: none; opacity: 0; transition: opacity .15s; }
.nav-item:hover .nav-tag, .nav-item:focus-visible .nav-tag { opacity: 1; }

/* active states */
.nav-item.d0.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(22, 119, 200, .28); }
.nav-group.has-active > .nav-item.d0 { color: var(--brand-600); }
.nav-group.has-active > .nav-item.d0 > svg { color: var(--brand); }
.nav-group.has-active:not(.open) > .nav-item.d0 { background: var(--brand-50); }

/* sub menus: animated accordion with a guide line */
.nav-sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.nav-group.open > .nav-sub { grid-template-rows: 1fr; }
.nav-sub-in { overflow: hidden; min-height: 0; margin-left: 19px; padding-left: 10px; border-left: 1.5px solid var(--border); }
.nav-group.open > .nav-sub > .nav-sub-in { padding-block: 2px 4px; }
.nav-item.d1, .nav-item.d2, .nav-item.d3, .nav-item.d4 { font-size: 13px; padding: 6px 10px; min-height: 34px; gap: 10px; }
.nav-sub-in .nav-sub-in { margin-left: 12px; }
.nav-bullet { width: 6px; height: 6px; border-radius: 50%; background: #cdd5df; flex: none; transition: background .15s, transform .15s; }
.nav-item:hover .nav-bullet { background: var(--text-3); }
.nav-group > .nav-item:not(.d0) .nav-bullet { border-radius: 2px; }
.nav-item.active:not(.d0) { color: var(--brand-600); background: var(--brand-50); font-weight: 600; }
.nav-item.active:not(.d0) .nav-bullet { background: var(--brand); transform: scale(1.35); }
.nav-item.active:not(.d0)::before { content: ''; position: absolute; left: -11.5px; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--brand); }
.nav-group.has-active > .nav-item:not(.d0) { color: var(--text); font-weight: 600; }
.nav-empty { padding: 24px 12px; color: var(--text-3); font-size: 13px; text-align: center; }

.sidebar .side-foot { padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; flex: none; }
.sf-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); flex: none; }

/* fly-out menu for the collapsed rail */
.nav-fly { position: fixed; z-index: 70; width: 250px; max-height: calc(100vh - 16px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: flyin .14s ease-out; }
@keyframes flyin { from { opacity: 0; transform: translateX(-6px); } }
.nav-fly-head { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; padding: 8px 10px 6px; display: flex; justify-content: space-between; align-items: center; }
.nav-fly > .nav-item.d1, .nav-fly > .nav-group > .nav-item.d1 { padding-left: 10px; }
.nav-fly.tip { width: auto; padding: 7px 12px; font-weight: 600; font-size: 12.5px; background: #1c2433; color: #fff; border-color: #1c2433; white-space: nowrap; }

/* collapsed rail — desktop only */
@media (min-width: 1001px) {
  .app.collapsed .sidebar { width: var(--rail-w); }
  .app.collapsed .main { margin-left: var(--rail-w); }
  .app.collapsed .sidebar .brand { padding: 0 0 0 21px; }
  .app.collapsed .sidebar .brand img { width: 34px; }
  .app.collapsed .sb-toggle svg { transform: rotate(180deg); }
  .app.collapsed .sidebar .role-pill { justify-content: center; padding: 9px 0; margin: 14px 14px 4px; }
  .app.collapsed .sidebar .role-pill span { display: none; }
  .app.collapsed .nav-search > svg, .app.collapsed .nav-search input, .app.collapsed .nav-search kbd { display: none; }
  .app.collapsed .nav-search { margin: 6px 14px 0; }
  .app.collapsed .nav-search-btn { display: flex; width: 100%; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--surface-2); border-radius: 9px; cursor: pointer; color: var(--text-2); }
  .app.collapsed .nav-search-btn:hover { color: var(--brand); border-color: var(--brand-100); }
  .app.collapsed .nav-search-btn svg { width: 17px; height: 17px; }
  .app.collapsed .nav { padding: 4px 14px 16px; }
  .app.collapsed .nav-heading { font-size: 0; padding: 10px 6px 8px; }
  .app.collapsed .nav-heading::after { content: ''; display: block; height: 1px; background: var(--border); }
  .app.collapsed .nav-section:first-child .nav-heading { display: none; }
  .app.collapsed .nav-item.d0 { justify-content: center; padding: 10px 0; }
  .app.collapsed .nav-item.d0 > .nav-lbl, .app.collapsed .nav-item.d0 > .nav-chev, .app.collapsed .nav-item.d0 > .nav-tag { display: none; }
  .app.collapsed .nav-item.d0 > .nav-count { position: absolute; top: 2px; right: 2px; padding: 0 5px; font-size: 10px; line-height: 15px; border: 2px solid var(--surface); }
  .app.collapsed .nav-group.has-active > .nav-item.d0 { background: var(--brand); color: #fff; }
  .app.collapsed .nav-group.has-active > .nav-item.d0 > svg { color: #fff; }
  .app.collapsed .nav-sub { display: none; }
  .app.collapsed .side-foot { justify-content: center; padding: 14px 0; }
  .app.collapsed .side-foot .sf-text { display: none; }
}

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .22s ease; }
.topbar { height: 68px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; }
.topbar .menu-btn { display: none; }
.search { flex: 1; max-width: 420px; position: relative; }
.search input { padding-left: 38px; background: var(--surface-2); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); }
.topbar .spacer { flex: 1; }
.dot-count { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; border: 1px solid transparent; background: none; }
.user-chip:hover { background: var(--surface-2); border-color: var(--border); }
.user-chip .meta { text-align: left; line-height: 1.2; }
.user-chip .meta b { display: block; font-size: 13px; }
.user-chip .meta span { font-size: 12px; color: var(--text-2); }
.menu { position: absolute; right: 24px; top: 62px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 230px; padding: 6px; z-index: 50; }
.menu .menu-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu button { width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--bad); }
.menu svg { width: 16px; height: 16px; }

.content { padding: 24px; max-width: 1440px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.backdrop { display: none; }
@media (max-width: 1000px) {
  .sidebar { transform: translateX(-100%); width: min(300px, 86vw); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .sb-toggle { display: none; }
  .app.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 35; }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .user-chip .meta { display: none; }
}
@media (max-width: 640px) { .search { display: none; } }

/* =========================================================
   CARDS & GRID
   ========================================================= */
.grid { display: grid; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.cols-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span-2 { grid-column: span 2; }
@media (max-width: 1200px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .cols-2, .cols-3, .cols-2-1, .cols-1-2 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }
.mt { margin-top: 18px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; }
.card-head { padding: 16px 18px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.card-body { padding: 16px 18px 18px; }
.card-body:last-child { flex: 1; }
svg { flex: none; }
.card-body.flush { padding: 8px 0 0; }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: flex-start; }
.kpi .ic { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--brand-50); color: var(--brand); }
.kpi .ic svg { width: 21px; height: 21px; }
.kpi .ic.accent { background: var(--accent-50); color: var(--accent); }
.kpi .ic.good { background: var(--good-bg); color: var(--good); }
.kpi .ic.info { background: var(--info-bg); color: var(--info); }
.kpi .label { color: var(--text-2); font-size: 13px; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* welcome banner */
.welcome { border-radius: var(--radius); padding: 22px 24px; color: #fff; background: radial-gradient(circle at 92% 0%, rgba(240, 89, 42, .55), transparent 45%), linear-gradient(120deg, #0f5c9d, #1677c8 60%, #2b93df); display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.welcome h1 { font-size: 22px; font-weight: 700; }
.welcome p { margin: 6px 0 0; opacity: .88; }
.welcome .btn { border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .14); color: #fff; }
.welcome .btn:hover { background: rgba(255, 255, 255, .24); }
.welcome .btn-accent { background: var(--accent); border-color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfcfe; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person b { display: block; font-weight: 600; font-size: 13.5px; }
.person > div > span { display: block; font-size: 12px; color: var(--text-2); }
.actions-cell { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; font-size: 13.5px; }
.list .meta { font-size: 12px; color: var(--text-2); }
.date-tile { width: 46px; flex: none; text-align: center; border-radius: 10px; background: var(--brand-50); color: var(--brand-600); padding: 5px 0; line-height: 1.1; }
.date-tile b { display: block; font-size: 17px; }
.date-tile span { font-size: 11px; text-transform: uppercase; font-weight: 600; }
.date-tile.accent { background: var(--accent-50); color: #b8401a; }
.empty { text-align: center; color: var(--text-3); padding: 26px 10px; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: var(--muted-bg); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ---------- Leave balance tiles ---------- */
.balances { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.bal { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.bal .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bal .n small { font-size: 13px; color: var(--text-3); font-weight: 500; }
.bal .t { font-size: 12.5px; color: var(--text-2); margin-bottom: 4px; }
.bal .progress { margin-top: 8px; height: 6px; }

/* ---------- Clock widget ---------- */
.clock { text-align: center; padding: 6px 0 4px; }
.clock .time { font-size: 40px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.clock .date { color: var(--text-2); margin-bottom: 14px; }
.clock .worked { display: flex; justify-content: center; gap: 28px; margin: 16px 0 4px; }
.clock .worked div b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.clock .worked div span { font-size: 12px; color: var(--text-2); }

/* ---------- Charts ---------- */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 120px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.hbar .lbl { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 14px; position: relative; }
.hbar .fill { height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; min-width: 2px; transition: opacity .15s; }
.hbar .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar:hover .fill { opacity: .8; }

.cols { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding: 0 4px; position: relative; border-bottom: 1px solid var(--border); }
.cols .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; cursor: default; }
.cols .col .bar { width: 100%; max-width: 38px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; transition: opacity .15s; }
.cols .col .bar.today { background: var(--accent); }
.cols .col .bar.empty { background: var(--muted-bg); }
.cols .col:hover .bar { opacity: .8; }
.cols .target { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--text-3); pointer-events: none; }
.cols .target span { position: absolute; right: 0; top: -18px; font-size: 11px; color: var(--text-3); background: var(--surface); padding: 0 4px; }
.col-labels { display: flex; gap: 14px; padding: 6px 4px 0; }
.col-labels span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.cols.dense, .cols.dense + .col-labels { gap: 6px; }
.cols.dense + .col-labels span { font-size: 11px; }

.stack { display: flex; height: 16px; gap: 2px; border-radius: 4px; overflow: hidden; margin: 4px 0 14px; }
.stack span { height: 100%; transition: opacity .15s; }
.stack span:hover { opacity: .8; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 16px; }
.legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }

.tooltip { position: fixed; z-index: 100; pointer-events: none; background: #1c2433; color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.tooltip b { font-variant-numeric: tabular-nums; }

/* ---------- Quick actions ---------- */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 500; font-size: 13px; color: var(--text); transition: border-color .15s, background .15s; }
.quick button:hover { border-color: var(--brand-100); background: var(--brand-50); }
.quick svg { width: 22px; height: 22px; color: var(--brand); }

/* ---------- Toggle ---------- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row b { display: block; font-size: 13.5px; font-weight: 600; }
.toggle-row span { font-size: 12px; color: var(--text-2); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: #cfd6e0; border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch i::after { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Announcement ---------- */
.announce { padding: 12px 0; border-bottom: 1px solid var(--border); }
.announce:last-child { border-bottom: 0; }
.announce .top { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.announce b { font-size: 13.5px; }
.announce p { margin: 0; color: var(--text-2); font-size: 13px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1c2433; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; gap: 10px; align-items: center; animation: pop .2s ease-out; max-width: calc(100vw - 32px); }
.toast.good::before, .toast.bad::before, .toast.info::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.toast.good::before { background: #3ddc97; }
.toast.bad::before { background: #ff7a66; }
.toast.info::before { background: #6cb8ff; }

.tabs { display: flex; gap: 4px; background: var(--muted-bg); padding: 3px; border-radius: 9px; }
.tabs button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs { flex-wrap: wrap; width: fit-content; max-width: 100%; }
.tab-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--border); font-size: 11px; text-align: center; margin-left: 2px; }
.tabs button.on .tab-count { background: var(--brand-50); color: var(--brand-600); }

/* =========================================================
   MODULE PAGES (v0.2)
   ========================================================= */
.btn-link { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: inherit; }
.btn-link:hover b { color: var(--brand); text-decoration: underline; }
.crumbs { font-size: 12px; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.modal.lg { max-width: 860px; }
.modal.xl { max-width: 1120px; }
.big-ic { width: 44px !important; height: 44px !important; color: var(--text-3); }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.gap-8 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mb { margin-bottom: 18px; }
.sep { height: 1px; background: var(--border); margin: 16px 0; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar .input { width: auto; padding: 8px 10px; }
.toolbar .search-in { flex: 1 1 220px; min-width: 0; }
.toolbar select.input { flex: 0 1 180px; }
.toolbar .count-lbl { margin-left: auto; font-size: 12.5px; color: var(--text-2); }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--brand-50); color: #174a78; font-size: 13px; }
.notice svg { width: 18px; height: 18px; margin-top: 1px; }
.notice.warn { background: var(--warn-bg); color: #6b3d00; }
.notice.bad { background: var(--bad-bg); color: #8a2214; }
.notice.good { background: var(--good-bg); color: #0d5c42; }

.form-section { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin: 6px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.form-section:not(:first-child) { margin-top: 18px; }
.field .req { color: var(--bad); }
.field .hint { margin-top: -2px; }
.input.invalid { border-color: var(--bad); }
.input-group { display: flex; align-items: stretch; }
.input-group .input:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .input:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }
.input-group .at { display: flex; align-items: center; padding: 0 10px; background: var(--surface-2); border: 1px solid var(--border); border-left: 0; border-right: 0; color: var(--text-2); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--muted-bg); font-size: 12px; color: var(--text-2); border: 1px solid transparent; }
button.chip { cursor: pointer; font-family: ui-monospace, Consolas, monospace; }
button.chip:hover { border-color: var(--brand-100); background: var(--brand-50); color: var(--brand-600); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* entity cards */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
@media (max-width: 420px) { .entity-grid { grid-template-columns: 1fr; } }
.entity-card .card-head { align-items: flex-start; }
.entity-ic { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-50); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: none; }
.entity-ic svg { width: 22px; height: 22px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.tree-indent { display: inline-block; width: 18px; border-left: 1.5px solid var(--border); height: 18px; margin-right: 6px; vertical-align: middle; border-bottom: 1.5px solid var(--border); border-bottom-left-radius: 4px; transform: translateY(-6px); }

/* privileges matrix */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix .grp td { background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 18px; }
.matrix input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.matrix input[disabled] { cursor: not-allowed; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.role-card { text-align: left; border: 1.5px solid var(--border); background: var(--surface); border-radius: 12px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.role-card:hover { border-color: var(--brand-100); }
.role-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.role-card b { font-size: 15px; }
.role-card span { font-size: 12.5px; color: var(--text-2); }

/* profile cards */
.pcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding: 18px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); text-align: center; position: relative; display: flex; flex-direction: column; }
.pcard.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.pcard.clickable:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.pcard .pc-band { height: 56px; background: linear-gradient(120deg, #0f63a8, #1677c8 60%, #f0592a); }
.pcard.h-accent .pc-band { background: linear-gradient(120deg, #f0592a, #f58a4b); }
.pcard.h-plain .pc-band { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.pcard .pc-av { margin: -32px auto 8px; }
.pcard .pc-av .avatar { width: 64px; height: 64px; font-size: 21px; border: 3px solid var(--surface); }
.pcard.av-rounded .pc-av .avatar { border-radius: 14px; }
.pcard .pc-body { padding: 0 16px 16px; flex: 1; }
.pcard .pc-name { font-weight: 700; font-size: 15px; }
.pcard .pc-status { position: absolute; top: 10px; right: 10px; }
.pcard .pc-fields { list-style: none; margin: 10px 0 0; padding: 0; font-size: 12.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.pcard .pc-fields li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pc-fields li b { color: var(--text-3); font-weight: 500; }
.pcard .pc-actions { display: flex; border-top: 1px solid var(--border); }
.pcard .pc-actions span { flex: 1; padding: 9px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; color: var(--brand); }
.pcard .pc-actions span + span { border-left: 1px solid var(--border); }
.pcard.horizontal { flex-direction: row; text-align: left; align-items: stretch; flex-wrap: wrap; }
.pcard.horizontal .pc-band { width: 8px; height: auto; flex: none; }
.pcard.horizontal .pc-av { margin: 16px 0 0 16px; }
.pcard.horizontal .pc-av .avatar { width: 56px; height: 56px; border: 0; }
.pcard.horizontal .pc-body { padding: 16px; flex: 1; min-width: 0; }
.pcard.horizontal .pc-status { position: static; margin-top: 4px; display: inline-block; }
.pcard.horizontal .pc-actions { flex-basis: 100%; }
.preview-stage { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, #f1f4f8 10px, #f1f4f8 20px); border-radius: 12px; padding: 28px; display: flex; justify-content: center; align-items: center; min-height: 320px; border: 1px dashed var(--border); }
.preview-stage .pcard { width: 280px; max-width: 100%; }
.preview-stage .pcard.horizontal { width: 380px; }
.field-order { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.field-order li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface); }
.field-order li:last-child { border-bottom: 0; }
.field-order li.off { background: var(--surface-2); color: var(--text-3); }
.field-order li .grow { flex: 1; }
.field-order .mv { width: 28px; height: 28px; padding: 0; }
.field-order input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
.list-select li { cursor: pointer; padding: 11px 12px; border-radius: 10px; border: 1px solid transparent; border-bottom: 1px solid var(--border); }
.list-select li.on { background: var(--brand-50); border-color: var(--brand-100); }
.list-select li:hover { background: var(--surface-2); }

/* letters */
.letter { background: #fff; color: #1c2433; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); padding: 36px 44px; font-family: Georgia, 'Times New Roman', serif; font-size: 14px; line-height: 1.65; max-width: 720px; margin: 0 auto; }
.letter .lh { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--brand); padding-bottom: 12px; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.letter .lh img { height: 40px; }
.letter .lh div { font-family: var(--font); font-size: 11px; color: var(--text-2); text-align: right; line-height: 1.4; }
.letter .lbody { white-space: pre-wrap; }
.letter .ph-missing { background: var(--warn-bg); color: var(--warn); padding: 0 3px; border-radius: 3px; font-family: var(--font); font-size: 12px; }
.letter .lfoot { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 8px; font-family: var(--font); font-size: 10.5px; color: var(--text-3); text-align: center; }
.tpl-editor { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
.tpl-editor textarea { min-height: 380px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.6; }
@media (max-width: 800px) { .tpl-editor { grid-template-columns: 1fr; } }
.letter-wrap { background: var(--surface-2); padding: 20px; border-radius: 10px; max-height: 60vh; overflow: auto; }

/* upload / import */
.dropzone { border: 2px dashed #c7d3e2; border-radius: 12px; padding: 26px; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-50); }
.dropzone svg { width: 30px; height: 30px; color: var(--brand); }
.dropzone p { margin: 8px 0 12px; color: var(--text-2); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.step { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; font-size: 13px; }
.step.done .n { background: var(--good); }
.step b { display: block; font-size: 13.5px; }
.step span { font-size: 12.5px; color: var(--text-2); }
.err-list { margin: 4px 0 0; padding-left: 16px; color: var(--bad); font-size: 12px; }
.change { font-size: 12px; }
.change s { color: var(--text-3); }
.change b { color: var(--good); font-weight: 600; }
tr.row-error td { background: #fffafa; }
.setup-list li { padding: 10px 0; }
.setup-dot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; background: var(--muted-bg); color: var(--text-3); }
.setup-dot.done { background: var(--good-bg); color: var(--good); }
.setup-dot svg { width: 14px; height: 14px; }

/* =========================================================
   Leave & Attendance (v0.4)
   ========================================================= */
/* attendance status chips */
.ac { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; padding: 0 4px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .01em; position: relative; line-height: 1; white-space: nowrap; }
.ac.big { min-width: 34px; height: 24px; font-size: 11.5px; }
.ac-P { background: #e3f5ee; color: #12805c; }
.ac-WFH { background: #eaf3fb; color: #1677c8; }
.ac-OD { background: #e0f3f6; color: #0f7487; }
.ac-HD { background: #fff3dc; color: #a15c00; }
.ac-MP { background: #fdeee8; color: #b8401a; box-shadow: inset 0 0 0 1px #f3b59d; }
.ac-A { background: #fde9e6; color: #c4321f; }
.ac-LV { background: #eeebfc; color: #5b4bc4; }
.ac-H { background: #eef1f5; color: #546173; }
.ac-WO { background: transparent; color: #a5afbd; font-weight: 600; }
.ac-none { background: transparent; color: var(--text-3); }
.ac.late::after { content: ''; position: absolute; top: -2px; right: -2px; width: 7px; height: 7px; border-radius: 50%; background: #d48806; border: 1.5px solid var(--surface); }
.ac.edited { box-shadow: inset 0 -2px 0 currentColor; }
.att-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); align-items: center; }
.att-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.lt-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: 0; flex: none; }

/* monthly muster */
.muster-wrap { overflow: auto; max-height: 70vh; }
table.muster { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.muster th, .muster td { padding: 4px 2px; text-align: center; border-bottom: 1px solid var(--border); background: var(--surface); }
.muster thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 600; color: var(--text-3); font-size: 11px; line-height: 1.2; padding: 6px 2px; }
.muster thead th small { display: block; font-weight: 500; font-size: 10px; }
.muster th.we, .muster td.we { background: #fafbfc; }
.muster thead th.today { color: var(--accent); }
.muster td.today { background: #fff8f5; }
.muster .emp { position: sticky; left: 0; z-index: 1; text-align: left; padding: 6px 12px; min-width: 200px; max-width: 220px; border-right: 1px solid var(--border); }
.muster thead .emp { z-index: 3; }
.muster .emp b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muster .emp span { color: var(--text-3); font-size: 11px; }
.muster .sum { font-weight: 700; color: var(--text-2); min-width: 34px; font-variant-numeric: tabular-nums; background: var(--surface-2); }
.muster .sum.last { border-right: 1px solid var(--border); }
.muster .ac { min-width: 24px; padding: 0 3px; }
.muster .ac-WO { font-size: 9.5px; }
.muster td button { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 6px; }
.muster td button:hover .ac { outline: 2px solid var(--brand-100); }
.month-nav { display: inline-flex; align-items: center; gap: 4px; }
.month-nav b { min-width: 92px; text-align: center; font-size: 13.5px; }
.month-nav .btn { padding: 6px 8px; }

/* leave calendar bars */
.lcal td.lc { padding: 3px 1px; }
.lcal .lbar { display: block; height: 20px; border-radius: 5px; min-width: 22px; font-size: 10px; font-weight: 700; color: #fff; line-height: 20px; }
.lcal .lbar.pending { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.45) 0 4px, transparent 4px 8px) !important; opacity: .8; }
.lcal .lbar.half { width: 55%; margin: 0 auto; }

/* my attendance calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; text-align: center; padding-bottom: 2px; }
.cal .day { border: 1px solid var(--border); border-radius: 10px; padding: 7px 8px; min-height: 84px; background: var(--surface); text-align: left; display: flex; flex-direction: column; gap: 4px; cursor: pointer; font: inherit; color: inherit; }
.cal .day:hover { border-color: var(--brand-100); box-shadow: var(--shadow); }
.cal .day.out { visibility: hidden; }
.cal .day.we { background: var(--surface-2); }
.cal .day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal .day.future { cursor: default; }
.cal .day .dn { font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.cal .day .tm { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cal .day .hr { font-size: 11px; color: var(--text-3); margin-top: auto; }
@media (max-width: 700px) { .cal { gap: 3px; } .cal .day { min-height: 58px; padding: 4px; } .cal .day .tm, .cal .day .hr { display: none; } }

/* balance cards */
.bal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.bal-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); position: relative; overflow: hidden; }
.bal-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--brand)); }
.bal-card .t { font-size: 12.5px; color: var(--text-2); font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.bal-card .n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.bal-card .n small { font-size: 12px; color: var(--text-3); font-weight: 500; letter-spacing: 0; }
.bal-card .meta { font-size: 11.5px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.bal-card .progress { margin-top: 10px; }
.bal-card .progress > span { background: var(--c, var(--brand)); }

/* forms */
.lt-rules { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 12px; }
.lt-rules:empty { display: none; }
.calc { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; margin: -4px 0 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calc:empty { display: none; }
.calc.bad { background: var(--bad-bg); border-color: #f6c4bc; color: #8a2214; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { width: 28px; height: 28px; border-radius: 8px; cursor: pointer; position: relative; display: block; }
.swatches input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatches label:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px currentColor; }
.day-picks { display: flex; gap: 6px; flex-wrap: wrap; }
.day-picks label { border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; user-select: none; }
.day-picks label:has(input:checked) { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-600); font-weight: 600; }
.day-picks input { display: none; }

/* approval trail */
.trail { list-style: none; margin: 0; padding: 0 0 0 18px; position: relative; }
.trail::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.trail li { position: relative; padding: 0 0 12px; display: flex; flex-direction: column; font-size: 13px; }
.trail li::before { content: ''; position: absolute; left: -18px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface); }
.trail li.pending::before { background: var(--surface); border-color: var(--warn); }
.trail li.bad::before { background: var(--bad); }
.trail li span { color: var(--text-2); font-size: 12px; }

/* stacked columns */
.cols .col .sbar { width: 100%; max-width: 38px; display: flex; flex-direction: column-reverse; gap: 2px; min-height: 0; }
.cols .col .sbar span { display: block; border-radius: 2px; min-height: 2px; }
.cols .col .sbar span:last-child { border-radius: 4px 4px 2px 2px; }
.cols .col:hover .sbar { opacity: .85; }

/* shifts */
.shift-bar { position: relative; height: 10px; border-radius: 99px; background: var(--muted-bg); margin: 10px 0 4px; }
.shift-bar span { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.shift-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-3); }

/* reports */
.report-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.report-nav { padding: 8px; }
.report-nav .rn-h { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 10px 10px 6px; }
.report-nav button { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.report-nav button:hover { background: var(--surface-2); }
.report-nav button.on { background: var(--brand-50); color: var(--brand-600); }
.report-nav button svg { margin-top: 2px; flex: none; }
.report-nav button b { font-size: 13px; font-weight: 600; display: block; }
.report-nav button span { font-size: 11.5px; color: var(--text-3); }
@media (max-width: 1000px) { .report-layout { grid-template-columns: 1fr; } }
.sum-row td { background: var(--surface-2); font-weight: 700; }
.bar-in { display: flex; align-items: center; gap: 8px; }
.bar-in i { display: block; height: 6px; border-radius: 99px; background: var(--brand); min-width: 2px; }
.req-kind { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.req-kind svg { color: var(--brand); }
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.mini-kpis div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.mini-kpis b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.mini-kpis span { font-size: 11.5px; color: var(--text-2); }

/* =========================================================
   Asset management (v0.5)
   ========================================================= */
.asset-cell { display: flex; gap: 10px; align-items: center; text-align: left; }
.asset-cell .entity-ic { width: 34px; height: 34px; border-radius: 8px; }
.asset-cell .entity-ic svg { width: 18px; height: 18px; }
.asset-cell b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.asset-cell span { font-size: 12px; color: var(--text-2); }
.asset-cell .mono { font-size: 11.5px; color: var(--text-2); }
.holder-box { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.asset-kpis button { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.asset-kpis button:hover { border-color: var(--brand-100); background: var(--brand-50); }
.asset-kpis button.on { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 1px var(--brand); }
.asset-kpis button b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.asset-kpis button span { font-size: 11.5px; color: var(--text-2); }
button.chip svg { width: 13px; height: 13px; }
.day-picks label svg { width: 18px; height: 18px; vertical-align: -4px; }

/* =========================================================
   Asset management v0.6 · tab strip, asset list, categories & types, acknowledgement
   ========================================================= */
.asset-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: -4px 0 18px; scrollbar-width: thin; }
.asset-tabs a { flex: none; padding: 10px 14px; font-size: 13px; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.asset-tabs a:hover { color: var(--text); }
.asset-tabs a.on { color: var(--brand-600); border-bottom-color: var(--brand); font-weight: 600; }
.asset-tabs .tab-count { background: var(--warn-bg); color: #6b3d00; }
.u-tabs { display: flex; gap: 18px; padding: 0 18px; border-top: 1px solid var(--border); }
.u-tabs span { padding: 10px 2px; font-size: 13px; font-weight: 600; color: var(--text); border-bottom: 2px solid var(--brand); margin-bottom: -1px; }
.btn-outline { border-color: var(--brand); color: var(--brand-600); background: var(--surface); }
.btn-outline:hover { background: var(--brand-50); }
.split-btn { display: inline-flex; }
.split-btn .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-btn .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(255,255,255,.35); padding-left: 8px; padding-right: 8px; }
.pop-menu { position: fixed; right: auto; top: 0; z-index: 400; min-width: 220px; max-height: 70vh; overflow-y: auto; }
.pop-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.pager .btn { width: 30px; height: 30px; padding: 0; }
.pager .btn[disabled] { opacity: .35; cursor: default; }
.pager .flip svg { transform: rotate(180deg); }
.asset-layout { grid-template-columns: 260px minmax(0, 1fr); }
.type-nav { max-height: calc(100vh - 170px); overflow-y: auto; position: sticky; top: 76px; }
.type-nav button { align-items: center; padding: 8px 10px; }
.type-nav button svg { margin-top: 0; color: var(--brand); }
.type-nav button div { flex: 1; min-width: 0; }
.type-nav button b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-nav button.on b { font-weight: 600; }
.type-nav .tn-count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.type-nav .rn-h { background: var(--surface-2); border-radius: 6px; margin-top: 6px; }
.toolbar.filters { gap: 0; padding: 0; }
.toolbar.filters > * { border-radius: 0; border: 0; border-right: 1px solid var(--border); padding: 12px 14px !important; flex: 1 1 150px; min-width: 0; background: transparent; }
.toolbar.filters > :last-child { border-right: 0; flex: 1.4 1 180px; }
.toolbar.filters .date-f { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.toolbar.filters .date-f span { white-space: nowrap; }
.toolbar.filters .date-f input { border: 0; padding: 0; width: 130px; flex: 1; background: transparent; }
.flag-chip { background: var(--brand-50); color: var(--brand-600); }
.flag-chip button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; display: inline-flex; }
.flag-chip svg { width: 13px; height: 13px; }
.asset-list td, .asset-list th { padding-left: 14px; padding-right: 14px; }
.asset-list th { white-space: nowrap; }
.sum-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .sum-grid { grid-template-columns: 1fr; } }
.cat-table .cat-row td { background: var(--surface-2); }
.type-link { display: inline-flex; gap: 8px; align-items: center; padding-left: 12px; }
.type-link svg { color: var(--brand); }
.trail.compact li { padding-bottom: 9px; }
.trail.compact .btn-link { font-size: 12px; }
.cat-nav { padding: 0; overflow: hidden; }
.cat-nav .cat-search { position: relative; padding: 10px; border-bottom: 1px solid var(--border); }
.cat-nav .cat-search svg { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.cat-nav .cat-search input { padding-left: 34px; }
.cat-nav button { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: none; padding: 12px 16px; cursor: pointer; font: inherit; color: var(--text); }
.cat-nav button:hover { background: var(--surface-2); }
.cat-nav button.on { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand); }
.cat-nav button b { font-weight: 500; font-size: 13.5px; }
.cat-nav button span { font-size: 12px; color: var(--text-3); }
.type-name { display: inline-flex; gap: 8px; align-items: center; }
.type-name svg { color: var(--brand); }
.type-name b { font-weight: 500; }
.ack-card { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn-bg); }
.ack-statement { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.55; margin: 14px 0 10px; color: var(--text-2); }
.chip-check { background: var(--muted-bg); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.ack-notice { align-items: center; }
.ack-notice span { flex: 1; }
.section-h { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 12px; }
.section-h h2 { font-size: 15px; margin: 0; display: flex; gap: 8px; align-items: center; }
.section-h p { margin: 0; font-size: 12.5px; color: var(--text-2); }
.id-preview { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border); font-size: 13.5px; }
@media (max-width: 1000px) { .type-nav { position: static; max-height: 300px; } .toolbar.filters > * { flex: 1 1 45%; border-bottom: 1px solid var(--border); } }.asset-list td, .asset-list th { padding-left: 11px; padding-right: 11px; font-size: 13px; }
.asset-list th { font-size: 11.5px; }
.cat-table th, .cat-table td { padding-left: 12px; padding-right: 12px; }
.mini-kpis.asset-kpis { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); }