/* ================================================================
   NexusDesk design system. Loaded last, so it decides how everything looks.
   Quiet surfaces, one accent colour, hairline borders, readable text sizes.
   ":root body" gives a rule the same weight as the older "body.light" rules,
   so one rule here covers both themes through the colour tokens below.
   ================================================================ */
:root {
  color-scheme: dark;
  --bg: #0d0f14;
  --surface: #14171d;
  --surface2: #1b1e26;
  --surface3: #252933;
  --line: #2e333e;
  --line2: #23272f;
  --text: #eceef2;
  --muted: #a3a9b6;
  --faint: #7f8694;
  --primary: #8b8bfa;
  --primary2: #5e5ce6;
  --on-primary: #ffffff;
  --accent-soft: rgba(139, 139, 250, .14);
  --aqua: #2fa893;
  --series1: #7c7cf2;
  --series2: #2fa893;
  --blue: #7ab0ff;
  --warn: #e8b769;
  --orange: #f0a064;
  --red: #f5808b;
  --green: #66cf9f;
  --red-soft: rgba(245, 128, 139, .13);
  --orange-soft: rgba(240, 160, 100, .13);
  --warn-soft: rgba(232, 183, 105, .13);
  --green-soft: rgba(102, 207, 159, .12);
  --blue-soft: rgba(122, 176, 255, .13);
  --shade: rgba(4, 6, 10, .62);
  --shadow: 0 16px 48px rgba(0, 0, 0, .45);
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar: 236px;
  --font: 'Segoe UI Variable Text', 'Segoe UI', Inter, -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace;
}
body.light {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface2: #f1f3f6;
  --surface3: #e7eaef;
  --line: #d9dde4;
  --line2: #e7e9ee;
  --text: #171a21;
  --muted: #565d6b;
  --faint: #6b7280;
  --primary: #4f46e5;
  --primary2: #4f46e5;
  --accent-soft: rgba(79, 70, 229, .09);
  --aqua: #0f8f7a;
  --series1: #4f46e5;
  --series2: #0f8f7a;
  --blue: #1d5fd6;
  --warn: #a15c07;
  --orange: #c2500f;
  --red: #cf2a3a;
  --green: #137a4d;
  --red-soft: rgba(207, 42, 58, .09);
  --orange-soft: rgba(194, 80, 15, .09);
  --warn-soft: rgba(161, 92, 7, .1);
  --green-soft: rgba(19, 122, 77, .09);
  --blue-soft: rgba(29, 95, 214, .09);
  --shade: rgba(20, 24, 33, .42);
  --shadow: 0 16px 48px rgba(23, 26, 33, .16);
}

/* ---------- Base ---------- */
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); letter-spacing: 0; -webkit-font-smoothing: antialiased; }
:root body h1 { font-size: 22px; letter-spacing: -.2px; line-height: 1.25; font-weight: 650; }
:root body h2 { font-size: 18px; letter-spacing: -.1px; font-weight: 650; }
:root body h3 { font-size: 14px; font-weight: 650; }
small { font-size: 12px; }
a { color: var(--primary); }
.nd-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.phone-only { display: none !important; }
.mobile-only { display: none; }
::selection { background: var(--accent-soft); }
:is(.btn, .icon-btn, .nav-link, .mobile-tab, .tiny-icon, .metric, .profile-trigger):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Sidebar ---------- */
:root body .sidebar { width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--line2); padding: 12px 10px 10px; gap: 0; box-shadow: none; transition: width .16s ease; }
.sheet-handle { display: none; }
:root body .brand { gap: 10px; padding: 2px 6px; }
:root body .sidebar-brand { position: static; background: none; margin-bottom: 12px; min-height: 36px; }
:root body .brand-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary2); box-shadow: none; font-size: 15px; font-weight: 750; color: #fff; flex: 0 0 auto; }
.brand-logo::after { content: none !important; display: none !important; }
:root body .brand strong { font-size: 14px; font-weight: 650; letter-spacing: 0; color: var(--text); line-height: 1.25; }
:root body .brand small { font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text { min-width: 0; flex: 1; }
#nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; margin: 0 -4px; padding: 0 4px; }
:root body .nav-label { color: var(--faint); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; margin: 14px 8px 4px; }
:root body .nav-link { min-height: 32px; padding: 5px 8px; gap: 10px; border: 0; border-radius: 7px; color: var(--muted); background: none; font-size: 13.5px; font-weight: 500; margin-bottom: 1px; transition: background .1s, color .1s; }
:root body .nav-link:hover { background: var(--surface2); color: var(--text); }
:root body .nav-link.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
:root body .nav-link.active .nav-icon { color: var(--primary); }
:root body .nav-icon { width: 18px; height: 18px; font-size: 0; color: inherit; display: block; }
:root body .ai-nav-icon { color: inherit; }
:root body .nav-link em { background: none; color: var(--faint); font-size: 12px; font-weight: 500; padding: 0; font-variant-numeric: tabular-nums; }
:root body .nav-beta { display: none; }
:root body .sidebar-bottom { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line2); }
:root body .ai-connection { background: none; border: 0; margin: 0 0 2px; padding: 5px 8px; border-radius: 7px; gap: 10px; }
:root body .ai-connection strong { font-size: 12.5px; font-weight: 500; color: var(--muted); }
:root body .ai-connection small { font-size: 12px; color: var(--faint); }
.connection-dot { box-shadow: none !important; margin-inline: 5px; }
:root body .tiny-icon { width: 30px; height: 30px; padding: 6px; border-radius: 7px; color: var(--faint); flex: 0 0 auto; display: grid; place-items: center; }
:root body .tiny-icon:hover { background: var(--surface2); color: var(--text); }
.tiny-icon .i { width: 16px; height: 16px; }
:root body .sidebar-user { border: 0; padding: 0; gap: 2px; align-items: center; }
:root body .profile-trigger { flex: 1; min-width: 0; gap: 9px; padding: 5px 6px; border-radius: 7px; background: none; border: 0; }
:root body .profile-trigger:hover { background: var(--surface2); }
:root body .avatar { width: 28px; height: 28px; border-radius: 50%; border: 0; font-size: 11px; font-weight: 650; }
:root body .user-text strong { font-size: 12.5px; font-weight: 600; color: var(--text); }
:root body .user-text small { font-size: 12px; color: var(--faint); }

/* Desktop rail: icons only, and the window keeps more room for the work */
@media (min-width: 671px) {
  body.nav-rail { --sidebar: 56px; }
  body.nav-rail .brand-text, body.nav-rail .nav-link > span:not(.nav-icon), body.nav-rail .nav-link > em, body.nav-rail .ai-connection > div, body.nav-rail #side-ai-settings, body.nav-rail .user-text { display: none; }
  body.nav-rail .nav-label { height: 1px; background: var(--line2); margin: 8px 6px; font-size: 0; }
  body.nav-rail .nav-link { justify-content: center; padding: 7px 0; }
  body.nav-rail .brand { justify-content: center; padding: 2px 0; }
  body.nav-rail .ai-connection { justify-content: center; padding: 6px 0; }
  body.nav-rail .connection-dot { margin: 0; }
  body.nav-rail .sidebar-user { flex-direction: column; }
  body.nav-rail .profile-trigger { justify-content: center; padding: 4px 0; }
}

