/* T-Group CRM — mobile-first working UI, light theme only. No external requests.
 * Breakpoints: < 640 phone · 640–1023 tablet · ≥ 1024 desktop.
 * Palette and type follow the product site jenbacher420.tgroup-energysolution.site
 * (site/css/industry.css + site.css): ink #1d1f20 on #f2f2f3, brand navy #02124d,
 * steel-blue accent ramp (#416180 links), neutral ramp, Fira Sans / Fira Sans Condensed
 * (the faces that actually render Ukrainian text there; Barlow has no Cyrillic). */

/* Fira Sans & Fira Sans Condensed — SIL OFL 1.1 (fonts/OFL-firasans.txt); the same
 * files the product site self-hosts (Cyrillic + Latin subsets only). */
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/fira-sans-400-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/fira-sans-400-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-500-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-500-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Sans Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-condensed-600-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/fira-sans-condensed-600-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;   /* light only: native controls stay light even when the device is in dark mode */
  --bg: #f2f2f3;          /* site --color-bg */
  --surface: #ffffff;
  --surface-2: #f5f5f8;   /* neutral-100 */
  --surface-3: #e7e7ea;   /* neutral-200 */
  --text: #1d1f20;        /* site --color-text */
  --muted: #5d5d60;       /* neutral-700, 6.4:1 on white */
  --border: #d4d4d7;      /* neutral-300 */
  --border-soft: #e7e7ea;
  --primary: #02124d;     /* site --brand (logo navy) */
  --primary-hover: #031d67;
  --primary-press: #020b2a;
  --primary-text: #ffffff;
  --accent: #416180;      /* accent-700: links, active navigation */
  --accent-strong: #2c455d;
  --accent-soft: #eef6ff; /* accent-100 */
  --danger: #b42318;
  --danger-bg: #fdecea;
  --focus: #597ea3;       /* accent-600 */
  --st-new: #2c455d;      --st-new-bg: #d6ebff;      /* accent-800 on accent-200 */
  --st-progress: #7a4a00; --st-progress-bg: #fcefc9;
  --st-proposal: #4b3a8f; --st-proposal-bg: #ece8fb;
  --st-won: #237a43;      --st-won-bg: #e6f3e9;      /* site .hbadge-ok */
  --st-lost: #424244;     --st-lost-bg: #e7e7ea;     /* neutral-800 on neutral-200 */
  --flag: #b42318;        --flag-bg: #fdecea;
  --repeat: #0d5f63;      --repeat-bg: #ddf1f1;
  --font-body: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Fira Sans Condensed", "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 1px 2px rgba(43, 43, 45, .08);
  --shadow-lg: 0 12px 32px rgba(43, 43, 45, .20);
  --tap: 40px;
  --topbar-h: 56px;
  --pad-l: max(12px, env(safe-area-inset-left));
  --pad-r: max(12px, env(safe-area-inset-right));
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d5d60' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  font-size: 16px;
}
@media (pointer: coarse) { :root { --tap: 44px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; font-synthesis: none; /* no faux bold: only the real 400/500/600 faces */ }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); min-height: 100vh; min-height: 100dvh;
  font-family: var(--font-body); font-weight: 400;
  line-height: 1.45; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
