/* ==========================================================================
   Pinch One · shared design system
   Tokens → reset → shell (sidebar, topbar, page) → components → home →
   dialogs / palette / toast → auth pages → responsive → print
   ========================================================================== */

:root {
  /* brand: sampled from the Pinch logo */
  --blue: #1d7db9;
  --blue-ink: #155f8f;
  --blue-deep: #0f4a70;
  --blue-wash: #eaf3fa;
  --blue-soft: #cfe3f2;
  --ink: #292f3d;
  --ink-2: #4b5263;
  --muted: #6b7382;
  --faint: #9ca3af;
  --canvas: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f0eee9;
  --line: #e5e3dd;
  --line-2: #d8d5cd;
  --ok: #2a7a58;
  --ok-wash: #e6f4ec;
  --warn: #9a6410;
  --warn-wash: #fbf2de;
  --danger: #b0433a;
  --danger-wash: #fbeae7;
  --violet: #6157c9;
  --violet-wash: #edebfa;
  --r-sm: 7px;
  --r: 11px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(41, 47, 61, .04), 0 1px 3px rgba(41, 47, 61, .05);
  --shadow-2: 0 8px 24px -10px rgba(41, 47, 61, .16), 0 2px 6px rgba(41, 47, 61, .05);
  --shadow-3: 0 28px 70px -24px rgba(41, 47, 61, .32);
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  color-scheme: light;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
h3 { font-size: 13.5px; font-weight: 600; }
small { font-size: 11.5px; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .55; }
select { cursor: pointer; }
img { max-width: 100%; display: block; }
svg { display: block; }
kbd { font-family: inherit; font-size: 10.5px; padding: 2px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--surface); border-radius: 5px; color: var(--muted); line-height: 1.3; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.sr-only, .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: fixed; top: -80px; left: 20px; background: var(--surface); z-index: 200; padding: 10px 14px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); }
.skip-link:focus { top: 14px; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px 16px; background: #fbfaf8; border-right: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden; min-width: 0; max-width: 100vw;
}
.brand { display: flex; align-items: center; gap: 10px; margin: 0 8px 18px; width: fit-content; }
.brand img { width: 92px; height: 36px; object-fit: contain; }
.brand-suffix { border-left: 1px solid var(--line-2); padding-left: 10px; font-size: 12.5px; letter-spacing: 3px; font-weight: 600; color: var(--ink-2); }
.brand:hover { text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nav-group { margin: 14px 10px 6px; font-size: 10px; font-weight: 600; letter-spacing: 1.3px; text-transform: uppercase; color: var(--faint); }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 8px 10px;
  border-radius: 9px; color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; min-width: 0;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-link .icon { color: var(--muted); transition: color .15s; }
.nav-link > span:not(.nav-badge) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav-link:hover .icon { color: var(--ink); }
.nav-link.active { background: var(--blue-wash); color: var(--blue-ink); }
.nav-link.active .icon { color: var(--blue); }
.nav-link.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--blue); color: #fff; font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.nav-badge.quiet { background: var(--surface-3); color: var(--muted); }
.nav-badge[hidden] { display: none; }
.nav-kbd { margin-left: auto; opacity: 0; transition: opacity .15s; }
.nav-link:hover .nav-kbd { opacity: 1; }
.sidebar-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.identity { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--line); margin-top: 8px; min-width: 0; }
.identity-text { min-width: 0; flex: 1; }
.identity-text strong { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity-text small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-wash); color: var(--blue-ink); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; letter-spacing: .3px; }
.avatar.sm { width: 26px; height: 26px; font-size: 9.5px; }

