/* ACHARYAZ CRM — design system
   Tokens → base → layout → components → modules → responsive.
   Brand: navy #21264B, off-white #F5F5F2, green #2FA36B (accents) / #1F7D52 (text & buttons, AA contrast). */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --navy-950: #171A36;
  --navy-900: #21264B;
  --navy-800: #2B3160;
  --navy-700: #3A4177;
  --navy-600: #545C93;
  --navy-100: #E3E5F0;
  --navy-50:  #F0F1F7;
  --green-500: #2FA36B;
  --green-600: #26905D;
  --green-700: #1F7D52;
  --green-800: #19673F;
  --green-50:  #E8F5EE;
  --bg: #F5F5F2;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --border: #E3E3DC;
  --border-strong: #CFCFC6;
  --text: #1A1D33;
  --text-2: #3F4358;
  --muted: #5F6478;
  --faint: #8A8FA3;
  --info: #2E5BBA;      --info-bg: #EAF0FB;
  --warning: #9A5B00;   --warning-bg: #FDF3E1;
  --danger: #B3261E;    --danger-bg: #FCECEA;
  --success: #1F7D52;   --success-bg: #E8F5EE;
  --neutral: #4E5366;   --neutral-bg: #EFEFEB;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(23, 26, 54, .05);
  --shadow-sm: 0 1px 3px rgba(23, 26, 54, .07), 0 1px 2px rgba(23, 26, 54, .04);
  --shadow-md: 0 6px 20px -4px rgba(23, 26, 54, .14), 0 2px 6px rgba(23, 26, 54, .06);
  --shadow-lg: 0 20px 48px -12px rgba(23, 26, 54, .28);
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 620; }
p { margin: 0 0 .75em; }
a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-800); text-decoration: underline; text-underline-offset: 2px; }
img, svg { display: block; max-width: 100%; }
small, .small { font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--green-500); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--green-50); color: var(--text); }
.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--navy-900); color: #fff; padding: 8px 12px; border-radius: var(--radius); z-index: 100; }
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------------ app shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .2s var(--ease); }
.app.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.sidebar { position: sticky; top: 0; height: 100vh; background: var(--navy-900); color: #C9CCE0; display: flex; flex-direction: column; z-index: 40; overflow: hidden; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.07); color: #fff; flex: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--green-500); color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 16px; letter-spacing: -.02em; flex: none;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); }
.brand-text { line-height: 1.1; white-space: nowrap; }
.brand-text strong { display: block; font-size: 14.5px; letter-spacing: .06em; font-weight: 700; color: #fff; }
.brand-text span { font-size: 11px; color: #9DA2C2; letter-spacing: .02em; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-section { margin-top: 14px; }
.nav-section:first-child { margin-top: 2px; }
.nav-label { font-size: 10.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: #7C82A8; padding: 6px 10px; white-space: nowrap; }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 7px; color: #C9CCE0; font-weight: 500; font-size: 13.5px; white-space: nowrap; margin: 1px 0; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link .icon { color: #9DA2C2; }
.nav-link.is-active { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.is-active .icon { color: var(--green-500); }
.nav-link.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--green-500); }
.nav-count { margin-left: auto; background: rgba(255,255,255,.12); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.07); flex: none; }
.app.is-collapsed .brand-text, .app.is-collapsed .nav-label, .app.is-collapsed .nav-link span, .app.is-collapsed .nav-count { display: none; }
.app.is-collapsed .nav-link { justify-content: center; padding: 10px; }
.app.is-collapsed .sidebar-brand { padding: 0; justify-content: center; }
.app.is-collapsed .nav-section { margin-top: 6px; border-top: 1px solid rgba(255,255,255,.06); padding-top: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; }
.topbar-search { position: relative; flex: 1; max-width: 520px; }
.topbar-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.topbar-search input { width: 100%; height: 38px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 9px; padding: 0 12px 0 36px; font: inherit; color: var(--text); }
.topbar-search input:focus { outline: none; background: #fff; border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-50); }
.topbar-search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 11px var(--font); color: var(--faint); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--navy-50); color: var(--navy-900); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-900); color: #fff; display: inline-grid; place-items: center; font-size: 12.5px; font-weight: 650; letter-spacing: .02em; flex: none; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.tone-green { background: var(--green-700); }
.avatar.tone-slate { background: var(--navy-600); }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: 22px; border: 1px solid transparent; background: transparent; cursor: pointer; font: inherit; color: var(--text); }
.user-btn:hover { background: var(--navy-50); }
.user-btn .user-name { font-weight: 550; font-size: 13px; max-width: 140px; }