/* ---------- Top bar ---------- */
:root body .main-area { margin-left: var(--sidebar); width: calc(100% - var(--sidebar)); transition: margin-left .16s ease; }
:root body .topbar { height: 52px; min-height: 52px; padding: 0 20px 0 12px; background: var(--bg); border-bottom: 1px solid var(--line2); backdrop-filter: none; gap: 16px; }
.top-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
:root body .breadcrumb { color: var(--text); font-size: 14px; font-weight: 600; }
:root body .breadcrumb .crumb-page { font-weight: 600; color: var(--text); }
:root body .top-actions { gap: 4px; flex: 0 1 auto; min-width: 0; }
:root body .top-search { width: clamp(180px, 26vw, 340px); height: 32px; display: flex; gap: 8px; padding: 0 8px 0 10px; background: var(--surface); border: 1px solid var(--line2); border-radius: 8px; color: var(--faint); font-size: 13px; margin-right: 8px; }
:root body .top-search:hover { border-color: var(--line); color: var(--muted); }
.top-search .i { width: 15px; height: 15px; }
.top-search em { font-style: normal; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root body .top-search kbd { border: 1px solid var(--line); border-radius: 4px; color: var(--faint); font: 11px var(--font); padding: 0 5px; background: none; flex: 0 0 auto; }
:root body .icon-btn { width: 32px; min-width: 32px; height: 32px; padding: 0; border: 0; border-radius: 7px; color: var(--muted); background: none; display: inline-grid; place-items: center; font-size: 16px; position: relative; }
:root body .icon-btn:hover { background: var(--surface2); color: var(--text); }
:root body .nd-notif-count { position: absolute; top: 2px; right: 1px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; line-height: 15px; font-weight: 700; border: 0; box-shadow: none; }
body.light .nd-notif-count { background: var(--red); }
:root body .top-create { height: 32px; margin-left: 6px; }

/* ---------- Buttons ---------- */
:root body .btn { min-height: 32px; padding: 5px 12px; gap: 6px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 550; box-shadow: none; filter: none; transition: background .1s, border-color .1s; }
:root body .btn:hover { background: var(--surface2); filter: none; }
:root body .btn:active { transform: none; background: var(--surface3); }
:root body .btn:disabled { opacity: .5; cursor: default; }
:root body .btn.primary { background: var(--primary2); border-color: var(--primary2); color: #fff; }
:root body .btn.primary:hover { background: color-mix(in srgb, var(--primary2) 88%, #fff); border-color: transparent; }
:root body .btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--text); }
:root body .btn.soft:hover { background: color-mix(in srgb, var(--primary) 22%, transparent); }
:root body .btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
:root body .btn.ghost:hover { background: var(--surface2); }
:root body .btn.danger { background: var(--red-soft); border-color: transparent; color: var(--red); }
:root body .btn.sm { min-height: 28px; padding: 3px 10px; font-size: 12.5px; }
.btn .i { width: 15px; height: 15px; }
:root body .btn.full { justify-content: center; }
:root body .panel-link { color: var(--primary); font-size: 13px; font-weight: 550; padding: 4px 6px; border-radius: 6px; }
:root body .panel-link:hover { background: var(--accent-soft); }

/* ---------- Page layout ---------- */
:root body .page-container { max-width: 1440px; padding: 22px 24px 48px; }
:root body .page-head { margin-bottom: 18px; align-items: center; gap: 16px; }
:root body .page-head h1 { margin-bottom: 2px; font-size: 22px; }
:root body .page-head p { color: var(--muted); font-size: 13.5px; }
.page-head .eyebrow { display: none; }
:root body .page-head-actions { padding-top: 0; gap: 8px; flex-shrink: 0; }
:root body .eyebrow { color: var(--faint); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }

/* ---------- Summary numbers: one strip, not a row of boxes ---------- */
:root body .metrics { gap: 1px; background: var(--line2); border: 1px solid var(--line2); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }
:root body .metric { background: var(--surface); border: 0; border-radius: 0; padding: 14px 16px; min-height: 0; text-align: left; transition: background .1s; }
:root body button.metric:hover, :root body .metric.is-link:hover { background: var(--surface2); transform: none; box-shadow: none; }
:root body .metric-top { color: var(--muted); font-size: 13px; font-weight: 500; }
.metric-icon, .metric-go { display: none !important; }
:root body .metric-value { font-size: 28px; font-weight: 650; letter-spacing: -.5px; margin: 4px 0 2px; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.15; }
:root body .metric-note { font-size: 12.5px; color: var(--faint); }
:root body .metric.is-bad .metric-value { color: var(--red); }

/* ---------- Panels ---------- */
:root body .panel { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); box-shadow: none; }
:root body .panel-head { padding: 14px 16px 10px; }
:root body .panel-head h3 { font-size: 14px; font-weight: 650; }
:root body .panel-head small { font-size: 12.5px; color: var(--faint); }
:root body .panel-body { padding: 0 16px 16px; }
:root body .dashboard-grid { gap: 16px; margin-bottom: 16px; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
:root body .gradient-banner { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: none; margin-bottom: 16px; }
.gradient-banner::after { content: none !important; display: none !important; }
:root body .gradient-banner h2 { font-size: 16px; margin-bottom: 2px; }
:root body .gradient-banner p { color: var(--muted); font-size: 13.5px; }

/* Priority bars */
:root body .priority-breakdown { gap: 14px; padding: 4px 16px 16px; }
:root body .prio-head { font-size: 13px; color: var(--muted); margin-bottom: 5px; }
:root body .prio-head b { font-weight: 600; font-variant-numeric: tabular-nums; }
:root body .pbar { height: 6px; background: var(--surface3); border-radius: 3px; }
:root body .pbar > i { background: var(--faint); border-radius: 3px; }
:root body .pbar > i.pbar-urgent { background: var(--red); }
:root body .pbar > i.pbar-high { background: var(--orange); }
:root body .pbar > i.pbar-medium { background: var(--series1); }
:root body .pbar > i.pbar-low { background: var(--faint); }

/* Trend chart */
:root body .chart-box { min-height: 200px; display: block; position: relative; }
:root body .chart-svg { width: 100%; height: 200px; overflow: visible; touch-action: pan-y; }
:root body .chart-grid { stroke: var(--line2); stroke-width: 1; stroke-dasharray: none; }
:root body .chart-label { fill: var(--faint); font-size: 11px; }
:root body .chart-line { stroke: var(--series1); stroke-width: 2; fill: none; }
:root body .chart-line2 { stroke: var(--series2); stroke-width: 2; fill: none; }
.chart-cross { stroke: var(--line); stroke-width: 1; }
.chart-tip { position: absolute; top: -6px; left: 0; display: grid; gap: 1px; padding: 7px 10px; background: var(--surface3); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; color: var(--text); pointer-events: none; white-space: nowrap; z-index: 2; }
.chart-tip span { color: var(--muted); }
:root body .chart-legend { gap: 14px; color: var(--muted); font-size: 12.5px; }
:root body .legend-dot { background: var(--series1); width: 8px; height: 8px; margin-right: 6px; }
:root body .legend-dot.aqua { background: var(--series2); }

/* Activity feed */
.mini-av { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface3); color: var(--muted); font-size: 10px; font-weight: 650; font-style: normal; flex: 0 0 auto; }
:root body .activity-entry { padding: 10px 16px; gap: 10px; border-top: 1px solid var(--line2); }
.activity-entry .mini-av { margin-top: 1px; }
:root body .activity-entry strong { font-size: 13px; font-weight: 600; color: var(--text); }
.activity-entry strong span { font-weight: 400; color: var(--muted); }
:root body .activity-entry p { font-size: 12.5px; color: var(--muted); margin: 1px 0; overflow-wrap: anywhere; }
:root body .activity-entry time { color: var(--faint); font-size: 12px; }

/* ---------- Ticket views, search and filters ---------- */
:root body .nd-views { gap: 2px; margin-bottom: 12px; border: 0; }
:root body .nd-view-chip { background: none; border: 0; border-radius: 7px; color: var(--muted); font-size: 13.5px; font-weight: 500; padding: 5px 11px; min-height: 30px; box-shadow: none; }
:root body .nd-view-chip:hover { background: var(--surface2); color: var(--text); }
:root body .nd-view-chip.active { background: var(--surface3); color: var(--text); font-weight: 600; box-shadow: none; }
:root body .toolbar { gap: 8px; margin-bottom: 12px; }
:root body .search-input { height: 32px; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; gap: 8px; color: var(--faint); }
.search-input .i { width: 15px; height: 15px; }
:root body .search-input:focus-within { border-color: var(--primary); }
:root body .search-input input { font-size: 13.5px; color: var(--text); outline: none; }
:root body .search-input input::placeholder { color: var(--faint); }
:root body .filter-select { height: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; color: var(--text); font-size: 13px; padding: 0 8px; }
select option { background: var(--surface); color: var(--text); }

/* ---------- Tables ---------- */
:root body .ticket-table th, :root body .ops-table th { background: transparent; color: var(--faint); font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; padding: 8px 12px; border-bottom: 1px solid var(--line2); border-top: 1px solid var(--line2); white-space: nowrap; }
:root body .ticket-table td, :root body .ops-table td { padding: 9px 12px; border-top: 1px solid var(--line2); border-bottom: 0; font-size: 13px; color: var(--muted); vertical-align: middle; }
:root body .ticket-table tbody tr:first-child td { border-top: 0; }
:root body .ticket-table th:first-child, :root body .ticket-table td:first-child { padding-left: 16px; }
:root body .ticket-table th:last-child, :root body .ticket-table td:last-child { padding-right: 16px; }
:root body .ticket-table tbody tr:hover { background: var(--surface2); }
:root body .ticket-table tbody tr.is-selected { background: var(--accent-soft); }
:root body .ticket-table .ticket-title { font-size: 13.5px; font-weight: 550; color: var(--text); max-width: min(46vw, 560px); }
:root body .ticket-no { font-size: 12px; color: var(--faint); margin-top: 1px; font-family: inherit; display: flex; gap: 8px; align-items: center; letter-spacing: 0; font-variant-numeric: tabular-nums; }
:root body .c-assignee { white-space: nowrap; }
.c-assignee > span { vertical-align: middle; }
.c-assignee .mini-av { margin-right: 7px; vertical-align: middle; }
:root body .ticket-table td.is-unassigned { color: var(--faint); font-style: normal; }
:root body .c-updated { white-space: nowrap; color: var(--faint); font-variant-numeric: tabular-nums; }
:root body .table-foot { padding: 10px 16px; border-top: 1px solid var(--line2); color: var(--faint); font-size: 12.5px; background: none; }
input[type=checkbox] { accent-color: var(--primary2); }

/* Status reads as a dot and a word; priority and warnings carry a soft tint */
:root body .pill { padding: 1px 8px; min-height: 20px; border: 0; border-radius: 10px; background: var(--surface3); color: var(--muted); font-size: 12px; font-weight: 550; gap: 6px; }
:root body .pill::before { width: 6px; height: 6px; }
:root body .pill.open { background: none; color: var(--blue); padding-left: 0; }
:root body .pill.in_progress { background: none; color: var(--primary); padding-left: 0; }
:root body .pill.waiting { background: none; color: var(--warn); padding-left: 0; }
:root body .pill.resolved, :root body .pill.closed { background: none; color: var(--green); padding-left: 0; }
:root body .pill.urgent { background: var(--red-soft); color: var(--red); }
:root body .pill.high { background: var(--orange-soft); color: var(--orange); }
:root body .pill.medium { background: var(--surface3); color: var(--text); }
:root body .pill.low { background: var(--surface3); color: var(--muted); }
:root body .pill.overdue { background: var(--red-soft); color: var(--red); padding-left: 8px; }
.pill.overdue::before { display: none; }
:root body .tag { background: var(--surface3); color: var(--muted); font-size: 12px; border: 0; border-radius: 6px; padding: 1px 7px; }

/* ---------- Cards: knowledge, assets, customers ---------- */
:root body :is(.kb-card, .asset-card) { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); padding: 16px; box-shadow: none; transform: none; }
:root body :is(.kb-card, .asset-card):hover { background: var(--surface2); border-color: var(--line); transform: none; }
:root body :is(.kb-card, .asset-card) h3 { font-size: 14px; margin-bottom: 4px; }
:root body :is(.kb-card, .asset-card) p { font-size: 13px; color: var(--muted); line-height: 1.5; }
:root body .kb-tag { background: var(--surface3); border: 0; color: var(--muted); font-size: 12px; padding: 1px 7px; border-radius: 6px; }
:root body .kb-card footer { font-size: 12px; color: var(--faint); }
:root body .asset-card .asset-type { background: var(--surface3); color: var(--muted); width: 34px; height: 34px; font-size: 18px; border-radius: 8px; }
:root body .kb-grid, :root body .asset-grid { gap: 12px; }

