/* ==========================================================================
   Command Deck UI — Direction A ("Paper"), chosen 7 Oct 2026.
   Loaded last; overrides deck.css + crm.css through the same class
   contracts. Principles: two weights (400 text, 500 titles/actions — no
   bold), hairlines instead of shadows and filled headers, one accent
   (petrol) used sparingly, quiet greys, generous spacing.
   ========================================================================== */
:root {
  --ui-bg: #F7F8F8;
  --ui-surface: #FFFFFF;
  --ui-ink: #16191D;
  --ui-ink-2: #4B535B;
  --ui-muted: #66707A;
  --ui-faint: #8A939B;
  --ui-line: #E8EBED;
  --ui-line-2: #EEF0F2;
  --ui-input: #E1E5E8;
  --ui-accent: #0E6F61;
  --ui-accent-hover: #0A5248;
  --ui-accent-soft: #EEF5F3;
  --ui-accent-line: #CFE5DF;
  --ui-danger: #B4432F;
  --ui-danger-soft: #FBEDEA;
  --ui-warn: #A06A00;
  --ui-warn-soft: #FFF6E5;
  --ui-ok: #2E7D4F;
  --ui-ok-soft: #EAF5EE;
  --ui-radius: 10px;

  /* re-point the old tokens so legacy rules follow the new palette */
  --navy-900: #16191D; --navy-800: #16191D; --navy-700: #4B535B; --navy-100: #F0F2F3;
  --teal-600: #0E6F61; --teal-500: #0E6F61; --teal-100: #EEF5F3; --petrol-700: #0A5248;
  --ink: #16191D; --muted: #66707A; --line: #E8EBED; --bg: #F7F8F8; --card: #FFFFFF;
  --red: #B4432F; --amber: #A06A00; --green: #2E7D4F;
  --radius: 10px; --shadow-1: none; --shadow-2: 0 8px 24px rgba(22,25,29,.08);
}

/* --- Base type ---------------------------------------------------------- */
body.ui, body {
  font: 400 14px/1.55 "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ui-ink); background: var(--ui-bg);
  -webkit-font-smoothing: antialiased;
}
b, strong, th, dt, label, legend, summary { font-weight: 500; }
h1 { font-size: 24px; font-weight: 500; letter-spacing: -.015em; color: var(--ui-ink); margin: 0 0 4px; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 500; color: var(--ui-ink); margin: 24px 0 8px; letter-spacing: 0; }
h3 { font-size: 14px; font-weight: 500; color: var(--ui-ink); margin: 16px 0 6px; }
a { color: var(--ui-accent); }
a:hover { color: var(--ui-accent-hover); text-decoration: none; }
.muted, .sub { color: var(--ui-muted); }
.small { font-size: 13px; }
code, kbd, .mono, .num { font-variant-numeric: tabular-nums; }
::selection { background: var(--ui-accent-soft); }

/* --- Shell --------------------------------------------------------------- */
.shell { background: var(--ui-bg); }
.sidebar {
  width: 224px; flex: none; background: var(--ui-surface); color: var(--ui-ink-2);
  border-right: 1px solid var(--ui-line); box-shadow: none;
  display: flex; flex-direction: column; padding: 18px 12px 14px; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.ui-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: var(--ui-ink); }
