/* ==========================================================================
   NALQIVO ERP — Phase 1 design system
   Light, precise, bilingual (AR RTL / EN LTR). No external assets.
   ========================================================================== */

/* Legacy variable names are aliases for the central tokens in tokens.css.
   Keeping them keeps every existing module stylesheet working while the
   brand, neutrals, radii, heights and shadows stay in one place. */
:root {
  --bg: var(--nq-bg);
  --bg-soft: var(--nq-bg-soft);
  --surface: var(--nq-surface);
  --surface-2: var(--nq-surface-2);
  --surface-3: var(--nq-surface-3);
  --ink: var(--nq-ink);
  --ink-2: var(--nq-ink-2);
  --muted: var(--nq-muted);
  --muted-2: var(--nq-muted-2);
  --line: var(--nq-line);
  --line-strong: var(--nq-line-strong);
  --brand: var(--nq-primary);
  --brand-2: var(--nq-primary-600);
  --brand-3: var(--nq-primary-700);
  --brand-50: var(--nq-primary-50);
  --brand-100: var(--nq-primary-100);
  --brand-200: var(--nq-primary-200);
  --brand-300: var(--nq-primary-300);
  --sky: var(--nq-primary-50);
  --green: var(--nq-success);
  --green-soft: var(--nq-success-soft);
  --red: var(--nq-danger);
  --red-soft: var(--nq-danger-soft);
  --amber: var(--nq-warning);
  --amber-soft: var(--nq-warning-soft);
  --purple: var(--nq-primary);
  --purple-soft: var(--nq-primary-50);
  --teal: var(--nq-accent);
  --teal-soft: var(--nq-accent-soft);
  --slate: #64748b;
  --slate-soft: #eef2f7;
  --shadow-xs: var(--nq-shadow-1);
  --shadow-sm: var(--nq-shadow-2);
  --shadow-md: var(--nq-shadow-3);
  --shadow-lg: var(--nq-shadow-4);
  --radius: var(--nq-radius-lg);
  --radius-md: 12px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --topbar-h: var(--nq-topbar-h);
  --font: var(--nq-font-family);
  --mono: var(--nq-font-mono);
  --easing: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body[data-view="launcher"] {
  background-color: #f7f8fa;
  background-image: radial-gradient(rgba(100, 116, 139, 0.16) 1px, transparent 1.1px);
  background-size: 22px 22px;
  background-position: 0 0;
}

body[data-view="login"] { background: #f4f8fe; }

[dir="ltr"] body { line-height: 1.58; }

h1, h2, h3, h4, h5 { margin: 0; color: var(--ink); font-weight: 700; line-height: 1.35; }
h1 { font-size: clamp(24px, 2.4vw, 32px); letter-spacing: -0.3px; }
h2 { font-size: 22px; letter-spacing: -0.2px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }
svg { flex: 0 0 auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
::selection { background: var(--brand-100); color: var(--brand-3); }

:focus-visible {
  outline: 3px solid rgba(108, 76, 241, 0.28);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  inset-inline-start: 16px;
  top: -100px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  transition: top 0.2s var(--easing);
}
.skip-link:focus { top: 16px; }

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.mono { font-family: var(--mono); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.center { text-align: center; }
.end { text-align: end; }
.nowrap { white-space: nowrap; }
.d-block { display: block; }
.full { grid-column: 1 / -1; }
.hidden { display: none !important; }
.popover-wrap { position: relative; }
.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;
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-nowrap { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.split-main { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr); gap: 20px; align-items: start; }
.split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.dot-sep::before { content: "•"; margin: 0 7px; color: var(--muted-2); }

/* --------------------------------------------------------------------------
   Boot, progress, toast, modal
   -------------------------------------------------------------------------- */
.boot-screen {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px; text-align: center;
  background: radial-gradient(1200px 600px at 50% -10%, var(--brand-50), transparent 70%);
}
.boot-screen img { border-radius: 18px; box-shadow: var(--shadow-md); }
.boot-wordmark { font-weight: 800; letter-spacing: 3px; font-size: 20px; color: var(--brand-3); }
.boot-wordmark span { color: var(--muted); font-weight: 600; letter-spacing: 1px; }
.boot-bar { width: 190px; height: 4px; border-radius: 99px; background: var(--brand-100); overflow: hidden; }
.boot-bar span { display: block; width: 40%; height: 100%; border-radius: 99px; background: var(--brand); animation: boot-slide 1.1s var(--easing) infinite; }
@keyframes boot-slide { 0% { transform: translateX(150%); } 100% { transform: translateX(-260%); } }
[dir="rtl"] .boot-bar span { animation-name: boot-slide-rtl; }
@keyframes boot-slide-rtl { 0% { transform: translateX(-150%); } 100% { transform: translateX(260%); } }

.global-progress {
  position: fixed; inset-inline: 0; top: 0; height: 3px; z-index: 300;
  pointer-events: none; opacity: 0; transition: opacity 0.2s ease;
}
.global-progress.active { opacity: 1; }
.global-progress span {
  display: block; height: 100%; width: 30%; border-radius: 0 99px 99px 0;
  background: linear-gradient(90deg, var(--brand), #64a4ff);
  animation: progress-move 1.2s var(--easing) infinite;
}
[dir="rtl"] .global-progress span { border-radius: 99px 0 0 99px; animation-name: progress-move-rtl; }
@keyframes progress-move { 0% { transform: translateX(-120%); } 100% { transform: translateX(420%); } }
@keyframes progress-move-rtl { 0% { transform: translateX(120%); } 100% { transform: translateX(-420%); } }

.toast-region {
  position: fixed; inset-block-end: 24px; inset-inline-end: 24px; z-index: 400;
  display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: #152941; color: #fff; box-shadow: var(--shadow-lg);
  font-size: 13.5px; line-height: 1.5; pointer-events: auto;
  animation: toast-in 0.28s var(--easing);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.toast svg { margin-top: 2px; }
.toast.success svg { color: #5ee0bd; }
.toast.error svg { color: #ff9aa5; }
.toast.info svg { color: #8fc2ff; }
.toast.leaving { animation: toast-out 0.2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(12, 27, 48, 0.48);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(14px, 5vh, 64px) 16px 32px;
  overflow-y: auto;
  animation: fade-in 0.2s ease;
}
.modal {
  width: min(600px, 100%);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  animation: modal-in 0.26s var(--easing);
  /* Tall forms scroll inside the body with the head and actions pinned, so
     every field stays reachable on short laptop/tablet viewports. */
  display: flex; flex-direction: column;
  max-height: calc(100dvh - clamp(28px, 10vh, 128px) - 32px);
  overflow: hidden;
  margin: auto 0;
}
.modal.size-sm { width: min(430px, 100%); }
.modal.size-lg { width: min(820px, 100%); }
.modal.size-xl { width: min(1040px, 100%); }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 24px 14px; flex: 0 0 auto;
}
.modal-title { font-size: 19px; font-weight: 700; }
.modal-sub { margin-top: 4px; color: var(--muted); font-size: 13px; }
.modal-body {
  flex: 1 1 auto; min-height: 0; padding: 8px 24px 20px;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
/* Author display rules (e.g. .field { display: flex }) override the browser's
   built-in [hidden] style, so hidden modal blocks need an explicit reset. */
.modal [hidden] { display: none !important; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  padding: 15px 24px; border-top: 1px solid var(--line); background: var(--surface-2);
  flex: 0 0 auto;
}
.modal-close {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--muted); display: grid; place-items: center;
  cursor: pointer; flex: 0 0 auto;
}
.modal-close:hover { background: var(--surface-3); color: var(--ink); }
.modal-section { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 14px; }
.modal-section-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(9px) scale(0.985); } to { opacity: 1; transform: none; } }

.context-menu {
  position: fixed; z-index: 500; min-width: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-md); padding: 6px; animation: menu-in 0.14s ease;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.context-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink); font-size: 13px; text-align: start; cursor: pointer;
}
.context-menu button:hover, .context-menu button:focus-visible { background: var(--brand-50); color: var(--brand-2); }
.context-menu .ctx-label { padding: 5px 10px 7px; font-size: 11px; letter-spacing: 0.4px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 5px; }

/* --------------------------------------------------------------------------
   Auth
   -------------------------------------------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(900px 520px at 85% -15%, rgba(73, 143, 255, 0.18), transparent 65%),
    radial-gradient(720px 500px at 8% 108%, rgba(107, 79, 224, 0.09), transparent 60%),
    #f6f9fe;
}
.auth-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 22px 0;
}
.auth-grid {
  width: min(1180px, calc(100% - 48px));
  margin: auto;
  display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(400px, 0.82fr);
  gap: clamp(28px, 4vw, 64px); align-items: center;
  padding: 16px 0 48px;
}
.auth-visual {
  position: relative; min-height: 580px; padding: clamp(28px, 3.6vw, 48px);
  border-radius: 30px; overflow: hidden;
  background:
    radial-gradient(700px 420px at 88% -12%, rgba(255, 255, 255, 0.55), transparent 58%),
    linear-gradient(146deg, #dcecff 0%, #eaf4ff 44%, #f7fbff 100%);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 1px 0 #fff, 0 30px 70px rgba(26, 64, 124, 0.09);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-visual::before {
  content: ""; position: absolute; inset-inline-end: -130px; top: -110px;
  width: 460px; height: 460px; border-radius: 50%;
  border: 1px solid rgba(108, 76, 241, 0.16);
  box-shadow: 0 0 0 42px rgba(108, 76, 241, 0.035), 0 0 0 100px rgba(108, 76, 241, 0.028), 0 0 0 168px rgba(108, 76, 241, 0.02);
}
.auth-visual::after {
  content: ""; position: absolute; inset-inline-start: -80px; bottom: -120px;
  width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(189, 219, 255, 0.36));
  filter: blur(2px);
  opacity: 0.8;
}
.auth-visual-inner { position: relative; z-index: 1; }
.auth-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 11px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(108, 76, 241, 0.12);
  color: var(--brand-2); font-weight: 600; font-size: 12px;
}
.auth-headline {
  margin-top: 26px; font-size: clamp(32px, 3.8vw, 52px); line-height: 1.22;
  letter-spacing: -1.1px; color: #0f2c56; max-width: 480px;
}
.auth-headline .accent { color: var(--brand); }
.auth-lead { margin-top: 16px; max-width: 450px; color: #4b627f; font-size: 15px; line-height: 1.8; }
.auth-features { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 13px; }
.auth-features li { display: flex; align-items: flex-start; gap: 11px; color: #2d486a; font-size: 13.5px; }
.auth-feature-icon {
  width: 27px; height: 27px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(108, 76, 241, 0.14); color: var(--brand);
}
.auth-preview {
  position: relative; z-index: 1; margin-top: 36px;
  border-radius: 18px; background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 40px rgba(30, 72, 138, 0.1);
  backdrop-filter: blur(14px);
  padding: 18px;
}
.auth-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.auth-preview-title { font-size: 12px; font-weight: 700; color: #355172; letter-spacing: 0.2px; }
.auth-preview-badge { font-size: 10px; padding: 3px 8px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-weight: 700; }
.auth-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.auth-step { background: #fff; border: 1px solid #e5eef9; border-radius: 11px; padding: 12px; }
.auth-step-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 9px; }
.auth-step-title { font-size: 11.5px; font-weight: 700; color: #1e3a5f; }
.auth-step-sub { font-size: 10.5px; color: #7c8ea4; margin-top: 2px; }
.auth-visual-foot { position: relative; z-index: 1; margin-top: 22px; font-size: 11.5px; color: #6e829b; display: flex; align-items: center; gap: 8px; }

.auth-panel {
  background: var(--surface); border: 1px solid #e7eef8; border-radius: 24px;
  box-shadow: 0 26px 70px rgba(27, 60, 110, 0.1);
  padding: clamp(26px, 3.2vw, 40px);
  width: 100%; max-width: 470px; margin-inline: auto;
}
.auth-card { animation: auth-in 0.32s var(--easing) both; }
@keyframes auth-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo img { width: 46px; height: 46px; border-radius: 13px; box-shadow: 0 8px 20px rgba(108, 76, 241, 0.24); }
.auth-wordmark { font-size: 19px; font-weight: 800; letter-spacing: 2.4px; color: var(--ink-strong); }
.auth-wordmark span { color: var(--muted); font-weight: 500; letter-spacing: 0.6px; }
.auth-company { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.auth-panel h1 { font-size: 25px; margin-top: 28px; color: var(--ink-strong); }
.auth-panel-sub { color: var(--muted); font-size: 13.5px; margin-top: 7px; margin-bottom: 24px; }
.auth-form { display: grid; gap: 16px; }
.auth-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: -2px; }
.link-btn {
  background: none; border: 0; padding: 0; color: var(--brand);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.link-btn:hover { color: var(--brand-2); text-decoration: underline; }
.auth-submit { width: 100%; height: 47px; font-size: 14.5px; border-radius: 12px; }
.auth-security { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted-2); font-size: 11.5px; margin-top: 18px; }
.auth-lang {
  display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff;
}
.auth-lang button { padding: 6px 11px; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.auth-lang button.active { background: var(--brand-50); color: var(--brand-2); font-weight: 700; }
.auth-demo { margin-top: 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); padding: 13px; }
.auth-demo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.auth-demo-title { font-size: 11.5px; font-weight: 700; color: #496483; }
.auth-demo-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.demo-chip {
  display: flex; align-items: center; gap: 7px; text-align: start;
  border: 1px solid #e3ecf8; background: #fff; border-radius: 8px;
  padding: 6px 8px; font-size: 11px; color: #34506f; cursor: pointer;
}
.demo-chip:hover { border-color: var(--brand-200); background: var(--surface-2); }
.demo-chip b { color: #1d3c61; font-size: 11px; font-weight: 700; }
.demo-chip span { color: var(--muted-2); font-size: 10px; margin-inline-start: auto; }
.auth-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 18px 0 26px; color: var(--muted-2); font-size: 11.5px; }
.auth-foot .row { gap: 5px; }

/* --------------------------------------------------------------------------
   App shell / topbar
   -------------------------------------------------------------------------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(1440px, calc(100% - 40px)); margin: 0 auto;
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: clamp(12px, 1.6vw, 22px);
  padding: 9px 0;
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand img { width: 39px; height: 39px; border-radius: 11px; box-shadow: 0 5px 13px rgba(108, 76, 241, 0.22); }
.brand-name { font-weight: 800; color: var(--ink-strong); letter-spacing: 1.9px; font-size: 15px; line-height: 1.1; }
.brand-name span { font-weight: 600; color: var(--muted); letter-spacing: 0.4px; font-size: 10px; }
.brand-company { color: var(--muted); font-size: 10.5px; line-height: 1.3; margin-top: 3px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-shell { position: relative; flex: 1 1 340px; max-width: 450px; }
.search-box {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-3); border: 1px solid transparent;
  border-radius: 11px; padding: 0 12px; height: 40px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.search-box:focus-within { background: #fff; border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(108, 76, 241, 0.1); }
.search-box svg { color: var(--muted-2); }
.search-box input {
  border: 0; background: transparent; outline: none; width: 100%; height: 100%;
  font-family: inherit; font-size: 13px; color: var(--ink);
}
.search-box input::placeholder { color: var(--muted-2); }
.search-kbd {
  font-family: var(--font); font-size: 9.5px; color: var(--muted-2);
  border: 1px solid var(--line-strong); background: #fff; border-radius: 5px;
  padding: 1px 5px; white-space: nowrap;
}
.topbar-actions { display: flex; align-items: center; gap: 5px; margin-inline-start: auto; flex-wrap: nowrap; }
.icon-btn {
  position: relative; width: 37px; height: 37px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--brand); }
.icon-btn.active { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
.icon-btn .count-dot {
  position: absolute; top: 2px; inset-inline-end: 1px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 99px; background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid #fff; line-height: 1;
}
.icon-btn .count-dot.neutral { background: var(--brand); }
.lang-btn {
  height: 31px; min-width: 45px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 11.5px; font-weight: 700;
  cursor: pointer; padding: 0 9px;
}
.lang-btn:hover { border-color: #bcd2f0; color: var(--brand); }
.top-clock {
  display: flex; flex-direction: column; align-items: flex-end; min-width: 88px;
  padding-inline: 4px; line-height: 1.3;
}
[dir="ltr"] .top-clock { align-items: flex-start; }
.top-clock .clock-time { font-size: 12.5px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.top-clock .clock-date { font-size: 10px; color: var(--muted-2); white-space: nowrap; }
.user-menu-wrap { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 9px; border: 1px solid transparent;
  background: transparent; border-radius: 11px; padding: 4px 6px 4px 8px; cursor: pointer;
  text-align: start;
}
[dir="rtl"] .user-chip { padding: 4px 8px 4px 6px; }
.user-chip:hover { background: var(--surface-3); }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 800;
  color: #fff; background: linear-gradient(145deg, var(--brand), var(--brand-2));
  letter-spacing: 0.2px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.avatar.teal { background: linear-gradient(145deg, #17b79a, #068b76); }
.avatar.purple { background: linear-gradient(145deg, #8a71f2, #6247d6); }
.avatar.amber { background: linear-gradient(145deg, #f4b03c, #d3870c); }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-chip-name { font-size: 12px; font-weight: 700; color: var(--ink); max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-role { font-size: 10px; color: var(--muted-2); max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip svg.chev { color: var(--muted-2); }

.popover {
  position: absolute; z-index: 90; top: calc(100% + 10px);
  inset-inline-end: 0; width: min(380px, calc(100vw - 24px));
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop-in 0.16s var(--easing);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.popover.wide { width: min(440px, calc(100vw - 24px)); }
.popover-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.popover-title { font-size: 13.5px; font-weight: 700; }
.popover-body { max-height: min(470px, 62vh); overflow-y: auto; }
.popover-foot { border-top: 1px solid var(--line); padding: 9px 12px; display: flex; justify-content: center; }
.popover-link { display: flex; width: 100%; justify-content: center; padding: 6px; font-size: 12px; font-weight: 600; color: var(--brand); background: none; border: 0; cursor: pointer; border-radius: 7px; }
.popover-link:hover { background: var(--brand-50); }
.user-popover { width: 268px; padding: 8px; }
.user-popover-head { padding: 12px; border-radius: 11px; background: var(--surface-2); margin-bottom: 6px; display: flex; gap: 10px; align-items: center; }
.user-popover .menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; border-radius: 8px; padding: 9px 10px;
  font-size: 13px; color: var(--ink-2); cursor: pointer; text-align: start;
}
.user-popover .menu-item:hover { background: var(--brand-50); color: var(--brand-2); }
.user-popover .menu-item.danger { color: var(--red); }
.user-popover .menu-item.danger:hover { background: var(--red-soft); }
.user-popover .menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.user-roles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.notif-list { display: flex; flex-direction: column; }
.notif-item {
  display: flex; gap: 11px; padding: 12px 14px; border: 0; background: transparent;
  border-bottom: 1px solid #eef2f7; text-align: start; cursor: pointer; width: 100%;
  color: var(--ink);
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--surface-2); }
.notif-item:last-child { border-bottom: 0; }
.notif-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; background: var(--brand-50); color: var(--brand); }
.notif-copy { min-width: 0; }
.notif-title { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.notif-text { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-time { font-size: 10px; color: var(--muted-2); margin-top: 4px; }
.notif-unread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex: 0 0 auto; }

.search-panel { width: min(560px, calc(100vw - 24px)); inset-inline-start: 0; inset-inline-end: auto; top: calc(100% + 8px); }
[dir="rtl"] .search-panel { inset-inline-start: 0; inset-inline-end: auto; }
.search-hint { padding: 20px 18px; color: var(--muted); font-size: 12px; text-align: center; }
.search-group-label { padding: 9px 16px 5px; font-size: 10px; letter-spacing: 0.5px; color: var(--muted); font-weight: 700; background: var(--surface-2); border-bottom: 1px solid #f1f4f9; }
.search-result {
  display: flex; align-items: center; gap: 11px; padding: 9px 15px;
  border: 0; background: transparent; width: 100%; text-align: start; cursor: pointer; color: var(--ink);
}
.search-result:hover { background: var(--brand-50); }
.search-result-icon { width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.search-result-title { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-sub { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.app-main { flex: 1 0 auto; }
.page {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

/* --------------------------------------------------------------------------
   Dynamic breadcrumb trail — central navigation bar (Odoo-style)
   -------------------------------------------------------------------------- */
.crumb-bar {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 8px 0 0;
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}
.crumb-bar[hidden] { display: none; }
.crumb-back {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 8px; padding: 3px 9px 3px 7px;
  font: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
  visibility: hidden; opacity: 0;
  transition: opacity 0.16s ease, visibility 0.16s ease, background 0.16s ease,
    color 0.16s ease, border-color 0.16s ease;
}
.crumb-back.reveal { visibility: visible; opacity: 1; }
.crumb-back:hover { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
.crumb-back.is-hidden { display: none; }
.crumb-back svg { flex: 0 0 auto; }
.crumb-back .crumb-back-label { white-space: nowrap; }
.crumb-tail { display: inline-flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto;
  text-decoration: none; color: var(--ink-2); font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 7px; white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}
a.crumb:hover, a.crumb:focus-visible { background: var(--surface-3); color: var(--brand); }
.crumb-app { color: var(--ink); font-weight: 750; }
.crumb-app img { width: 17px; height: 17px; border-radius: 5px; flex: 0 0 auto; }
.crumb-app .crumb-app-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.crumb-app.is-current { cursor: default; }
.crumb-mid { max-width: 250px; overflow: hidden; text-overflow: ellipsis; }
.crumb-current {
  display: inline-flex; align-items: center; flex: 0 1 auto;
  color: var(--ink); font-size: 12px; font-weight: 750;
  padding: 3px 8px; white-space: nowrap; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis;
}
.crumb-sep { display: inline-flex; align-items: center; color: var(--muted-2); flex: 0 0 auto; }
.crumb-sep svg { display: block; }
/* Base icons point the RTL way (arrows toward newer levels and back to the
   app). Flip them under LTR so the trail reads correctly in both languages. */
[dir="ltr"] .crumb-sep svg { transform: scaleX(-1); }
[dir="ltr"] .crumb-back svg { transform: scaleX(-1); }
/* Genuine touch-first devices (phones, tablets) have no hover — keep the back
   button visible and tappable. Desktops — including touch-capable Windows
   laptops and narrow windows — always use the hover reveal instead. */
@media (hover: none) and (pointer: coarse) {
  .crumb-back { visibility: visible; opacity: 1; padding: 5px 11px; }
}
@media (max-width: 760px) {
  .crumb-bar { padding-top: 8px; }
  .crumb-mid, .mid-sep { display: none; }
  .crumb-app .crumb-app-name { max-width: 110px; }
  .crumb-current { max-width: 46vw; }
}
.app-footer {
  border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.65);
  color: var(--muted-2); font-size: 11px;
}
.app-footer-inner {
  width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 16px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.demo-banner {
  display: flex; align-items: center; gap: 9px; padding: 9px 13px;
  background: #fff8e8; border: 1px solid #f3dfb2; color: #8a6012;
  border-radius: 11px; font-size: 12px; line-height: 1.5;
}
.demo-banner svg { flex: 0 0 auto; }
.demo-banner strong { font-weight: 800; }

/* --------------------------------------------------------------------------
   Page header, breadcrumbs, hero
   -------------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head-copy { min-width: 0; flex: 1 1 320px; }
.page-eyebrow { display: flex; align-items: center; gap: 7px; color: var(--brand); font-weight: 700; font-size: 11.5px; letter-spacing: 0.3px; margin-bottom: 7px; }
.page-head h1 { font-size: clamp(23px, 2.1vw, 29px); }
.page-sub { margin-top: 6px; color: var(--muted); font-size: 13px; max-width: 780px; line-height: 1.7; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted-2); margin-bottom: 10px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs .sep { color: var(--line-strong); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 13px; flex-wrap: wrap; }
.section-head h2 { font-size: 17px; }
.section-head .muted { font-size: 12px; }

/* --------------------------------------------------------------------------
   Launcher
   -------------------------------------------------------------------------- */
.launcher-hero {
  position: relative; border-radius: 24px; padding: clamp(24px, 3vw, 34px);
  margin-bottom: 28px; overflow: hidden;
  background:
    radial-gradient(560px 240px at 92% -30%, rgba(255, 255, 255, 0.55), transparent 60%),
    linear-gradient(118deg, var(--brand-50) 0%, var(--surface-3) 48%, var(--surface-2) 100%);
  border: 1px solid #e2ecf9;
  box-shadow: inset 0 1px 0 #fff;
}
.launcher-hero::after {
  content: ""; position: absolute; inset-inline-end: 6%; top: -90px; width: 260px; height: 260px;
  border-radius: 50%; border: 1px solid rgba(108, 76, 241, 0.12);
  box-shadow: 0 0 0 32px rgba(108, 76, 241, 0.035), 0 0 0 72px rgba(108, 76, 241, 0.022);
  pointer-events: none;
}
.launcher-greet-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.launcher-greeting { font-size: clamp(24px, 2.6vw, 33px); letter-spacing: -0.4px; color: var(--ink-strong); }
.launcher-greeting span { color: var(--brand); }
.launcher-sub { color: #5a718d; font-size: 13.5px; margin-top: 8px; max-width: 620px; }
.launcher-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 17px; }
.launcher-date {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, 0.72); border: 1px solid #e1ebf8;
  padding: 6px 11px; border-radius: 99px; font-size: 11.5px; color: #46617f;
}
.launcher-hero-side { position: relative; z-index: 1; text-align: end; }
.launcher-hero-side .tiny { color: #68809c; margin-top: 8px; max-width: 190px; }
.launcher-clock { font-size: clamp(26px, 3vw, 38px); font-weight: 300; letter-spacing: 1px; color: #0f2f5c; font-variant-numeric: tabular-nums; line-height: 1; }
.launcher-wrap { position: relative; }
.launcher-section { margin-top: 28px; }
.launcher-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.launcher-section-head h2 { font-size: 16px; color: #223852; display: flex; align-items: center; gap: 8px; }
.launcher-section-head h2 svg { color: var(--brand); }
.launcher-hint { font-size: 11px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 6px; }
.app-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: clamp(16px, 2.4vw, 28px) clamp(12px, 1.8vw, 22px);
  align-items: start;
}
.app-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 9px;
  background: transparent; border: 0; cursor: pointer; padding: 8px 4px 10px;
  border-radius: 16px; color: var(--ink);
  transition: transform 0.18s var(--easing), background 0.18s ease;
}
.app-tile:hover { transform: translateY(-4px); background: rgba(255, 255, 255, 0.6); }
.app-tile:active { transform: translateY(-1px); }
.app-icon {
  width: 66px; height: 66px; border-radius: 19px;
  display: grid; place-items: center; position: relative;
  box-shadow: 0 8px 18px rgba(24, 46, 81, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: box-shadow 0.18s ease;
}
.app-tile:hover .app-icon { box-shadow: 0 12px 26px rgba(24, 46, 81, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.32); }
.app-icon svg { width: 30px; height: 30px; }
.app-name { font-size: 12.5px; font-weight: 600; text-align: center; line-height: 1.35; color: #263c56; max-width: 124px; }
.app-sub { font-size: 10px; color: var(--muted-2); text-align: center; max-width: 124px; display: none; }
.app-fav-mark {
  position: absolute; top: -5px; inset-inline-end: -5px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  border: 1px solid #e5ecf5; display: grid; place-items: center; color: #e4a11b;
  box-shadow: var(--shadow-xs);
}
.app-fav-mark svg { width: 10px; height: 10px; }
.app-tile.planned .app-icon { box-shadow: none; border: 1.5px dashed #cfd9e6; }
.app-tile.planned { opacity: 0.72; }
.app-tile.planned:hover { opacity: 0.92; transform: translateY(-2px); }
.app-tile .soon-tag {
  position: absolute; top: 1px; inset-inline-end: 1px;
  background: #fff; border: 1px solid #e3e9f2; color: var(--muted);
  font-size: 8.5px; font-weight: 700; border-radius: 99px; padding: 1px 5px;
}
.launcher-empty {
  border: 1px dashed var(--line-strong); border-radius: 16px; padding: 34px;
  text-align: center; color: var(--muted); background: rgba(255, 255, 255, 0.5);
}
.launcher-footnote {
  margin-top: 34px; padding: 16px 18px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.62); border: 1px solid rgba(227, 233, 242, 0.85);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; font-size: 11.5px; color: var(--muted);
}
.launcher-footnote .row { gap: 7px; }

/* --------------------------------------------------------------------------
   Odoo-style app launcher
   -------------------------------------------------------------------------- */
.odoo-launcher {
  max-width: 1040px;
  margin: 0 auto;
  padding: 10px 0 4px;
}
.odoo-demo-strip {
  max-width: 780px;
  margin: 0 auto 34px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: #fffaeb;
  border: 1px solid #f3e2ad;
  border-radius: 12px;
  color: #7c5a12;
  font-size: 11.5px;
  line-height: 1.6;
}
.odoo-demo-strip svg { margin-top: 1px; }
.odoo-demo-strip strong { font-weight: 800; }

/* Personal welcome above the app grid */
.nq-welcome {
  max-width: 780px;
  margin: 0 auto 26px;
  padding: 4px 6px 0;
}
.nq-welcome h1 {
  font-size: 20px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--nq-welcome-ink, #233247);
  text-shadow: var(--nq-welcome-shadow, none);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nq-welcome-motto {
  margin: 6px 0 0;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--nq-welcome-muted, #5a718d);
  text-shadow: var(--nq-welcome-shadow-soft, none);
  max-width: 36rem;
}

.odoo-apps-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 14px 0 0;
}
.odoo-apps-grid {
  display: grid;
  grid-template-columns: repeat(6, 96px);
  justify-content: center;
  align-items: start;
  column-gap: clamp(12px, 2.8vw, 32px);
  row-gap: 27px;
}
.odoo-app {
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #3a4656;
  cursor: pointer;
  border-radius: 16px;
}
.odoo-app-card {
  width: 66px;
  height: 66px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 2px 6px rgba(16, 24, 40, 0.08);
  display: grid;
  place-items: center;
  position: relative;
  transition: transform 0.16s var(--easing), box-shadow 0.16s ease;
}
.odoo-app-card img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  user-select: none;
}
.odoo-app:hover .odoo-app-card {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.13), 0 2px 4px rgba(15, 23, 42, 0.05);
}
.odoo-app:active .odoo-app-card { transform: translateY(-1px); }
.odoo-app-name {
  max-width: 96px;
  min-height: 17px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  color: #364152;
  overflow-wrap: anywhere;
}
.odoo-app-pin {
  position: absolute;
  top: -5px;
  inset-inline-end: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #e0a01a;
  background: #fff;
  border: 1px solid #edf0f4;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.12);
}
.odoo-apps-special { margin-top: 38px; }
.odoo-tools {
  max-width: 780px;
  margin: 44px auto 0;
  padding-top: 26px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}
.odoo-tools-head h2 {
  font-size: 13.5px;
  color: #334155;
  font-weight: 700;
}
.odoo-tools-head p {
  margin-top: 3px;
  color: #8792a2;
  font-size: 10.5px;
}
.odoo-tools-grid { margin-top: 22px; }
.odoo-launcher-foot {
  max-width: 780px;
  margin: 34px auto 0;
  padding-top: 15px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  flex-wrap: wrap;
  color: #8a95a3;
  font-size: 10.5px;
}
.odoo-foot-hint { display: inline-flex; align-items: center; gap: 6px; color: #98a2b1; }
.odoo-foot-hint svg { color: #dca420; }
.odoo-foot-link {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: transparent; padding: 2px 0;
  font-size: 10.5px; color: #6f7d90; cursor: pointer;
}
.odoo-foot-link:hover { color: var(--brand); }
.odoo-roadmap-list { display: grid; gap: 9px; margin-top: 14px; }
.odoo-roadmap-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.odoo-roadmap-name { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.odoo-roadmap-desc { font-size: 10.5px; color: var(--muted); }

/* Planned dialog + Apps information */
.odoo-soon { text-align: center; padding: 2px 4px 8px; }
.odoo-soon-icon {
  width: 92px;
  height: 92px;
  margin: 0 auto 17px;
  border-radius: 21px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 4px rgba(16, 24, 40, 0.05), 0 10px 24px rgba(16, 24, 40, 0.09);
  display: grid;
  place-items: center;
}
.odoo-soon-icon img { width: 56px; height: 56px; object-fit: contain; }
.odoo-soon-desc {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
  max-width: 380px;
  margin: 0 auto 15px;
}
.odoo-apps-info { padding-top: 2px; }
.odoo-info-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 16px;
}
.odoo-info-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 13px 8px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.odoo-info-stats strong { font-size: 22px; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.odoo-info-stats span { font-size: 10.5px; color: var(--muted); text-align: center; }
.odoo-apps-info p { font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.odoo-info-names {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 15px;
}
.odoo-info-names span {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--brand-50);
  color: var(--brand-2);
  border: 1px solid var(--brand-100);
}

@media (max-width: 860px) {
  .odoo-apps-grid { grid-template-columns: repeat(6, 78px); column-gap: 10px; row-gap: 23px; }
  .odoo-app { width: 78px; }
  .odoo-app-name { max-width: 78px; font-size: 11px; }
  .odoo-app-card { width: 60px; height: 60px; border-radius: 14px; }
  .odoo-app-card img { width: 42px; height: 42px; }
}
@media (max-width: 860px) {
  .nq-welcome h1 { font-size: 18px; }
}
@media (max-width: 680px) {
  .nq-welcome { margin-bottom: 22px; }
  .odoo-apps-wrap { padding-top: 4px; }
  .odoo-apps-grid { grid-template-columns: repeat(4, minmax(64px, 78px)); column-gap: 8px; row-gap: 22px; }
  .odoo-apps-special { margin-top: 28px; }
  .odoo-demo-strip { margin-bottom: 22px; font-size: 11px; }
  .odoo-tools { margin-top: 34px; }
  .odoo-launcher-foot { margin-top: 26px; }
}
@media (max-width: 460px) {
  .odoo-apps-grid { grid-template-columns: repeat(3, minmax(64px, 1fr)); }
  .odoo-app { width: 100%; }
  .odoo-launcher { padding-top: 0; }
  .odoo-info-stats { grid-template-columns: 1fr; }
  .odoo-info-stats > div { flex-direction: row; justify-content: space-between; padding: 9px 12px; }
}

/* --------------------------------------------------------------------------
   Cards, stats, charts
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-xs); overflow: hidden;
}
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 17px 19px 0; flex-wrap: wrap; }
.card-head.bordered { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.card-title { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.card-title svg { color: var(--brand); }
.card-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.card-body { padding: 16px 19px 19px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 11px 19px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; }
.vsub-kpis .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .vsub-kpis .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  display: block; text-align: start; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 16px; box-shadow: var(--shadow-xs); color: var(--ink);
  transition: transform 0.17s var(--easing), box-shadow 0.17s ease, border-color 0.17s ease;
  cursor: pointer; position: relative; overflow: hidden;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
a.stat { color: inherit; text-decoration: none; }
.stat.is-static { cursor: default; }
.stat.is-static:hover { transform: none; box-shadow: var(--shadow-xs); border-color: var(--line); }
.stat.is-static .stat-arrow { display: none; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 11.5px; color: var(--muted); font-weight: 600; line-height: 1.4; }
.stat-icon { width: 33px; height: 33px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.stat-value { margin-top: 11px; font-size: clamp(23px, 2.2vw, 29px); font-weight: 750; letter-spacing: -0.6px; line-height: 1.1; color: #102641; font-variant-numeric: tabular-nums; }
.stat-value .cur { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-inline-start: 4px; }
.stat-note { font-size: 10.5px; color: var(--muted-2); margin-top: 5px; }
.stat.tone-blue .stat-icon { background: var(--brand-50); color: var(--brand); }
.stat.tone-red .stat-icon { background: var(--red-soft); color: var(--red); }
.stat.tone-green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat.tone-purple .stat-icon { background: var(--purple-soft); color: var(--purple); }
.stat.tone-amber .stat-icon,
.stat.tone-orange .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat.tone-teal .stat-icon { background: var(--teal-soft); color: var(--teal); }
.stat.tone-slate .stat-icon { background: var(--slate-soft); color: var(--slate); }
.stat .stat-arrow { color: var(--muted-2); opacity: 0; transition: opacity 0.15s ease; }
.stat:hover .stat-arrow { opacity: 1; }
[dir="rtl"] .stat .stat-arrow { transform: scaleX(-1); }

.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; min-width: 0; }
.chart-bar-wrap { width: 100%; max-width: 46px; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart-bar {
  width: 100%; border-radius: 7px 7px 3px 3px; min-height: 4px;
  background: linear-gradient(180deg, #6da7ff, var(--brand));
  position: relative; transition: filter 0.15s ease;
}
.chart-col:hover .chart-bar { filter: saturate(1.2) brightness(1.04); }
.chart-bar-val { font-size: 10.5px; font-weight: 700; color: var(--ink-2); }
.chart-bar-label { font-size: 10px; color: var(--muted-2); white-space: nowrap; }
.chart-bars.empty-chart { align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }

.dist-list { display: grid; gap: 12px; }
.dist-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; }
.dist-label { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; min-width: 0; }
.dist-label .swatch { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto; }
.dist-count { font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.dist-track { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.dist-fill { height: 100%; border-radius: 99px; background: var(--brand); min-width: 2px; }

.note-callout {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 14px;
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 11px;
  color: #375684; font-size: 11.5px; line-height: 1.6;
}
.note-callout svg { color: var(--brand); margin-top: 1px; }
.note-callout.warn { background: var(--amber-soft); border-color: #f3e0b4; color: #7f5c14; }
.note-callout.warn svg { color: var(--amber); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid transparent; background: var(--brand); color: #fff;
  font-family: inherit; font-size: 12.5px; font-weight: 600; line-height: 1;
  cursor: pointer; white-space: nowrap; text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--brand-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { flex: 0 0 auto; }
.btn.primary { background: var(--brand); box-shadow: 0 4px 12px rgba(108, 76, 241, 0.18); }
.btn.primary:hover { background: var(--brand-2); }
.btn.secondary { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn.secondary:hover { border-color: var(--line-strong); color: var(--brand); background: #fff; }
.btn.soft { background: var(--brand-50); color: var(--brand-2); border-color: transparent; }
.btn.soft:hover { background: var(--brand-100); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger { background: var(--red); box-shadow: 0 4px 12px rgba(217, 68, 85, 0.16); }
.btn.danger:hover { background: #c33747; }
.btn.danger-soft { background: var(--red-soft); color: var(--red); }
.btn.danger-soft:hover { background: #fbdde1; }
.btn.success { background: var(--green); }
.btn.success:hover { background: #07856c; }
.btn.success-soft { background: var(--green-soft); color: var(--green); }
.btn.success-soft:hover { background: #d3f3ea; }
.btn.warn-soft { background: var(--amber-soft); color: var(--amber); }
.btn.warn-soft:hover { background: #fcebc9; }
.btn.sm { height: 31px; padding: 0 10px; font-size: 11.5px; border-radius: 8px; gap: 5px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 13.5px; border-radius: 11px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 10.5px; border-radius: 7px; gap: 4px; }
.btn.icon { width: 38px; padding: 0; }
.btn.link { background: transparent; border: 0; color: var(--brand); padding: 0; height: auto; }
.btn.link:hover { background: transparent; text-decoration: underline; }
.btn.dashed { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.btn.dashed:hover { border-color: var(--line-strong); color: var(--brand); background: var(--surface-2); }
.btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-action {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--muted); display: inline-grid; place-items: center;
  cursor: pointer;
}
.icon-action:hover { background: var(--surface-3); color: var(--brand); }
.icon-action.danger:hover { background: var(--red-soft); color: var(--red); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid > [data-generator-wrap] { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .field-label { font-size: 11.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.field .req { color: var(--red); font-weight: 700; }
.input, .select, .textarea {
  width: 100%; background: #fff; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 11px; font-family: inherit; font-size: 13px; line-height: 1.4;
  min-height: 38px; outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-300); box-shadow: 0 0 0 3px rgba(108, 76, 241, 0.1);
}
.input::placeholder, .textarea::placeholder { color: #a6b1c1; }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
.textarea { min-height: 86px; resize: vertical; }
select.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-inline-end: 30px; }
[dir="rtl"] select.select { background-position: 16px 50%, 11px 50%; }
.field-hint { font-size: 10.5px; color: var(--muted-2); line-height: 1.5; }
.field-error { font-size: 10.5px; color: var(--red); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: #e9a2aa; box-shadow: 0 0 0 3px rgba(217, 68, 85, 0.08); }
.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap .input { width: 100%; padding-inline-end: 42px; }
.password-reveal {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.password-reveal:hover { background: var(--surface-3); color: var(--ink-2); }
.password-reveal.is-on { background: var(--surface-3); color: var(--brand); }
.password-reveal:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.checkbox { display: inline-flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; margin: 3px 0 0; accent-color: var(--brand); flex: 0 0 auto; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-card { position: relative; }
.radio-card input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.radio-card span {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: #fff; font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.radio-card input:checked + span { background: var(--brand-50); border-color: #b7cff4; color: var(--brand-2); font-weight: 600; }
.form-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.form-section-title { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 11px; display: flex; align-items: center; gap: 7px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding-top: 16px; border-top: 1px solid var(--line); margin-top: 18px; flex-wrap: wrap; }
.form-actions .start { margin-inline-end: auto; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .btn { border-start-start-radius: 0; border-end-start-radius: 0; height: auto; }
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form .input, .inline-form .select { width: auto; min-width: 150px; }
.form-error {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px;
  border-radius: 9px; background: var(--red-soft); border: 1px solid #f3c9ce; color: #a52d3b;
  font-size: 11.5px; line-height: 1.55; margin-bottom: 12px;
}
.form-error svg { flex: 0 0 auto; margin-top: 1px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid #eff3f8; }
.switch-row:last-child { border-bottom: 0; }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 2; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #cdd7e4; transition: background 0.18s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform 0.18s var(--easing); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-16px); }

/* --------------------------------------------------------------------------
   Badges / pills / meta
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 600;
  background: var(--surface-3); color: var(--muted); white-space: nowrap; line-height: 1.7;
  border: 1px solid transparent;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.blue { background: var(--brand-50); color: var(--brand-2); }
.badge.green { background: var(--green-soft); color: #077a63; }
.badge.red { background: var(--red-soft); color: #b32e3d; }
.badge.amber { background: var(--amber-soft); color: #9c6407; }
.badge.purple { background: var(--purple-soft); color: #5537c9; }
.badge.slate { background: var(--slate-soft); color: #4b5c72; }
.badge.teal { background: #e0f4f0; color: #0b6e62; }
.badge.orange { background: #fdeede; color: #b25e09; }
.badge.outline { background: #fff; border-color: var(--line-strong); color: var(--muted); }
.badge.lg { font-size: 11.5px; padding: 4px 10px; border-radius: 7px; }
.priority { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; }
.priority::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--muted); }
.priority.high { color: #b32e3d; }
.priority.high::before { background: #e05765; }
.priority.medium { color: #996205; }
.priority.medium::before { background: #e9a62a; }
.priority.low { color: var(--muted); }
.priority.low::before { background: #9fb0c4; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
}
.pill.active { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-2); }
.code-chip {
  font-family: var(--mono); font-size: 11px; padding: 2px 6px;
  border-radius: 5px; background: var(--surface-3); color: var(--ink-2);
  direction: ltr; unicode-bidi: isolate; display: inline-block;
}
/* Policy rules preview (approvals v2): read-only JSON block. */
.code-block {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; max-height: 320px; overflow: auto; white-space: pre-wrap;
  word-break: break-word;
}
.tag-soft-blue { background: var(--brand-50); color: var(--brand-2); }
.tag-soft-green { background: var(--green-soft); color: #077a63; }
.warranty-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: start; font-size: 10.5px; font-weight: 700; letter-spacing: 0.25px;
  color: var(--muted); background: var(--surface-2);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid #eef2f7; color: var(--ink-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table tbody tr.selected { background: var(--brand-50); }
.table .cell-main { font-weight: 600; color: var(--ink); }
.table .cell-sub { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.table .cell-actions { text-align: end; white-space: nowrap; }
/* Action cells must remain table-cells. .cell-actions is also used as an
   inline-flex cluster outside tables; that display must not apply to a <td>,
   or the cell leaves the row layout and its bottom border sits higher than
   the rest of the row (visible as a broken line under the last columns). */
.table td.cell-actions {
  display: table-cell;
  text-align: end;
  white-space: nowrap;
  vertical-align: middle;
}
/* One continuous row rule, independent of per-cell boxes. */
.contact-table tbody tr,
.opp-table tbody tr {
  border-bottom: 1px solid var(--nq-line, var(--line, #eef2f7));
}
.contact-table tbody td,
.opp-table tbody td {
  border-bottom: 0;
}
.contact-table tbody tr:last-child,
.opp-table tbody tr:last-child {
  border-bottom: 0;
}
.table .num { font-variant-numeric: tabular-nums; }
.table.compact th { padding: 8px 12px; }
.table.compact td { padding: 8px 12px; }
.table-wrap.round { border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.table-wrap.round .table th:first-child { border-start-start-radius: 12px; }
.table-wrap.round .table th:last-child { border-start-end-radius: 12px; }
.empty-row { text-align: center; color: var(--muted); padding: 36px 16px !important; font-size: 12px; }
.list-stack { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 11px; padding: 11px 19px;
  border-bottom: 1px solid #eef2f7; background: transparent; width: 100%;
  border-inline: 0; border-top: 0; text-align: start; color: var(--ink);
  cursor: pointer; font-family: inherit; font-size: inherit;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: 0 0 auto; }
.list-row-main { min-width: 0; flex: 1; }
.list-row-title { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row-sub { font-size: 10.5px; color: var(--muted-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row-end { text-align: end; flex: 0 0 auto; font-size: 10.5px; color: var(--muted-2); }

/* --------------------------------------------------------------------------
   Tabs / toolbar / pagination / filters
   -------------------------------------------------------------------------- */
.tabs { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  position: relative; border: 0; background: transparent; color: var(--muted);
  padding: 9px 12px 11px; font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; border-radius: 7px 7px 0 0;
}
.tab:hover { color: var(--ink-2); background: var(--surface-2); }
.tab.active { color: var(--brand); }
.tab.active::after { content: ""; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; background: var(--brand); border-radius: 99px 99px 0 0; }
.tab .tab-count { font-size: 9.5px; background: var(--surface-3); color: var(--muted); padding: 0 5px; border-radius: 99px; margin-inline-start: 4px; }
.tab.active .tab-count { background: var(--brand-50); color: var(--brand); }
.segmented { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 9px; }
.segmented button {
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-family: inherit; font-size: 11.5px; font-weight: 600; padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-xs); }
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar-start { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1 1 320px; }
.toolbar-end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-inline { position: relative; min-width: 210px; flex: 0 1 280px; }
.search-inline svg { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search-inline .input { padding-inline-start: 31px; height: 35px; min-height: 35px; font-size: 12px; }
.filter-select { height: 35px; min-height: 35px; font-size: 12px; padding-block: 0; width: auto; min-width: 130px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 13px; }
.pagination-info { font-size: 11.5px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  min-width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 11.5px; cursor: pointer; padding: 0 7px;
}
.pager button:hover:not(:disabled) { border-color: var(--line-strong); color: var(--brand); }
.pager button.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }
.pager .pager-gap { color: var(--muted-2); font-size: 11px; padding: 0 2px; }

/* --------------------------------------------------------------------------
   Detail layouts / data lists / timeline
   -------------------------------------------------------------------------- */
.detail-hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow-xs);
}
.detail-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title { font-size: 21px; font-weight: 750; letter-spacing: -0.2px; }
.detail-sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.detail-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px 20px; margin-top: 18px; }
.meta-item { min-width: 0; }
.meta-label { font-size: 10px; color: var(--muted-2); font-weight: 600; letter-spacing: 0.15px; margin-bottom: 3px; display: flex; align-items: center; gap: 4px; }
.meta-value { font-size: 12.5px; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.meta-value.light { font-weight: 500; color: var(--ink-2); }
.data-list { display: grid; gap: 10px; }
.data-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid #f0f4f9; font-size: 12px; }
.data-row:last-child { border-bottom: 0; padding-bottom: 0; }
.data-row .k { color: var(--muted); flex: 0 0 auto; }
.data-row .v { text-align: end; color: var(--ink-2); font-weight: 500; overflow-wrap: anywhere; }
.data-row .v.strong { color: var(--ink); font-weight: 700; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: 13px; top: 28px; bottom: 0; width: 1px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 27px; height: 27px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); flex: 0 0 auto; z-index: 1; }
.tl-dot.success { background: var(--green-soft); border-color: #c7f0e4; color: var(--green); }
.tl-dot.blue { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand); }
.tl-dot.amber { background: var(--amber-soft); border-color: #f4e3bd; color: var(--amber); }
.tl-dot.red { background: var(--red-soft); border-color: #f5cdd2; color: var(--red); }
.tl-content { min-width: 0; flex: 1; }
.tl-title { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.tl-note { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.6; overflow-wrap: anywhere; }
.tl-meta { font-size: 10px; color: var(--muted-2); margin-top: 4px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.stepper { display: grid; gap: 0; }
.step-row { display: flex; gap: 11px; padding-bottom: 16px; position: relative; }
.step-row:last-child { padding-bottom: 0; }
.step-row::before { content: ""; position: absolute; inset-inline-start: 14px; top: 30px; bottom: 2px; width: 1px; background: var(--line); }
.step-row:last-child::before { display: none; }
.step-marker {
  width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; flex: 0 0 auto; z-index: 1;
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--line);
}
.step-row.current .step-marker { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(108, 76, 241, 0.12); }
.step-row.approved .step-marker { background: var(--green-soft); color: var(--green); border-color: #bdeede; }
.step-row.rejected .step-marker { background: var(--red-soft); color: var(--red); border-color: #f3c6cc; }
.step-content { min-width: 0; flex: 1; }
.step-title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.step-sub { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.step-note { margin-top: 5px; font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 7px; padding: 6px 9px; line-height: 1.55; }
.two-col-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.note-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; }
.note-card .label { font-size: 10px; color: var(--muted-2); font-weight: 700; margin-bottom: 5px; }
.note-card .body { font-size: 12px; color: var(--ink-2); line-height: 1.7; white-space: pre-wrap; }
.reading-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.reading-cell { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.reading-cell .k { font-size: 10px; color: var(--muted-2); }
.reading-cell .v { font-size: 15px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hint-strip { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); padding: 8px 12px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 9px; }

/* --------------------------------------------------------------------------
   Split panels / request selects
   -------------------------------------------------------------------------- */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: #fff; border-radius: 99px;
  padding: 4px 9px; font-size: 11px; color: var(--ink-2);
}
.chip button { border: 0; background: transparent; color: var(--muted-2); display: grid; place-items: center; padding: 0; cursor: pointer; }
.chip button:hover { color: var(--red); }
.approver-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 7px; max-height: 200px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
.approver-option { display: flex; align-items: center; gap: 7px; font-size: 11.5px; padding: 5px 6px; border-radius: 7px; cursor: pointer; }
.approver-option:hover { background: var(--surface-2); }
.approver-option input { accent-color: var(--brand); }
.approver-option .order {
  min-width: 18px; height: 18px; border-radius: 50%; background: var(--brand-50);
  color: var(--brand); font-size: 9px; display: grid; place-items: center; font-weight: 700;
}

/* --------------------------------------------------------------------------
   Calendar
   -------------------------------------------------------------------------- */
.calendar-layout { display: grid; gap: 18px; }
.week-board {
  display: grid; grid-template-columns: repeat(7, minmax(118px, 1fr));
  border: 1px solid var(--line); border-radius: 14px; overflow: auto; background: #fff;
}
.week-day-col { min-height: 440px; border-inline-end: 1px solid var(--line); min-width: 118px; }
.week-day-col:last-child { border-inline-end: 0; }
.week-day-head {
  padding: 10px 9px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  position: sticky; top: 0; z-index: 2;
}
.week-day-name { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: 0.3px; }
.week-day-num { font-size: 16px; font-weight: 750; color: var(--ink); margin-top: 1px; }
.week-day-head.today { background: var(--brand-50); }
.week-day-head.today .week-day-num { color: var(--brand); }
.week-day-events { padding: 7px; display: flex; flex-direction: column; gap: 5px; }
.cal-event {
  display: block; text-align: start; width: 100%; border: 0; border-inline-start: 3px solid var(--brand);
  background: #f3f8ff; border-radius: 6px; padding: 6px 7px; cursor: pointer; color: var(--ink);
  font-family: inherit;
}
.cal-event:hover { background: var(--brand-50); }
.cal-event .time { font-size: 9px; color: var(--muted); direction: ltr; text-align: start; }
.cal-event .name { font-size: 10.5px; font-weight: 600; line-height: 1.35; margin-top: 1px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-event .cust { font-size: 9px; color: var(--muted-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.p-high { border-inline-start-color: var(--red); background: var(--red-soft); }
.cal-event.p-medium { border-inline-start-color: var(--amber); background: #fffaf0; }
.cal-event.p-low { border-inline-start-color: #93a4b9; background: #f7f9fc; }
.cal-day-empty { font-size: 9px; color: var(--muted-2); text-align: center; padding: 14px 4px; }
.agenda-list { display: flex; flex-direction: column; }
.agenda-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 16px;
  border-bottom: 1px solid #eef2f7; width: 100%; border-inline: 0; border-top: 0;
  background: transparent; text-align: start; cursor: pointer; color: var(--ink);
}
.agenda-item:hover { background: var(--surface-2); }
.agenda-date { flex: 0 0 52px; text-align: center; border-inline-end: 1px solid var(--line); padding-inline-end: 9px; }
.agenda-date .d { font-size: 16px; font-weight: 750; color: var(--ink); line-height: 1.1; }
.agenda-date .m { font-size: 9px; color: var(--muted); }
.agenda-main { flex: 1; min-width: 0; }
.agenda-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-sub { font-size: 10.5px; color: var(--muted-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-time { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; direction: ltr; }

/* --------------------------------------------------------------------------
   Empty / errors / skeletons
   -------------------------------------------------------------------------- */
.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; border-radius: 15px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted-2); }
.empty-title { font-size: 14px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.empty-text { font-size: 12px; color: var(--muted); max-width: 380px; margin: 0 auto 14px; line-height: 1.65; }
.loading-block { padding: 32px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 12px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.7s linear infinite; flex: 0 0 auto; }
.spinner.light { border-color: rgba(255, 255, 255, 0.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.2s ease infinite; border-radius: 7px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-card { height: 120px; }
.error-state { padding: 38px 20px; text-align: center; }
.error-state .empty-title { color: var(--red); }
.page-skeleton { display: grid; gap: 16px; }
.page-skeleton .head { height: 60px; width: min(420px, 80%); }
.page-skeleton .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.page-skeleton .stat { height: 100px; }

/* --------------------------------------------------------------------------
   Settings
   -------------------------------------------------------------------------- */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-nav {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 8px; box-shadow: var(--shadow-xs); position: sticky; top: calc(var(--topbar-h) + 16px);
}
.settings-nav button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border: 0; background: transparent; border-radius: 8px;
  font-family: inherit; font-size: 12.5px; color: var(--ink-2); text-align: start; cursor: pointer;
}
.settings-nav button:hover { background: var(--surface-2); color: var(--brand); }
.settings-nav button.active { background: var(--brand-50); color: var(--brand-2); font-weight: 600; }
.settings-nav button svg { color: var(--muted-2); }
.settings-nav button.active svg { color: var(--brand); }
.settings-panels { min-width: 0; display: grid; gap: 18px; }
.settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); overflow: hidden; }
.settings-card-head { padding: 18px 20px 13px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.settings-card-head h3 { font-size: 15px; }
.settings-card-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.settings-card-body { padding: 18px 20px 20px; }
.profile-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.profile-summary .avatar { width: 52px; height: 52px; border-radius: 14px; font-size: 17px; }
.permission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.permission-group { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.permission-group h4 { font-size: 12px; margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.permission-group label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-2); padding: 3px 0; cursor: pointer; }
.permission-group input { accent-color: var(--brand); }
.role-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: #fff;
}
.role-card:hover { border-color: var(--line-strong); }
.role-card .role-name { font-size: 13px; font-weight: 600; }
.role-card .role-meta { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.session-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f0f4f9; }
.session-row:last-child { border-bottom: 0; }
.session-current { font-size: 10px; color: var(--green); font-weight: 700; }
.audit-action { font-family: var(--mono); font-size: 10.5px; background: var(--surface-3); border-radius: 5px; padding: 2px 5px; color: var(--ink-2); }
.roadmap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.roadmap-card { border: 1px dashed var(--line-strong); border-radius: 11px; padding: 13px; background: var(--surface-2); }
.roadmap-card .icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: #fff; color: var(--muted); border: 1px solid var(--line); margin-bottom: 8px; }
.roadmap-card h4 { font-size: 12.5px; }
.roadmap-card p { margin: 3px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.55; }
.temp-password {
  border: 1px dashed var(--brand-200); background: var(--surface-2); border-radius: 10px;
  padding: 13px 15px; font-family: var(--mono); font-size: 16px; letter-spacing: 1px;
  direction: ltr; text-align: center; color: var(--brand-3); margin: 8px 0 4px;
  user-select: all;
}
.stack-cell { display: flex; align-items: center; gap: 8px; }

/* --------------------------------------------------------------------------
   Misc components
   -------------------------------------------------------------------------- */
.hero-actions-card {
  background: linear-gradient(135deg, var(--brand-3), var(--brand) 65%, var(--brand-300));
  border-radius: var(--radius); color: #fff; padding: 22px; position: relative; overflow: hidden;
  box-shadow: 0 16px 34px rgba(18, 58, 118, 0.18);
}
.hero-actions-card::after {
  content: ""; position: absolute; inset-inline-end: -50px; top: -80px; width: 230px; height: 230px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 36px rgba(255, 255, 255, 0.05), 0 0 0 76px rgba(255, 255, 255, 0.03);
}
.hero-actions-card h2 { color: #fff; font-size: 17px; }
.hero-actions-card p { color: rgba(255, 255, 255, 0.72); font-size: 11.5px; margin-top: 4px; }
.hero-actions-card .btn.secondary { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.22); color: #fff; }
.hero-actions-card .btn.secondary:hover { background: rgba(255, 255, 255, 0.2); }
.hero-actions-card .meta-label { color: rgba(255, 255, 255, 0.55); }
.hero-actions-card .meta-value { color: #fff; }
.current-job {
  border: 1px solid var(--brand-100); border-radius: 14px; background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  padding: 16px; position: relative; overflow: hidden;
}
.current-job .job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.current-job .job-number { font-family: var(--mono); font-size: 11px; color: var(--brand); font-weight: 700; }
.current-job .job-title { font-size: 15px; font-weight: 700; margin-top: 3px; }
.current-job .job-sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.current-job .job-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.summary-strip .cell { background: #fff; padding: 11px 13px; }
.summary-strip .v { font-size: 19px; font-weight: 750; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.summary-strip .k { font-size: 10px; color: var(--muted); margin-top: 2px; }
.info-banner {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px;
  background: var(--surface-2); border: 1px solid var(--brand-100); border-radius: 11px;
  color: #3c567a; font-size: 11.5px; line-height: 1.6;
}
.info-banner svg { color: var(--brand); margin-top: 1px; }
.info-banner strong { color: #27476f; }
.status-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stage-dot { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.stage-dot .d { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.stage-dot.done .d { background: var(--green); }
.stage-dot.current .d { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.stage-dot.current { color: var(--brand); font-weight: 700; }
.parts-line { display: grid; grid-template-columns: minmax(0, 2fr) 86px minmax(0, 1.4fr) 30px; gap: 7px; align-items: center; }
.parts-line .input, .parts-line .select { min-height: 33px; height: 33px; font-size: 11.5px; padding-block: 0; }
.big-number { font-variant-numeric: tabular-nums; }
.donut-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.donut-legend .item { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.donut-legend .sw { width: 7px; height: 7px; border-radius: 2px; }
.progress-track { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-300)); }
.readonly-value { padding: 9px 0; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.pagination-compact { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.list-empty { padding: 26px 18px; text-align: center; font-size: 11.5px; color: var(--muted); }
.danger-text { color: var(--red); }
.success-text { color: var(--green); }
.warn-text { color: var(--amber); }
.noscript {
  position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg);
  padding: 32px; font-size: 15px; color: var(--ink); z-index: 999; text-align: center;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   Phase 2 — commercial documents (sales / purchasing line editor)
   -------------------------------------------------------------------------- */
.line-editor { display: flex; flex-direction: column; overflow-x: auto; }
.line-grid {
  display: grid;
  grid-template-columns: 112px minmax(190px, 1fr) 82px 108px 96px 108px 30px;
  gap: 7px; align-items: center; min-width: 740px;
}
.line-grid.purchase { grid-template-columns: minmax(220px, 1fr) 86px 110px 110px 30px; min-width: 580px; }
.line-grid .line-head { padding: 5px 0 7px; border-bottom: 1px solid var(--line); font-size: 10px; color: var(--muted-2); font-weight: 700; }
.line-rows { display: flex; flex-direction: column; }
.line-item { padding: 7px 0; border-bottom: 1px solid #eef2f7; }
.line-item .input, .line-item .select { height: 33px; min-height: 33px; font-size: 11.5px; padding-block: 0; }
.line-item .line-total { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.line-remove {
  width: 29px; height: 29px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--muted-2); display: grid; place-items: center; cursor: pointer;
}
.line-remove:hover { color: var(--red); background: var(--red-soft); }
.line-note { font-size: 9.5px; color: var(--muted-2); margin-top: 3px; line-height: 1.4; }
.line-empty { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 12px; border: 1px dashed var(--line-strong); border-radius: 10px; margin: 10px 0; }
.totals-box { margin-inline-start: auto; width: min(330px, 100%); border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); padding: 11px 14px; }
.totals-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--muted); padding: 4px 0; }
.totals-row strong { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 650; }
.totals-row.grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 9px; color: var(--ink); }
.totals-row.grand strong { font-size: 17px; font-weight: 750; letter-spacing: -0.3px; }
.doc-timeline { display: flex; flex-direction: column; gap: 0; }
.doc-step { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eef2f7; }
.doc-step:last-child { border-bottom: 0; }
.doc-step-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-3); color: var(--muted); }
.doc-step.done .doc-step-icon { background: var(--green-soft); color: var(--green); }
.doc-step.current .doc-step-icon { background: var(--brand-50); color: var(--brand); }
.doc-step-title { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.doc-step-time { font-size: 10.5px; color: var(--muted-2); margin-top: 1px; }
.doc-step.pending .doc-step-title { color: var(--muted-2); font-weight: 500; }
.doc-link-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--brand); background: var(--brand-50); padding: 3px 8px; border-radius: 7px; text-decoration: none; }
.doc-link-chip:hover { background: var(--brand-100); }
.approval-inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }

@media (max-width: 1180px) {
  .auth-grid { grid-template-columns: minmax(0, 0.95fr) minmax(380px, 0.9fr); gap: 28px; }
  .auth-visual { min-height: 540px; }
  .top-clock { display: none; }
  .split-main { grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.85fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .auth-visual { display: none; }
  .auth-grid { grid-template-columns: minmax(0, 470px); justify-content: center; }
  .auth-panel { max-width: 470px; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  .search-shell { order: 3; flex-basis: 100%; max-width: none; }
  .topbar-actions { margin-inline-start: auto; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 3px; padding: 6px; }
  .settings-nav button { flex: 0 0 auto; width: auto; white-space: nowrap; }
  .week-board { grid-template-columns: repeat(7, minmax(132px, 1fr)); }
  .split-main { grid-template-columns: 1fr; }
  .page-skeleton .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .page { width: calc(100% - 28px); padding: 20px 0 40px; }
  .topbar-inner, .app-footer-inner { width: calc(100% - 28px); }
  .brand-company { display: none; }
  .user-chip-text { display: none; }
  .user-chip { padding: 3px; }
  .brand-name { font-size: 13.5px; letter-spacing: 1.5px; }
  .brand img { width: 34px; height: 34px; }
  .topbar-actions { gap: 1px; }
  .icon-btn { width: 34px; height: 34px; }
  .topbar-actions .icon-btn[data-top="calendar"], .topbar-actions .icon-btn[data-top="messages"] { display: none; }
  .lang-btn { min-width: 38px; height: 29px; padding: 0 6px; }
  .launcher-hero { padding: 22px 18px; border-radius: 18px; }
  .launcher-hero-side { display: none; }
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 16px 10px; }
  .app-icon { width: 55px; height: 55px; border-radius: 16px; }
  .app-icon svg { width: 25px; height: 25px; }
  .app-name { font-size: 11px; max-width: 90px; }
  .app-fav-mark { width: 16px; height: 16px; }
  .launcher-footnote { font-size: 10.5px; }
  .page-head { gap: 12px; margin-bottom: 16px; }
  .page-sub { font-size: 12px; }
  .grid-2, .grid-3, .grid-4, .split-even { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .two-col-notes { grid-template-columns: 1fr; }
  .detail-hero { padding: 16px; }
  .detail-title { font-size: 18px; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { border-radius: 18px; max-height: calc(100dvh - 20px); margin: 0; }
  .modal-head { padding: 18px 16px 10px; }
  .modal-body { padding: 6px 16px 16px; }
  .modal-foot { padding: 12px 16px; position: sticky; bottom: 0; }
  .table th, .table td { padding: 9px 10px; }
  .toolbar-start { flex-basis: 100%; }
  .search-inline { flex: 1 1 100%; }
  .filter-select { flex: 1 1 130px; }
  .week-board { grid-template-columns: repeat(7, minmax(138px, 1fr)); }
  .page-actions .btn { flex: 0 1 auto; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .toast-region { inset-inline: 12px; inset-block-end: 12px; max-width: none; }
  .search-panel { width: calc(100vw - 28px); position: fixed; inset-inline-start: 14px; top: 110px; }
  .popover { position: fixed; inset-inline: 12px; top: 70px; width: auto; }
  .user-popover { top: 70px; inset-inline-start: auto; inset-inline-end: 12px; width: 260px; }
  .parts-line { grid-template-columns: 1fr 74px; }
  .parts-line .input.note-field { grid-column: 1 / 2; }
  .parts-line .icon-action { grid-column: 2 / 3; justify-self: end; }
  .auth-grid { width: calc(100% - 28px); padding-bottom: 24px; }
  .auth-top, .auth-foot { width: calc(100% - 28px); }
  .auth-panel { padding: 24px 20px; border-radius: 20px; }
  .auth-demo-list { grid-template-columns: 1fr; }
  .auth-foot { flex-direction: column; gap: 6px; align-items: flex-start; }
  .hero-actions-card { padding: 18px; }
  .current-job .job-meta { grid-template-columns: 1fr; }
  .readonly-value { padding: 5px 0; }
  .settings-card-head, .settings-card-body { padding-inline: 15px; }
  .page-skeleton .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .lang-btn { font-size: 10.5px; }
  .app-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-icon { width: 52px; height: 52px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .app-tile:hover, .stat:hover { transform: none; }
}

@media print {
  .topbar, .app-footer, .page-actions, .tabs, .toolbar, .btn, .global-progress { display: none !important; }
  body { background: #fff; }
  .page { width: 100%; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ==========================================================================
   Phase 3 — collaboration, workspaces, people and accounting
   ========================================================================== */

/* Layout primitives */
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 20px;
  align-items: start;
}
.cell-actions { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.text-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--brand); font-weight: 600; text-decoration: none;
}
.text-link:hover { color: var(--brand-2); }
.text-red { color: var(--red) !important; }
.input-sm { min-height: 33px; height: 33px; padding-block: 0; font-size: 11.5px; }
.select-sm {
  min-height: 32px; height: 32px; padding-block: 0; font-size: 11px;
  padding-inline-end: 26px; background-size: 4px 4px, 4px 4px;
}
.tabs-sm { margin-bottom: 0; border-bottom: 0; gap: 2px; }
.tabs-sm .tab { padding: 6px 10px; font-size: 11px; border-radius: 7px; }
.tabs-sm .tab.active { background: var(--brand-50); }
.tabs-sm .tab.active::after { display: none; }
.pill-button {
  cursor: pointer; font-family: inherit; color: var(--ink-2);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.pill-button:hover { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-2); }
.check-label, .check-row {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--ink-2); cursor: pointer;
}
.check-row {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff;
}
.check-label input, .check-row input { width: 14px; height: 14px; margin: 0; flex: 0 0 auto; accent-color: var(--brand); }
.progress { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-300)); }

/* Document line editor (accounting) */
.line-editor-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 4px 0 10px; font-size: 12.5px; font-weight: 700; color: var(--ink-2);
}
.line-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 92px 118px 110px 38px;
  gap: 7px; align-items: center; min-width: 620px;
  padding: 6px 0; border-bottom: 1px solid #eef2f7;
}
.line-row-head {
  border-bottom: 1px solid var(--line); padding-bottom: 7px;
  font-size: 10px; font-weight: 700; color: var(--muted-2);
}
.line-row .input { min-height: 34px; height: 34px; font-size: 11.5px; padding-block: 0; }
.line-row .line-total { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.line-editor-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0 2px;
}
.line-editor-foot .strong { font-variant-numeric: tabular-nums; }

/* Accounting summary blocks */
.aging-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.aging-cell {
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 9px; padding: 8px 10px; min-width: 0;
}
.aging-cell .strong { font-size: 12.5px; display: block; margin-top: 1px; }
.totals-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.totals-list > div {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 5px 0; font-size: 12px; color: var(--muted);
}
.totals-list > div > span:last-child {
  color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums;
}
.totals-strong {
  border-top: 1px solid var(--line); margin-top: 5px;
  padding-top: 9px !important; font-size: 13px !important; color: var(--ink) !important;
  font-weight: 700;
}
.totals-strong > span:last-child { font-size: 16px; font-weight: 750; }

/* Documents, projects, threads */
.doc-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.doc-icon {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--brand-50); color: var(--brand);
}
.doc-cell .cell-sub { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-meta .meta-grid { margin-top: 0; }
.thread-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  background: #fff; margin-bottom: 8px;
}
.thread-item:last-child { margin-bottom: 0; }
.thread-item.internal { background: var(--amber-soft); border-color: #f0ddb4; }
.thread-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 5px; font-size: 11.5px;
}
.thread-body { font-size: 12px; color: var(--ink-2); white-space: pre-wrap; line-height: 1.7; }

/* To-dos */
.todo-list { display: flex; flex-direction: column; }
.todo-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid #eef2f7;
}
.todo-row:last-child { border-bottom: 0; }
.todo-row.done { background: #fbfdfc; }
.todo-check {
  border: 0; background: transparent; color: var(--muted-2); padding: 1px;
  display: grid; place-items: center; cursor: pointer; border-radius: 50%;
  flex: 0 0 auto;
}
.todo-check.checked { color: var(--green); }
.todo-title { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.todo-row.done .todo-title { color: var(--muted); text-decoration: line-through; }
.todo-note { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.55; }
.todo-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 10px; color: var(--muted-2); margin-top: 5px;
}
.todo-meta span { display: inline-flex; align-items: center; gap: 3px; }

/* Surveys */
.survey-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.survey-card { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.survey-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.survey-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; background: var(--brand-50); color: var(--brand);
}
.survey-title { font-size: 14px; }
.survey-desc { flex: 1; margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.65; }
.survey-metrics { display: flex; flex-wrap: wrap; gap: 10px; font-size: 10.5px; color: var(--muted); }
.survey-metrics span { display: inline-flex; align-items: center; gap: 4px; }
.survey-focus { flex: 0 0 auto; }
.survey-card .btn { align-self: flex-start; }
.survey-status-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 13px;
}
.question-list, .response-list { display: flex; flex-direction: column; }
.question-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid #eef2f7;
}
.question-row:last-child { border-bottom: 0; }
.question-index {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--brand-50);
  color: var(--brand-2); font-size: 10.5px; font-weight: 700;
}
.response-row { border-bottom: 1px solid #eef2f7; }
.response-row:last-child { border-bottom: 0; }
.response-row > summary {
  list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; cursor: pointer;
}
.response-row > summary::-webkit-details-marker { display: none; }
.response-row > summary > .cell-main { flex: 1; min-width: 0; }
.response-row > summary svg { color: var(--muted-2); transition: transform 0.15s ease; }
.response-row[open] > summary svg { transform: rotate(180deg); }
.response-answers { display: grid; gap: 8px; padding: 2px 16px 14px 48px; background: var(--surface-2); }
[dir="rtl"] .response-answers { padding: 2px 48px 14px 16px; }
.response-answer { display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; color: var(--muted); }
.response-answer strong { color: var(--ink); font-weight: 600; white-space: pre-wrap; }

/* Social */
.social-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.social-card { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.social-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.social-channel {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 99px;
  background: var(--brand-50); color: var(--brand-2);
  font-size: 10.5px; font-weight: 600;
}
.social-title { font-size: 14px; }
.social-content {
  flex: 1; margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.social-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; font-size: 10px; color: var(--muted-2); }
.social-meta span { display: inline-flex; align-items: center; gap: 3px; }
.social-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 3px; }

/* Chat (discuss + live chat console) */
.chat-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  height: clamp(500px, calc(100vh - 250px), 760px);
  min-height: 0;
}
.chat-side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-side-head { flex: 0 0 auto; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.chat-channel-list { flex: 1; overflow-y: auto; padding: 7px; }
.chat-channel {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--ink); font-family: inherit;
  text-align: start; cursor: pointer;
}
.chat-channel:hover { background: var(--surface-2); }
.chat-channel.active { background: var(--brand-50); border-color: var(--brand-100); }
.chat-channel-icon {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--brand-50); color: var(--brand);
}
.chat-channel.active .chat-channel-icon { background: #fff; }
.chat-channel-name {
  display: block; font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-channel-sub {
  display: block; margin-top: 1px; font-size: 10px; color: var(--muted-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-channel-meta { flex: 0 0 auto; }
.chat-main { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-main-empty { flex: 1; display: grid; place-items: center; padding: 24px; }
.chat-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.chat-head-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.chat-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-messages {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 11px;
  padding: 16px; background: linear-gradient(180deg, var(--surface-2), var(--surface-2));
}
.chat-msg { display: flex; align-items: flex-start; gap: 8px; }
.chat-msg.mine { justify-content: flex-end; }
.chat-bubble-wrap { max-width: min(78%, 620px); min-width: 0; }
.chat-bubble {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 13px;
  background: #fff; box-shadow: var(--shadow-xs);
}
.chat-msg.mine .chat-bubble { background: var(--brand); border-color: var(--brand); color: #fff; }
.chat-author { margin-bottom: 2px; font-size: 10px; font-weight: 700; color: var(--muted); }
.chat-msg.mine .chat-author { color: rgba(255, 255, 255, 0.75); }
.chat-text { font-size: 12.5px; line-height: 1.65; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.mine .chat-text { color: #fff; }
.chat-time { margin-top: 3px; font-size: 9.5px; color: var(--muted-2); text-align: end; }
.chat-msg.mine .chat-time { color: rgba(255, 255, 255, 0.64); }
.chat-composer {
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px;
  padding: 11px 14px; border-top: 1px solid var(--line); background: #fff;
}
.chat-composer .input { min-height: 40px; max-height: 130px; resize: none; }
.chat-composer .btn { min-height: 40px; }
.chat-main > .info-banner { flex: 0 0 auto; margin: 12px 14px 14px; }

/* Operations assistant */
.ai-shell {
  display: flex; flex-direction: column; overflow: hidden;
  height: clamp(520px, calc(100vh - 270px), 820px);
}
.ai-messages {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
  padding: 22px;
  background:
    radial-gradient(700px 280px at 50% 0%, #f2f8ff, transparent 72%),
    var(--surface);
}
.ai-msg { display: flex; align-items: flex-start; gap: 9px; width: 100%; max-width: 840px; }
.ai-msg.user { align-self: flex-end; justify-content: flex-end; }
.ai-avatar {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--brand-50); color: var(--brand);
}
.ai-body { min-width: 0; }
.ai-msg.assistant .ai-body {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px;
  background: #fff; box-shadow: var(--shadow-xs);
}
.ai-msg.user .ai-body {
  max-width: min(78%, 560px); padding: 10px 13px;
  border-radius: 13px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.ai-text { font-size: 12.5px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-msg.user .ai-text { color: #fff; }
.ai-msg .btn { margin-top: 8px; }
.ai-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 7px; margin-top: 8px; }
.ai-card {
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2);
}
.ai-card-label { font-size: 9.5px; color: var(--muted); }
.ai-card strong { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ai-suggestions {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px; border-top: 1px solid var(--line); background: #fff;
}
.ai-composer {
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px;
  padding: 11px 14px 13px; border-top: 1px solid var(--line); background: #fff;
}
.ai-composer .input { min-height: 42px; max-height: 130px; resize: none; }
.ai-composer .btn { min-height: 42px; }
.ai-welcome {
  display: flex; align-items: flex-start; gap: 12px;
  max-width: 680px; margin: auto 0; padding: 18px;
  background: linear-gradient(135deg, var(--surface-2), #eef5ff);
  border: 1px solid #deebfb; border-radius: 14px;
}
.ai-welcome .ai-avatar { width: 36px; height: 36px; border-radius: 11px; background: #fff; }
.ai-welcome-title { margin-bottom: 4px; font-size: 13.5px; font-weight: 700; }
.ai-welcome p { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.75; }
.ai-typing { display: inline-flex; align-items: center; gap: 4px; padding: 3px 0; }
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2);
  animation: ai-dot 1s infinite ease-in-out;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Project task board */
.task-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.task-col {
  flex: 1 1 170px; min-width: 158px; display: flex; flex-direction: column;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.task-col-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 700; color: var(--ink-2);
}
.task-col-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 8px; }
.task-card {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; box-shadow: var(--shadow-xs);
}
.task-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.task-title { margin: 5px 0 3px; font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.task-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 5px; font-size: 9.5px; color: var(--muted-2);
}
.task-meta span { display: inline-flex; align-items: center; gap: 3px; }
.task-stage-select { width: 100%; margin-top: 7px; }

/* --------------------------------------------------------------------------
   Phase 3 responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .aging-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chat-shell { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .split-grid { grid-template-columns: 1fr; }
  .chat-shell {
    grid-template-columns: 1fr; height: auto; min-height: 0;
  }
  .chat-side { max-height: 250px; }
  .chat-main { min-height: 480px; }
}
@media (max-width: 760px) {
  .aging-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-row { min-width: 560px; }
  .ai-shell { height: calc(100vh - 220px); min-height: 440px; }
  .ai-messages { padding: 15px; }
  .ai-msg.user .ai-body { max-width: 86%; }
  .chat-bubble-wrap { max-width: 86%; }
  .survey-grid, .social-grid { grid-template-columns: 1fr; }
  .response-answers, [dir="rtl"] .response-answers { padding: 2px 16px 14px; }
}
@media (max-width: 480px) {
  .aging-grid { grid-template-columns: 1fr 1fr; }
  .line-editor-head { flex-direction: column; align-items: flex-start; }
  .line-editor-foot { flex-direction: column; align-items: flex-end; }
  .todo-row { padding: 11px 12px; }
  .question-row, .response-row > summary { padding-inline: 13px; }
}

/* ==========================================================================
   Phase 4 — work-order form (Odoo-style), technician board, print report
   ========================================================================== */

/* Stage bar with separators */
.wo-stage { gap: 4px; row-gap: 8px; }
.wo-stage .stage-dot { padding: 3px 7px; border-radius: 7px; background: var(--surface-2); }
.wo-stage .stage-dot.done { background: var(--green-soft); color: #0b7a63; }
.wo-stage .stage-dot.done .d { background: var(--green); }
.wo-stage .stage-dot.current { background: var(--brand-50); }
.wo-stage .stage-dot.cancelled { background: var(--red-soft); color: var(--red); }
.wo-stage .stage-dot.cancelled .d { background: var(--red); }
.wo-stage .stage-sep { flex: 0 0 10px; height: 1px; background: var(--line-strong); margin-inline-end: 2px; }

/* Stat buttons (linked records / counts) */
.wo-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--ink-2); cursor: pointer;
  text-decoration: none; font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.stat-btn:hover { border-color: var(--brand-200); background: #fff; color: var(--brand-2); }
.stat-btn svg { color: var(--brand); flex: 0 0 auto; }
.stat-btn .sb-label { font-size: 10px; color: var(--muted); line-height: 1.2; }
.stat-btn .sb-value { font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.2; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-btn .sb-value .warn-text { color: var(--amber); }

/* Work-order tabs */
.wo-tabs { margin-bottom: 14px; }
.wo-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.wo-tabs .tab svg { color: var(--muted); }
.wo-tabs .tab.active svg { color: var(--brand); }
.wo-tabs .tab-count.warn { background: var(--amber-soft); color: #9c6407; }
.wo-tabs .tab.active .tab-count.warn { background: var(--amber-soft); color: #9c6407; }

/* Inspection sheet */
.checklist-row {
  border: 1px solid var(--line); border-radius: 11px; background: #fff;
  padding: 11px 13px; margin-bottom: 9px;
}
.checklist-row.required-open { border-color: #eccfa0; background: #fffaf1; }
.checklist-row .check-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.checklist-row .check-label { font-size: 12.5px; font-weight: 650; color: var(--ink); line-height: 1.5; }
.checklist-row .check-note { font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; margin-top: 8px; }
.checklist-row .check-meta { margin-top: 6px; }
.checklist-row .input { margin-top: 8px; min-height: 35px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface-2); }
.seg-btn {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 11px; font-size: 11px; font-weight: 650; font-family: inherit; cursor: pointer;
  border-inline-end: 1px solid var(--line);
}
.seg-btn:last-child { border-inline-end: 0; }
.seg-btn.active.ok { background: var(--green-soft); color: #077a63; }
.seg-btn.active.warn { background: var(--amber-soft); color: #9c6407; }
.seg-btn.active.na { background: var(--surface-3); color: var(--ink-2); }
.check-result-pill { font-size: 10.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.check-result-pill.ok { background: var(--green-soft); color: #077a63; }
.check-result-pill.needs_attention { background: var(--amber-soft); color: #9c6407; }
.check-result-pill.not_applicable { background: var(--surface-3); color: var(--muted); }
.check-result-pill.none { background: var(--surface-3); color: var(--muted-2); font-weight: 500; }

/* Work-hours timer */
.timer-box { display: flex; flex-direction: column; gap: 10px; }
.timer-live { display: flex; align-items: center; gap: 14px; background: var(--brand-50); border: 1px solid #d7e6fb; border-radius: 12px; padding: 12px 15px; }
.timer-live.idle { background: var(--surface-2); border-color: var(--line); }
.timer-clock { font-family: var(--mono); font-size: 24px; font-weight: 750; color: var(--brand); font-variant-numeric: tabular-nums; }
.timer-live.idle .timer-clock { color: var(--ink); }
.timer-title { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.timer-total { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.timer-total strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.running-row td { background: var(--surface-2); }

/* Attachments */
.attach-form .row { gap: 8px; }
.attach-form .select { width: 150px; }
.attach-form .input[type="file"] { max-width: 260px; font-size: 11.5px; }
.attach-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin-top: 14px; }
.attach-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.attach-thumb { display: block; height: 118px; background: var(--surface-3); }
.attach-thumb img,
.attach-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.attach-thumb.is-video { position: relative; }
.attach-thumb.is-video .attach-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(8, 18, 32, .28); pointer-events: none; }
.attach-file-icon { display: grid; place-items: center; height: 118px; color: var(--muted); }
.attach-info { padding: 9px 11px; display: flex; flex-direction: column; gap: 3px; }
.attach-name { font-size: 11.5px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-info .btn { align-self: flex-start; margin-top: 4px; }

/* Info banner variants */
.info-banner.ok { background: #f0faf5; border-color: #cdeedb; color: #17604d; }
.info-banner.ok svg { color: var(--green); }

/* Technician board — views, kanban, week calendar */
.board-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.board-toolbar .search-inline { flex: 1 1 220px; max-width: 340px; }
.board-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.board-filters .select { width: auto; min-width: 120px; }
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.kanban-col { flex: 0 0 244px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 180px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 8px; border-bottom: 1px solid var(--line); }
.kanban-col-title { font-size: 11.5px; font-weight: 750; color: var(--ink-2); }
.kanban-col-count { font-size: 10px; background: var(--surface-3); color: var(--muted); border-radius: 99px; padding: 1px 8px; font-weight: 700; }
.kanban-card { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 10px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.kanban-card:hover { border-color: var(--brand-200); }
.kanban-card.overdue { border-inline-start: 3px solid var(--red); }
.kanban-card .k-number { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--brand); }
.kanban-card .k-title { font-size: 12px; font-weight: 650; color: var(--ink); line-height: 1.45; }
.kanban-card .k-sub { font-size: 10.5px; color: var(--muted); }
.kanban-card .k-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.kanban-card .k-when { font-size: 10px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 4px; }
.kanban-card .k-when.late { color: var(--red); font-weight: 700; }
.late-row td { background: #fff7f8; }
.late-row td:first-child { border-inline-start: 3px solid var(--red); }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(128px, 1fr)); gap: 8px; }
.week-strip .day-col { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 8px; min-height: 120px; }
.week-strip .day-head { font-size: 10.5px; font-weight: 750; color: var(--ink-2); padding: 2px 4px 7px; display: flex; justify-content: space-between; }
.week-strip .day-head.today { color: var(--brand); }
.week-strip .day-count { font-size: 9.5px; color: var(--muted); font-weight: 700; }
.job-chip { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; margin-top: 6px; cursor: pointer; }
.job-chip:hover { border-color: var(--brand-200); }
.job-chip.overdue { border-inline-start: 3px solid var(--red); }
.jc-number { font-family: var(--mono); font-size: 9.5px; font-weight: 700; color: var(--brand); }
.jc-sub { font-size: 9.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Advanced to-dos board — kanban cards, drag & drop, list, week calendar,
   detail dialog with comments, @mentions and linked-record chips
   -------------------------------------------------------------------------- */
.todo-card .k-top { display: flex; align-items: center; gap: 7px; }
.todo-card .k-check {
  width: 21px; height: 21px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: #fff; color: var(--muted-2); display: grid; place-items: center;
  cursor: pointer; padding: 0; flex: 0 0 auto;
}
.todo-card .k-check:hover { border-color: var(--green); color: var(--green); }
.todo-card .k-check.on { background: var(--green); border-color: var(--green); color: #fff; }
.todo-card .k-check.disabled { cursor: default; opacity: 0.55; }
.todo-card .k-check.disabled:hover { border-color: var(--line-strong); color: var(--muted-2); }
.todo-card .k-icons { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.todo-card .k-ico { font-size: 9.5px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 3px; font-weight: 650; }
.todo-card .k-who { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; color: var(--muted); font-weight: 650; }
.todo-card.is-done { opacity: 0.62; }
.todo-card.is-done .k-title { text-decoration: line-through; color: var(--muted); }
.todo-card.dragging { opacity: 0.45; }
.todo-col-body { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 64px; }
.todo-col.drop-target { border-color: var(--brand); background: var(--brand-50); }
.todo-col-empty { text-align: center; padding: 16px 0 6px; }
.todo-quickadd {
  border: 1px dashed var(--line-strong); background: transparent; color: var(--muted);
  border-radius: 9px; padding: 6px 10px; font-size: 10.5px; font-weight: 650;
  display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; width: 100%;
}
.todo-quickadd:hover { border-color: var(--brand); color: var(--brand); background: #fff; }
.todo-quickadd-form { display: flex; gap: 6px; }
.todo-quickadd-form .input { font-size: 11.5px; }

/* list view rows */
.todo-row-tr { cursor: pointer; }
.todo-row-tr.is-done .td-title { text-decoration: line-through; color: var(--muted); }
.td-title { font-size: 12px; font-weight: 650; color: var(--ink); }
.td-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* week calendar additions */
.todo-cal-col .week-day-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.todo-cal-add {
  border: 0; background: transparent; color: var(--muted-2); cursor: pointer;
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; padding: 0; flex: 0 0 auto;
}
.todo-cal-add:hover { background: var(--brand-50); color: var(--brand); }
.todo-outside { cursor: pointer; }
.todo-outside.late { border-color: #f5cdd2; color: var(--red); background: #fff7f8; }

/* linked record chips */
a.todo-link-chip { text-decoration: none; }
a.todo-link-chip:hover { border-color: var(--brand); color: var(--brand); }
.todo-link-chip.locked { background: var(--surface-3); color: var(--muted); cursor: default; }
.todo-link-chip.missing { background: var(--amber-soft); color: var(--amber); border-color: #f4e3bd; cursor: default; }

/* detail dialog */
.section-label { font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: 0.3px; }
.todo-state-bar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.todo-subtasks { display: grid; gap: 5px; }
.todo-subtask { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.todo-subtask .sub-title { font-size: 12px; color: var(--ink-2); font-weight: 550; flex: 1; min-width: 0; }
.todo-subtask.done .sub-title { text-decoration: line-through; color: var(--muted); }
.todo-comments { display: grid; gap: 10px; max-height: 340px; overflow-y: auto; padding: 2px; }
.todo-composer { position: relative; display: flex; gap: 8px; align-items: flex-end; }
.todo-composer .input { min-height: 42px; resize: vertical; }
.mention { background: var(--brand-50); color: var(--brand-2); border-radius: 5px; padding: 0 4px; font-weight: 650; }
.mention-suggest {
  position: absolute; bottom: calc(100% + 6px); inset-inline-start: 0; display: flex; flex-wrap: wrap; gap: 5px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: var(--shadow-sm); padding: 7px; z-index: 6; max-width: 100%;
}

@media (max-width: 760px) {
  .todo-state-bar .select { flex: 1 1 120px; }
  .todo-composer { flex-direction: column; align-items: stretch; }
  .todo-comments { max-height: 240px; }
}


/* Printable completion report — screen preview + print isolation */
.print-target { border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; background: #fff; }
.print-head { border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 14px; }
.print-brand { font-size: 11px; font-weight: 750; letter-spacing: 0.4px; color: var(--brand); }
.print-title { font-size: 19px; font-weight: 800; color: var(--ink); margin-top: 3px; }
.print-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.print-section { font-size: 13px; font-weight: 800; color: var(--ink); margin: 18px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.print-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; }
.print-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 11.5px; }
.print-row .k { color: var(--muted); flex: 0 0 auto; }
.print-row .v { color: var(--ink); font-weight: 650; text-align: end; }
.print-muted { font-size: 11.5px; color: var(--ink-2); line-height: 1.8; }
.print-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.print-table th { text-align: start; border-bottom: 1px solid var(--line-strong); padding: 6px 8px; color: var(--muted); font-weight: 700; }
.print-table td { border-bottom: 1px solid var(--line); padding: 6px 8px; color: var(--ink-2); }
@media print {
  body.print-wo * { visibility: hidden !important; }
  body.print-wo .print-target, body.print-wo .print-target * { visibility: visible !important; }
  body.print-wo .print-target {
    position: absolute; inset-inline: 0; top: 0; width: 100%;
    border: 0; border-radius: 0; padding: 0;
  }
  .print-target .print-row { break-inside: avoid; }
}

/* Phase 4 responsive */
@media (max-width: 980px) {
  .kanban-col { flex-basis: 216px; }
  .week-strip { grid-template-columns: repeat(4, minmax(128px, 1fr)); }
}
@media (max-width: 760px) {
  .wo-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checklist-row .check-head { flex-direction: column; align-items: stretch; }
  .seg { width: 100%; }
  .seg-btn { flex: 1; text-align: center; }
  .week-strip { grid-template-columns: repeat(2, minmax(128px, 1fr)); }
  .attach-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .attach-form .row { flex-direction: column; align-items: stretch; }
  .attach-form .select, .attach-form .input[type="file"] { width: 100%; max-width: none; }
  .timer-live { flex-direction: column; align-items: flex-start; gap: 6px; }
}
@media (max-width: 480px) {
  .week-strip { grid-template-columns: 1fr; }
  .print-rows { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Sales workspace — three-track status strip, saved filters, document kanban,
   recent documents strip, week calendar of deliveries and quotation expiry
   -------------------------------------------------------------------------- */
.sales-card .k-top { display: flex; align-items: center; gap: 7px; }
.sales-card .k-icons { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.sales-card .k-ico { font-size: 9.5px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 3px; font-weight: 650; }
.sales-card .k-money { font-size: 11.5px; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.sales-card .k-cur { font-size: 9.5px; color: var(--muted-2); font-weight: 700; }
.sales-card .k-tracks { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.sales-card.dragging { opacity: 0.45; }
.sales-card.is-cancelled { opacity: 0.6; }
.sales-col { flex: 0 0 262px; }
.sales-col.drop-target { border-color: var(--brand); background: var(--brand-50); }
.sales-col-body { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 64px; }
.sales-col-empty { text-align: center; padding: 16px 0 6px; }

/* recent documents strip */
.recent-strip { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 9px 12px; }
.recent-strip .recent-label { font-size: 10.5px; font-weight: 800; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.recent-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: 99px; padding: 4px 10px; font-size: 10.5px; font-weight: 650; color: var(--ink-2);
  cursor: pointer; max-width: 100%;
}
.recent-chip:hover { border-color: var(--brand); color: var(--brand); }
.recent-chip .rc-num { font-family: var(--mono); font-weight: 700; color: var(--brand); }
.recent-chip .rc-sub { color: var(--muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-chip .rc-time { font-size: 9.5px; color: var(--muted-2); font-weight: 600; }

/* three-track status strip on the document page */
.sales-tracks { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; padding: 12px 0 2px; }
.sales-track { display: flex; align-items: center; gap: 7px; }
.sales-track .track-label { font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: 0.3px; }

/* calendar events for deliveries and quotation expiry */
.week-nav { display: flex; align-items: center; gap: 6px; }
.cal-event {
  display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 8px; font-size: 10.5px; cursor: pointer; border-inline-start: 3px solid var(--line-strong);
}
.cal-event:hover { border-color: var(--brand-200); }
.cal-event.delivery { border-inline-start-color: var(--brand); }
.cal-event.expiry { border-inline-start-color: var(--amber); }
.cal-event.overdue { border-inline-start-color: var(--red); }
.cal-event .ce-num { font-family: var(--mono); font-weight: 700; color: var(--brand); flex: 0 0 auto; }
.cal-event .ce-sub { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-event .ce-money { margin-inline-start: auto; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; flex: 0 0 auto; }

/* small helpers for the sales toolbar and reports */
.currency-note { font-size: 9.5px; color: var(--muted-2); font-weight: 650; }
.reports-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.reports-controls .input[type="date"] { width: 150px; }
.margin-note { font-size: 10.5px; color: var(--muted); line-height: 1.7; }

/* progress rows on the document page */
.progress-rows { display: grid; gap: 8px; }
.progress-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; }
.progress-row .pr-label { color: var(--muted); }
.progress-row .pr-value { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .sales-col { flex-basis: 216px; }
  .recent-chip .rc-sub { display: none; }
  .recent-chip .rc-time { display: none; }
}

/* ==========================================================================
   Odoo-style settings workspace: grouped nav, setting rows, count chips,
   sticky save bar and inline editors.
   ========================================================================== */
.settings-nav { display: grid; gap: 2px; align-content: start; }
.settings-nav-group { display: grid; gap: 2px; }
.settings-nav-group + .settings-nav-group { margin-top: 12px; }
.settings-nav-group-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2); padding: 4px 10px 6px;
}
[dir="rtl"] .settings-nav-group-label { letter-spacing: 0; }

.settings-savebar {
  position: sticky; top: 6px; z-index: 8;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 9px 14px; margin-bottom: 16px;
}
.settings-savebar[hidden] { display: none; }
.settings-savebar:not([hidden]) { animation: savebar-in .16s ease; }
@keyframes savebar-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.savebar-note { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.savebar-note svg { color: var(--amber, #b7791f); }

.odoo-section {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-xs); overflow: hidden; margin-bottom: 16px;
}
.odoo-section-head { padding: 15px 18px 9px; }
.odoo-section-head h3 {
  display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; color: var(--ink);
  margin: 0;
}
.odoo-section-head h3 svg { color: var(--brand); flex: 0 0 auto; }
.odoo-section-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted-2); }
.odoo-section-body { padding: 0 18px 8px; }

.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 13px 0; border-top: 1px solid var(--line);
}
.setting-row:first-child { border-top: 0; }
.setting-info { min-width: 0; }
.setting-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.setting-desc { font-size: 11px; color: var(--muted-2); margin-top: 2px; line-height: 1.6; max-width: 620px; }
.setting-control { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.setting-value-text { font-size: 12px; color: var(--ink-2); }
.setting-value-text.strong { font-weight: 700; color: var(--ink); }
.setting-suffix { font-size: 11px; color: var(--muted-2); font-weight: 600; white-space: nowrap; }
.setting-profile-chip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }

.count-chip {
  min-width: 26px; height: 22px; padding: 0 9px; border-radius: 11px;
  background: var(--brand-50); color: var(--brand-2);
  font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center;
}
.count-chip.amber { background: #fdf3e3; color: #9a6413; }

.policy-input { width: 104px; text-align: center; font-variant-numeric: tabular-nums; }
.pref-select { min-width: 200px; }

.setting-inline-editor {
  border-top: 1px dashed var(--line); margin: 2px 0 6px; padding: 14px 0 10px;
  background: linear-gradient(to bottom, var(--surface-2, rgba(0,0,0,.02)) 0%, transparent 100%);
  border-radius: 0 0 6px 6px;
}
.setting-inline-editor[hidden] { display: none; }

@media (max-width: 900px) {
  .setting-row { flex-direction: column; align-items: flex-start; gap: 9px; }
  .setting-control { width: 100%; justify-content: flex-start; }
  .pref-select { flex: 1 1 auto; min-width: 0; }
  .settings-savebar { position: static; flex-wrap: wrap; }
}

/* --------------------------------------------------------------------------
   Navigation redesign — one application menu + in-app contextual bar
   The permanent global app strip is gone; no duplicated app-grid triggers.
   -------------------------------------------------------------------------- */
.app-switch-btn {
  background: var(--brand-50);
  color: var(--brand);
  border-color: var(--brand-100);
}
.app-switch-btn:hover,
.app-switch-btn:focus-visible { background: var(--brand-100); color: var(--brand-2); }

/* Odoo-style app header: the current app name followed by that app's own
   sections. Exactly one navigation row exists per app — page bodies never
   repeat these sections. The active section is a quiet brand-tinted pill so
   the row reads as navigation with a clear current location. */
.context-bar {
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.context-bar[hidden] { display: none; }
.context-inner {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.context-back {
  display: inline-flex; align-items: center; align-self: center; gap: 5px; flex: 0 0 auto;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 8px; padding: 3px 9px 3px 7px;
  font: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
  visibility: hidden; opacity: 0;
  transition: opacity 0.16s ease, visibility 0.16s ease, background 0.16s ease,
    color 0.16s ease, border-color 0.16s ease;
}
.context-bar:hover .context-back,
.context-bar:focus-within .context-back { visibility: visible; opacity: 1; }
.context-back:hover { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
.context-back svg { flex: 0 0 auto; }
.context-back span { white-space: nowrap; }
.context-app {
  display: inline-flex; align-items: center; flex: 0 0 auto;
  padding: 0 14px 0 2px; border-radius: 0;
  border-inline-end: 1px solid var(--line);
  color: var(--ink); font-size: 15px; font-weight: 800; letter-spacing: -0.1px;
  text-decoration: none; white-space: nowrap;
  transition: color 0.15s ease;
}
.context-app:hover, .context-app:focus-visible { color: var(--brand); }
.context-app-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.context-tabs {
  --ctx-fade-left: 0px;
  --ctx-fade-right: 0px;
  display: flex; align-items: center; gap: 2px; flex: 1 1 auto;
  margin-inline-start: 0; min-width: 0;
  overflow-x: auto; overscroll-behavior-inline: contain;
  scroll-padding-inline: 12px;
  scrollbar-width: none; -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0,
    #000 var(--ctx-fade-left), #000 calc(100% - var(--ctx-fade-right)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0,
    #000 var(--ctx-fade-left), #000 calc(100% - var(--ctx-fade-right)), transparent 100%);
}
.context-tabs::-webkit-scrollbar { display: none; }
/* Reserve room at the scroll edge so the final section can clear the round
   scroll control instead of sitting under it. */
.context-tabs.is-overflowing { padding-inline-end: 34px; }
.context-scroll {
  position: absolute; inset-inline-end: -3px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; z-index: 3;
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: #fff; color: var(--ink-2); cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 39, 68, 0.15);
}
.context-scroll[hidden] { display: none; }
.context-scroll:hover, .context-scroll:focus-visible {
  background: var(--brand-50); border-color: var(--brand-100); color: var(--brand);
}
.context-tab {
  display: inline-flex; align-items: center; flex: 0 0 auto;
  height: 32px; padding: 0 11px;
  border: 0; border-radius: 9px;
  color: var(--ink-2); font-size: 12.5px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.context-tab:hover, .context-tab:focus-visible { background: var(--surface-2); color: var(--ink); }
.context-tab.is-active {
  background: var(--brand-50); color: var(--brand-2); font-weight: 750;
  box-shadow: inset 0 0 0 1px var(--brand-100);
}
[dir="ltr"] .context-back svg { transform: scaleX(-1); }
/* Touch-first devices have no hover: keep the app-level back control visible. */
@media (hover: none) and (pointer: coarse) {
  .context-back { visibility: visible; opacity: 1; padding: 5px 10px; }
}
@media (max-width: 760px) {
  .context-inner { width: calc(100% - 28px); min-height: 46px; gap: 8px; }
  .context-app { font-size: 13px; padding-inline-end: 10px; }
  .context-app-name { max-width: 150px; }
  .context-tabs { margin-inline-start: 0; }
  .context-tab { height: 29px; padding: 0 9px; font-size: 11.5px; }
  .context-back span { display: none; }
  .context-scroll { width: 30px; height: 30px; inset-inline-end: 0; }
}

/* Odoo-style complete application menu (single entry point). */
.apps-menu { display: flex; flex-direction: column; gap: 14px; }
.apps-menu-search {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 9px; flex: 0 0 auto;
  height: 42px; padding: 0 12px;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: 11px;
}
.apps-menu-search svg { color: var(--muted-2); flex: 0 0 auto; }
.apps-menu-search input {
  width: 100%; height: 100%; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 13px; color: var(--ink);
}
.apps-menu-list {
  display: flex; flex-direction: column; gap: 17px;
  max-height: min(62vh, 620px); overflow-y: auto; padding-inline-end: 4px;
}
.apps-menu-group { min-width: 0; }
.apps-menu-head {
  display: flex; align-items: center; gap: 7px;
  padding: 0 2px 8px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 10.5px; font-weight: 750; letter-spacing: 0.3px;
}
.apps-menu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 5px;
}
.apps-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 9px;
  border: 1px solid transparent; border-radius: 11px;
  background: transparent; color: var(--ink); font: inherit; text-align: start;
  cursor: pointer; transition: background 0.14s ease, border-color 0.14s ease;
}
.apps-menu-item:hover,
.apps-menu-item:focus-visible { background: var(--brand-50); border-color: var(--brand-100); }
.apps-menu-icon {
  width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line);
}
.apps-menu-icon img { width: 24px; height: 24px; object-fit: contain; }
.apps-menu-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-weight: 650;
}
.apps-menu-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 30px 16px; color: var(--muted); font-size: 12px;
}
.apps-menu-empty.hidden { display: none; }
@media (max-width: 760px) {
  .apps-menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .apps-menu-item { gap: 8px; padding: 7px; }
  .apps-menu-icon { width: 32px; height: 32px; }
  .apps-menu-name { font-size: 11.5px; }
  .apps-menu-list { max-height: none; overflow: visible; }
}
@media (max-width: 420px) {
  .apps-menu-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Contacts workspace + CRM pipeline (Phase 6)
   ========================================================================== */
.contact-toolbar { padding: 12px 14px; margin-bottom: 14px; }
.contact-toolbar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.contact-toolbar-row .search-inline { flex: 1 1 240px; max-width: 380px; min-width: 180px; }
/* Toolbar controls must not inherit the global full-width form sizing. */
.contact-toolbar-row .select { width: auto; min-width: 138px; flex: 0 0 auto; }
.contact-toolbar-row .cb { width: auto; min-width: 158px; flex: 0 0 auto; }
.contact-toolbar-row .cb .cb-input { min-width: 0; }
.contact-toolbar-row .input-sm { width: auto; }
.contact-count { font-size: 11px; color: var(--muted); margin-inline-start: auto; white-space: nowrap; }
.contact-columns { position: relative; }
.contact-columns > summary { list-style: none; }
.contact-columns > summary::-webkit-details-marker { display: none; }
.contact-columns-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 210px; background: #fff; border: 1px solid var(--line);
  border-radius: 11px; box-shadow: var(--shadow); padding: 10px 12px;
  display: grid; gap: 7px;
}
.contact-columns-menu .checkbox { font-size: 12px; }
.legacy-registry-link { color: var(--muted); }
.badge-stack { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tag-chip {
  display: inline-flex; align-items: center; height: 20px;
  padding: 0 7px; border-radius: 6px; background: var(--slate-soft, #eef2f7);
  color: var(--muted); font-size: 10px; font-weight: 600; white-space: nowrap;
}
.tag-chip.more { background: var(--brand-50); color: var(--brand-2); }
.stage-pill {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-2); font-size: 10.5px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stage-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--stage-color, var(--brand)); flex: 0 0 auto;
}
.mini-record {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); color: inherit; text-decoration: none;
}
.mini-record:last-child { border-bottom: 0; }
.mini-record:hover .mini-record-title { color: var(--brand-2); }
.mini-record-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mini-record-title { font-size: 12px; font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-record-sub { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contact-company-avatar {
  display: grid; place-items: center; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand-50), #e3edfc); color: var(--brand-2);
  border: 1px solid var(--brand-100, var(--brand-200));
}
.contact-table td, .opp-table td { vertical-align: middle; }
.contact-group-row td {
  background: var(--surface-2); font-size: 10.5px; font-weight: 750;
  color: var(--muted); letter-spacing: 0.2px; padding-block: 7px !important;
}
.contact-group-count { margin-inline-start: 7px; color: var(--muted-2); font-weight: 600; }
.contact-bulk-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 12px; border-color: var(--brand-100, var(--brand-200)); background: var(--brand-50, #f5f8ff); }
.contact-bulk-bar[hidden] { display: none; }
.contact-bulk-count {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 750;
}
.contact-bulk-bar .spacer { flex: 1; }
.contact-select-col { width: 34px; text-align: center; }
.contact-select-col input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.contact-grid-table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
.grid-sort { display: inline-flex; align-items: center; gap: 3px; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.grid-sort.active { color: var(--brand-2); font-weight: 750; }
.grid-clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; align-items: start; }
.contact-kanban-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; padding: 10px; }
.contact-kanban-card { display: block; text-decoration: none; color: inherit; }
.contact-kanban-card:hover { border-color: var(--brand-100, var(--brand-200)); box-shadow: var(--shadow-sm); }
.contact-kanban-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.contact-kanban-head .k-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-hero-id { display: flex; align-items: center; gap: 13px; min-width: 0; }
.contact-tabs-wrap { margin-bottom: 14px; }
.contact-fin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.contact-insights { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.contact-insights .card { margin: 0; }
.contact-overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.contact-overview-tile {
  display: flex; align-items: center; gap: 9px; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  text-decoration: none; color: inherit; min-width: 0;
}
.contact-overview-tile:hover { border-color: var(--brand-200); background: var(--brand-50, #f5f8ff); }
.contact-overview-icon {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-50, #f5f8ff); color: var(--brand); flex: 0 0 auto;
}
.contact-overview-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.contact-overview-body strong { font-size: 16px; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }
.contact-overview-body span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 980px) { .contact-insights { grid-template-columns: 1fr; } }
.contact-fin-grid > div {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.contact-fin-label { font-size: 10.5px; color: var(--muted); }
.contact-fin-grid strong { font-size: 19px; color: var(--ink); font-variant-numeric: tabular-nums; }
.contact-fin-totals { margin-top: 12px; display: grid; gap: 6px; }
.contact-fin-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); }
.contact-fin-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
/* Contact profile form — kind/sector pickers, map link and tax trust */
.pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.pick-card {
  display: flex; align-items: flex-start; gap: 10px; text-align: start; font: inherit;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: inherit; cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}
.pick-card:hover { border-color: var(--line-strong, #d8e1ec); }
.pick-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pick-card.is-active {
  border-color: var(--brand); background: var(--brand-50);
  box-shadow: inset 0 0 0 1px var(--brand-100, var(--brand-200));
}
.pick-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--brand-2);
}
.pick-card.is-active .pick-icon { background: #fff; border-color: var(--brand-100, var(--brand-200)); color: var(--brand); }
.pick-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pick-title { font-size: 13px; font-weight: 750; color: var(--ink); }
.pick-sub { font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.pick-grid-sector { margin-top: 2px; }
.map-link-icon {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--brand-2);
}
.map-detail-link { display: inline-flex; align-items: center; gap: 5px; color: var(--brand-2); text-decoration: none; font-weight: 600; }
.map-detail-link:hover { text-decoration: underline; }
.tax-trust-box {
  display: flex; align-items: center; gap: 11px; padding: 12px 14px;
  border: 1px solid #f2d6a3; border-radius: 12px;
  background: linear-gradient(135deg, #fffaf0, #fff4dd);
}
.tax-trust-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; background: #fff;
  border: 1px solid #f2d6a3; color: #b45309;
}
.tax-trust-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tax-trust-title { font-size: 13px; font-weight: 750; color: #7c4a03; }
.tax-trust-sub { font-size: 10.5px; color: #9a6b1f; }
.tax-trust-rate { font-size: 15px; font-weight: 800; color: #b45309; font-variant-numeric: tabular-nums; }
.trust-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
}
.trust-cell {
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2, #f8f9fa); border: 1px solid var(--border, #e5e7eb);
}
.trust-label { font-size: 11px; color: var(--text-muted, #6b7280); margin-bottom: 4px; }
.trust-value { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .trust-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .pick-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------- Pipeline */
.opp-toolbar .search-inline { flex: 1 1 220px; }
.opp-toolbar .select { width: auto; min-width: 138px; flex: 0 0 auto; }
.opp-party-chip { gap: 5px; }
.opp-party-chip .icon-btn { width: 17px; height: 17px; min-width: 17px; border: 0; background: transparent; }
.opp-kpis .stat-note { min-height: 14px; }
.opp-board {
  display: flex; gap: 12px; align-items: flex-start;
  overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity;
}
.opp-column {
  flex: 1 1 255px; min-width: 245px; max-width: 420px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 13px; padding: 9px; scroll-snap-align: start;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.opp-column.drop-target { border-color: var(--brand); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-100, var(--brand-200)); }
.opp-column-head { display: flex; align-items: center; gap: 6px; padding: 2px 3px 0; }
.opp-stage-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.opp-column-title { font-size: 11.5px; font-weight: 750; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-column-count {
  margin-inline-start: auto; min-width: 20px; height: 18px; padding: 0 6px;
  display: inline-grid; place-items: center; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); font-size: 10px; font-weight: 700; color: var(--muted);
}
.opp-column-total { font-size: 10px; color: var(--muted-2); padding: 4px 3px 8px; font-variant-numeric: tabular-nums; }
.opp-column-body { display: grid; gap: 8px; }
.opp-column-empty {
  border: 1px dashed var(--line-strong, #d8e1ec); border-radius: 10px;
  padding: 22px 10px; text-align: center; font-size: 10.5px; color: var(--muted-2);
}
.opp-card {
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 11px; display: grid; gap: 6px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 40, 70, 0.03);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
.opp-card:hover { border-color: var(--brand-200); box-shadow: var(--shadow-sm); }
.opp-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.opp-card[draggable="true"] { cursor: grab; }
.opp-card.dragging { opacity: 0.45; transform: rotate(1.2deg); }
.opp-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.opp-card-title { font-size: 12.5px; font-weight: 700; color: var(--ink); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.opp-card-party { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); min-width: 0; }
.opp-card-party span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-card-value { font-size: 14px; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }
.opp-card-prob { display: flex; align-items: center; gap: 7px; }
.opp-prob-track { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-3, #edf2f8); overflow: hidden; }
.opp-prob-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #4f8cf5); }
.opp-prob-label { font-size: 9.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.opp-card-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.opp-card-chips .chip { height: 19px; font-size: 9.5px; padding: 0 6px; }
.opp-card-foot { display: flex; align-items: center; gap: 8px; font-size: 9.5px; color: var(--muted-2); padding-top: 2px; }
.opp-card-follow { display: inline-flex; align-items: center; gap: 4px; }
.opp-card-follow.late { color: var(--red); font-weight: 700; }
.opp-card-meta { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: auto; white-space: nowrap; }
.opp-card-owner { display: inline-flex; }
.opp-card-owner .avatar { width: 22px; height: 22px; font-size: 8px; }
.opp-card-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.opp-card-tags .tag-chip { height: 18px; font-size: 9px; }
.opp-report-toolbar { padding: 12px 14px; margin-bottom: 14px; }
.opp-report-toolbar .contact-toolbar-row { gap: 10px; align-items: center; }
.opp-detail-grid .card-head .select { width: auto; min-width: 170px; flex: 0 0 auto; }
.opp-report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-top: 14px; align-items: start; }
.opp-report-bar { height: 4px; margin-top: 5px; background: var(--surface-3, #edf2f8); border-radius: 999px; overflow: hidden; min-width: 70px; }
.opp-report-bar > span { display: block; height: 100%; border-radius: inherit; }
.late-text { color: var(--red); font-weight: 700; }
.opp-hero-id { display: flex; align-items: center; gap: 13px; min-width: 0; }
.opp-hero-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-50), #e4eefc); color: var(--brand-2); flex: 0 0 auto;
}
.opp-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.opp-summary-grid > div {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
  display: flex; flex-direction: column; gap: 3px; background: var(--surface-2);
}
.opp-summary-grid > div > span { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); }
.opp-summary-grid > div > strong { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.opp-summary-grid > div.late > strong { color: var(--red); }
/* Opportunity 360: tabs reorganise the existing cards; the Kanban card itself
   keeps its dimensions, colours and spacing untouched. */
.opp-360-tabs { margin-top: 16px; }
.opp-360-tabs .tab { display: inline-flex; align-items: center; gap: 5px; }
.opp-360-tabs .tab svg { color: var(--muted); }
.opp-360-tabs .tab.active svg { color: var(--brand); }
.opp-360-panels { display: block; }
.opp-360-panels > [data-panel] { animation: opp-panel-in .14s ease; }
@keyframes opp-panel-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
/* Multi-select checkbox groups inside declarative forms (stage gates). */
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 14px; }
.opp-loss-note {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--red-soft); border: 1px solid #f5cdd2; color: #8f1f2c;
  border-radius: 10px; padding: 10px 12px; font-size: 11.5px; line-height: 1.6;
}
.opp-comment-form { margin-bottom: 14px; }
.opp-timeline { display: flex; flex-direction: column; }
.opp-timeline-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.opp-timeline-item:last-child { border-bottom: 0; }
.opp-timeline-icon {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--slate-soft, #eef2f7); color: var(--muted);
}
.opp-timeline-icon.blue { background: var(--brand-50); color: var(--brand); }
.opp-timeline-icon.green { background: var(--green-soft); color: var(--green); }
.opp-timeline-icon.red { background: var(--red-soft); color: var(--red); }
.opp-timeline-main { min-width: 0; flex: 1; }
.opp-timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.opp-timeline-head b { font-size: 11.5px; color: var(--ink); }
.opp-timeline-text { font-size: 11.5px; color: var(--muted); line-height: 1.65; margin-top: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.opp-timeline-text.comment { color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; }
.stage-manager { min-height: 160px; }
.stage-list { display: grid; gap: 6px; }
.stage-row {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.stage-row.inactive { opacity: 0.62; background: var(--surface-2); }
.stage-row-main { min-width: 0; flex: 1; }
.stage-row-title { font-size: 12px; font-weight: 700; color: var(--ink); }
.stage-row-title .muted { font-weight: 500; }
.stage-row-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.stage-row-actions { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.stage-row-actions .btn { height: 27px; font-size: 10.5px; }
.reason-chip { cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.reason-chip:hover { border-color: var(--brand-100, var(--brand-200)); background: var(--brand-50); color: var(--brand-2); }
.rotate-180 { transform: rotate(180deg); }
.card-foot-bordered { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 13px 13px; }

@media (max-width: 1180px) {
  .opp-column { flex-basis: 240px; min-width: 235px; }
}
@media (max-width: 820px) {
  .contact-toolbar-row .search-inline { max-width: none; flex-basis: 100%; }
  .contact-count { margin-inline-start: 0; }
  .opp-column { flex: 0 0 86vw; max-width: none; }
  .contact-kanban { grid-template-columns: 1fr; }
  .opp-report-grid { grid-template-columns: 1fr; }
  .stage-row { flex-wrap: wrap; }
  .stage-row-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 520px) {
  .contact-fin-grid, .opp-summary-grid { grid-template-columns: 1fr; }
  .opp-column { flex-basis: 90vw; }
}
.record-comment{padding:16px 0;border-bottom:1px solid var(--border,#ddd)}.record-reply{margin-inline-start:24px;padding-inline-start:16px;border-inline-start:3px solid var(--border,#ddd)}.record-comment-text{white-space:pre-wrap;overflow-wrap:anywhere}.record-comment small{opacity:.7}.record-comment textarea{margin-top:8px}

/* Focused employee sign-in. Scoped to avoid changing in-app forms. */
.auth-refined { background:#f5f6f8; min-height:100svh; color:#182b43; }
.auth-refined .auth-top {width:min(1160px,calc(100% - 64px));padding:25px 0;}
.auth-refined .auth-logo img {width:38px;height:38px;border-radius:10px;box-shadow:none;}
.auth-refined .auth-wordmark {font-size:19px;letter-spacing:2px;color:#162d49;}
.auth-refined .auth-wordmark span {font-size:11px;letter-spacing:1px;margin-inline-start:5px;color:#7b8899;}
.auth-header-label {font-size:12px;color:#798594;}
.auth-refined .auth-grid {width:min(1080px,calc(100% - 64px));grid-template-columns:minmax(0,1fr) minmax(360px,.95fr);gap:0;padding:0;margin:22px auto 30px;background:#fff;border:1px solid #e2e6ec;border-radius:22px;overflow:hidden;box-shadow:0 20px 65px -35px #243a5b4d;align-items:stretch;}
.auth-refined .auth-visual {min-height:600px;border:0;border-radius:0;padding:52px 44px;background:linear-gradient(150deg,#112940,#183c5c 65%,#204d68);box-shadow:none;overflow:hidden;}
.auth-refined .auth-visual::before,.auth-refined .auth-visual::after {display:none;}
.auth-refined .auth-eyebrow {font-size:12px;color:#b4c9da;background:none;border:0;padding:0;line-height:1.9;letter-spacing:0;}
.auth-refined .auth-headline {font-size:clamp(29px,3vw,41px);line-height:1.65;font-weight:700;letter-spacing:-.6px;color:#fff;margin:26px 0 12px;}
.auth-refined .auth-headline span {color:#9bd9db;}
.auth-refined .auth-lead {font-size:14px;line-height:2;color:#c0cfdd;max-width:310px;margin:0;}
.auth-module-list {display:grid;gap:18px;margin-top:32px;}
.auth-module-list>div {display:flex;align-items:center;gap:12px;font-size:13px;color:#e1eaf2;}
.auth-module-list svg {color:#89c6cf;flex:none;}
.auth-refined .auth-visual-foot {color:#8fabc2;font-size:10px;letter-spacing:2px;margin-top:80px;gap:12px;}
.auth-brand-rule {width:32px;height:1px;background:#5b8299;}
.auth-brand-art {position:absolute;inset-inline-end:-65px;bottom:30px;width:260px;height:200px;opacity:.12;transform:rotate(-25deg);pointer-events:none;}
.auth-brand-art span {position:absolute;inset:0;border:1px solid #d8eef5;border-radius:24px;}
.auth-brand-art span:nth-child(2){transform:translate(-26px,-26px);}
.auth-brand-art span:nth-child(3){transform:translate(-52px,-52px);}
.auth-refined .auth-panel {padding:48px 52px;background:#fff;border:0;border-radius:0;box-shadow:none;display:flex;align-items:center;min-width:0;}
.auth-refined .auth-card {width:100%;animation:none;}
.auth-card-kicker {color:#638099;font-weight:600;font-size:11px;margin-bottom:12px;}
.auth-refined .auth-panel h1 {font-size:28px;font-weight:700;margin:0;line-height:1.5;color:#172e48;letter-spacing:-.4px;}
.auth-refined .auth-panel-sub {font-size:13px;color:#788595;line-height:1.9;margin:8px 0 28px;}
.auth-refined .auth-form {gap:19px;}
.auth-refined .auth-form label {font-size:12px;font-weight:600;color:#30465f;margin-bottom:7px;}
.auth-refined .auth-form .req {color:#8d9aab;font-size:11px;}
.auth-refined .auth-form .input {height:46px;border-radius:8px;border:1px solid #dce2e9;background:#fff;box-shadow:none;font-size:14px;padding:10px 13px;transition:border-color .15s,box-shadow .15s;}
.auth-refined .auth-form .input:focus {outline:none;border-color:#317c9b;box-shadow:0 0 0 3px #317c9b18;}
.auth-refined .auth-form .input::placeholder {color:#a2adbb;}
.auth-refined .field-hint {font-size:11px;color:#8a95a4;margin-top:6px;}
.auth-refined .auth-meta {justify-content:flex-end;margin-top:-5px;}
.auth-refined .link-btn {font-size:12px;color:#266c89;}
.auth-refined .auth-submit {height:46px;border-radius:8px;background:var(--brand);border-color:var(--brand);box-shadow:0 4px 12px rgba(108,76,241,.12);font-size:14px;font-weight:600;}
.auth-refined .auth-submit:hover {background:var(--brand-2);border-color:var(--brand-2);}
.auth-refined .auth-submit:focus-visible {outline:3px solid #89c6cf;outline-offset:3px;}
.auth-refined .auth-security {margin-top:23px;padding-top:20px;border-top:1px solid #edf0f4;color:#8b97a5;font-size:11px;line-height:1.8;}
.auth-refined .auth-foot {width:min(1080px,calc(100% - 64px));font-size:11px;padding:0 0 24px;color:#8a96a5;margin-top:auto;}
@media(max-width:960px){
  .auth-refined .auth-grid{grid-template-columns:minmax(0,.9fr) minmax(330px,1fr);width:calc(100% - 40px);}
  .auth-refined .auth-visual{display:flex;padding:40px 28px;min-height:570px;}
  .auth-refined .auth-panel{padding:38px 30px;}
}
@media(max-width:720px){
  .auth-refined .auth-top{width:calc(100% - 40px);padding:22px 0;}
  .auth-refined .auth-header-label{display:none;}
  .auth-refined .auth-grid{display:block;max-width:440px;width:calc(100% - 32px);margin:16px auto 26px;border-radius:16px;}
  .auth-refined .auth-visual{display:none;}
  .auth-refined .auth-panel{padding:32px 26px;}
  .auth-refined .auth-panel h1{font-size:25px;}
  .auth-refined .auth-foot{width:calc(100% - 40px);gap:12px;flex-wrap:wrap;font-size:10px;}
}
@media(prefers-reduced-motion:reduce){.auth-refined *{animation:none!important;transition:none!important;}}

/* Maintenance operations: readable row cards on phones. */
@media (max-width:640px) {
 .ops-table,.ops-table tbody,.ops-table tr,.ops-table td {display:block;width:100%;min-width:0!important;box-sizing:border-box;}
 .ops-table thead {display:none;}
 .ops-table tr {border:1px solid #dce5f0;border-radius:12px;margin:12px 0;padding:8px;}
 .ops-table td {border:0;white-space:normal;overflow-wrap:anywhere;padding:8px;}
 .ops-table td::before {content:attr(data-label);display:block;font-weight:700;margin-bottom:6px;}
 .ops-table form {padding:0!important;min-width:0;}
 .ops-table .btn {white-space:normal;max-width:100%;}
}

/* Apps store: keep the search box clear of the app grid (تصميم واجهات ERP, 2026-10-24). */
.odoo-apps-store .apps-menu-search {
  position: sticky; top: 0; z-index: 3;
  margin: 18px 0 26px;
  background: var(--surface, #fff);
  box-shadow: 0 6px 12px -10px rgba(11, 31, 75, .25);
}
.odoo-apps-store .odoo-apps-grid { padding-top: 6px; }
@media (max-width: 768px) {
  .odoo-apps-store .apps-menu-search { margin: 12px 0 18px; }
}

/* ==========================================================================
   Whole-app phone & tablet experience layer (2026-10-26)
   Additive only: shell, cards, forms, tables, boards and modals shared by
   every module. Module stylesheets that load later (attendance, calendar,
   login) keep their own art direction. No new hover-only affordances.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tablet / small laptop: compact shell, roomy scrollers
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .topbar { padding-top: env(safe-area-inset-top, 0px); }
  .page,
  .topbar-inner,
  .context-inner,
  .crumb-bar,
  .app-footer-inner { width: calc(100% - 32px); }
  .page { padding-bottom: calc(44px + env(safe-area-inset-bottom, 0px)); }
  .app-footer-inner { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 980px) {
  .topbar-inner { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .search-box { height: 37px; }
  .icon-btn { width: 36px; height: 36px; }
  .topbar-actions { gap: 2px; }
  .user-chip .avatar { width: 32px; height: 32px; }
  .page { padding-top: 18px; }
  .page-head h1 { font-size: clamp(21px, 3.4vw, 26px); }
  .modal-backdrop { padding: 12px; }
  .modal { max-height: calc(100dvh - 24px); }
}

/* Dense tables keep their columns readable and scroll inside their wrapper
   instead of squeezing every header into one narrow strip. */
@media (max-width: 900px) {
  /* Four compact KPIs fit on a portrait tablet; 160px avoids a 3 + 1 orphan. */
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .table-wrap { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .table:has(thead th:nth-child(6)) { min-width: 760px; }
  .table:has(thead th:nth-child(8)) { min-width: 940px; }
  .line-editor { -webkit-overflow-scrolling: touch; }
  .week-board { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .settings-savebar { top: 0; }
}
/* Wide lists on tablets keep their first column (the record name) in view
   while the remaining columns scroll. Phone card mode takes over below 620. */
@media (min-width: 621px) and (max-width: 900px) {
  .table:has(thead th:nth-child(6)) th:first-child,
  .table:has(thead th:nth-child(6)) td:first-child {
    position: sticky; inset-inline-start: 0; z-index: 1;
    background: var(--surface);
    box-shadow: 1px 0 0 var(--line);
  }
  [dir="rtl"] .table:has(thead th:nth-child(6)) th:first-child,
  [dir="rtl"] .table:has(thead th:nth-child(6)) td:first-child { box-shadow: -1px 0 0 var(--line); }
  .table:has(thead th:nth-child(6)) thead th:first-child { background: var(--surface-2); }
}

@media (max-width: 760px) {
  .app-footer-inner { padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); font-size: 10px; gap: 6px; }
  .detail-actions { width: 100%; }
  .detail-actions .btn { flex: 1 1 auto; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
  .chart-bars { height: 150px; gap: 6px; }
  .chart-bar-label { font-size: 9px; }
  .reports-controls .input[type="date"] { width: auto; flex: 1 1 140px; }
  .settings-nav { margin-inline: -14px; padding-inline: 14px; scroll-snap-type: x proximity; }
  .settings-nav button { scroll-snap-align: start; }
  .settings-card-head, .settings-card-body { padding-inline: 14px; }
  .print-target { padding: 14px; }
  .table:has(thead th:nth-child(5)) { min-width: 640px; }
}

/* --------------------------------------------------------------------------
   Phone: touch-first shell, readable records, sheets that respect the keyboard
   -------------------------------------------------------------------------- */
@media (max-width: 620px) {
  html { -webkit-tap-highlight-color: transparent; }

  /* --- shell --- */
  .topbar-inner { width: calc(100% - 24px); gap: 6px 8px; padding: 7px 0 8px; min-height: 0; }
  .brand { gap: 8px; }
  .brand img { width: 32px; height: 32px; border-radius: 9px; }
  .brand-name { font-size: 12.5px; letter-spacing: 1.2px; }
  .brand-name span { font-size: 9px; }
  .brand-company { display: none; }
  .topbar-actions { gap: 1px; }
  .icon-btn { width: 40px; height: 40px; border-radius: 11px; }
  .icon-btn svg { width: 19px; height: 19px; }
  .icon-btn .count-dot { top: 3px; inset-inline-end: 3px; }
  .user-chip { padding: 2px; }
  .user-chip .avatar { width: 34px; height: 34px; border-radius: 10px; }
  .search-shell { flex-basis: 100%; }
  .search-box { height: 38px; border-radius: 11px; }
  .search-box input { font-size: 16px; }
  .search-kbd { display: none; }

  .context-inner { width: calc(100% - 24px); min-height: 42px; gap: 4px; }
  .context-app { font-size: 12.5px; }
  .context-app-name { max-width: 118px; }
  .context-tab { padding: 0 10px; font-size: 11.5px; min-height: 44px; }
  .context-back { padding: 6px 9px; }
  .context-tabs { -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; }

  .crumb-bar { width: calc(100% - 24px); padding-top: 6px; min-height: 24px; }
  .crumb { font-size: 11px; padding: 3px 6px; }
  .crumb-app .crumb-app-name { max-width: 96px; }
  .crumb-current { max-width: 52vw; font-size: 11px; padding: 3px 6px; }
  .crumb-app img { width: 15px; height: 15px; }

  .page { width: calc(100% - 24px); padding: 14px 0 calc(40px + env(safe-area-inset-bottom, 0px)); }

  /* --- page header --- */
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 14px; }
  .page-head-copy { flex-basis: auto; }
  .page-eyebrow { font-size: 10.5px; margin-bottom: 5px; }
  .page-head h1 { font-size: 21px; line-height: 1.35; }
  .page-sub { font-size: 12px; line-height: 1.6; margin-top: 4px; }
  .page-actions { width: 100%; gap: 6px; }
  .page-actions .btn { flex: 1 1 auto; min-height: 42px; }
  .page-actions .segmented { width: 100%; }
  .page-actions .segmented button { flex: 1; }

  /* --- cards and stats --- */
  .card { border-radius: 14px; }
  .card-head { padding: 13px 14px 0; gap: 8px; }
  .card-body { padding: 12px 14px 14px; }
  .card-foot { padding: 10px 14px; }
  .card-title { font-size: 13.5px; }
  .section-head { margin: 18px 0 10px; }
  .section-head h2 { font-size: 15px; }
  .stat-grid { gap: 8px; }
  .stat { padding: 11px 12px; border-radius: 12px; }
  .stat-top { gap: 6px; }
  .stat-icon { width: 28px; height: 28px; border-radius: 8px; }
  .stat-label { font-size: 10.5px; }
  .stat-value { margin-top: 7px; font-size: 21px; }
  .stat-note { font-size: 9.5px; }
  .note-callout { padding: 10px 12px; font-size: 11px; }
  .empty-state { padding: 28px 16px; }

  /* --- forms: 16px inputs stop iOS from zooming, 44px targets --- */
  .field > label, .field-label { font-size: 11px; }
  .input, .select, .textarea,
  .search-box input,
  .search-inline .input,
  .inline-form .input, .inline-form .select { font-size: 16px; }
  .input, .select, .textarea { min-height: 44px; padding: 10px 12px; border-radius: 10px; }
  .textarea { min-height: 96px; }
  .input-sm, .select-sm { min-height: 40px; height: 40px; font-size: 15px; }
  .search-inline .input { height: 42px; min-height: 42px; padding-inline-start: 34px; }
  .filter-select { min-height: 42px; height: 42px; font-size: 15px; }
  .form-grid { gap: 12px; }
  .form-actions { gap: 8px; }
  .form-actions .btn { flex: 1 1 auto; min-height: 44px; }
  .form-actions .start { margin-inline-end: 0; }
  .inline-form { gap: 8px; }
  .inline-form .input, .inline-form .select { width: 100%; min-width: 0; }
  .radio-card span { min-height: 40px; padding: 9px 12px; font-size: 12.5px; }
  .checkbox { font-size: 12.5px; gap: 9px; }
  .checkbox input { width: 18px; height: 18px; margin-top: 2px; }
  .btn { min-height: 42px; height: auto; }
  .btn.sm { min-height: 38px; }
  .btn.xs { min-height: 32px; }
  .btn.icon { width: 42px; }
  .icon-action { width: 36px; height: 36px; }
  .pager button { min-width: 36px; height: 36px; }
  .switch { width: 44px; height: 26px; }
  .switch span::after { width: 20px; height: 20px; }
  .switch input:checked + span::after { transform: translateX(18px); }
  [dir="rtl"] .switch input:checked + span::after { transform: translateX(-18px); }

  /* --- tabs scroll sideways instead of stacking into several rows --- */
  .tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-snap-type: x proximity; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; margin-bottom: 14px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; min-height: 42px; padding: 10px 12px; scroll-snap-align: start; }
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .toolbar-start, .toolbar-end { width: 100%; flex-basis: 100%; }
  .toolbar-end { justify-content: space-between; }
  .search-inline { flex-basis: 100%; min-width: 0; max-width: none; }
  .filter-select { flex: 1 1 130px; }
  .pagination { gap: 8px; }
  .pagination-info { font-size: 11px; }
  .pager { flex-wrap: wrap; }

  /* --- lists and detail rows --- */
  .list-row { padding: 11px 12px; gap: 9px; }
  .list-row-icon { width: 32px; height: 32px; }
  .list-row-title, .list-row-sub { white-space: normal; overflow-wrap: anywhere; }
  .data-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .data-row .v { text-align: start; }
  .detail-hero { padding: 14px; border-radius: 14px; }
  .detail-title { font-size: 17px; }
  .detail-hero-top { gap: 10px; }
  .timeline .tl-note, .opp-timeline-text { font-size: 11.5px; }

  /* --- boards: one column at a time with snap, never a cramped grid --- */
  .kanban { scroll-snap-type: x proximity; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; gap: 10px; }
  .kanban-col { flex: 0 0 min(84vw, 310px); scroll-snap-align: start; }
  .sales-col { flex: 0 0 min(84vw, 300px); scroll-snap-align: start; }
  .opp-column { scroll-snap-align: start; }
  .stage-row-actions .btn { flex: 0 1 auto; }

  /* --- modals behave as a full-height sheet with pinned bars --- */
  .modal-backdrop { padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); align-items: flex-end; }
  .modal, .modal.size-sm, .modal.size-lg, .modal.size-xl {
    width: 100%; max-height: calc(100dvh - 16px);
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: 18px;
  }
  .modal-head { padding: 14px 14px 8px; align-items: flex-start; }
  .modal-title { font-size: 17px; }
  .modal-sub { font-size: 12px; }
  .modal-close { width: 40px; height: 40px; margin: -4px -4px 0 0; }
  [dir="rtl"] .modal-close { margin: -4px 0 0 -4px; }
  .modal-body { flex: 1 1 auto; min-height: 0; padding: 6px 14px 16px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .modal-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .modal-foot .btn { flex: 1 1 auto; min-height: 44px; }
  .modal-section { padding: 12px; }
  .popover { top: calc(env(safe-area-inset-top, 0px) + 104px); inset-inline: 10px; width: auto; max-height: calc(100dvh - 124px); overflow-y: auto; }
  .user-popover { inset-inline-start: auto; inset-inline-end: 10px; width: min(300px, calc(100vw - 20px)); }
  .search-panel { inset-inline: 10px; width: auto; top: calc(env(safe-area-inset-top, 0px) + 104px); }
  .toast-region { inset-inline: 12px; inset-block-end: calc(12px + env(safe-area-inset-bottom, 0px)); }

  /* --- tables become labelled record cards --- */
  .table-wrap.round:has(.table-cards) { border: 0; background: transparent; }
  .table.table-cards { display: block; width: 100%; min-width: 0 !important; border-collapse: initial; font-size: 12.5px; }
  .table.table-cards thead { display: none; }
  .table.table-cards tbody { display: block; }
  .table.table-cards tr {
    position: relative; display: block; margin-bottom: 9px; overflow: hidden;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
    box-shadow: var(--shadow-xs);
  }
  .table.table-cards tbody tr:last-child { margin-bottom: 0; }
  .table.table-cards td {
    position: relative; display: flex; flex-wrap: wrap; align-items: flex-start;
    gap: 2px 10px; width: 100%; text-align: start;
    white-space: normal; overflow-wrap: anywhere; vertical-align: top;
    padding: 8px 10px;
    border: 0; border-bottom: 1px solid var(--nq-line);
  }
  .table.table-cards tbody tr:last-child td { border-bottom: 0; }
  .table.table-cards td::before {
    content: attr(data-label); flex: 0 0 30%; min-width: 0;
    font-size: 10.5px; font-weight: 700; color: var(--muted); line-height: 1.5;
    overflow-wrap: anywhere;
  }
  /* The first cell is the record's identity: give it the full width and put
     its label above the name so rich cells never collide with the label. */
  .table.table-cards td:first-child { display: block; padding: 9px 10px 8px; }
  .table.table-cards td:first-child::before { display: block; width: auto; margin-bottom: 3px; }
  .table.table-cards td[data-label=""] { justify-content: flex-end; }
  .table.table-cards td[data-label=""]::before { display: none; }
  .table.table-cards td:empty { display: none; }
  .table.table-cards td[colspan] { display: block; text-align: center; }
  .table.table-cards td[colspan]::before { display: none; }
  .table.table-cards .cell-actions { gap: 6px; }
  .table.table-cards .cell-actions::before { display: none; }
  .table.table-cards .empty-row { padding: 24px 12px !important; text-align: center; }
  .table.table-cards .empty-row::before { display: none; }
  .table.table-cards tbody tr:has(> td[colspan]),
  .table.table-cards tbody tr.contact-group-row { border: 0; box-shadow: none; background: transparent; }
  .table.table-cards tbody tr:has(> td[colspan]) td,
  .table.table-cards tbody tr.contact-group-row td { border: 0; background: var(--surface-2); border-radius: 9px; padding: 8px 10px; }
  .table:not(.table-cards) { min-width: 620px; }
}

/* Very narrow phones keep two compact KPIs per row instead of one tall stack. */
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .stat { padding: 10px; }
  .stat-value { font-size: 19px; }
  .meta-grid { gap: 9px 10px; }
  /* A hero email/address never breaks after one letter on a small phone. */
  .detail-hero .meta-grid { grid-template-columns: 1fr; }
  .meta-value { text-wrap: pretty; }
  .page-head h1 { font-size: 20px; }
}
@media (max-width: 380px) {
  .meta-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 11.5px; letter-spacing: .8px; }
}

/* Touch feedback instead of sticky hover states. */
@media (hover: none), (pointer: coarse) {
  .btn, .icon-btn, .icon-action, .tab, .list-row, .stat, .kanban-card, .opp-card, .cal-event, .apps-menu-item { touch-action: manipulation; }
  .btn:active { transform: scale(.985); }
  .stat:active { transform: scale(.985); }
  .icon-btn:active, .icon-action:active { background: var(--surface-3); }
  .list-row:active, .kanban-card:active, .opp-card:active, .apps-menu-item:active,
  .table tbody tr.clickable:active { background: var(--brand-50); }
  .cal-event:active { filter: brightness(.97); }
  .tab:active { color: var(--brand); }
}

@supports (min-height: 100dvh) {
  .app-shell, .boot-screen { min-height: 100dvh; }
}

@media print {
  .table.table-cards { display: table; width: 100%; min-width: 0 !important; }
  .table.table-cards thead { display: table-header-group; }
  .table.table-cards tbody { display: table-row-group; }
  .table.table-cards tr { display: table-row; border: 0; margin: 0; box-shadow: none; }
  .table.table-cards td { display: table-cell; width: auto; padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: start; }
  .table.table-cards td::before { display: none; }
}
/* Single-nav polish: smoother context tabs (colour only, no layout) */
.context-tab { transition: background-color .15s ease, color .15s ease, box-shadow .15s ease; }
@media (prefers-reduced-motion: reduce) { .context-tab { transition: none; } }

/* Comment deep-links: notification click lands on the exact comment and
   highlights it briefly (logistics V3 follow-up, 2026-11-07). */
.record-comment.comment-focused{border-radius:10px;animation:comment-focus-pulse 3.4s ease-out forwards}
@keyframes comment-focus-pulse{0%,55%{background:var(--brand-100,#e8efff);box-shadow:0 0 0 3px var(--brand-200,#cddcff)}100%{background:transparent;box-shadow:0 0 0 0 transparent}}
@media (prefers-reduced-motion: reduce){.record-comment.comment-focused{animation:none;background:var(--brand-100,#e8efff)}}

/* Contacts — duplicate preview & review (V2 corrective, 2026-11-09) */
.dup-preview { border: 1px solid var(--amber-200, #f5d9a8); background: var(--amber-50, #fffaf0); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; display: grid; gap: 6px; }
.dup-preview-head { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; color: var(--ink); }
.dup-preview-head svg { flex: 0 0 auto; margin-top: 1px; color: var(--amber-600, #b7791f); }
.dup-preview-row { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; color: inherit; }
.dup-preview-row:hover { border-color: var(--brand-200); background: var(--brand-50, #f5f8ff); }
.dup-preview-name { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dup-preview-meta { flex: 1; min-width: 0; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dup-preview-score { font-size: 11.5px; font-weight: 700; color: var(--amber-700, #975a16); font-variant-numeric: tabular-nums; }
.dup-score { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--amber-50, #fffaf0); color: var(--amber-700, #975a16); font-weight: 700; font-size: 11.5px; }

/* Subscriptions control panel — monthly/annual totals, billing-cycle pills
   and category tiles (additive, 2026-11-15). */
.vsub-totals { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 14px; }
.vsub-total { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.vsub-total-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.vsub-total-main { font-size: 20px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.vsub-total-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.vsub-cycle-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.vsub-pill { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12px; cursor: pointer; transition: background-color .15s ease, border-color .15s ease; }
.vsub-pill:hover { border-color: var(--brand-300, #b9cdfa); }
.vsub-pill.active { background: var(--brand-600, #2563eb); border-color: var(--brand-600, #2563eb); color: #fff; }
.vsub-pill-count { opacity: .85; font-variant-numeric: tabular-nums; }
.vsub-cats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.vsub-cat { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; text-align: start; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.vsub-cat:hover { border-color: var(--brand-300, #b9cdfa); }
.vsub-cat.active { border-color: var(--brand-500, #3b82f6); box-shadow: 0 0 0 2px var(--brand-100, #e8efff); }
.vsub-cat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50, #eff4ff); color: var(--brand-600, #2563eb); }
.vsub-cat-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vsub-cat-name { font-weight: 700; font-size: 13px; }
.vsub-cat-count { font-size: 11px; color: var(--muted); }
.vsub-cat-figures { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; padding-top: 4px; }
.vsub-cat-figures > span { display: flex; flex-direction: column; gap: 1px; }
.vsub-figure { display: block; white-space: nowrap; }
.vsub-cat-next { grid-column: 1 / -1; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.vsub-cat-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--slate-50, #f6f7f9); font-size: 11px; white-space: nowrap; }
@media (max-width: 640px) { .vsub-cats { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .vsub-pill, .vsub-cat { transition: none; } }