/* ---------- Forms ---------- */
:root body .field { gap: 5px; margin-bottom: 13px; }
:root body .field label, :root body label.field { color: var(--muted); font-size: 12.5px; font-weight: 550; letter-spacing: 0; text-transform: none; }
:root body :is(.field input, .field select, .field textarea, label.field > input, label.field > select) { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; color: var(--text); font-size: 13.5px; font-weight: 400; padding: 7px 10px; box-shadow: none; }
:root body :is(.field input, .field select, label.field > input, label.field > select) { height: 34px; padding-block: 0; }
body.light :is(.field input, .field select, .field textarea) { background: #fff; }
:root body :is(.field input, .field select, .field textarea):focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
:root body .field textarea { line-height: 1.5; min-height: 96px; }
:root body .field small { font-size: 12px; color: var(--faint); }
:root body :is(.field input, .field textarea)::placeholder { color: var(--faint); }
:root body .form-grid { gap: 0 12px; }
:root body .section-title { color: var(--text); font-size: 14px; font-weight: 650; letter-spacing: 0; text-transform: none; margin: 20px 0 10px; }

/* ---------- Dialogs and the ticket panel ---------- */
:root body .overlay-shade { background: var(--shade); backdrop-filter: none; }
:root body .dialog { background: var(--surface); border: 0; border-left: 1px solid var(--line); box-shadow: var(--shadow); width: min(640px, 100%); }
:root body .dialog:has(.nd-ticket-organized) { width: min(860px, 100%); }
:root body .dialog-top { padding: 12px 12px 12px 20px; align-items: center; border-bottom: 1px solid var(--line2); background: var(--surface); }
.dialog-top .eyebrow { display: none; }
:root body .dialog-top h2 { font-size: 15px; font-weight: 600; }
:root body .dialog-content { padding: 18px 20px 28px; background: var(--surface); }
:root body .detail-title { font-size: 19px; font-weight: 650; line-height: 1.3; margin-bottom: 8px; letter-spacing: -.1px; }
:root body .detail-meta { gap: 8px; margin-bottom: 12px; }
:root body .detail-actions { gap: 6px; margin-bottom: 12px; }
:root body .detail-desc { background: none; border: 0; padding: 0; color: var(--text); font-size: 14px; line-height: 1.6; }
:root body .detail-mini { color: var(--faint); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; margin-bottom: 1px; }
:root body .detail-cell strong { font-size: 13.5px; font-weight: 550; }
:root body .modal-footer { gap: 8px; margin-top: 16px; }
:root body .comment { border-left: 2px solid var(--line); padding: 2px 0 4px 12px; }
:root body .comment.internal { border-left-color: var(--warn); }
:root body .comment strong { font-size: 13px; }
:root body .comment time { font-size: 12px; }
:root body .comment p { font-size: 13.5px; color: var(--text); line-height: 1.55; }
:root body .file-row { background: var(--surface2); font-size: 13px; border-radius: 7px; }
:root body .file-row a { color: var(--primary); }

/* Ticket tabs and cards: a flat page instead of boxes inside boxes */
:root body .nd-ticket-hero { background: none; border: 0; padding: 0 0 14px; }
:root body .nd-ticket-tabs { gap: 2px; background: var(--surface); border-bottom: 1px solid var(--line2); }
:root body .nd-ticket-tabs [role="tab"] { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); font-size: 13.5px; font-weight: 500; padding: 8px 11px; box-shadow: none; margin-bottom: -1px; }
:root body .nd-ticket-tabs [role="tab"]:hover { color: var(--text); background: none; }
:root body .nd-ticket-tabs [role="tab"][aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); background: none; }
:root body .nd-ticket-tab-panel { background: none; }
:root body .nd-ticket-card { background: none; border: 1px solid var(--line2); border-radius: var(--radius); padding: 14px; box-shadow: none; }
:root body .nd-ticket-card-title { font-size: 13.5px; font-weight: 650; letter-spacing: 0; text-transform: none; color: var(--text); }
:root body .nd-ticket-customer { background: var(--surface2); border: 0; border-radius: var(--radius); padding: 12px 14px; }
:root body .nd-customer-label { color: var(--faint); font-size: 12px; font-weight: 500; letter-spacing: 0; }
:root body .nd-customer-type { background: var(--surface3); border: 0; font-size: 12px; font-weight: 550; padding: 0 8px; }
:root body .nd-customer-main strong { font-size: 14px; font-weight: 600; }