.app { margin-left: var(--sidebar-w); min-height: 100vh; position: relative; isolation: isolate; }
.app::before { content: ""; position: fixed; inset: 0; left: var(--sidebar-w); z-index: -1; pointer-events: none; background-image: var(--grain); background-size: 220px 220px; opacity: .42; mix-blend-mode: multiply; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 32px;
  background: rgba(245, 244, 240, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(229, 227, 221, .8);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs strong { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep .icon { width: 14px; height: 14px; color: var(--faint); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.palette-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 260px; height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, .7); color: var(--muted); font-size: 12.5px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.palette-trigger:hover { background: #fff; border-color: var(--line-2); box-shadow: var(--shadow-1); }
.palette-trigger .icon { width: 16px; height: 16px; }
.palette-trigger span { flex: 1; text-align: left; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; line-height: 1; }
.chip .icon { width: 12px; height: 12px; }
.chip.ok { background: var(--ok-wash); color: var(--ok); }
.chip.warn { background: var(--warn-wash); color: var(--warn); }
.chip.danger { background: var(--danger-wash); color: var(--danger); }
.chip.info { background: var(--blue-wash); color: var(--blue-ink); }
.chip.violet { background: var(--violet-wash); color: var(--violet); }
.chip.outline { background: transparent; border: 1px solid var(--line-2); color: var(--muted); font-weight: 500; }
.chip-demo { background: var(--warn-wash); color: var(--warn); letter-spacing: .4px; text-transform: uppercase; font-size: 10px; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-2); transition: background .15s, border-color .15s; }
.inbox-trigger { position: relative; }
.inbox-trigger .nav-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 5px; }
.inbox-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.inbox-row:first-child { border-top: 0; }
.inbox-row.unread .row-title { color: var(--ink); }
.inbox-row .row-title { white-space: normal; }
.inbox-row .row-icon { margin-top: 2px; }
.inbox-row .btn { flex-shrink: 0; }
.icon-button:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--ink); }
.icon-button.ghost { border-color: transparent; background: transparent; }
.icon-button.ghost:hover { background: var(--surface-3); }
.mobile-menu { display: none; }