strong, b { font-weight: 500; }
::selection { background: rgba(89, 128, 166, .28); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; letter-spacing: .005em; }
h2 { font-size: 1.0625rem; letter-spacing: .01em; }
/* Condensed face (site --font-heading) for headings, controls and numbers. */
.btn, .chip, .tab, .seg-btn, legend, .brand-name, .c-name, .hero-name, .c-id, .hero-id strong, .ev-title, .panel-title, .menu-item, .link-btn, .back-link {
  font-family: var(--font-head); font-weight: 600;
}
p { margin: 0 0 .5rem; }
/* Keeps short names ("Jenbacher JGS 420 GS-N.L") from breaking at the hyphen; ellipsis as a last resort. */
.nobr { display: inline-block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.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; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.container {
  max-width: 1280px; margin: 0 auto;
  padding: 12px var(--pad-r) calc(32px + env(safe-area-inset-bottom)) var(--pad-l);
}
/* Long unbroken values (e-mails, company names, URLs from web forms) must never overflow. */
#app { overflow-wrap: break-word; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 var(--pad-r) 0 var(--pad-l);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-height: 40px; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-mark { display: block; width: 28px; height: 28px; border-radius: 4px; }
.brand-name { font-size: 1.125rem; letter-spacing: .07em; text-transform: uppercase; line-height: 1; }
.brand-crm { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 6px; }
.nav-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 10px; border-bottom: 2px solid transparent; color: var(--text); text-decoration: none; font-weight: 500; }
.nav-link:hover { color: var(--accent); }
.nav-link.active { color: var(--accent); border-bottom-color: var(--primary); }
.btn-new { padding: 0 12px 0 10px; }
.btn-icon { width: var(--tap); padding: 0; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 30; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu-user { margin: 0; padding: 8px 10px; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.menu-user strong { color: var(--text); }
.menu-role { display: block; margin-top: 2px; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.menu-item.menu-link { color: var(--text); text-decoration: none; }
.menu-item {
  display: flex; align-items: center; width: 100%; min-height: var(--tap); padding: 0 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--danger); font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-size: 1rem; letter-spacing: .02em; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
  touch-action: manipulation;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn:active { background: var(--surface-3); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.btn-primary:active { background: var(--primary-press); border-color: var(--primary-press); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 10px; font-size: .9375rem; }
@media (pointer: coarse) { .btn-sm { min-height: 40px; } }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-won { color: var(--st-won); border-color: #b8dec2; background: var(--st-won-bg); }
.btn-lost { color: var(--st-lost); border-color: var(--border); background: var(--st-lost-bg); }
.link-btn {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 4px; border: 0; background: none;
  color: var(--accent); font-size: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: .9375rem; caret-color: var(--accent);
}
/* iOS Safari zooms into inputs with a font smaller than 16px. */
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } }
input[type=search] { -webkit-appearance: none; appearance: none; }
/* Safari renders native selects ~20px high and ignores padding/min-height: draw our own. */
select { -webkit-appearance: none; appearance: none; padding-right: 36px; background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px; text-overflow: ellipsis; }
textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(89, 126, 163, .25); }
label { display: block; font-size: .8125rem; font-weight: 500; margin-bottom: 4px; color: var(--muted); }
.field { margin-bottom: 12px; min-width: 0; }
.field .err { color: var(--danger); font-size: .82rem; font-weight: 500; margin-top: 3px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.form-grid, .form-grid-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (min-width: 640px) { .form-grid, .form-grid-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.form-error { color: var(--danger); background: var(--danger-bg); border-left: 3px solid var(--danger); padding: 8px 12px; border-radius: var(--radius-sm); margin: 8px 0; font-size: .9375rem; }
.form-error:empty { display: none; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
legend { font-size: 1.0625rem; letter-spacing: .03em; text-transform: uppercase; margin-bottom: 10px; padding: 0; }
.hint { margin: -4px 0 0; }

/* ---------- cards & badges ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 3px;
  font-size: .75rem; font-weight: 500; letter-spacing: .02em; line-height: 1.5; white-space: nowrap;
}
.badge .ic { width: 12px; height: 12px; stroke-width: 2.5; }
.st-new { color: var(--st-new); background: var(--st-new-bg); }
.st-in_progress { color: var(--st-progress); background: var(--st-progress-bg); }
.st-proposal { color: var(--st-proposal); background: var(--st-proposal-bg); }
.st-closed-won { color: var(--st-won); background: var(--st-won-bg); }
.st-closed-lost, .st-closed { color: var(--st-lost); background: var(--st-lost-bg); }
.flag-dup { color: var(--flag); background: var(--flag-bg); }
.flag-repeat { color: var(--repeat); background: var(--repeat-bg); }

/* ---------- chips (status filter, history filter) ---------- */
.chips {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch; margin: 0; padding: 1px 0;
}
.chips::-webkit-scrollbar { display: none; }
.chips::after { content: ""; flex: 0 0 4px; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-size: .9375rem; letter-spacing: .02em; cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
@media (pointer: coarse) { .chip { min-height: 40px; } }
.chip:hover { border-color: var(--muted); }
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.chip[aria-pressed="true"] .count { color: inherit; opacity: .8; }
.chips-sm .chip { min-height: 32px; font-size: .875rem; padding: 0 10px; }
@media (pointer: coarse) { .chips-sm .chip { min-height: 36px; } }

/* ---------- list page ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 10px; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 8px; }
.head-count { font-family: var(--font-body); font-size: .8125rem; font-weight: 500; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 3px; padding: 1px 8px; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.head-count:empty { display: none; }
.list-controls { display: grid; gap: 8px; margin-bottom: 12px; }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.search { position: relative; margin: 0; min-width: 0; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }
.btn-filter { padding: 0 12px; }
.btn-filter.has-active { border-color: var(--accent); color: var(--accent); }
.filter-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 3px; background: var(--accent); color: var(--surface); font-size: .75rem; }
.filters { grid-column: 1 / -1; display: none; gap: 8px; grid-template-columns: minmax(0, 1fr); padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filters.open { display: grid; }
@media (min-width: 480px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.results { min-height: 120px; }
.loading { padding: 16px 0; }

.lead-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lead-list > li { display: flex; min-width: 0; }
.lead-list > li > .lead-row { flex: 1 1 auto; min-width: 0; align-content: start; }
.lead-cols { display: none; }
.lead-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main status" "sub sub" "meta meta";
  gap: 2px 10px; padding: 11px 14px 10px; color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.lead-row:hover { border-color: var(--muted); }
.lead-row:active { background: var(--surface-2); }
.c-main { grid-area: main; min-width: 0; }
.c-name { display: block; font-size: 1.0625rem; letter-spacing: .01em; line-height: 1.25; overflow-wrap: anywhere; }
.c-company, .c-product { display: none; }
.c-status { grid-area: status; align-self: start; padding-top: 1px; }
.c-sub { grid-area: sub; min-width: 0; color: var(--muted); font-size: .875rem; line-height: 1.35; overflow-wrap: anywhere; }
.c-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: .8125rem; color: var(--muted); }
.c-id { color: var(--text); font-variant-numeric: tabular-nums; }
.c-date { font-variant-numeric: tabular-nums; }
.c-flags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.c-flags:empty { display: none; }
@media (min-width: 640px) and (max-width: 1023.98px) {
  .lead-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Desktop: the same rows become a compact table. */
@media (min-width: 1024px) {
  .lead-cols, .lead-row {
    display: grid; grid-template-columns: 56px 124px minmax(0, 1.7fr) minmax(0, 1.1fr) 170px 164px;
    grid-template-areas: none; gap: 0 16px; align-items: center; padding: 9px 16px;
  }
  .lead-cols {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 500; color: var(--muted);
    background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; padding-block: 8px;
  }
  .lead-list { gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); }
  .lead-row { border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0; box-shadow: none; min-height: 52px; }
  .lead-list > li:last-child .lead-row { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
  .lead-row:hover { background: var(--surface-2); }
  .c-meta { display: contents; }
  .lead-cols > *, .lead-row > *, .c-meta > * { grid-row: 1; min-width: 0; }
  .c-id { grid-column: 1; }
  .c-date { grid-column: 2; font-size: .8125rem; color: var(--muted); }
  .c-main { grid-column: 3; }
  .c-name { font-size: 1rem; }
  .c-company { display: block; font-size: .8125rem; color: var(--muted); overflow-wrap: anywhere; line-height: 1.3; }
  .c-product { display: block; grid-column: 4; font-size: .875rem; overflow-wrap: anywhere; }
  .c-flags { grid-column: 5; display: inline-flex; }
  .c-status { grid-column: 6; padding: 0; align-self: center; }
  .c-sub { display: none; }
  .lead-cols > * { display: block; font: inherit; color: inherit; letter-spacing: inherit; }
}
.empty { padding: 32px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty p { margin-bottom: 12px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 16px 0 0; }
@media (min-width: 1024px) {
  .toolbar { grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(140px, 1fr)) auto; }
  .btn-filter { display: none; }
  .filters, .filters.open { display: contents; }
}

/* ---------- lead page ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 2px; min-height: 36px; margin: -4px 0 6px -6px; padding: 0 8px 0 2px;
  color: var(--accent); text-decoration: none; font-weight: 500; border-radius: var(--radius-sm);
}
.lead-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.lead-main, .lead-side { display: contents; }
.hero { order: 1; } .quick-comment { order: 2; } .contact-panel { order: 3; } .tabs-card { order: 4; }
@media (min-width: 1024px) {
  .lead-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
  .lead-main { display: grid; gap: 12px; min-width: 0; }
  .lead-side { display: block; position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px); min-width: 0; }
}

.hero { padding: 12px 14px 14px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8125rem; color: var(--muted); }
.hero-id strong { color: var(--text); font-weight: 500; }
.hero-name { font-size: 1.625rem; margin: 6px 0 2px; overflow-wrap: anywhere; }
.hero-sub { color: var(--muted); margin: 0 0 12px; font-size: .9375rem; overflow-wrap: anywhere; }
.hero-company { color: var(--text); font-weight: 500; }
.hero { border-top: 3px solid var(--primary); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.btn-contact {
  flex: 1 1 auto; min-width: 0; min-height: 44px; justify-content: flex-start; padding: 6px 14px; gap: 10px;
  background: var(--surface-2); color: var(--accent); white-space: normal; text-align: left;
  font-family: var(--font-body); font-weight: 400; font-size: 1rem; letter-spacing: 0;
}
.btn-contact .btn-text { min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.seg-btn {
  flex: 1 1 auto; min-height: 38px; padding: 0 6px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text);
  font-size: .9375rem; letter-spacing: .02em; cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
.seg-btn:hover { background: var(--surface-3); }
.seg-btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); box-shadow: var(--shadow); }
.seg-btn[disabled] { opacity: .6; cursor: default; }
@media (max-width: 359.98px) { .seg { display: grid; grid-template-columns: 1fr 1fr; } }
.close-choice { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; padding: 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.close-label { width: 100%; font-size: .8125rem; font-weight: 500; color: var(--muted); }
.closed-at { margin: 6px 0 0; }
.notes { display: grid; gap: 6px; margin-top: 12px; }
.note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; padding: 6px 10px; font-size: .8125rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-wrap: anywhere;
}
.note-dup { flex-wrap: nowrap; color: var(--flag); background: var(--flag-bg); border-color: transparent; padding-block: 2px; }
.note-text { flex: 1 1 auto; min-width: 0; }
.note-dup .link-btn { color: inherit; }
.note .link-btn { flex: 0 0 auto; white-space: nowrap; }
.note .ic { width: 16px; height: 16px; }
.related { gap: 6px; }
.rel-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; max-width: 100%;
}
.rel-prod { font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 479.98px) { .rel-prod { display: none; } }

.quick-comment { padding: 10px; }
.qc-row { display: flex; gap: 8px; align-items: flex-end; }
.qc-row .field { flex: 1 1 auto; margin: 0; }
.qc-row textarea { min-height: 44px; max-height: 40vh; resize: none; padding: 10px 12px; }
.qc-row .btn { flex: 0 0 auto; min-height: 44px; }
.qc-last { margin-top: 8px; padding: 8px 4px 0; border-top: 1px dashed var(--border); }
.qc-last-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .75rem; color: var(--muted); }
.qc-last-meta .link-btn { min-height: 32px; font-size: .8125rem; }
.qc-last-text {
  margin: 0; font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 359.98px) { .quick-comment .btn-label { display: none; } }

.contact-panel { padding: 0; }
.panel-h { margin: 0; font-size: inherit; }
.panel-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 52px; padding: 8px 14px;
  border: 0; border-radius: var(--radius); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.panel-title { display: flex; flex-direction: column; font-size: 1.0625rem; letter-spacing: .01em; min-width: 0; }
.panel-hint { font-family: var(--font-body); font-weight: 400; font-size: .8125rem; letter-spacing: 0; color: var(--muted); overflow-wrap: anywhere; }
.contact-panel.open .panel-hint { display: none; }
.panel-toggle .ic { color: var(--muted); transition: transform .15s; }
.contact-panel.open .panel-toggle .ic { transform: rotate(180deg); }
.panel-body { display: none; padding: 0 14px 14px; }
.contact-panel.open .panel-body { display: block; }
.panel-body > .btn { margin-top: 10px; }
.dup-box { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--flag-bg); color: var(--flag); font-size: .875rem; }
.dup-box p { margin: 0 0 4px; }
.dup-box ul { margin: 0; padding-left: 18px; }
.dup-box li { overflow-wrap: anywhere; margin: 2px 0; }
.dup-name { color: var(--text); font-weight: 500; }
.dup-box .muted { color: inherit; opacity: .85; }

/* key/value lists */
dl.kv { margin: 0; }
.kv-row { display: grid; grid-template-columns: minmax(92px, 38%) minmax(0, 1fr); gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.kv-row:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: .8125rem; padding-top: 1px; }
.kv dd { margin: 0; overflow-wrap: anywhere; font-size: .9375rem; }
.kv-row.diff dd { color: var(--st-progress); }
.diff-note { font-size: .75rem; font-weight: 500; white-space: nowrap; }
@media (max-width: 359.98px) { .kv-row { grid-template-columns: minmax(0, 1fr); gap: 0; } }
@media (min-width: 768px) { .kv-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; } .kv-details .kv-row:nth-last-child(2):nth-child(odd) { border-bottom: 0; } }

/* tabs */
.tabs-card { padding: 0; }
.tabs { display: flex; gap: 2px; padding: 0 6px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; scroll-margin-top: calc(var(--topbar-h) + env(safe-area-inset-top) + 8px); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 10px;
  margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted);
  font-size: 1rem; letter-spacing: .02em; cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.tab .count { min-width: 20px; padding: 0 6px; border-radius: 3px; background: var(--surface-3); color: var(--muted); font-family: var(--font-body); font-size: .75rem; font-weight: 500; line-height: 1.6; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .count { background: var(--st-new-bg); color: var(--st-new); }
.tab-panel { padding: 12px; }
.tab-panel:focus-visible { outline-offset: -2px; }
.panel-note { font-size: .8125rem; color: var(--muted); margin: 0 0 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.panel-head h2 { margin: 0; font-size: 1rem; }

/* submissions */
.sub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sub-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.sub-item.is-repeat { border-left: 3px solid var(--repeat); }
.sub-sum { display: grid; gap: 4px; min-height: 44px; padding: 9px 12px; list-style: none; cursor: pointer; touch-action: manipulation; }
.sub-sum::-webkit-details-marker { display: none; }
.sub-sum::marker { content: ""; }
.sub-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: .8125rem; color: var(--muted); }
.sub-n { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.sub-date { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.sub-line .ic-chevron { margin-left: auto; color: var(--muted); transition: transform .15s; }
.sub-item[open] .sub-line .ic-chevron { transform: rotate(180deg); }
.sub-excerpt { font-size: .9375rem; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sub-item[open] .sub-excerpt { display: none; }
.sub-body { padding: 0 12px 12px; }
.message { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 8px; }

/* history */
.timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.ev { position: relative; padding: 0 0 12px 18px; margin-left: 5px; border-left: 2px solid var(--border); overflow-wrap: anywhere; }
.ev:last-child { padding-bottom: 2px; }
.ev::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.ev-comment::before { border-color: var(--accent); background: var(--accent); }
.ev-status::before { border-color: var(--st-proposal); }
.ev-submission::before { border-color: var(--repeat); }
.ev-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 10px; }
.ev-title { font-size: 1rem; letter-spacing: .01em; }
.ev-meta { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-text { font-size: .875rem; color: var(--muted); }
.ev-more { font-size: .875rem; }
.ev-more summary { display: inline-flex; align-items: center; min-height: 28px; color: var(--accent); cursor: pointer; font-weight: 500; }
.ev-more ul { margin: 2px 0 0; padding-left: 18px; }
.ev-more p { margin: 2px 0 0; color: var(--muted); }
.comment-text { white-space: pre-wrap; margin-top: 4px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .9375rem; }
.timeline[data-filter="comment"] .ev:not([data-cat="comment"]),
.timeline[data-filter="status"] .ev:not([data-cat="status"]) { display: none; }

/* new lead & login */
.narrow { max-width: 760px; margin: 0 auto; }
.new-form { padding: 16px; }
.login-wrap { min-height: 80vh; min-height: 80dvh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.login-brand img { border-radius: 4px; }
.login-card { border-top: 3px solid var(--primary); }
.login-sub { margin: 2px 0 0; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.login-brand h1 { margin: 0; }
.login-brand p { margin: 0; }

/* users (admin) */
.user-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.user-row { padding: 12px 14px; }
.user-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.user-name { font-family: var(--font-head); font-weight: 600; font-size: 1.125rem; overflow-wrap: anywhere; }
.user-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; font-size: .8125rem; color: var(--muted); }
.users-note { margin-top: 12px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: var(--radius-sm); background: #010c36; color: #fff; /* site footer navy */
  border: 1px solid #010c36; border-left: 3px solid #94bce3; box-shadow: var(--shadow-lg);
  pointer-events: none; /* never blocks taps on buttons underneath (e.g. form actions) */
}

@media (max-width: 599.98px) { .hide-sm { display: none; } }
@media (max-width: 479.98px) { .nav-link { display: none; } }
@media (max-width: 359.98px) {
  .brand-crm { display: none; }
}
@media (min-width: 1024px) {
  :root { font-size: 15px; }
  .container { padding-top: 16px; padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
  .topbar-inner { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
  .hero { padding: 16px 20px 18px; }
  .hero-name { font-size: 1.6rem; }
  .tab-panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