/* ---------- AI copilot chat ---------- */
:root body .chat-compose { background: var(--bg); border-color: var(--line); border-radius: 10px; }
:root body .chat-avatar { background: var(--surface3); color: var(--muted); border-radius: 50%; }
:root body .chat-message:not(.user) .chat-bubble { background: var(--surface2); border: 0; color: var(--text); border-radius: 12px; font-size: 14px; line-height: 1.55; }
:root body .chat-message.user .chat-bubble { background: var(--primary2); border: 0; color: #fff; border-radius: 12px; font-size: 14px; line-height: 1.55; }
:root body .chat-message.user .chat-avatar { background: var(--surface3); color: var(--muted); }
:root body .chat-hint { font-size: 12px; }

/* ---------- Sign in ---------- */
:root body .auth-wrap { background: var(--bg); }
.auth-glow { display: none; }
:root body .auth-card { background: var(--surface); border: 1px solid var(--line2); border-radius: 16px; box-shadow: none; padding: 28px; width: min(100%, 400px); }
:root body .brand-auth { margin-bottom: 22px; padding: 0; }
:root body .auth-card h1 { font-size: 21px; margin-bottom: 2px; }
:root body .auth-card > p { font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
:root body .auth-card .btn { min-height: 36px; margin-top: 4px; }
:root body .auth-foot { font-size: 12px !important; color: var(--faint) !important; margin-top: 16px !important; }

/* ---------- Toasts, empty states, loading, quick search ---------- */
:root body .toast { background: var(--surface3); border: 1px solid var(--line); color: var(--text); border-radius: 9px; font-size: 13px; padding: 9px 13px; }
:root body .toast.error { background: var(--surface3); border-color: var(--red); color: var(--text); }
:root body .toast.success { background: var(--surface3); border-color: var(--green); color: var(--text); }
:root body .blank { padding: 44px 18px; }
:root body .blank .blank-icon { color: var(--faint); display: grid; place-items: center; font-size: 24px; }
.blank-icon .i { width: 26px; height: 26px; }
:root body .blank h3 { font-size: 14.5px; margin-bottom: 3px; }
:root body .blank p { font-size: 13px; color: var(--muted); }
:root body .nd-palette-shade { background: var(--shade); backdrop-filter: none; }
:root body .nd-palette-box { background: var(--surface); border-radius: 12px; border-color: var(--line); }
:root body .nd-palette-item.active { background: var(--accent-soft); }
.nd-palette-icon .nav-icon, .nd-palette-input .i { color: var(--faint); }
:root body .nd-palette-text strong { font-size: 13.5px; font-weight: 550; }
:root body .nd-palette-group { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.nd-pull { display: none; }

/* ---------- Tablets and small windows ---------- */
@media (max-width: 1200px) {
  :root body .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  :root body .top-search { width: 32px; height: 32px; padding: 0; justify-content: center; margin: 0; border: 0; background: none; color: var(--muted); font-size: 0; }
  .top-search em, :root body .top-search kbd { display: none; }
}

/* ================================================================
   Phones: an app, not a shrunken website.
   ================================================================ */
@media (max-width: 670px) {
  :root { --radius-lg: 12px; }
  body { font-size: 15px; }
  .phone-only { display: inline-flex !important; }
  .mobile-only { display: inline-grid; }
  :root body .main-area { margin: 0; width: 100%; padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }

  /* Top bar: page name, then the few things you reach for */
  :root body .topbar { height: calc(50px + env(safe-area-inset-top, 0px)); min-height: calc(50px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 8px 0 16px; background: var(--bg); gap: 6px; }
  :root body .topbar .breadcrumb { font-size: 18px; font-weight: 650; max-width: none; }
  :root body .topbar .breadcrumb .crumb-page { font-weight: 650; }
  #menu-toggle, #refresh, #theme-toggle { display: none !important; }
  :root body .top-actions { gap: 2px; }
  :root body .top-actions .icon-btn, :root body .top-search { width: 40px; min-width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; }
  .top-actions .i { width: 21px; height: 21px; }
  :root body .top-create { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; margin: 0 3px 0 6px; border-radius: 50%; }
  .top-create .i { width: 19px; height: 19px; stroke-width: 2.2; }
  .top-create-label { display: none; }
  :root body .nd-notif-count { top: 4px; right: 4px; }

  /* Bottom tabs */
  :root body .mobile-tabbar { height: calc(56px + env(safe-area-inset-bottom, 0px)); padding: 0 4px env(safe-area-inset-bottom, 0px); gap: 0; background: var(--surface); border-top: 1px solid var(--line2); border-radius: 0; box-shadow: none; backdrop-filter: none; }
  :root body .mobile-tab { min-height: 56px; gap: 3px; padding: 0; background: none; border-radius: 0; color: var(--faint); font-size: 11px; font-weight: 500; }
  :root body .mobile-tab.active { background: none; color: var(--primary); font-weight: 600; }
  .mobile-tab.active::before { content: none !important; display: none !important; }
  :root body .mobile-tab-icon { height: 22px; font-size: 0; line-height: 1; }
  .mobile-tab .i { width: 22px; height: 22px; }
  :root body .mobile-tab:active { transform: none; opacity: .65; }

  /* "More" opens a sheet from the bottom, with the pages laid out as tiles */
  :root body .sidebar { position: fixed; inset: auto 0 0 0; width: 100%; max-height: 86dvh; border: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 8px 14px calc(12px + env(safe-area-inset-bottom, 0px)); transform: translateY(105%); transition: transform .22s cubic-bezier(.2, .8, .3, 1); box-shadow: none; visibility: hidden; }
  :root body .sidebar.mobile-open { transform: none; visibility: visible; box-shadow: var(--shadow); }
  .sheet-handle { display: block; width: 36px; height: 4px; margin: 0 auto 8px; border-radius: 2px; background: var(--line); flex: 0 0 auto; }
  :root body .sidebar-brand { margin-bottom: 10px; padding: 0 2px; }
  :root body .sidebar-close { order: 3; width: 36px; height: 36px; min-width: 36px; min-height: 36px; border: 0; border-radius: 50%; background: var(--surface2); color: var(--muted); display: inline-grid; place-items: center; padding: 0; }
  #nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; margin: 0; padding: 0; overscroll-behavior: contain; }
  :root body .nav-label { display: none; }
  :root body .nav-link { min-height: 50px; padding: 8px 12px; gap: 10px; background: var(--surface2); border-radius: 12px; color: var(--text); font-size: 14px; margin: 0; line-height: 1.2; }
  :root body .nav-link.active { background: var(--accent-soft); }
  :root body .nav-link .nav-icon { color: var(--muted); }
  :root body #nav :is([data-page="overview"], [data-page="tickets"], [data-page="copilot"], [data-page="assets"]) { display: none; }
  :root body .sidebar-bottom { border-top: 0; margin-top: 10px; padding-top: 0; }
  :root body .ai-connection { display: none; }
  :root body .sidebar-user { background: var(--surface2); border-radius: 12px; padding: 4px; }
  :root body .sidebar-user .tiny-icon { width: 44px; height: 44px; padding: 13px; display: inline-grid; }
  .tiny-icon .i { width: 18px; height: 18px; }
  :root body .profile-trigger { padding: 6px; min-height: 44px; }
  :root body .profile-trigger:hover { background: none; }
  :root body .sidebar-backdrop { background: var(--shade); }

  /* Page frame: the top bar already names the page */
  :root body .page-container { padding: 12px 14px calc(24px + env(safe-area-inset-bottom, 0px)); }
  :root body .page-head { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 12px; }
  :root body .page-head > div:first-child { display: none; }
  :root body .page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; }
  :root body .page-head-actions:empty { display: none; }
  :root body .page-head-actions .btn { flex: 1 1 auto; min-height: 40px; }
  #view:has(#ticket-toolbar) .page-head { display: none; }
  #view:has(#banner-new) .page-head > div:first-child { display: block; }
  #view:has(#banner-new) .page-head p { display: block; }

  :root body .btn { min-height: 40px; font-size: 14px; border-radius: 9px; }
  :root body .btn.sm { min-height: 34px; font-size: 13.5px; }
  :root body .field label, :root body label.field { font-size: 13px; }
  :root body :is(.field input, .field select, label.field > input, label.field > select) { height: 44px; min-height: 44px; font-size: 16px; border-radius: 9px; }
  :root body .field textarea { font-size: 16px; min-height: 110px; border-radius: 9px; }
  :root body .form-grid { grid-template-columns: 1fr; }

  /* Overview */
  :root body .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
  :root body .metrics.metrics-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  :root body .metric { padding: 11px 13px; }
  :root body .metric-value { font-size: 24px; margin: 1px 0 0; }
  :root body .metric-note { display: none; }
  :root body .dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
  :root body .panel-head { padding: 12px 14px 8px; flex-wrap: nowrap; }
  :root body .panel-body { padding: 0 14px 14px; }
  :root body .priority-breakdown { padding: 2px 14px 14px; gap: 11px; }
  :root body .chart-legend { font-size: 12px; gap: 10px; flex: 0 0 auto; }
  :root body .activity-entry { padding: 10px 14px; }
  :root body .gradient-banner { flex-direction: column; align-items: stretch; padding: 16px; margin-bottom: 12px; }

  /* Search and filters */
  :root body .search-input { height: 42px; min-height: 42px; border-radius: 10px; }
  :root body .search-input input { font-size: 16px; }
  :root body .filter-toggle { min-height: 42px; }
  :root body .toolbar { margin-bottom: 8px; }
  :root body .toolbar .filter-select { height: 42px; font-size: 14px; border-radius: 9px; }
  :root body .nd-views { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 8px; padding: 0 14px; gap: 4px; }
  .nd-views::-webkit-scrollbar { display: none; }
  :root body .nd-view-chip { flex: 0 0 auto; min-height: 34px; font-size: 14px; padding: 5px 12px; border-radius: 17px; }
  :root body .nd-view-chip.active { background: var(--text); color: var(--bg); }

  /* Ticket list: full-width rows, like a mail app */
  #view:has(#ticket-toolbar) .panel { margin-inline: -14px; border-radius: 0; border-inline: 0; }
  #view:has(#ticket-toolbar) .panel-head { padding: 8px 14px; align-items: center; }
  #view:has(#ticket-toolbar) .panel-head h3 { display: none; }
  #view:has(#ticket-toolbar) .panel-head small { font-size: 13px; }
  :root body .ticket-table, :root body .ticket-table tbody { display: block; min-width: 0; }
  :root body .ticket-table thead { display: none; }
  :root body .ticket-table tbody tr, :root body .ticket-table:not(.selecting) tbody tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "title title title title" "status prio assignee updated"; align-items: center; column-gap: 8px; row-gap: 5px; padding: 11px 14px; border: 0; border-top: 1px solid var(--line2); }
  :root body .ticket-table.selecting tbody tr { grid-template-columns: 26px auto auto minmax(0, 1fr) auto; grid-template-areas: "sel title title title title" "sel status prio assignee updated"; }
  :root body .ticket-table tbody tr:first-child { border-top: 0; }
  :root body .ticket-table tbody tr:active { background: var(--surface2); }
  :root body .ticket-table tbody tr td, :root body .ticket-table tbody tr td:first-child, :root body .ticket-table tbody tr td:last-child { padding: 0; border: 0; display: block; min-width: 0; }
  :root body .ticket-table td.c-sel { display: none; grid-area: sel; }
  :root body .ticket-table.selecting td.c-sel { display: block; }
  :root body .ticket-table td.c-title { grid-area: title; }
  :root body .ticket-table .ticket-title { white-space: normal; max-width: none; font-size: 15px; line-height: 1.3; font-weight: 550; }
  :root body .ticket-no { font-size: 12.5px; margin-top: 2px; }
  :root body .ticket-table td.c-status { grid-area: status; }
  :root body .ticket-table td.c-prio { grid-area: prio; }
  :root body .ticket-table td.c-cat { display: none; }
  :root body .ticket-table td.c-assignee { grid-area: assignee; font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; }
  .ticket-table td.c-assignee::before { content: none !important; }
  .c-assignee .mini-av { display: none; }
  :root body .ticket-table td.c-updated { grid-area: updated; font-size: 12.5px; text-align: right; }
  :root body .table-foot { padding: 10px 14px; }
  :root body .table-foot > span { display: none; }

  /* Dialogs rise from the bottom; a ticket takes the whole screen */
  :root body .overlay { align-items: flex-end; }
  :root body .dialog { width: 100%; height: auto; max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px)); border: 0; border-radius: 16px 16px 0 0; display: flex; flex-direction: column; }
  :root body .dialog:has(.nd-ticket-organized) { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  :root body .dialog-top { position: static; padding: calc(8px + env(safe-area-inset-top, 0px)) 6px 8px 16px; flex: 0 0 auto; }
  :root body .dialog:not(:has(.nd-ticket-organized)) .dialog-top { padding-top: 8px; border-radius: 16px 16px 0 0; }
  :root body #dialog-close { width: 44px; height: 44px; }
  #dialog-close .i { width: 21px; height: 21px; }
  :root body .dialog-content { flex: 1 1 auto; min-height: 0; max-height: none; padding: 14px 16px calc(20px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; }
  :root body .dialog-content.nd-ticket-organized { padding: 0; }
  :root body .modal-footer { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom, 0px)); margin: 14px -16px calc(-20px - env(safe-area-inset-bottom, 0px)); padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line2); }
  :root body .modal-footer .btn { flex: 1; min-height: 44px; }
  #view .modal-footer { position: static; margin: 12px 0 0; padding: 0; border: 0; background: none; }

  :root body .nd-ticket-hero { padding: 14px 16px 12px; }
  :root body .detail-title { font-size: 18px; }
  :root body .nd-ticket-customer { margin: 10px 0 0; padding: 11px 13px; }
  :root body .nd-ticket-tabs { position: sticky; top: 0; z-index: 3; padding: 0 8px; }
  :root body .nd-ticket-tabs [role="tab"] { font-size: 14px; min-height: 44px; }
  :root body .nd-ticket-tab-panel { padding: 14px 16px 20px; }
  :root body .nd-ticket-card { padding: 0 0 14px; border: 0; border-bottom: 1px solid var(--line2); border-radius: 0; margin-bottom: 14px; }
  :root body .nd-quick-compose { position: sticky; bottom: 0; z-index: 4; margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line2); box-shadow: none; gap: 8px; }
  :root body .nd-quick-compose .btn { min-height: 42px; font-size: 14.5px; font-weight: 600; }

  /* Toasts sit above the tabs */
  :root body #toast-zone { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }

  /* Pull to refresh */
  .nd-pull { display: grid; place-items: center; position: fixed; top: calc(50px + env(safe-area-inset-top, 0px)); left: 50%; z-index: 9; width: 36px; height: 36px; border-radius: 50%; background: var(--surface3); color: var(--muted); transform: translate(-50%, -60px); opacity: 0; pointer-events: none; }
  .nd-pull.is-ready { color: var(--primary); }
  .nd-pull.is-loading { opacity: 1; transform: translate(-50%, 12px); animation: nd-pull-spin .8s linear infinite; }
  @keyframes nd-pull-spin { to { rotate: 360deg; } }
}
@media (max-width: 670px) and (prefers-reduced-motion: reduce) {
  :root body .sidebar { transition: none; }
  .nd-pull.is-loading { animation: none; }
}