.ui-brand img { height: 22px; width: auto; display: block; }
.ui-brand span { font-size: 13px; color: var(--ui-muted); }
.ui-brand:hover { color: var(--ui-ink); }
.ui-nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; min-height: 0; flex: 1 1 auto; padding: 0; scrollbar-width: thin; }
.sidebar .ui-nav-link, .sidebar nav .ui-nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--ui-ink-2); font-weight: 400; font-size: 14px; position: static;
}
.sidebar .ui-nav-link:hover { background: #F3F5F6; color: var(--ui-ink); }
.sidebar .ui-nav-link.is-active { background: var(--ui-accent-soft); color: var(--ui-accent); font-weight: 500; }
.sidebar .ui-nav-link.is-active::before { display: none; }
.sidebar .nav-ico { width: 17px; height: 17px; opacity: 1; flex: none; }
.ui-subnav { display: flex; flex-direction: column; margin: 2px 0 8px 37px; }
.ui-subnav a { display: flex; justify-content: space-between; gap: 8px; padding: 5px 10px 5px 0; font-size: 13px; color: var(--ui-muted); border-radius: 6px; }
.ui-subnav a:hover { color: var(--ui-ink); }
.ui-subnav a.is-current { color: var(--ui-ink); font-weight: 500; }
.ui-count { color: var(--ui-faint); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.ui-nav-link .v2-classic-badge { margin-left: auto; }
.ui-nav-link .v2-classic-badge[hidden] { display: none; }
.ui-nav-foot { border-top: 1px solid var(--ui-line); padding-top: 8px; margin-top: 8px; display: flex; flex-direction: column; gap: 1px; }
.sidebar .ui-nav-quiet { font-size: 13px; color: var(--ui-muted); padding: 6px 10px; }
.ui-me { display: flex; align-items: center; gap: 10px; padding: 10px 10px 2px; flex-wrap: wrap; }
.ui-avatar { width: 26px; height: 26px; border-radius: 50%; background: #EEF0F2; color: var(--ui-ink-2); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.ui-me-name { font-size: 13px; color: var(--ui-ink); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-signout { font-size: 12px; color: var(--ui-faint); }
.sidebar-foot, .nav-group { display: none; }

.content-col { background: var(--ui-bg); }
.topbar {
  background: rgba(247,248,248,.9); backdrop-filter: blur(8px); border-bottom: 1px solid transparent;
  padding: 14px 40px; gap: 14px;
}
.topbar-search {
  background: var(--ui-surface); border: 1px solid var(--ui-input); border-radius: 8px; box-shadow: none;
  padding: 0 12px; height: 36px; max-width: 380px; color: var(--ui-faint);
}
.topbar-search input { font-size: 14px; color: var(--ui-ink); }
.topbar-search:focus-within { border-color: var(--ui-accent); box-shadow: 0 0 0 3px rgba(14,111,97,.12); }
.week-chip { background: transparent; color: var(--ui-muted); font-weight: 400; font-size: 13px; padding: 0; }
.main { padding: 12px 40px 64px; max-width: 1144px; }

/* Quick add menu */
.ui-quick { position: relative; }
.ui-quick > summary { list-style: none; cursor: pointer; }
.ui-quick > summary::-webkit-details-marker { display: none; }
.ui-quick-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; min-width: 210px;
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 10px; box-shadow: var(--shadow-2);
  padding: 6px; display: flex; flex-direction: column;
}
.ui-quick-menu a { padding: 9px 12px; border-radius: 7px; color: var(--ui-ink); font-size: 14px; }
.ui-quick-menu a:hover { background: #F3F5F6; }

/* --- Page head ----------------------------------------------------------- */
.page-head { align-items: flex-end; margin: 8px 0 22px; gap: 16px; }
.page-head h1 { margin: 0; }
.page-head .sub, h1 + .sub, h1 + p.sub { color: var(--ui-muted); font-size: 14px; margin-top: 4px; }
.actions-row { gap: 8px; align-items: center; }

/* --- Buttons ------------------------------------------------------------- */
.btn, a.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--ui-surface); color: var(--ui-ink); border: 1px solid var(--ui-input);
  border-radius: 8px; padding: 0 14px; min-height: 36px; font: 400 14px/1 "Geist", system-ui, sans-serif;
  cursor: pointer; box-shadow: none; text-decoration: none;
}
.btn:hover { background: #F3F5F6; color: var(--ui-ink); border-color: #D3D8DC; }
.btn-teal, a.btn-teal, .btn-teal:visited, button.btn-teal, summary.btn-teal {
  background: var(--ui-accent); color: #fff; border-color: var(--ui-accent); font-weight: 500;
}
.btn-teal:hover { background: var(--ui-accent-hover); border-color: var(--ui-accent-hover); color: #fff; }
.btn-ghost, a.btn-ghost { background: var(--ui-surface); color: var(--ui-ink); border: 1px solid var(--ui-input); }
.btn-ghost:hover { background: #F3F5F6; color: var(--ui-ink); }
.btn-danger { background: var(--ui-surface); color: var(--ui-danger); border-color: #EBC7BF; }
.btn-danger:hover { background: var(--ui-danger-soft); color: var(--ui-danger); }
.btn-sm { min-height: 30px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

/* --- Panels, cards and figures ------------------------------------------ */
.panel {
  background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius);
  box-shadow: none; padding: 18px 20px; margin-bottom: 20px;
}
.panel-title { font-size: 15px; font-weight: 500; color: var(--ui-ink); margin-bottom: 12px; text-transform: none; letter-spacing: 0; gap: 10px; }
.panel h3 { font-size: 13px; color: var(--ui-muted); font-weight: 500; }
.cards { gap: 0; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); overflow: hidden; margin: 4px 0 24px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.cards .stat, .stat {
  background: transparent; border: 0; border-left: 1px solid var(--ui-line-2); border-radius: 0; box-shadow: none;
  padding: 16px 20px; transform: none; display: flex; flex-direction: column-reverse; gap: 2px; justify-content: flex-end;
}
.cards .stat:first-child { border-left: 0; }
.stat .num { font-size: 22px; font-weight: 400; color: var(--ui-ink); letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .lbl { font-size: 12px; color: var(--ui-muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
.stat.alert .num { color: var(--ui-danger); }
.stat.warn .num { color: var(--ui-warn); }
.stat.good .num { color: var(--ui-ink); }
.stat.good, .stat.alert, .stat.warn { border-top: 0; }
a.stat:hover { background: #FAFBFB; transform: none; box-shadow: none; border-top-color: transparent; }
.stat .small, .stat .muted { order: -1; }

.hero { background: var(--ui-surface); color: var(--ui-ink); border: 1px solid var(--ui-line); box-shadow: none; border-radius: var(--ui-radius); }
.hero-kicker, .hero-item-label { color: var(--ui-muted); text-transform: none; letter-spacing: 0; font-size: 12px; }
.hero-title { font-weight: 500; color: var(--ui-ink); }
.hero-item a { color: var(--ui-accent); font-weight: 400; }
.hero-bar { background: var(--ui-line-2); }
.hero-bar span { background: var(--ui-accent); }
.empty { color: var(--ui-muted); }
.empty-title { font-weight: 500; color: var(--ui-ink); }

/* --- Tables ---------------------------------------------------------------- */
table.tbl { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); font-size: 14px; }
.tbl th, .tbl thead th {
  background: var(--ui-surface) !important; color: var(--ui-muted); font-size: 12px; font-weight: 400;
  text-transform: none; letter-spacing: 0; padding: 11px 12px; border-bottom: 1px solid var(--ui-line-2);
}
.tbl th:first-child, .tbl td:first-child { padding-left: 18px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 18px; }
.tbl td { padding: 12px; border-top: 1px solid var(--ui-line-2); vertical-align: top; }
.tbl tr:hover td { background: #FAFBFB; }
.tbl-wrap { border-radius: var(--ui-radius); }

/* --- Pills / chips --------------------------------------------------------- */
.pill, .chip { font-weight: 400; font-size: 12px; letter-spacing: 0; padding: 1px 9px; border-radius: 999px; background: #F0F2F3; color: var(--ui-ink-2); text-transform: none; }
.pill-class { background: #F0F2F3; color: var(--ui-ink); }
.pill-ok, .chip-COMPLETED, .chip-RESOLVED, .chip-SENT, .chip-CONFIRMED { background: var(--ui-ok-soft); color: var(--ui-ok); }
.pill-flag, .chip-BLOCKED, .chip-OPEN, .chip-AWAITING_DECISION, .chip-FAILED { background: var(--ui-danger-soft); color: var(--ui-danger); }
.pill-muted, .chip-CANCELLED, .chip-CLOSED, .chip-POSTPONED, .chip-NOT_STARTED { background: #F0F2F3; color: var(--ui-muted); }
.chip-IN_PROGRESS { background: #EAF1F8; color: #2F5E8A; }
.chip-WAITING, .pill-stale { background: var(--ui-warn-soft); color: var(--ui-warn); }
.pill-complete { background: var(--ui-accent-soft); color: var(--ui-accent); }
.money { font-variant-numeric: tabular-nums; }

/* --- Forms ----------------------------------------------------------------- */
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number],
input[type=url], input[type=search], input[type=tel], input[type=month], select, textarea {
  font: 400 14px/1.4 "Geist", system-ui, sans-serif; color: var(--ui-ink);
  background: var(--ui-surface); border: 1px solid var(--ui-input); border-radius: 8px; padding: 8px 11px; min-height: 38px;
  box-shadow: none;
}
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ui-accent); box-shadow: 0 0 0 3px rgba(14,111,97,.12); }
label, form.stack label, .form-grid label { font-size: 13px; font-weight: 500; color: var(--ui-ink-2); }
.helptext, .help, form .small.muted { color: var(--ui-faint); font-size: 12px; }
.filters, .crm-filters { gap: 8px; margin: 0 0 18px; }
.filters select, .filters input { min-width: 0; }
.filters .btn { min-height: 38px; }

/* --- Messages -------------------------------------------------------------- */
.msg { font-weight: 400; border-radius: 8px; padding: 10px 14px; border: 1px solid transparent; }
.msg-success { background: var(--ui-ok-soft); color: var(--ui-ok); border-color: #D2EADB; }
.msg-error { background: var(--ui-danger-soft); color: var(--ui-danger); border-color: #F1D3CC; }
.msg-warning { background: var(--ui-warn-soft); color: #7A5200; border-color: #F2E2BF; }
.msg-info { background: #F0F5FA; color: #2F5E8A; border-color: #DCE7F2; }

/* --- Lists, key/values, timelines ----------------------------------------- */
.kv { gap: 0 16px; font-size: 14px; }
.kv dt { color: var(--ui-muted); font-weight: 400; padding: 7px 0; }
.kv dd { padding: 7px 0; }
.timeline { border-left: 1px solid var(--ui-line); }
.timeline .entry::before { background: var(--ui-faint); width: 7px; height: 7px; left: -20px; }
ul.timeline li { border-color: var(--ui-line-2); }
.timeline .when, .timeline .kind { color: var(--ui-muted); font-weight: 400; }
.contact-row { border-color: var(--ui-line-2); }
.section-nav { background: var(--ui-bg); gap: 6px; }
.section-nav a { border: 1px solid var(--ui-line); background: var(--ui-surface); color: var(--ui-ink-2); font-size: 13px; font-weight: 400; border-radius: 999px; padding: 4px 11px; }
.section-nav a:hover { color: var(--ui-ink); border-color: #D3D8DC; }

/* --- CRM bits ------------------------------------------------------------------ */
.score summary { background: var(--ui-accent-soft); color: var(--ui-accent); font-weight: 500; }
.score[open] summary, .score summary:hover { background: var(--ui-accent); color: #fff; }
.crm-board .board-col { background: #F1F3F4; border: 0; border-radius: var(--ui-radius); }
.crm-board .board-col h4 { font-weight: 500; color: var(--ui-muted); text-transform: none; letter-spacing: 0; font-size: 13px; }
.deal-card { background: var(--ui-surface); border: 1px solid var(--ui-line); box-shadow: none; border-radius: 9px; }
.deal-card .who { background: #EEF0F2; color: var(--ui-ink-2); font-weight: 500; }
.chip-btn, .tap-chips label { font-weight: 400 !important; color: var(--ui-ink-2); }
.tap-chips label:has(input:checked), .chip-btn[aria-pressed="true"] { border-color: var(--ui-accent); background: var(--ui-accent-soft); color: var(--ui-accent); }
dialog.crm-dialog { color: var(--ui-ink); }
.optout { color: var(--ui-danger); }

/* --- Login --------------------------------------------------------------------- */
.login-wrap { background: var(--ui-bg); }
.login-card { background: var(--ui-surface); border: 1px solid var(--ui-line); box-shadow: none; border-radius: 12px; }

/* --- Phone ----------------------------------------------------------------------- */
.ui-tabbar { display: none; }
@media (max-width: 860px) {
  .mobile-topbar {
    display: flex; align-items: center; gap: 10px; background: var(--ui-surface); border-bottom: 1px solid var(--ui-line);
    padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  }
  .nav-toggle { color: var(--ui-ink); display: inline-flex; padding: 4px; }
  .ui-brand-mark img { height: 20px; display: block; }
  .topbar-search-link { color: var(--ui-ink-2); margin-left: auto; }
  button.topbar-search-link { background: none; border: 0; padding: 4px; font: inherit; cursor: pointer; }
  .sidebar { position: fixed; left: -270px; width: 264px; z-index: 70; box-shadow: var(--shadow-2); transition: left .2s ease; height: 100dvh; }
  .sidebar.open { left: 0; }
  .nav-backdrop.show { background: rgba(22,25,29,.35); }
  .main { padding: 16px 16px 104px; }
  h1 { font-size: 22px; }
  .page-head { margin: 4px 0 16px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards .stat { border-left: 0; border-top: 1px solid var(--ui-line-2); }
  .cards .stat:nth-child(2n) { border-left: 1px solid var(--ui-line-2); }
  .cards .stat:nth-child(-n+2) { border-top: 0; }
  .panel { padding: 16px; }
  .mobile-bar.ui-tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--ui-surface); border-top: 1px solid var(--ui-line);
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .ui-tabbar > a, .ui-tabbar > button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 48px;
    color: var(--ui-muted); font: 400 11px/1.2 "Geist", system-ui, sans-serif; background: none; border: 0; cursor: pointer;
  }
  .ui-tabbar svg { width: 21px; height: 21px; }
  .ui-tabbar > a[aria-current="page"] { color: var(--ui-accent); }
  .ui-quick-bar { display: flex; justify-content: center; }
  .ui-quick-bar > summary { display: flex; align-items: center; justify-content: center; min-height: 48px; }
  .ui-plus { width: 42px; height: 42px; border-radius: 50%; background: var(--ui-accent); color: #fff; font-size: 24px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
  .ui-quick-bar .ui-quick-menu { right: auto; left: 50%; transform: translateX(-50%); top: auto; bottom: calc(100% + 10px); }
  .tbl-stack td[data-label]::before { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ui-faint); }
  .tbl-stack tr { padding: 10px 14px; }
}
@media (pointer: coarse) {
  .sidebar .ui-nav-link { min-height: 44px; }
  .ui-subnav a { min-height: 40px; align-items: center; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* --- Shared page patterns (Today, account page, lists) ------------------------ */
.ui-kicker { margin: 0 0 4px; color: var(--ui-muted); font-size: 13px; }
.ui-of { color: var(--ui-faint); font-size: 15px; }
.ui-note { background: var(--ui-warn-soft); color: #6B4A00; border: 1px solid #F2E2BF; border-radius: 8px; padding: 9px 14px; margin-bottom: 10px; font-size: 14px; }
.ui-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.ui-split > * { min-width: 0; display: flex; flex-direction: column; gap: 26px; }
.ui-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.ui-section-head h2 { margin: 0; font-size: 15px; }
.ui-section-head a { font-size: 13px; }
.ui-rows { list-style: none; margin: 0; padding: 0; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); }
.ui-rows > li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 13px 18px; border-top: 1px solid var(--ui-line-2); }
.ui-rows > li:first-child { border-top: 0; }
.ui-row-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; color: var(--ui-ink); }
.ui-row-main:hover { color: var(--ui-ink); }
.ui-row-main:hover > span:first-child { color: var(--ui-accent); }
.ui-row-sub { color: var(--ui-muted); font-size: 13px; }
.ui-row-meta { font-size: 13px; color: var(--ui-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ui-row-meta.late { color: var(--ui-danger); }
.ui-row-meta.warn { color: var(--ui-warn); white-space: normal; }
.ui-row-meta.ok { color: var(--ui-ok); }
.ui-row-empty { color: var(--ui-muted); }
.ui-time { width: 44px; flex: none; color: var(--ui-muted); font-size: 13px; font-variant-numeric: tabular-nums; align-self: flex-start; padding-top: 1px; }
.ui-dot { width: 8px; height: 8px; border-radius: 50%; background: #C9CFD4; flex: none; }
.ui-dot.late { background: var(--ui-danger); }
.ui-dot.today { background: var(--ui-accent); }
.ui-done > summary { list-style: none; }
.ui-done > summary::-webkit-details-marker { display: none; }
.ui-done[open] { flex-basis: 100%; }
.ui-done-form { margin-top: 10px; padding: 12px 14px; background: #FAFBFB; border: 1px solid var(--ui-line-2); border-radius: 8px; }
@media (max-width: 980px) { .ui-split { grid-template-columns: 1fr; } }

/* specificity fixes against deck.css `.sidebar nav a` and global input rules */
.sidebar .ui-subnav a { color: var(--ui-muted); font-weight: 400; padding: 5px 10px 5px 0; background: none; }
.sidebar .ui-subnav a:hover { color: var(--ui-ink); background: none; }
.sidebar .ui-subnav a.is-current { color: var(--ui-ink); font-weight: 500; }
.topbar-search input[type=search] { border: 0; min-height: 0; padding: 0; box-shadow: none; background: transparent; }
.topbar-search input[type=search]:focus { box-shadow: none; }

/* --- Filter bar (Labs register and list pages) ---------------------------- */
.ui-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ui-search { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 0; background: var(--ui-surface); border: 1px solid var(--ui-input); border-radius: 8px; padding: 0 12px; color: var(--ui-faint); font-weight: 400; }
.ui-search input[type=search] { border: 0; box-shadow: none; padding: 0; min-height: 36px; flex: 1 1 auto; min-width: 0; background: transparent; }
.ui-search:focus-within { border-color: var(--ui-accent); box-shadow: 0 0 0 3px rgba(14,111,97,.12); }
.ui-filters select { width: auto; max-width: 200px; }
.ui-filters select.is-set { border-color: var(--ui-accent-line); background-color: var(--ui-accent-soft); color: var(--ui-accent); }
.ui-seg { display: inline-flex; border: 1px solid var(--ui-input); border-radius: 8px; overflow: hidden; margin-left: auto; }
.ui-seg a { padding: 0 13px; min-height: 36px; display: inline-flex; align-items: center; color: var(--ui-muted); background: var(--ui-surface); }
.ui-seg a + a { border-left: 1px solid var(--ui-input); }
.ui-seg a[aria-current] { background: #F0F2F3; color: var(--ui-ink); }
.more-filters { flex-basis: 100%; }
.ui-more { list-style: none; cursor: pointer; display: inline-block; color: var(--ui-ink-2); font-size: 13px; padding: 4px 2px; }
.ui-more::-webkit-details-marker { display: none; }
.ui-more::before { content: "+ "; color: var(--ui-faint); }
.more-filters[open] .ui-more::before { content: "− "; }
.more-grid label { color: var(--ui-muted); font-weight: 400; }
@media (max-width: 640px) {
  .ui-filters select { flex: 1 1 45%; max-width: none; }
  .ui-seg { margin-left: 0; }
}
.ui-filters .ui-search { flex: 1 1 220px; }
.ui-filters select { max-width: 180px; }

/* Labs register on a phone: one compact row per lab */
@media (max-width: 640px) {
  .ui-labs tr { display: grid; grid-template-columns: 46px minmax(0, 1fr); column-gap: 10px; padding: 12px 14px; }
  .ui-labs td { padding: 0 !important; }
  .ui-labs td[data-label]::before { display: none; }
  .ui-labs td[data-label="Score"] { grid-row: 1 / span 2; }
  .ui-labs td[data-label="Lab"] { grid-column: 2; }
  .ui-labs td[data-label="County"] { grid-column: 2; font-size: 13px; color: var(--ui-muted); }
  .ui-labs td[data-label="Class"], .ui-labs td[data-label="KENAS"], .ui-labs td[data-label="Ownership"],
  .ui-labs td[data-label="Group"], .ui-labs td[data-label="Profile"], .ui-labs td[data-label="Deal"] { display: none; }
}
.ui-labs td[data-label="Lab"] > a { color: var(--ui-ink); }
.ui-labs td[data-label="Lab"] > a:hover { color: var(--ui-accent); }
.ui-labs td[data-label="Class"] .pill-class { background: none; padding: 0; }
.ui-warn-text { color: var(--ui-warn); }
.ui-ok-text { color: var(--ui-ok); }
.complete-bar { width: 48px; height: 4px; background: linear-gradient(90deg, var(--ui-accent) var(--pc), var(--ui-line-2) var(--pc)); }

/* --- Account page ------------------------------------------------------------- */
.ui-back { display: inline-block; font-size: 13px; color: var(--ui-muted); margin: 4px 0 6px; }
.ui-back:hover { color: var(--ui-ink); }
.ui-acct-head h1 { font-size: 26px; }
.ui-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.ui-tags .pill { font-size: 12px; }
.ui-faint { color: var(--ui-faint); }
.ui-link { background: none; border: 0; padding: 0; font: inherit; color: var(--ui-accent); cursor: pointer; list-style: none; }
.ui-link::-webkit-details-marker { display: none; }
.ui-link:hover { color: var(--ui-accent-hover); }
.ui-danger-text { color: var(--ui-danger) !important; }
.ui-btn-warn { border-color: #F0D9A8; background: var(--ui-warn-soft); color: #7A5200; }
.ui-btn-warn:hover { background: #FBEFD6; color: #7A5200; border-color: #E8CB8E; }
.ui-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 16px 20px; margin: 0 0 28px; }
.ui-strip-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ui-strip-label { font-size: 12px; color: var(--ui-muted); }
.ui-strip-title { font-size: 16px; }
.ui-strip-fact { display: flex; flex-direction: column; gap: 2px; }
.ui-person { align-items: flex-start !important; }
.ui-person .ui-avatar { width: 34px; height: 34px; font-size: 13px; flex: none; }
.ui-person .ui-row-main { gap: 1px; }
.ui-person-acts { display: flex; gap: 6px; align-items: center; }
.ui-more-menu .ui-quick-menu { min-width: 200px; }
.ui-quick-menu form { margin: 0; }
.ui-quick-menu button { width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 7px; font: inherit; font-size: 14px; color: var(--ui-ink); cursor: pointer; }
.ui-quick-menu button:hover { background: #F3F5F6; }
.ui-points { display: block !important; }
.ui-points ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.ui-points li { padding: 2px 0; }
.ui-inline-form { width: 100%; }
.ui-inline-form > summary { padding: 2px 0; }
.ui-inline-form[open] > summary { margin-bottom: 12px; }
.ui-log { margin-bottom: 12px; }
.ui-log[open] { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 14px 18px; }
.ui-timeline { list-style: none; margin: 0; padding: 0; }
.ui-timeline > li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-top: 1px solid var(--ui-line); }
.ui-timeline-when { font-size: 13px; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.ui-card { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 6px 18px; margin: 0; }
.ui-fact-sec { padding: 10px 0; border-top: 1px solid var(--ui-line-2); }
.ui-fact-sec:first-child { border-top: 0; }
.ui-fact-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; color: var(--ui-muted); margin-bottom: 2px; }
.ui-fact-acts { display: flex; gap: 12px; font-size: 13px; }
.ui-facts { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr); margin: 0; }
.ui-facts dt { color: var(--ui-muted); font-weight: 400; padding: 7px 10px 7px 0; }
.ui-facts dd { margin: 0; padding: 7px 0; overflow-wrap: anywhere; }
.ui-facts-plain dt, .ui-facts-plain dd { border-top: 1px solid var(--ui-line-2); }
.ui-facts-plain dt:first-of-type, .ui-facts-plain dd:first-of-type { border-top: 0; }
.ui-fact-src { display: block; font-size: 12px; color: var(--ui-faint); }
.ui-fact-empty { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--ui-line-2); font-size: 13px; }
.ui-fact-score { padding: 8px 0 10px; border-top: 1px solid var(--ui-line-2); font-size: 13px; }
.ui-ask { font-size: 13px; color: var(--ui-ink-2); margin: 10px 2px 0; }
@media (max-width: 640px) {
  .ui-timeline > li { grid-template-columns: 1fr; gap: 2px; }
  .ui-strip { gap: 12px 20px; }
  .ui-facts { grid-template-columns: 1fr; }
  .ui-facts dt { padding-bottom: 0; border: 0 !important; }
}
@media (max-width: 640px) { .ui-labs td { border: 0 !important; } }
.login-card { padding: 32px 32px 28px; }
.login-card h1 { text-align: center; font-size: 20px; }
.login-card > .sub { text-align: center; margin: 2px 0 20px; font-size: 13px; }
.login-logo { height: 34px; margin-bottom: 14px; }

/* Organizations & contacts */
.kv code, .ui-facts code { overflow-wrap: anywhere; word-break: break-all; }
.ui-orgs .ui-row-main { flex-basis: 260px; }

/* --- AI assist (drafts a person reviews) ------------------------------------ */
.ui-ai-mark { display: inline-block; font-size: 12px; line-height: 18px; color: var(--ui-accent); background: var(--ui-accent-soft); border: 1px solid var(--ui-accent-line); border-radius: 999px; padding: 0 8px; vertical-align: middle; }
.ui-ai-editor { width: 100%; min-height: 520px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; }
.ui-ai-notes { width: 100%; min-height: 220px; }
.ui-ai-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.ui-suggest > li { display: block; }
.ui-suggest-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px; }
.ui-suggest-head h2 { margin: 0; font-size: 15px; }
.ui-suggest-body { margin-top: 12px; display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.ui-suggest-body .ui-wide { grid-column: 1 / -1; }
.ui-suggest-body label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ui-muted); font-weight: 400; }
.ui-suggest > li.is-rejected .ui-suggest-body { opacity: .45; }
.ui-decide { display: inline-flex; border: 1px solid var(--ui-input); border-radius: 8px; overflow: hidden; background: var(--ui-surface); }
.ui-decide label { position: relative; padding: 0 12px; min-height: 34px; display: inline-flex; align-items: center; font-size: 13px; font-weight: 400; color: var(--ui-muted); cursor: pointer; }
.ui-decide label + label { border-left: 1px solid var(--ui-input); }
.ui-decide input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ui-decide label:has(input:checked) { background: var(--ui-accent-soft); color: var(--ui-accent); }
.ui-decide label:has(input[value=reject]:checked) { background: #F3F4F5; color: var(--ui-ink-2); }
.ui-decide label:has(input:focus-visible) { outline: 2px solid var(--ui-accent); outline-offset: -2px; }
.ui-chipset { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-chipset label { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--ui-input); border-radius: 999px; padding: 3px 10px; color: var(--ui-ink-2); }
.ui-chipset input { margin: 0; }
.ui-brief-list { margin: 4px 0 0; padding-left: 18px; }
.ui-brief-list li { padding: 3px 0; }
.ui-usage-num { font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 640px) {
  .ui-ai-editor { min-height: 380px; font-size: 14px; }
  .ui-suggest-body { grid-template-columns: 1fr; }
  .ui-decide { width: 100%; }
  .ui-decide label { flex: 1; justify-content: center; min-height: 40px; }
}
@media print {
  .sidebar, .topbar, .messages, .ui-back, .ui-no-print, .floating-dock { display: none !important; }
  .shell, .main { display: block !important; margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
  .ui-card { border: 0; padding: 0; }
}
.ui-stack-lg { display: flex; flex-direction: column; gap: 26px; }
.ui-filters input[type=date] { width: auto; }
@media (max-width: 640px) { .ui-acct-head .ui-more-menu .ui-quick-menu { left: 0; right: auto; } }
.ui-hk-item { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 auto; min-width: 0; font-weight: 400; cursor: pointer; }
.ui-hk-item input { margin-top: 4px; flex: none; }
.ui-hk-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--ui-ink); }
/* Management report page: toolbar + structured editor around the document */
.mr-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin: 0 auto 14px; max-width: 210mm; }
.mr-status { font-size: 13px; color: var(--ui-muted); }
.mr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mr-editor { max-width: 210mm; margin: 0 auto 18px; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.mr-editor fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mr-editor legend { font-size: 13px; color: var(--ui-ink); font-weight: 500; margin-bottom: 4px; padding: 0; }
.mr-editor label { font-size: 12px; color: var(--ui-muted); font-weight: 400; }
.mr-editor[hidden] { display: none; }
.mr-ed-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.mr-plan-ed { display: flex; flex-direction: column; gap: 6px; }
.mr-plan-ed-head, .mr-plan-ed-row { display: grid; grid-template-columns: minmax(130px, 0.9fr) minmax(0, 2fr) 150px 84px; gap: 8px; align-items: center; }
.mr-plan-ed-head span { font-size: 12px; color: var(--ui-muted); }
.mr-remove { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; }
@media (max-width: 760px) {
  .mr-ed-grid { grid-template-columns: 1fr; }
  .mr-plan-ed-head { display: none; }
  .mr-plan-ed-row { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--ui-line-2); }
  .mr-plan-ed-row input[type=text] { grid-column: 1 / -1; order: -1; }
  .mr-actions .btn { flex: 1 1 auto; }
}

/* Install on a phone: Android downloads the app, iPhone shows Add to Home Screen */
[data-install][hidden], .ui-install [hidden] { display: none !important; }
.ui-install-link { justify-content: center; margin: 6px 0 2px; }
.ui-install { border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: var(--ui-surface); color: var(--ui-ink);
  width: min(440px, calc(100vw - 32px)); padding: 20px 22px 18px; margin: auto auto max(16px, env(safe-area-inset-bottom)); }
.ui-install::backdrop { background: rgba(22, 25, 29, .35); }
.ui-install h2 { font-size: 17px; font-weight: 500; margin: 0 28px 10px 0; text-wrap: balance; }
.ui-install ol { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.ui-install p { margin: 0 0 10px; }
.ui-install-close { position: absolute; top: 8px; right: 8px; margin: 0; }
.ui-install-close button { border: 0; background: none; font-size: 22px; line-height: 1; padding: 4px 8px; color: var(--ui-muted); cursor: pointer; border-radius: 8px; }
.ui-install-share { vertical-align: -3px; color: var(--ui-accent, currentColor); }