main { padding: 26px 32px 32px; max-width: 1480px; margin: 0 auto; min-width: 0; }
main:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-head-text { min-width: 0; }
.eyebrow { font-size: 10.5px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.eyebrow:empty { display: none; }
h1 { font-size: clamp(22px, 2.1vw, 28px); font-weight: 650; letter-spacing: -.6px; line-height: 1.2; }
h1 .accent { color: var(--blue); }
.page-lede { font-size: 13px; color: var(--muted); margin-top: 6px; max-width: 70ch; }
.page-lede:empty { display: none; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.page-head-actions:empty { display: none; }

.context { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.context-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.context-field { position: relative; display: inline-flex; align-items: center; height: 36px; padding: 0 30px 0 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; font-size: 12.5px; color: var(--ink); gap: 8px; max-width: 100%; }
.context-field:hover { border-color: var(--line-2); }
.context-field .icon { width: 15px; height: 15px; color: var(--muted); }
.context-field > span { color: var(--muted); font-weight: 500; white-space: nowrap; }
.context-field select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; padding: 0; height: 34px; min-width: 0; max-width: 260px; font-weight: 600; color: var(--ink); padding-right: 4px; }
.context-field::after { content: ""; position: absolute; right: 11px; top: 50%; width: 7px; height: 7px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: translateY(-65%) rotate(45deg); pointer-events: none; }
.context-note { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; min-width: 0; }
.context-note:empty { display: none; }

.page-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--line); margin-top: 34px; padding-top: 14px; letter-spacing: .2px; flex-wrap: wrap; }
.loading-bar { position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: 2px; z-index: 60; background: linear-gradient(90deg, transparent, var(--blue), transparent); background-size: 40% 100%; animation: loading 1.1s linear infinite; }
.loading-bar[hidden] { display: none; }
@keyframes loading { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ---------- buttons ---------- */
.btn, .primary-button, .secondary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 9px; font-size: 12.5px; font-weight: 600; white-space: nowrap; text-decoration: none; line-height: 1;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background .15s var(--ease), border-color .15s, transform .12s var(--ease), box-shadow .15s;
}
.btn .icon, .primary-button .icon, .secondary-button .icon { width: 15px; height: 15px; }
.btn:hover, .secondary-button:hover { background: var(--surface-2); border-color: var(--line-2); text-decoration: none; }
.btn:active, .primary-button:active, .secondary-button:active { transform: translateY(1px); }
.btn-primary, .primary-button { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(29, 125, 185, .25); }
.btn-primary:hover, .primary-button:hover { background: var(--blue-ink); border-color: var(--blue-ink); color: #fff; text-decoration: none; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-wash); border-color: #efc9c3; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.text-button { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--blue-ink); min-height: 30px; padding: 0 2px; background: none; border: 0; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-button .icon { width: 14px; height: 14px; }
.button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.link-arrow { display: inline-flex; align-items: center; gap: 4px; }
.link-arrow .icon { width: 14px; height: 14px; transition: transform .15s var(--ease); }
.link-arrow:hover .icon { transform: translate(1px, -1px); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 12px; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; }
.panel-head h2 .icon { width: 16px; height: 16px; color: var(--muted); }
.panel-head p, .panel-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.panel-head .button-row, .panel-head .module-actions { flex-shrink: 0; }
.panel-body { padding: 4px 20px 18px; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.panel-label { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; white-space: nowrap; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-heading h2 { font-size: 16px; letter-spacing: -.3px; }
.section-heading p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--blue-wash); border: 1px solid var(--blue-soft); border-radius: var(--r); font-size: 12.5px; color: var(--blue-deep); line-height: 1.6; }
.callout .icon { color: var(--blue); margin-top: 1px; }
.callout.warn { background: var(--warn-wash); border-color: #efdcb3; color: #6f4a0f; }
.callout.warn .icon { color: var(--warn); }
.callout.neutral { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.note { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.empty-state { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.empty-state .icon { width: 30px; height: 30px; margin: 0 auto 10px; color: var(--faint); }
.empty-state strong { display: block; color: var(--ink); font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.empty-state.ok .icon { color: var(--ok); }
.error-panel { padding: 22px 24px; background: var(--danger-wash); border: 1px solid #efc9c3; border-radius: var(--r-lg); color: #7f2f28; line-height: 1.7; }
.error-panel h2 { color: inherit; margin-bottom: 4px; }
.form-error, .module-form-error { padding: 12px 14px; background: var(--danger-wash); color: #8a352d; font-size: 12px; border-radius: var(--r-sm); line-height: 1.6; margin: 10px 0; }
.form-error:empty, .module-form-error:empty { display: none; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; text-align: left; overflow: hidden; transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s; }
button.stat:hover, a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-2); text-decoration: none; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-top .icon { width: 16px; height: 16px; color: var(--faint); }
.stat-value { font-size: clamp(24px, 2vw, 30px); font-weight: 650; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-value small { font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-left: 4px; }
.stat-foot { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.stat.accent { background: linear-gradient(135deg, #eef5fb, #fff 60%); border-color: var(--blue-soft); }
.stat.alert .stat-value { color: var(--danger); }

/* ---------- rows / lists ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line); min-width: 0; text-align: left; width: 100%; color: inherit; transition: background .12s; }
.row:hover { background: var(--surface-2); text-decoration: none; }
.row:first-child { border-top: 0; }
.row-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex-shrink: 0; }
.row-icon .icon { width: 16px; height: 16px; }
.row-icon.info { background: var(--blue-wash); color: var(--blue-ink); }
.row-icon.ok { background: var(--ok-wash); color: var(--ok); }
.row-icon.warn { background: var(--warn-wash); color: var(--warn); }
.row-icon.danger { background: var(--danger-wash); color: var(--danger); }
.row-icon.violet { background: var(--violet-wash); color: var(--violet); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta > * { display: inline; }
.row-meta .sep { color: var(--line-2); margin: 0 5px; }
.row-meta .priority-dot { display: inline-block; margin-right: 6px; vertical-align: 1px; }
.row-end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.attention .row-end { flex-direction: column; align-items: flex-end; gap: 3px; }
.attention .row-end .icon { display: none; }
.attention .row-end .date { font-size: 11px; }
.row-end .icon { width: 14px; height: 14px; color: var(--faint); }
.row-action { font-size: 12px; font-weight: 600; color: var(--blue-ink); white-space: nowrap; }
.row-action.quiet { color: var(--muted); font-weight: 500; }
.check { width: 20px; height: 20px; border: 1.5px solid var(--line-2); border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; color: #fff; background: #fff; transition: background .15s, border-color .15s; }
.check .icon { width: 12px; height: 12px; }
.check.done { background: var(--ok); border-color: var(--ok); }
.check:hover { border-color: var(--blue); }
.priority-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; flex-shrink: 0; }
.priority-dot.high { background: var(--warn); }
.priority-dot.urgent { background: var(--danger); }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; text-transform: capitalize; line-height: 1; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.submitted, .badge.review, .badge.pending, .badge.queued, .badge.returned, .badge.blocked, .badge.on_hold, .badge.expiring_soon, .badge.due_today, .badge.draft { background: var(--warn-wash); color: var(--warn); }
.badge.in_progress, .badge.active, .badge.ready, .badge.drafted { background: var(--blue-wash); color: var(--blue-ink); }
.badge.approved, .badge.done, .badge.complete, .badge.posted, .badge.released, .badge.matched, .badge.healthy, .badge.confirmed { background: var(--ok-wash); color: var(--ok); }
.badge.rejected, .badge.overdue, .badge.cancelled, .badge.failed, .badge.expired, .badge.reversed { background: var(--danger-wash); color: var(--danger); }
.badge.plain::before { display: none; }
.badge.plain { text-transform: none; }

/* ---------- tabs ---------- */
.module-tabs { display: inline-flex; align-items: center; gap: 2px; padding: 3px; margin: 0 0 18px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 11px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.module-tabs::-webkit-scrollbar { display: none; }
.module-tabs button, .module-tabs a, .module-tabs .primary-button, .module-tabs .secondary-button {
  height: 32px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent; box-shadow: none;
  color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; text-decoration: none; transition: color .15s, background .15s;
}
.module-tabs button:hover, .module-tabs a:hover { color: var(--ink); background: rgba(255, 255, 255, .55); }
.module-tabs .active, .module-tabs [aria-selected="true"], .module-tabs [aria-pressed="true"], .module-tabs .primary-button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tab-count { margin-left: 6px; font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: var(--surface); color: var(--muted); }

/* ---------- tables ---------- */
.table-scroll, .table-wrap { max-width: 100%; overflow-x: auto; }
.module-table, .data-table { border-collapse: collapse; width: 100%; font-size: 12.5px; text-align: left; }
.module-table th, .data-table th { font-size: 10.5px; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); padding: 11px 16px; background: var(--surface-2); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
.module-table td, .data-table td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; line-height: 1.5; }
.module-table tbody tr:first-child td { border-top: 0; }
.module-table tbody tr:hover { background: var(--surface-2); }
.module-table td small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.module-table .number, .data-table .number, .data-table td:not(:first-child), .data-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.module-table button { font-size: 12.5px; font-weight: 600; color: var(--blue-ink); text-align: left; }
.module-table button:hover { text-decoration: underline; text-underline-offset: 3px; }
.module-table .button-row button, .module-table .button-row a { font-weight: 600; }
.module-table caption { caption-side: top; text-align: left; padding: 10px 16px; font-size: 11.5px; color: var(--muted); }
.module-table input, .module-table select { width: 100%; min-width: 80px; max-width: 220px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 12.5px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin: 6px 0 16px; }
.form-grid label, .field { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.form-grid label.full, .form-grid .full, .form-grid fieldset, .form-grid p { grid-column: 1 / -1; }
.form-grid p { font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.6; }
.form-grid input:not([type="checkbox"]):not([type="radio"]), .form-grid select, .form-grid textarea, .input, .field input, .field select, .field textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 11px; min-height: 38px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 400;
  transition: border-color .15s, box-shadow .15s;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .input:focus, .field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.form-grid input[type="checkbox"], .form-grid input[type="radio"] { width: 16px; height: 16px; min-height: 0; margin: 0 8px 0 0; vertical-align: -3px; accent-color: var(--blue); display: inline-block; }
.form-grid textarea { min-height: 96px; resize: vertical; }
.form-grid fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px 12px; min-width: 0; margin: 0; }
.form-grid fieldset label { display: flex; align-items: center; gap: 4px; font-weight: 500; padding: 5px 0; }
.form-grid legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
.form-grid input[readonly] { background: var(--surface-2); color: var(--muted); }
.search-box, input[type="search"] { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 12px; font-size: 12.5px; min-height: 36px; }
input[type="search"]:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

/* ---------- dialogs ---------- */
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); max-height: min(88vh, 900px); overflow: auto; width: 620px; max-width: calc(100vw - 28px); }
dialog::backdrop { background: rgba(41, 47, 61, .34); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px 12px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.4px; line-height: 1.3; min-width: 0; }
.dialog-body { padding: 18px 22px 22px; }
.dialog-body > p, #module-dialog p { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; margin: 10px 0; }
.dialog-body h3, #module-dialog h3 { margin: 20px 0 10px; }
.dialog-body dl, .detail-dialog dl { display: grid; grid-template-columns: 130px 1fr; gap: 10px 18px; font-size: 12.5px; margin: 16px 0; }
.dialog-body dt, .detail-dialog dt { color: var(--muted); }
.dialog-body dd, .detail-dialog dd { margin: 0; font-weight: 500; }
.module-wide-dialog { width: 960px; }
.dialog-sm { width: 460px; }
.detail-notice { padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 11.5px !important; color: var(--muted) !important; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.comment-box { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.comment-row { padding: 11px 13px; background: var(--surface-2); border-radius: var(--r-sm); margin-top: 8px; }
.comment-row small { font-size: 11px; color: var(--muted); }
.comment-row p { margin: 4px 0 0 !important; font-size: 12.5px; white-space: pre-wrap; }
.comment-form { display: flex; gap: 8px; margin-top: 12px; }
.comment-form input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 9px 11px; font-size: 12.5px; }
.detail-description { white-space: pre-wrap; }
.timeline { list-style: none; padding: 0; margin: 8px 0 0; }
.timeline li { position: relative; padding: 6px 0 6px 18px; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.timeline li small { display: block; color: var(--muted); font-size: 11px; }
dialog.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(520px, 100vw); max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; border: 0; border-left: 1px solid var(--line); }
dialog.drawer[open] { animation: slide .22s var(--ease); }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- command palette ---------- */
.palette { width: 640px; margin-top: 12vh; overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.palette-input .icon { color: var(--muted); }
.palette-input input { flex: 1; min-width: 0; border: 0; background: transparent; height: 46px; font-size: 15px; outline: none; }
.palette-results { max-height: 380px; overflow-y: auto; padding: 8px; }
.palette-group { font-size: 10.5px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 9px; text-align: left; color: var(--ink); text-decoration: none; font-size: 13px; }
.palette-item .icon { width: 16px; height: 16px; color: var(--muted); }
.palette-item .hint { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.palette-item[aria-selected="true"], .palette-item:hover { background: var(--blue-wash); color: var(--blue-ink); text-decoration: none; }
.palette-item[aria-selected="true"] .icon { color: var(--blue); }
.palette-empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 12.5px; }
.palette-foot { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.shortcut-list { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; font-size: 12.5px; align-items: center; padding: 4px 0; }
.shortcut-list span:nth-child(even) { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 22px; left: calc(50% + var(--sidebar-w) / 2); transform: translate(-50%, 16px); opacity: 0; display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 16px 12px 14px; border-radius: 12px; font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow-3); pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease); max-width: min(90vw, 520px); z-index: 90; }
.toast .icon { width: 16px; height: 16px; color: #8fd0a9; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.warn .icon { color: #f3c96b; }
.toast.danger .icon { color: #f5a097; }

/* ---------- skeletons ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-line { height: 12px; margin: 10px 0; }
.skeleton-line.w-60 { width: 60%; } .skeleton-line.w-40 { width: 40%; } .skeleton-line.w-80 { width: 80%; }
.skeleton-block { height: 96px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.module-loading { padding: 20px 20px 24px; }
.module-loading::before, .module-loading::after { content: ""; display: block; height: 12px; border-radius: 6px; background: var(--surface-3); margin: 8px 0; animation: pulse 1.3s ease-in-out infinite; }
.module-loading::after { width: 55%; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- home ---------- */
.hero { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 22px 24px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: linear-gradient(120deg, #ffffff, #f1f6fb 55%, #e9f2f9); overflow: hidden; box-shadow: var(--shadow-1); }
.hero::before { content: ""; position: absolute; inset: 0; background-image: var(--grain); background-size: 220px 220px; opacity: .28; mix-blend-mode: multiply; pointer-events: none; }
.hero > * { position: relative; }
.hero h1 { font-size: clamp(22px, 2.2vw, 30px); }
.hero-summary { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.hero-summary span { display: inline-flex; align-items: center; gap: 6px; }
.hero-summary .icon { width: 14px; height: 14px; color: var(--muted); }
.hero-summary strong { font-weight: 650; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 18px; align-items: start; }
.home-grid.two { grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); }
.home-grid.wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.attention .panel-head { padding-bottom: 8px; }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-3); color: var(--ink-2); }
.count-pill.info { background: var(--blue); color: #fff; }
.count-pill.danger { background: var(--danger-wash); color: var(--danger); }
.count-pill.warn { background: var(--warn-wash); color: var(--warn); }
.count-pill.zero { background: var(--ok-wash); color: var(--ok); }
.modules-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 10px; margin-bottom: 18px; }
.module-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-1); color: inherit; text-decoration: none; min-width: 0; transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s; }
.module-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-2); text-decoration: none; }
.module-tile .row-icon { width: 36px; height: 36px; background: var(--blue-wash); color: var(--blue); }
.module-tile .row-icon .icon { width: 17px; height: 17px; }
.module-tile-text { min-width: 0; flex: 1; }
.module-tile-text strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-tile-text small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-tile .chip { flex-shrink: 0; }
.finance-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.finance-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.finance-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.finance-card-head strong { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.finance-card-head .icon { width: 16px; height: 16px; color: var(--muted); }
.finance-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.finance-figure dt { font-size: 11px; color: var(--muted); font-weight: 500; }
.finance-figure dd { font-size: 17px; font-weight: 650; letter-spacing: -.5px; margin-top: 3px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.finance-figure dd.big { font-size: 22px; }
.finance-figure dd.pos { color: var(--ok); } .finance-figure dd.neg { color: var(--danger); }
.finance-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.exports { display: flex; gap: 6px; flex-wrap: wrap; }
.exports a { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--surface); }
.exports a:hover { border-color: var(--line-2); color: var(--ink); text-decoration: none; background: var(--surface-2); }
.exports a .icon { width: 13px; height: 13px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding: 4px 20px 16px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); min-width: 0; }
.week-day.today { background: var(--blue-wash); border-color: var(--blue-soft); }
.week-day small { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
.week-day strong { font-size: 15px; font-weight: 650; }
.week-day.today strong { color: var(--blue-ink); }
.week-dots { display: flex; gap: 3px; height: 6px; }
.week-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.week-dots i.done { background: var(--ok); }
.ring { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.ring .track { stroke: var(--surface-3); }
.ring .value { stroke: var(--blue); transition: stroke-dashoffset .8s var(--ease); }
.ring .ok { stroke: var(--ok); }
.ring .warn { stroke: var(--warn); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.leave-row { display: flex; align-items: center; gap: 14px; padding: 10px 20px; }
.leave-row + .leave-row { border-top: 1px solid var(--line); }
.leave-row strong { display: block; font-size: 13px; }
.leave-row small { color: var(--muted); }
.progress { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 4px; background: var(--blue); transition: width .6s var(--ease); }
.progress > span.warn { background: var(--warn); } .progress > span.danger { background: var(--danger); } .progress > span.ok { background: var(--ok); }
.project-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.project-row:first-child { border-top: 0; }
.project-row strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.meter { min-width: 0; }
.meter small { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.workload-row { display: flex; align-items: center; gap: 10px; padding: 8px 20px; }
.workload-row .avatar { flex-shrink: 0; }
.workload-row .meter { flex: 1; }
.workload-row .meter small span:first-child { color: var(--ink); font-weight: 600; }
.mini-chart { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding: 8px 20px 0; }
.mini-chart .bar-column { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.mini-chart .bar-column > div { width: 100%; max-width: 46px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--blue-soft), #b9d6ec); min-height: 4px; transition: height .5s var(--ease); }
.mini-chart .bar-column.peak > div { background: linear-gradient(180deg, var(--blue), var(--blue-ink)); }
.mini-chart small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.mini-chart strong { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.activity-row { display: flex; gap: 10px; padding: 8px 20px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.activity-row .avatar { margin-top: 1px; }
.activity-row strong { color: var(--ink); font-weight: 600; }
.activity-row small { display: block; font-size: 11px; color: var(--muted); }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 4px 20px 18px; }
.quick-action { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); text-align: left; color: var(--ink); font-size: 12.5px; font-weight: 600; text-decoration: none; transition: background .15s, border-color .15s, transform .15s var(--ease); min-width: 0; }
.quick-action:hover { background: var(--blue-wash); border-color: var(--blue-soft); text-decoration: none; transform: translateY(-1px); }
.quick-action .icon { color: var(--blue); }
.quick-action span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding: 4px 2px 16px; }
.kanban-column { padding: 12px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 13px; min-height: 240px; }
.kanban-column h3 { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; padding: 2px 4px 12px; color: var(--ink-2); }
.kanban-card { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow-1); transition: transform .15s var(--ease), box-shadow .15s; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.kanban-card strong { display: block; font-size: 12.5px; line-height: 1.45; margin: 6px 0 8px; }
.kanban-card small { font-size: 11px; color: var(--muted); }
.kanban-card footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--muted); }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.report-saved-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 12.5px; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--canvas); }
.auth-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 56px 64px; background: linear-gradient(160deg, #eef4f9, #f6f4ef 60%, #eef2ec); overflow: hidden; }
.auth-story::before { content: ""; position: absolute; inset: 0; background-image: var(--grain); background-size: 220px 220px; opacity: .6; mix-blend-mode: multiply; pointer-events: none; }
.auth-story > * { position: relative; }
.auth-story .brand { margin: 0; }
.auth-story h1 { font-size: clamp(38px, 4.6vw, 60px); letter-spacing: -2px; font-weight: 650; line-height: 1.08; max-width: 12ch; margin: 36px 0 18px; }
.auth-story p { font-size: 15px; color: var(--ink-2); line-height: 1.7; max-width: 42ch; }
.auth-journey { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 28px; }
.auth-journey span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border: 1px solid var(--line-2); border-radius: 999px; background: rgba(255, 255, 255, .6); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.auth-journey .icon { width: 14px; height: 14px; color: var(--blue); }
.auth-copyright { font-size: 11px; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; margin-top: 48px; }
.auth-form { padding: 56px; display: flex; flex-direction: column; justify-content: center; max-width: 560px; margin: auto; width: 100%; }
.auth-form h2 { font-size: 26px; font-weight: 650; letter-spacing: -.6px; margin: 8px 0 6px; }
.auth-form > p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.auth-form .primary-button, .auth-form .btn-primary { width: 100%; margin-top: 4px; height: 40px; }
.demo-personas { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.demo-personas > p { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin: 10px 0 0; }
.persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.persona-button { width: 100%; text-align: left; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font-size: 12.5px; font-weight: 600; transition: background .15s, border-color .15s, transform .15s var(--ease); display: flex; align-items: center; gap: 10px; }
.persona-button .avatar { width: 28px; height: 28px; font-size: 10px; }
.persona-button small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 1px; }
.persona-button:hover { background: var(--blue-wash); border-color: var(--blue-soft); transform: translateY(-1px); }
.auth-card { width: min(640px, 100%); margin: 6vh auto; padding: 28px 32px 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card h2 { margin: 22px 0 6px; }
.auth-card > p { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; margin: 6px 0; }
.auth-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; font-size: 12.5px; }

/* ---------- module-specific hooks kept for compatibility ---------- */
.detail-dialog { width: 620px; }
.source-strip { padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.section-note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.screen-reader-message { font-size: 12px; color: var(--muted); }
.leave-field[hidden] { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1250px) {
  :root { --sidebar-w: 218px; }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .nav-link.active::before { left: -10px; }
  main { padding: 22px 24px 28px; }
  .topbar { padding: 0 24px; }
  .palette-trigger { min-width: 200px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid.two { grid-template-columns: minmax(0, 1.3fr) minmax(280px, 1fr); }
}
@media (min-width: 761px) and (max-width: 1050px) {
  .home-grid, .home-grid.two, .home-grid.wide { grid-template-columns: minmax(0, 1fr); }
  .project-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .page-head { flex-wrap: wrap; align-items: flex-start; }
  .palette-trigger span { display: none; }
  .palette-trigger { min-width: 0; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  .sidebar { width: 264px; max-width: calc(100vw - 28px); transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-3); }
  .sidebar.open { transform: translateX(0); }
  .sidebar .nav-link.active::before { display: none; }
  .app { margin-left: 0; }
  .app::before { left: 0; }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 14px; height: 56px; gap: 10px; }
  .crumbs a, .crumb-sep { display: none; }
  .palette-trigger { min-width: 0; padding: 0 10px; }
  .palette-trigger span, .palette-trigger kbd { display: none; }
  main { padding: 18px 16px 24px; }
  .page-head { display: block; }
  .page-head-actions { justify-content: flex-start; margin-top: 12px; }
  .context { gap: 10px; }
  .context-field { flex: 1 1 auto; }
  .context-field select { max-width: 100%; width: 100%; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 13px 14px; }
  .home-grid, .home-grid.two, .home-grid.wide { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .hero { display: block; padding: 18px; }
  .hero-actions { justify-content: flex-start; margin-top: 14px; }
  .row { padding: 10px 14px; gap: 10px; }
  .row-end .date { display: none; }
  .panel-head, .panel-body { padding-left: 14px; padding-right: 14px; }
  .week { padding: 4px 14px 14px; gap: 4px; }
  .week-day strong { font-size: 13px; }
  .project-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 14px; }
  .quick-actions { grid-template-columns: 1fr; padding: 4px 14px 14px; }
  .modules-strip { grid-template-columns: minmax(0, 1fr); }
  .attention .row-end { flex-direction: row; gap: 8px; }
  .finance-figure dd { font-size: 15px; } .finance-figure dd.big { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .toast { left: 50%; width: max-content; font-size: 12px; }
  .loading-bar { left: 0; }
  dialog { max-width: calc(100vw - 16px); }
  .dialog-body, .dialog-head { padding-left: 16px; padding-right: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .auth-form { padding: 32px 20px; }
  .kanban { grid-auto-columns: min(78vw, 260px); }
  .page-foot { flex-direction: column; gap: 6px; }
  .palette { margin-top: 6vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .stat:hover, .module-tile:hover, .quick-action:hover, .kanban-card:hover { transform: none; }
}
@media print {
  .sidebar, .topbar, .page-head-actions, .context, .page-foot, .loading-bar, .toast, .hero-actions, .quick-actions, .exports, .module-tabs { display: none !important; }
  .app { margin: 0; } .app::before { display: none; } main { padding: 0; max-width: none; }
  .panel, .stat, .finance-card { break-inside: avoid; box-shadow: none; }
  .home-grid, .stat-grid, .modules-strip { display: block; }
  .panel, .stat, .finance-card { margin-bottom: 14px; }
}

/* ===== Viewing as another user (super admin, read-only) ===== */
.impersonation-banner {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 20px;
  background: #292F3D;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.5;
}
.impersonation-banner p { margin: 0; flex: 1 1 280px; }
.impersonation-banner strong { color: #fff; }
.impersonation-banner .icon { color: #8fc6e8; flex: 0 0 auto; }
.impersonation-banner form { margin: 0; }
.impersonation-stop {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  border-radius: 8px;
  padding: 5px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.impersonation-stop:hover { background: rgba(255, 255, 255, 0.12); }
.impersonation-stop:focus-visible { outline: 2px solid #8fc6e8; outline-offset: 2px; }