/* ---------- Corrections after looking at the real pages ---------- */
#sidebar #nav { scrollbar-color: var(--line) transparent; padding-bottom: 4px; }
#sidebar #nav .nav-link { min-height: 32px; padding-top: 5px; padding-bottom: 5px; }
:root body .nd-doom-sidebar-link { margin-left: 0; padding-left: 8px; border-left: 0; }
.nd-doom-sidebar-link .nav-icon { color: inherit !important; }
@media (min-width: 671px) { #sheet-theme { display: none !important; } }
html { scrollbar-color: var(--line) transparent; }
/* Long ticket titles shorten instead of pushing the table wider than its panel */
:root body .ticket-table .c-title { width: 100%; max-width: 0; }
:root body .ticket-table .ticket-title { max-width: 100%; }
:root body .nd-ticket-tabs { overflow-y: hidden; }
@media (max-width: 670px) {
  #sidebar #nav .nav-link { min-height: 50px; padding-top: 8px; padding-bottom: 8px; }
  #sidebar #nav { padding-bottom: 0; }
  :root body .ticket-table .c-title { width: auto; max-width: none; }
}

@media (max-width: 670px) {
  /* The selection box only appears after tapping Select */
  :root body .ticket-table:not(.selecting) tbody tr td.c-sel { display: none; }
  /* The menu sheet is as tall as its contents */
  :root body .sidebar { height: auto; top: auto; }
  #sidebar #nav { flex: 0 1 auto; }
  :root body .sidebar-bottom { margin-top: 10px; }
  :root body .nd-doom-sidebar-link { padding-left: 12px; }
}

/* ---------- Summary numbers on Timesheets, Mileage, Reports and Team ---------- */
:root body :is(.ops-metrics, .nd-stats) { gap: 1px; background: var(--line2); border: 1px solid var(--line2); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }
:root body :is(.ops-kpi, .nd-stats .statbox) { background: var(--surface); border: 0; border-radius: 0; padding: 12px 16px; box-shadow: none; min-width: 0; margin: 0; min-height: 0; }
:root body :is(.ops-kpi, .nd-stats .statbox) small { color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; }
:root body :is(.ops-kpi, .nd-stats .statbox) strong { font-size: 24px; font-weight: 650; letter-spacing: -.3px; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; margin: 2px 0; }
:root body .ops-kpi span { color: var(--faint); font-size: 12.5px; }

/* ---------- Cards on the customer and settings pages ---------- */
:root body .ops-company-card { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); box-shadow: none; transform: none; }
:root body .ops-company-card:hover { background: var(--surface2); border-color: var(--line); transform: none; }
:root body .ops-company-card strong { font-size: 14px; font-weight: 600; }
:root body .ops-company-monogram { background: var(--surface3); color: var(--muted); border: 0; border-radius: 8px; font-size: 12px; font-weight: 650; }
:root body .settings-card { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); box-shadow: none; }
:root body .ops-customer-groups .btn.primary { background: var(--surface3); border-color: transparent; color: var(--text); }
@media (max-width: 670px) {
  :root body :is(.ops-metrics, .nd-stats) { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
  :root body :is(.ops-kpi, .nd-stats .statbox) { padding: 10px 13px; }
  :root body .ops-kpi strong, :root body .nd-stats .statbox strong { font-size: 20px; }
  :root body .ops-kpi span { display: none; }
  :root body .ops-company-card { padding: 11px 13px; border-radius: 12px; }
  :root body .ops-company-card .ops-company-monogram { width: 36px; height: 36px; border-radius: 9px; }
  :root body .settings-card { padding: 14px; }
}

/* Company cards: a compact row on every screen size */
:root body .ops-company-card { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 1px 12px; align-items: center; padding: 12px 14px; }
:root body .ops-company-card .ops-company-monogram { grid-row: span 3; width: 36px; height: 36px; border-radius: 9px; margin: 0; align-self: center; }
:root body .ops-company-card > :not(.ops-company-monogram) { grid-column: 2; margin: 0; min-width: 0; }

/* Three summary numbers stay on one row on a phone */
@media (max-width: 670px) {
  :root body .metrics.metrics-3 .metric { grid-column: auto; min-width: 0; }
  :root body .metrics.metrics-3 .metric-top { font-size: 12.5px; }
}

:root body .gradient-banner h2 { color: var(--text); }
:root body .nd-work-receipt > strong { color: var(--green); }
:root body .nd-customer-label { color: var(--muted); }
:root body .nd-ai-version { background: var(--surface3); border: 0; color: var(--muted); }
body.light { --orange: #ad440b; }

/* ================================================================
   Dialogs open in the middle of the screen. A ticket is a page.
   ================================================================ */
:root body .overlay { justify-content: center; align-items: center; padding: 24px; }
:root body .dialog { width: min(600px, 100%); height: auto; max-height: min(100%, 860px); border: 1px solid var(--line); border-radius: 14px; animation: nd-dialog-in .14s ease-out; overflow: hidden; }
:root body .dialog.nd-dialog-wide { width: min(940px, 100%); }
:root body .dialog-content { flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
/* Movement only: a slow or paused animation must never leave a form invisible. */
@keyframes nd-dialog-in { from { transform: translateY(6px); } to { transform: none; } }

/* The page itself: sits beside the sidebar, and takes the place of the top bar */
:root body .overlay.is-ticket-page { left: var(--sidebar); padding: 0; z-index: 30; display: block; transition: left .16s ease; }
.overlay.is-ticket-page .overlay-shade { display: none; }
:root body .overlay.is-ticket-page .dialog { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; background: var(--bg); animation: nd-page-in .12s ease-out; position: relative; }
@keyframes nd-page-in { from { opacity: 0; } to { opacity: 1; } }
.nd-ticket-tool { display: none !important; }
.is-ticket-page .nd-ticket-tool { display: flex !important; }
.is-ticket-page #nd-ticket-back { display: inline-grid !important; }
.is-ticket-page #dialog-close { display: none; }
:root body .is-ticket-page .dialog-top { height: 52px; min-height: 52px; flex: 0 0 auto; padding: 0 16px 0 10px; gap: 6px; justify-content: flex-start; background: var(--bg); border-bottom: 1px solid var(--line2); }
.is-ticket-page .dialog-top > div:not(.nd-ticket-tools) { flex: 1; min-width: 0; }
:root body .is-ticket-page .dialog-top h2 { font-size: 14px; font-weight: 600; color: var(--muted); }
.nd-ticket-tools { gap: 2px; align-items: center; }
.nd-ticket-tools.no-list #nd-ticket-prev, .nd-ticket-tools.no-list #nd-ticket-next { display: none; }
.nd-ticket-tools .icon-btn:disabled { opacity: .35; cursor: default; background: none; }
:root body .is-ticket-page .dialog-content, :root body .is-ticket-page .dialog-content.nd-ticket-organized { flex: 1 1 auto; min-height: 0; padding: 0 0 40px; background: var(--bg); overflow-y: auto; }
#dialog-content.nd-ticket-loading { visibility: hidden; }
.nd-ticket-ghost { position: absolute; inset: 52px 0 0 0; overflow: hidden; pointer-events: none; z-index: 2; background: var(--bg); }

/* Title, then two columns */
:root body .nd-ticket-hero { max-width: 1280px; margin: 0 auto; padding: 20px 24px 14px; background: none; }
:root body .nd-ticket-hero .detail-title { font-size: 22px; line-height: 1.25; margin-bottom: 8px; overflow-wrap: anywhere; }
:root body .nd-ticket-hero .detail-meta { margin: 0; }
.nd-ticket-body { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.nd-ticket-main { min-width: 0; }
.nd-ticket-issue { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 14px; }
.nd-ticket-issue .detail-desc { margin: 0; }
:root body #ai-result:not(:empty) { margin-bottom: 14px; }
:root body .is-ticket-page .nd-ticket-tabs { background: none; padding: 0; border-bottom: 1px solid var(--line2); position: static; }
:root body .is-ticket-page .nd-ticket-tab-panel { padding: 14px 0 0; }
:root body .is-ticket-page .nd-ticket-card { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 14px; }
.nd-ticket-side { position: sticky; top: 16px; display: grid; gap: 12px; min-width: 0; }
.nd-props-summary { display: none; }
.nd-props-body { display: grid; gap: 12px; }
.nd-side-block { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); padding: 12px 14px; min-width: 0; }
.nd-side-block > h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 550; }
:root body .nd-side-fields .field { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 8px; margin-bottom: 6px; position: relative; }
:root body .nd-side-fields .field:last-child { margin-bottom: 0; }
:root body .nd-side-fields .field label { font-weight: 450; color: var(--faint); font-size: 13px; }
:root body .nd-side-fields select { background: transparent; border-color: transparent; height: 30px; padding: 0 4px; font-weight: 500; font-size: 13px; width: 100%; min-width: 0; cursor: pointer; }
:root body .nd-side-fields select:hover, :root body .nd-side-fields select:focus { background: var(--surface2); border-color: var(--line); box-shadow: none; }
.nd-side-fields .field.is-saved::after { content: 'Saved'; position: absolute; right: 22px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--green); background: var(--surface); padding: 0 4px; pointer-events: none; }
:root body .nd-side-facts .detail-split { display: grid; grid-template-columns: 1fr; gap: 9px; margin: 0; }
:root body .nd-side-facts .detail-cell { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 2px 8px; padding: 0; background: none; border: 0; }
:root body .nd-side-facts .detail-mini { font-size: 13px; color: var(--faint); margin: 0; }
:root body .nd-side-facts .detail-cell strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
:root body .nd-side-facts .detail-cell strong + .detail-mini { grid-column: 2; font-size: 12px; overflow-wrap: anywhere; }
:root body .nd-side-ai .detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
:root body .nd-side-ai .btn { padding-inline: 6px; font-size: 12.5px; white-space: normal; line-height: 1.2; background: var(--surface2); border-color: transparent; }
:root body .nd-side-ai .btn:hover { background: var(--surface3); }
:root body .nd-side-ai .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
:root body .is-ticket-page .nd-ticket-customer { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); margin: 0; padding: 12px 14px; }
.nd-ticket-customer .nd-customer-main { flex-direction: column; align-items: flex-start; gap: 1px; margin-bottom: 2px; }
:root body .nd-ticket-customer #nd-customer-edit-toggle { margin-top: 8px; width: 100%; background: var(--surface2); }
.nd-ticket-customer .nd-customer-form { grid-template-columns: 1fr; }
.nd-ticket-customer select { width: 100%; }