.content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .lead { color: var(--muted); margin: 4px 0 0; font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .sep { color: var(--faint); }
.mobile-only { display: none !important; }

/* ------------------------------------------------------------------ buttons */
.btn { --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg); font: 550 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; user-select: none;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s; box-shadow: var(--shadow-xs); }
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: var(--faint); color: var(--btn-fg); }
.btn:active { transform: translateY(.5px); }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { --btn-bg: var(--green-700); --btn-fg: #fff; --btn-bd: var(--green-700); }
.btn-primary:hover { background: var(--green-800); border-color: var(--green-800); color: #fff; }
.btn-navy { --btn-bg: var(--navy-900); --btn-fg: #fff; --btn-bd: var(--navy-900); }
.btn-navy:hover { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-danger { --btn-bg: var(--surface); --btn-fg: var(--danger); --btn-bd: #E8B4AF; }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-danger-solid { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); }
.btn-danger-solid:hover { background: #962018; color: #fff; }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--navy-50); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; gap: 5px; }
.btn-xs .icon { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: rgba(255,255,255,.9) rgba(255,255,255,.9) transparent transparent; animation: spin .7s linear infinite; }
.btn:not(.btn-primary):not(.btn-navy):not(.btn-danger-solid).is-loading::after { border-color: var(--navy-700) var(--navy-700) transparent transparent; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; box-shadow: none; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn.is-active { background: var(--navy-900); color: #fff; border-color: var(--navy-900); z-index: 1; }
.link-btn { background: none; border: 0; padding: 0; color: var(--green-700); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ cards & panels */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 54px; flex-wrap: wrap; }
.card-head h2 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--muted); }
.card-head .sub { font-size: 12.5px; color: var(--muted); font-weight: 450; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-main-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.span-2 { grid-column: span 2; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; }
a.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); text-decoration: none; }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-label .icon { width: 15px; height: 15px; color: var(--faint); }
.stat-value { font-size: 24px; font-weight: 680; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-meta { font-size: 12px; color: var(--muted); }
.stat-meta .up { color: var(--success); font-weight: 600; } .stat-meta .down { color: var(--danger); font-weight: 600; }
.stat.is-alert .stat-value { color: var(--danger); }
.stat.is-accent { background: var(--navy-900); border-color: var(--navy-900); }
.stat.is-accent .stat-label, .stat.is-accent .stat-meta { color: #B8BCD6; }
.stat.is-accent .stat-value { color: #fff; }
.stat.is-accent .stat-label .icon { color: var(--green-500); }

/* ------------------------------------------------------------------ badges, chips, pills */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1; background: var(--neutral-bg); color: var(--neutral); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-plain::before { display: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--navy-50); color: var(--navy-800); white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 14px; background: #fff; border: 1px solid var(--border-strong); font-size: 12.5px; color: var(--text-2); }
.chip b { font-weight: 600; color: var(--text); }
.chip a { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--muted); }
.chip a:hover { background: var(--danger-bg); color: var(--danger); text-decoration: none; }
.priority-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.priority-dot.urgent { background: var(--danger); } .priority-dot.high { background: #D97706; } .priority-dot.normal { background: var(--info); }

/* ------------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--danger); margin-left: 2px; }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.input, .select, .textarea, select, input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], input[type=datetime-local], input[type=search], input[type=url], textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; color: var(--text);
  font: 14px/1.4 var(--font); transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none; }
select, .select { padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235F6478' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
select[multiple] { background-image: none; padding-right: 11px; min-height: 96px; }
textarea { min-height: 88px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-50); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; accent-color: var(--green-700); margin: 0; flex: none; }
input[disabled], select[disabled], textarea[disabled], input[readonly] { background: var(--surface-2); color: var(--muted); }
.is-invalid, .is-invalid:focus { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-bg) !important; }
.field-error { color: var(--danger); font-size: 12px; margin: 0; font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 16px; }
.input-group { display: flex; }
.input-group > :first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group > :last-child { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }
.input-affix { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); font-size: 13px; white-space: nowrap; }
.form-section { padding: 20px 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section > h3 { margin-bottom: 4px; }
.form-section > .hint { margin-bottom: 14px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 20px; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); margin: 20px -18px -18px; padding: 12px 18px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); z-index: 5; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* enhanced multi-select */
.ms { position: relative; }
.ms-control { min-height: 38px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; padding: 4px 32px 4px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; cursor: text;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235F6478' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.ms.is-open .ms-control, .ms-control:focus-within { border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-50); }
.ms-token { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 4px 0 8px; border-radius: 5px; background: var(--navy-50); color: var(--navy-800); font-size: 12.5px; font-weight: 500; }
.ms-token button { border: 0; background: none; color: var(--navy-600); cursor: pointer; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px; padding: 0; font-size: 15px; line-height: 1; }
.ms-token button:hover { background: var(--navy-100); }
.ms-input { flex: 1; min-width: 80px; border: 0 !important; box-shadow: none !important; min-height: 26px !important; padding: 2px 4px !important; background: transparent !important; }
.ms-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 240px; overflow-y: auto; z-index: 25; padding: 4px; display: none; }
.ms.is-open .ms-menu { display: block; }
.ms-option { padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ms-option:hover, .ms-option.is-hl { background: var(--navy-50); }
.ms-option.is-selected { color: var(--green-700); font-weight: 600; }
.ms-option.is-selected::after { content: "✓"; }
.ms-empty { padding: 9px; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); letter-spacing: .02em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--text); text-decoration: none; }
.table th.is-sorted { color: var(--text); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #FBFBF9; }
.table tbody tr.is-selected { background: var(--green-50); }
.table .col-check { width: 40px; padding-right: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.table-compact td { padding: 8px 12px; }
.table-compact th { padding: 8px 12px; }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-title { font-weight: 600; color: var(--text); display: block; }
a.cell-title:hover { color: var(--green-700); }
.cell-sub { font-size: 12px; color: var(--muted); display: block; }
.row-link { color: inherit; }
.row-link:hover { text-decoration: none; }

.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.toolbar .search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.toolbar .search input { padding-left: 34px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar { padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.bulk-bar { display: none; align-items: center; gap: 10px; padding: 10px 18px; background: var(--navy-900); color: #fff; flex-wrap: wrap; }
.bulk-bar.is-visible { display: flex; }
.bulk-bar select, .bulk-bar input { min-height: 32px; height: 32px; padding: 4px 30px 4px 9px; font-size: 13px; width: auto; }
.bulk-bar .btn { height: 32px; }
.bulk-count { font-weight: 650; margin-right: 6px; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; gap: 4px; align-items: center; }
.pager a, .pager span { min-width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid var(--border); color: var(--text-2); font-weight: 550; padding: 0 8px; background: #fff; }
.pager a:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.pager .is-current { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
.pager .is-disabled { opacity: .45; }

/* filter drawer */
.filters-panel { background: var(--surface); }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; padding: 16px 18px; }
.filters-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
details.filters > summary { list-style: none; cursor: pointer; }
details.filters > summary::-webkit-details-marker { display: none; }

/* ------------------------------------------------------------------ dropdowns, dialogs, toasts */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); padding: 6px; z-index: 50; display: none; }
.dropdown.is-open > .dropdown-menu { display: block; animation: pop .14s var(--ease); }
.dropdown-menu.left { left: 0; right: auto; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px; color: var(--text-2); font: 500 13.5px var(--font); background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--navy-50); color: var(--text); text-decoration: none; }
.dropdown-menu .icon { color: var(--muted); width: 16px; height: 16px; }
.dropdown-menu hr { margin: 5px 0; }
.dropdown-head { padding: 8px 10px 6px; }
.dropdown-head strong { display: block; font-size: 13.5px; }
.dropdown-head span { font-size: 12px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

.notif-menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex !important; gap: 10px; padding: 11px 14px !important; border-radius: 0 !important; border-bottom: 1px solid var(--border); align-items: flex-start !important; }
.notif-item.is-unread { background: #F7FBF9; }
.notif-item .nicon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--navy-50); color: var(--navy-700); flex: none; }
.notif-item .ntext { min-width: 0; }
.notif-item .ntitle { font-weight: 600; font-size: 13px; color: var(--text); display: block; }
.notif-item .nbody { font-size: 12.5px; color: var(--muted); display: block; }
.notif-foot { padding: 10px 14px; text-align: center; font-size: 13px; }

.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); z-index: 50; padding: 6px; display: none; max-height: 70vh; overflow-y: auto; }
.search-results.is-open { display: block; }
.search-group { font-size: 11px; font-weight: 650; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; padding: 8px 10px 4px; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--text); }
.search-item:hover, .search-item.is-hl { background: var(--navy-50); text-decoration: none; color: var(--text); }
.search-item .icon { color: var(--muted); }
.search-item small { color: var(--muted); display: block; font-size: 12px; }

dialog.modal { border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); color: var(--text); background: #fff; }
dialog.modal.modal-lg { width: min(820px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(23, 26, 54, .45); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: pop .16s var(--ease); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 18px 20px; overflow-y: auto; max-height: calc(100vh - 180px); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; background: var(--navy-950); color: #fff; padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastIn .25s var(--ease); }
.toast .icon { margin-top: 1px; }
.toast-success .icon { color: #5FD39A; } .toast-error .icon { color: #FF8A80; } .toast-info .icon { color: #9DB8FF; } .toast-warning .icon { color: #FFC266; }
.toast button { margin-left: auto; background: none; border: 0; color: #9DA2C2; cursor: pointer; padding: 0 0 0 8px; font-size: 18px; line-height: 1; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: all .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; border: 1px solid transparent; align-items: flex-start; }
.alert .icon { margin-top: 1px; }
.alert-info { background: var(--info-bg); color: #1F3F82; border-color: #CFDCF5; }
.alert-warning { background: var(--warning-bg); color: #6E4100; border-color: #F2DDB3; }
.alert-danger { background: var(--danger-bg); color: #8A1C16; border-color: #F3C7C2; }
.alert-success { background: var(--success-bg); color: #155C3B; border-color: #C3E6D3; }
.alert p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ tabs, lists, timeline */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; padding: 0 6px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 12px 12px 11px; color: var(--muted); font-weight: 550; font-size: 13.5px; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--navy-900); border-bottom-color: var(--green-500); }
.tab .count { background: var(--neutral-bg); color: var(--neutral); font-size: 11px; padding: 1px 7px; border-radius: 9px; font-weight: 650; }

.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 10px 16px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--text); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
a.list-item { color: inherit; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-meta { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; }
.date-tile { width: 42px; flex: none; text-align: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.date-tile b { display: block; font-size: 15px; line-height: 1.6; color: var(--text); }
.date-tile span { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; background: var(--navy-900); color: #fff; line-height: 1.7; letter-spacing: .05em; }
.date-tile.is-overdue span { background: var(--danger); }

.timeline { list-style: none; margin: 0; padding: 4px 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 33px; top: 14px; bottom: 14px; width: 1px; background: var(--border); }
.tl-item { position: relative; display: flex; gap: 12px; padding: 10px 18px; }
.tl-icon { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; color: var(--navy-700); flex: none; }
.tl-icon .icon { width: 15px; height: 15px; }
.tl-icon.green { background: var(--green-50); border-color: #C3E6D3; color: var(--green-700); }
.tl-icon.red { background: var(--danger-bg); border-color: #F3C7C2; color: var(--danger); }
.tl-body { min-width: 0; flex: 1; padding-top: 4px; }
.tl-title { font-weight: 600; font-size: 13.5px; }
.tl-text { font-size: 13px; color: var(--text-2); white-space: pre-line; margin-top: 2px; overflow-wrap: anywhere; }
.tl-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; background: var(--navy-50); color: var(--navy-700); display: grid; place-items: center; }
.empty-icon .icon { width: 24px; height: 24px; }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { max-width: 380px; margin: 0 auto 14px; font-size: 13.5px; }
.empty.compact { padding: 22px 16px; }

.progress { height: 8px; background: var(--neutral-bg); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green-500); border-radius: 4px; transition: width .3s var(--ease); }
.progress.navy > span { background: var(--navy-700); }
.progress-sm { height: 5px; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.meter .progress { flex: 1; min-width: 50px; }

.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--navy-100); border-top-color: var(--navy-700); animation: spin .7s linear infinite; }
.skeleton { background: linear-gradient(90deg, #EEEEEA 25%, #F6F6F3 50%, #EEEEEA 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ modules */
.profile-head { display: flex; gap: 16px; align-items: flex-start; padding: 20px; }
.profile-head .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; margin-top: 6px; }
.profile-head .meta span { display: inline-flex; align-items: center; gap: 5px; }
.profile-head .meta .icon { width: 15px; height: 15px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.kpi { padding: 12px 18px; border-right: 1px solid var(--border); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font-weight: 650; font-size: 15px; margin-top: 2px; }

.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }
.chart-box.short { height: 200px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .bar { height: 10px; background: var(--neutral-bg); border-radius: 5px; overflow: hidden; }
.bar-row .bar > span { display: block; height: 100%; background: var(--navy-700); border-radius: 5px; }
.bar-row .bar.green > span { background: var(--green-500); }
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 60px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-bar { height: 26px; border-radius: 6px; background: var(--navy-700); min-width: 4px; display: flex; align-items: center; padding: 0 8px; color: #fff; font-size: 12px; font-weight: 600; }

/* kanban */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; scroll-snap-type: x proximity; min-height: 60vh; }
.board-col { flex: 0 0 272px; background: #ECECE6; border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 230px); scroll-snap-align: start; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px 9px; font-weight: 650; font-size: 13px; }
.board-col-head .count { background: rgba(33,38,75,.08); color: var(--navy-800); font-size: 11.5px; padding: 1px 8px; border-radius: 10px; }
.board-list { padding: 0 8px 8px; overflow-y: auto; flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 8px; border-radius: 0 0 12px 12px; transition: background .15s; }
.board-col.is-over .board-list { background: rgba(47,163,107,.12); outline: 2px dashed var(--green-500); outline-offset: -4px; }
.board-col.is-blocked .board-list { background: rgba(179,38,30,.06); }
.kcard { background: #fff; border-radius: 9px; border: 1px solid var(--border); padding: 10px 11px; box-shadow: var(--shadow-xs); cursor: grab; font-size: 13px; }
.kcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kcard.is-dragging { opacity: .5; transform: rotate(1.5deg); }
.kcard-title { font-weight: 620; color: var(--text); display: block; margin-bottom: 2px; }
.kcard-sub { color: var(--muted); font-size: 12px; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 22px; padding: 0 6px; border-radius: 6px; font-weight: 700; font-size: 12px; background: var(--neutral-bg); color: var(--neutral); font-variant-numeric: tabular-nums; }
.score.hi { background: var(--success-bg); color: var(--success); }
.score.mid { background: var(--info-bg); color: var(--info); }
.score.lo { background: var(--warning-bg); color: var(--warning); }
.score-lg { min-width: 54px; height: 32px; font-size: 15px; border-radius: 8px; }

/* match cards */
.match { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); align-items: start; }
.match:last-child { border-bottom: 0; }
.match.is-ineligible { background: #FCFBF8; }
.crit { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.crit span { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 2px 8px; border-radius: 5px; font-weight: 550; }
.crit .ok { background: var(--success-bg); color: var(--success); }
.crit .partial { background: var(--info-bg); color: var(--info); }
.crit .miss { background: var(--neutral-bg); color: var(--neutral); }
.crit .fail { background: var(--danger-bg); color: var(--danger); }

/* finance documents */
.doc-sheet { background: #fff; max-width: 860px; margin: 0 auto; padding: 40px 44px; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); }
.doc-sheet h1 { font-size: 24px; letter-spacing: .04em; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; }
.doc-sheet .table th { position: static; }
.totals { margin-left: auto; width: min(340px, 100%); }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; }
.totals .grand { border-top: 2px solid var(--navy-900); margin-top: 6px; padding-top: 10px; font-size: 16px; font-weight: 700; }
.breakdown { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.breakdown .row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13.5px; }
.breakdown .row.total { border-top: 1px solid var(--border-strong); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 15px; }
.milestones { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.milestone { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: #fff; }
.milestone h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.deadline-bar { position: relative; height: 8px; background: var(--neutral-bg); border-radius: 4px; margin: 26px 0 8px; }
.deadline-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green-500); border-radius: 4px; }
.deadline-bar .mark { position: absolute; top: -20px; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.deadline-bar .mark::after { content: ""; position: absolute; left: 50%; top: 17px; width: 2px; height: 12px; background: var(--navy-700); }

/* auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-aside { background: var(--navy-900); color: #DADCEB; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 56px solid rgba(47,163,107,.12); }
.auth-aside h2 { color: #fff; font-size: 30px; font-weight: 680; line-height: 1.2; letter-spacing: -.02em; max-width: 440px; }
.auth-aside p { color: #B8BCD6; font-size: 15px; max-width: 440px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; max-width: 420px; position: relative; z-index: 1; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: #DADCEB; }
.auth-points .icon { color: var(--green-500); margin-top: 2px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 24px; }
.auth-card form { display: grid; gap: 14px; }
.auth-foot { margin-top: 28px; font-size: 12.5px; color: var(--faint); }

.overlay { display: none; }
.print-only { display: none; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1024px) {
  .app, .app.is-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-lg); }
  .app.is-nav-open .sidebar { transform: none; }
  .app.is-collapsed .brand-text, .app.is-collapsed .nav-label, .app.is-collapsed .nav-link span, .app.is-collapsed .nav-count { display: initial; }
  .app.is-collapsed .nav-link { justify-content: flex-start; padding: 8px 10px; }
  .overlay { position: fixed; inset: 0; background: rgba(23,26,54,.45); z-index: 35; }
  .app.is-nav-open .overlay { display: block; }
  .mobile-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
  .grid-main, .grid-main-wide { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .content { padding: 16px 14px 90px; }
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar-search kbd, .user-btn .user-name, .user-btn > .icon { display: none; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 19px; }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > .dropdown, .page-actions > form { flex: 1 1 auto; }
  .page-actions > .dropdown > .btn { width: 100%; }
  .grid-2, .grid-3, .grid-4, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 20px; }
  .card-head, .card-body, .toolbar, .pagination, .filter-bar { padding-left: 14px; padding-right: 14px; }
  .card-body { padding-top: 14px; padding-bottom: 14px; }
  .toolbar .search { max-width: none; min-width: 100%; }
  .toolbar-right { margin-left: 0; width: 100%; }
  .toolbar-right > * { flex: 1 1 auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .profile-head { padding: 16px 14px; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .dl dt { margin-top: 8px; font-size: 12px; }
  .filters-grid { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .bar-row { grid-template-columns: 96px 1fr 40px; }
  .funnel-row { grid-template-columns: 104px 1fr 40px; font-size: 12px; }
  .match { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px; }
  .match .match-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  .doc-sheet { padding: 20px 16px; }
  .doc-grid { grid-template-columns: minmax(0, 1fr); }
  .sticky-actions { margin: 16px -14px -14px; padding: 10px 14px; position: sticky; bottom: 0; }
  .form-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.97); margin: 16px -14px -14px; padding: 10px 14px; z-index: 5; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
  .form-actions .btn { flex: 1 1 auto; }
  .board { scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px 12px; scroll-padding-inline: 14px; }
  .board-col { flex-basis: 84vw; max-height: none; }
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .modal-body { max-height: calc(92vh - 130px); }
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .tl-item { padding: 10px 14px; }
  .timeline::before { left: 29px; }
  .list-item { padding: 11px 14px; }

  /* tables → stacked cards */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: 12px 14px; border-bottom: 1px solid var(--border); position: relative; }
  .table-cards tbody tr:last-child { border-bottom: 0; }
  .table-cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; min-width: 0; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; flex: none; max-width: 45%; }
  .table-cards td[data-label=""]::before, .table-cards td:not([data-label])::before { content: none; }
  .table-cards td.cell-primary { display: block; text-align: left; padding-bottom: 6px; padding-right: 36px; }
  .table-cards td.cell-primary::before { content: none; }
  .table-cards td.col-check { position: absolute; right: 14px; top: 14px; width: auto; padding: 0; }
  .table-cards td.col-actions { justify-content: flex-start; padding-top: 8px; width: 100%; }
  .table-cards td.col-actions::before { content: none; }
  .table-cards td > * { min-width: 0; }
  .table-cards tfoot { display: block; }
  .table-cards tfoot tr { display: flex; justify-content: space-between; flex-wrap: wrap; }
  .table-cards tfoot td { width: auto; }
  .hide-sm { display: none !important; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat-value { font-size: 18px; }
  .brand-text span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------------ print (invoices, receipts) */
@media print {
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .no-print, .toasts, .page-head .page-actions, .overlay { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .doc-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .print-only { display: block; }
  a { color: inherit; }
  .badge { border: 1px solid currentColor; }
}

/* ---- Overflow hardening (found by automated 360–1440px checks) ---- */
/* Visually-hidden labels are absolutely positioned; give scrolling containers a containing block so they never widen the page. */
.board, .board-col, .table-wrap, .kanban, .tabs, .chips { position: relative; }
.profile-head .meta, .profile-head .meta span, .profile-head .meta a { min-width: 0; overflow-wrap: anywhere; }
.profile-head .meta span { max-width: 100%; }
.deadline-bar .mark.mark-end { transform: translateX(-100%); }
.deadline-bar .mark.mark-end::after { left: auto; right: 0; }
.topbar-search input[type=search] { padding: 0 12px 0 36px; min-height: 38px; height: 38px; border-color: var(--border); background: var(--surface-2); border-radius: 9px; }
.topbar-search input[type=search]:focus { background: #fff; border-color: var(--navy-600); }
@media (max-width: 1024px) {
  .sidebar { box-shadow: none; visibility: hidden; transition: transform .22s var(--ease), visibility 0s linear .22s; }
  .app.is-nav-open .sidebar { box-shadow: var(--shadow-lg); visibility: visible; transition: transform .22s var(--ease), visibility 0s; }
}