/* Conversation */
.is-ticket-page .nd-ticket-workflow-head { display: none; }
:root body .nd-thread-post { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); box-shadow: none; }
:root body .nd-thread-post.nd-thread-note { background: color-mix(in srgb, var(--warn) 6%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 24%, var(--line2)); }
:root body .nd-thread-text { color: var(--text); font-size: 14px; line-height: 1.55; }
:root body .nd-post-avatar { background: var(--surface3); color: var(--muted); border: 0; border-radius: 50%; font-weight: 650; }
:root body .nd-thread-label { background: var(--surface3); border: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
:root body .nd-thread-label.nd-note-tag { background: var(--warn-soft); color: var(--warn); }
:root body .nd-thread-event { color: var(--faint); font-size: 13px; }
:root body .nd-thread-event small { color: var(--faint); font-size: 12.5px; }
:root body .nd-compose { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); box-shadow: none; }
:root body .nd-compose-mode { background: none; border-bottom: 1px solid var(--line2); padding: 0 6px; gap: 2px; }
:root body .nd-mode { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); font-size: 13.5px; font-weight: 500; padding: 9px 11px; flex: 0 0 auto; }
:root body .nd-mode.active { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); background: none; }
:root body .nd-compose-editor label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
:root body .nd-compose-editor textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 14px; line-height: 1.5; }
:root body .nd-compose-editor textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
:root body .nd-compose-hint { font-size: 12.5px; color: var(--faint); line-height: 1.45; }
:root body .nd-inline-work { background: none; border: 0; border-top: 1px solid var(--line2); border-radius: 0; padding: 0; margin: 10px 0 0; }
.nd-inline-work-toggle { display: flex; align-items: baseline; gap: 8px; cursor: pointer; padding: 9px 0; }
.nd-inline-work-toggle strong { font-size: 13px; font-weight: 550; color: var(--text); }
.nd-inline-work-toggle span { font-size: 12.5px; color: var(--faint); }
.nd-inline-work-toggle::after { content: 'Show'; margin-left: auto; font-size: 12.5px; color: var(--primary); }
.nd-inline-work.is-open .nd-inline-work-toggle::after { content: 'Hide'; }
.nd-compose:has(#nd-mode-note.active) .nd-inline-work-toggle::after { content: 'Required for notes'; color: var(--faint); }
.nd-inline-work:not(.is-open) .nd-time-fields { display: none; }
.nd-compose:has(#nd-mode-note.active) .nd-time-fields { display: block; }
:root body :is(.nd-time-grid, .nd-post-footer-controls, .nd-template-bar) :is(input:not([type=checkbox]):not([type=radio]), select) { background: var(--bg); border-color: var(--line); height: 34px; min-height: 34px; border-radius: 7px; }
:root body .nd-compose-bottom small { color: var(--faint); font-size: 12.5px; }

/* ---------- New ticket form ---------- */
:root body .dialog:has(.nd-new-ticket) .dialog-content { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.nd-new-ticket { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.nd-new-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 20px; }
.nd-new-ticket.is-staff .nd-new-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; padding: 0; }
.nd-new-ticket.is-staff .nd-new-main { padding: 16px 20px; min-width: 0; }
.nd-new-side { background: var(--surface2); border-left: 1px solid var(--line2); padding: 16px 16px 6px; min-width: 0; }
body.light .nd-new-side { background: #f8f9fb; }
:root body .nd-new-main #f-title { height: 38px; font-size: 15px; font-weight: 550; }
:root body .nd-new-side :is(input, select) { background: var(--surface); }
.nd-new-side select { width: 100%; }
.nd-combo { position: relative; }
.nd-combo .nd-requester-find { width: 100%; }
.nd-combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 6; max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 4px; box-shadow: var(--shadow); }
.nd-combo-item { display: grid; width: 100%; gap: 0; text-align: left; background: none; border: 0; border-radius: 6px; padding: 5px 8px; color: var(--text); }
.nd-combo-item strong { font-size: 13px; font-weight: 550; }
.nd-combo-item small { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nd-combo-item.active, .nd-combo-item:hover { background: var(--accent-soft); }
.nd-combo-empty { padding: 8px; font-size: 13px; color: var(--faint); }
:root body .nd-segments { border: 0; padding: 0; margin: 0 0 13px; min-width: 0; }
.nd-segments legend { padding: 0; font-size: 12.5px; font-weight: 550; color: var(--muted); margin-bottom: 5px; }
.nd-segment-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.nd-segment { position: relative; cursor: pointer; margin: 0; }
.nd-segment input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.nd-segment span { display: block; text-align: center; font-size: 12.5px; font-weight: 500; padding: 7px 0; background: var(--surface); color: var(--muted); }
.nd-segment:hover span { color: var(--text); }
.nd-segment input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.nd-segment input:checked + span { background: var(--surface3); color: var(--text); font-weight: 650; }
.nd-seg-urgent input:checked + span { background: var(--red-soft); color: var(--red); }
.nd-seg-high input:checked + span { background: var(--orange-soft); color: var(--orange); }
.nd-similar { margin: -5px 0 13px; padding: 8px 10px; border-radius: 8px; background: var(--surface2); display: grid; gap: 2px; }
.nd-similar > small { font-size: 12px; color: var(--faint); margin-bottom: 2px; }
.nd-similar-item { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; text-align: left; background: none; border: 0; border-radius: 5px; padding: 2px 4px; color: var(--text); font-size: 13px; }
.nd-similar-item:hover { background: var(--surface3); }
.nd-similar-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nd-similar-item small { flex: 0 0 auto; color: var(--faint); font-size: 12px; }
.nd-drop { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--line); border-radius: 9px; padding: 9px 12px; color: var(--muted); font-size: 13.5px; font-weight: 500; cursor: pointer; position: relative; }
.nd-drop:hover, .nd-drop.is-over { border-color: var(--primary); background: var(--accent-soft); }
.nd-drop small { display: block; font-size: 12px; font-weight: 400; color: var(--faint); }
.nd-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.nd-drop:focus-within { border-color: var(--primary); }
.nd-new-file-list { display: grid; gap: 4px; margin-top: 8px; }
.nd-new-file-list .file-row { margin: 0; padding: 3px 4px 3px 10px; }
.nd-new-file-list .file-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.nd-new-file-list .file-row small { margin-left: 0; flex: 0 0 auto; }
.nd-new-file-list .file-row .file-remove { margin-left: 0; flex: 0 0 auto; }
.nd-new-main > .field:last-child { margin: 13px 0 0; }
:root body .nd-new-footer { flex: 0 0 auto; margin: 0; padding: 10px 16px; border-top: 1px solid var(--line2); align-items: center; background: var(--surface); position: static; }
.nd-new-note { margin-right: auto; font-size: 12.5px; color: var(--faint); min-width: 0; }
.nd-new-note kbd, .nd-key-row kbd { font: 11.5px var(--font); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-right: 3px; background: var(--surface2); color: var(--muted); }
.nd-link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
:root body .nd-new-another { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 0 6px 0 0; white-space: nowrap; }

/* ---------- Loading placeholders, selection bar, shortcuts ---------- */
.nd-skeleton { padding: 2px 0; }
.nd-skeleton i { display: block; border-radius: 6px; background: var(--surface2); animation: nd-sk 1.3s ease-in-out infinite; }
.sk-title { width: 240px; max-width: 70%; height: 24px; }
.sk-sub { width: 360px; max-width: 90%; height: 13px; margin: 9px 0 22px; }
.sk-panel { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); padding: 16px; display: grid; gap: 15px; }
.sk-panel i { height: 14px; }
.sk-panel i:nth-child(2n) { width: 82%; }
.sk-panel i:nth-child(3n) { width: 64%; }
.nd-ticket-skeleton { max-width: 1280px; margin: 0 auto; padding: 20px 24px; }
@keyframes nd-sk { 50% { opacity: .5; } }
#bulk-open { display: none; }
.nd-bulk-bar { position: fixed; left: calc(var(--sidebar) + (100vw - var(--sidebar)) / 2); bottom: 20px; transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 14px; background: var(--surface3); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); font-size: 13.5px; font-weight: 550; white-space: nowrap; }
.nd-keys { display: grid; gap: 9px; }
.nd-key-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; font-size: 13.5px; color: var(--muted); }
.nd-key-row > span:last-child { color: var(--text); }

/* ---------- Smaller windows: the side column moves above the conversation ---------- */
@media (max-width: 1000px) {
  .nd-ticket-body { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .nd-ticket-side { position: static; order: -1; }
  .nd-props-summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); font-size: 13.5px; font-weight: 550; color: var(--muted); }
  .nd-props-summary::-webkit-details-marker { display: none; }
  .nd-props[open] .nd-props-summary { margin-bottom: 12px; }
  .nd-props[open] .nd-props-summary .i { transform: rotate(180deg); }
  .nd-new-ticket.is-staff .nd-new-body { grid-template-columns: minmax(0, 1fr); }
  .nd-new-side { border-left: 0; border-top: 1px solid var(--line2); }
}
@media (prefers-reduced-motion: reduce) {
  .nd-skeleton i { animation: none; }
  :root body .dialog, :root body .overlay.is-ticket-page .dialog { animation: none; }
}
@media (max-width: 670px) {
  :root body .overlay { padding: 0; align-items: flex-end; }
  :root body .dialog { width: 100%; max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px)); border: 0; border-radius: 16px 16px 0 0; animation: nd-sheet-in .18s cubic-bezier(.2, .8, .3, 1); }
  :root body .dialog.nd-dialog-wide { width: 100%; }
  @keyframes nd-sheet-in { from { transform: translateY(24px); } to { transform: none; } }
  :root body .overlay.is-ticket-page { left: 0; z-index: 40; }
  :root body .overlay.is-ticket-page .dialog { height: 100dvh; }
  :root body .is-ticket-page .dialog-top { height: calc(50px + env(safe-area-inset-top, 0px)); min-height: calc(50px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 6px 0 4px; }
  :root body .is-ticket-page #nd-ticket-back, .nd-ticket-tools .icon-btn { width: 40px; height: 40px; min-width: 40px; }
  .is-ticket-page #nd-ticket-back .i { width: 22px; height: 22px; }
  :root body .is-ticket-page .dialog-content, :root body .is-ticket-page .dialog-content.nd-ticket-organized { padding-bottom: 0; }
  :root body .nd-ticket-hero { padding: 14px 14px 10px; }
  :root body .nd-ticket-hero .detail-title { font-size: 19px; }
  .nd-ticket-body { padding: 0 14px 16px; }
  :root body .is-ticket-page .nd-ticket-tabs { position: sticky; top: 0; z-index: 3; background: var(--bg); margin: 0 -14px; padding: 0 6px; }
  :root body .is-ticket-page .nd-ticket-tab-panel { padding: 12px 0 8px; }
  :root body .is-ticket-page .nd-ticket-card { padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--line2); border-radius: var(--radius-lg); }
  :root body .nd-side-fields select { height: 40px; font-size: 16px; }
  .nd-side-fields .field.is-saved::after { right: 26px; }
  :root body .nd-side-fields .field label { font-size: 14px; }
  .nd-ticket-ghost { top: calc(50px + env(safe-area-inset-top, 0px)); }
  .nd-new-body, .nd-new-ticket.is-staff .nd-new-main { padding: 14px 16px; }
  :root body .nd-new-footer { padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; position: static; }
  .nd-new-note { display: none; }
  :root body .nd-new-another { margin-right: auto; }
  :root body .nd-new-footer .btn { flex: 0 1 auto; min-height: 42px; }
  :root body .nd-new-main #f-title { height: 44px; font-size: 16px; }
  .nd-segment span { padding: 10px 0; font-size: 13.5px; }
  .nd-drop small { display: none; }
  .nd-bulk-bar { left: 50%; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .nd-combo-item { padding: 9px 10px; }
}

/* ---------- Corrections after looking at the ticket page ---------- */
:root body .overlay.is-ticket-page .dialog:has(.nd-ticket-organized), :root body .overlay.is-ticket-page .dialog { width: 100%; height: 100%; max-height: none; }
:root body .nd-side-fields :is(.field select) { background: transparent; border-color: transparent; height: 30px; padding: 0 4px; font-weight: 500; font-size: 13px; }
:root body .nd-side-fields :is(.field select):hover, :root body .nd-side-fields :is(.field select):focus { background: var(--surface2); border-color: var(--line); box-shadow: none; }
.nd-side-fields select option { font-weight: 400; }
.nd-ticket-side { max-height: calc(100vh - 84px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
:root body .nd-ticket-work-stats { display: flex; gap: 18px; margin: 0 0 12px; padding: 0; background: none; border: 0; }
:root body .nd-ticket-work-stats > div { display: flex; align-items: baseline; gap: 6px; background: none; border: 0; padding: 0; min-height: 0; }
:root body .nd-ticket-work-stats strong { font-size: 14px; font-weight: 600; margin: 0; }
:root body .nd-ticket-work-stats small, :root body .nd-ticket-work-stats span { font-size: 12.5px; color: var(--faint); }
:root body .nd-thread-actions { margin-top: 6px; gap: 4px; }
:root body .nd-thread-actions .btn { border-color: transparent; background: none; color: var(--faint); min-height: 24px; padding: 1px 6px; font-weight: 500; }
:root body .nd-thread-actions .btn:hover { background: var(--surface2); color: var(--text); }
@media (max-width: 1000px) { .nd-ticket-side { max-height: none; overflow: visible; } }
@media (max-width: 670px) {
  :root body .nd-side-fields :is(.field select) { height: 40px; font-size: 16px; }
  :root body .overlay.is-ticket-page .dialog:has(.nd-ticket-organized), :root body .overlay.is-ticket-page .dialog { height: 100dvh; }
}
:root body .overlay.is-ticket-page .dialog, :root body .overlay.is-ticket-page .dialog:has(.nd-ticket-organized) { max-width: none; }
:root body .nd-ticket-work-stats > span { display: flex; align-items: baseline; gap: 6px; background: none; border: 0; padding: 0; min-height: 0; }
:root body .is-ticket-page #dialog.dialog { width: 100%; max-width: none; }
:root body .nd-ticket-customer #nd-customer-edit-toggle { position: static; font-size: 13px; min-height: 32px; height: auto; }
:root body .overlay.is-ticket-page .dialog { animation: none; }
.nd-ticket-card .ops-subpanel { padding: 0 !important; border: 0; background: none; }
:root body .nd-inline-work { margin: 10px 17px 0; }
:root body .file-row small { color: var(--muted); }

/* ================================================================
   Ticket list: counts, the row you are on, who a ticket is for
   ================================================================ */
.nd-view-count { font-weight: 500; font-size: 12px; color: var(--faint); margin-left: 3px; font-variant-numeric: tabular-nums; }
.nd-view-chip.active .nd-view-count { color: inherit; opacity: .75; }
.nd-view-count.is-bad { color: var(--red); }
.ticket-who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-who::before { content: "·"; margin-right: 8px; color: var(--faint); }
:root body .ticket-table tr.is-cursor td { background: var(--accent-soft); }
:root body .ticket-table tr.is-cursor td:first-child { box-shadow: inset 2px 0 0 var(--primary); }
.activity-entry.is-link { cursor: pointer; border-radius: 8px; }
.activity-entry.is-link:hover { background: var(--surface2); }
.nd-ticket-fresh { position: sticky; top: 8px; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 auto 12px; max-width: 520px; padding: 7px 8px 7px 14px; background: var(--surface3); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); font-size: 13.5px; font-weight: 550; }

/* ================================================================
   Customer home and ticket progress
   ================================================================ */
.nd-requests { margin-bottom: 14px; }
.nd-request { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 13px 16px; border-top: 1px solid var(--line2); cursor: pointer; }
.nd-request:hover { background: var(--surface2); }
.nd-request:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.nd-request-main { min-width: 0; }
.nd-request h3 { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.nd-request small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--faint); }
.nd-request-last { margin: 7px 0 0; font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.nd-request-last b { color: var(--text); font-weight: 600; }
.nd-request-side { flex: 0 0 auto; }
.nd-track { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px; }
.nd-track-steps { display: flex; margin: 0 0 12px; padding: 0; list-style: none; }
.nd-track-steps li { flex: 1 1 0; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; font-size: 12.5px; color: var(--faint); }
.nd-track-steps li::before { content: ""; position: absolute; top: 5px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.nd-track-steps li:first-child::before { content: none; }
.nd-track-steps li.is-done::before, .nd-track-steps li.is-now::before { background: var(--primary); }
.nd-track-steps i { position: relative; z-index: 1; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); box-sizing: border-box; }
.nd-track-steps li.is-done i { background: var(--primary); border-color: var(--primary); }
.nd-track-steps li.is-now i { border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }
.nd-track-steps li.is-done, .nd-track-steps li.is-now { color: var(--text); }
.nd-track-steps li.is-now { font-weight: 600; }
.nd-track-foot p { margin: 0; font-size: 13.5px; color: var(--muted); }
.nd-replied { margin-left: 8px; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--text); font-size: 12px; font-weight: 550; white-space: nowrap; }
:root body .kb-card.nd-help-card { cursor: pointer; }
.nd-help-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nd-help-strip { margin-bottom: 14px; padding: 14px 16px; }
.nd-help-strip label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 600; color: var(--text); }
.nd-help-strip-row { display: flex; gap: 8px; }
.nd-help-strip-row input { flex: 1 1 auto; min-width: 0; }
.nd-help-back { margin-bottom: 12px; }
.nd-help-article { padding: 20px 22px; }
.nd-help-article h2 { margin: 8px 0 2px; font-size: 21px; color: var(--text); overflow-wrap: anywhere; }
.nd-help-article > small { display: block; color: var(--faint); font-size: 12.5px; }
.nd-help-text { margin: 16px 0 0; max-width: 72ch; color: var(--text); font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.nd-help-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding: 14px 16px; }
.nd-help-foot p { margin: 0; font-size: 14px; color: var(--muted); }
.nd-help-foot .btn { flex: 0 0 auto; }
.nd-help-suggest { margin: 0 0 12px; padding: 10px 12px; background: var(--surface2); border: 1px solid var(--line2); border-radius: var(--radius-lg); }
.nd-help-suggest > small { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.nd-help-suggest summary { padding: 5px 0; color: var(--text); font-size: 13.5px; cursor: pointer; overflow-wrap: anywhere; }
.nd-help-suggest-body { max-height: 240px; margin: 2px 0 8px; overflow: auto; color: var(--muted); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.nd-kb-toggles { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.nd-kb-warning { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 670px) {
  .nd-request { padding: 13px 14px; gap: 10px; }
  .nd-track { padding: 13px 14px; }
  .nd-help-article { padding: 16px 14px; }
  .nd-help-foot { flex-direction: column; align-items: stretch; }
  :root body .nd-help-foot .btn, :root body .nd-help-strip-row .btn { min-height: 44px; }
  .nd-help-suggest summary { padding: 9px 0; }
  .ticket-who { max-width: 45vw; }
}

/* ---------- Residential customers, businesses and contracts ---------- */
.nd-cust { display: inline-block; max-width: 240px; margin-left: 8px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; }
.nd-contract-state { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 6px; background: var(--surface3); color: var(--muted); font-size: 12px; font-weight: 550; white-space: nowrap; }
.nd-contract-state.is-active { background: var(--green-soft); color: var(--green); }
.nd-contract-state.is-ending_soon { background: var(--warn-soft); color: var(--warn); }
.nd-contract-state.is-upcoming { background: var(--blue-soft); color: var(--blue); }
.nd-contract-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.nd-contract-card { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border: 1px solid var(--line2); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.nd-contract-card:hover { background: var(--surface2); border-color: var(--line); }
.nd-contract-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nd-contract-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.nd-contract-card small { color: var(--muted); font-size: 12px; }
.nd-person { display: grid; gap: 4px; justify-items: start; margin-bottom: 12px; }
.nd-person p { margin: 0; }
.nd-record-notes { margin: 8px 0 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface2); font-size: 13px; white-space: pre-wrap; }
.nd-older-records { margin-top: 14px; color: var(--muted); font-size: 13px; }
.nd-older-records summary { cursor: pointer; }
.nd-older-records ul { margin: 6px 0 0; padding-left: 18px; }
.nd-kind-switch { margin-right: auto; }
.nd-new-customer, .nd-new-res { display: grid; gap: 10px; }
.nd-new-res { padding: 10px 12px; border-radius: var(--radius); background: var(--surface2); }
:root body .nd-customer-type.contract { background: var(--green-soft); color: var(--green); }
.ops-line small + small { display: block; }
@media (max-width: 650px) {
  .nd-cust { max-width: 45vw; margin-left: 0; display: block; }
  .nd-contract-list { grid-template-columns: 1fr; }
  :root body .nd-contract-card { min-height: 44px; }
  .nd-kind-switch { flex-basis: 100%; }
}
