:root {
  --bg: #0b1020; --panel: rgba(12, 18, 36, .78); --panel-solid: #121a2e; --ink: #f4f7ff; --muted: #a8b3c9;
  --line: rgba(140, 170, 220, .28); --brand: #3ec6ff; --brand-ink: #041018; --accent: #8b6cff;
  --ok: #3dd68c; --warn: #f0b429; --bad: #ff6b6b; --info: #6ea8ff;
  --scrim: linear-gradient(160deg, rgba(8, 10, 24, .88) 0%, rgba(12, 20, 40, .72) 45%, rgba(10, 16, 32, .9) 100%);
  --focus: #7ee0ff;
}
* { box-sizing: border-box; }
body {
  margin: 0; font: 14px/1.45 "Segoe UI", system-ui, sans-serif; color: var(--ink);
  background-color: var(--bg);
  background-image: var(--scrim), url("/static/images/background1.jpg");
  background-size: cover; background-position: center; background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; color: #9ae6ff; }
header.top {
  background: rgba(8, 14, 28, .82); color: var(--ink); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 0 24px; padding: 0 20px; min-height: 52px; position: sticky; top: 0; z-index: 50;
}
header.top .brand { font-weight: 700; font-size: 16px; align-self: center; white-space: nowrap; }
header.top .brand a { color: #fff; }
header.top .brand a:hover { text-decoration: none; opacity: .9; }
/* Top menu (decision #85): Samantha first; Settings dropdown sits with Mute at the right end. */
nav.menu { flex: 1 0 auto; display: flex; min-width: 0; }
.menu-bar { list-style: none; margin: 0; padding: 0; display: flex; flex: 1; align-items: stretch; }
.menu-bar > li { list-style: none; }
.menu-group { position: relative; display: flex; align-items: stretch; }
.menu-group.active { box-shadow: inset 0 -3px 0 var(--brand); }
.menu-bar .menu-top {
  display: flex; align-items: center; gap: 6px; padding: 0 16px; min-height: 52px; color: #c9d7ef; font: inherit; font-weight: 500;
  background: none; border: 0; border-radius: 0; cursor: pointer; white-space: nowrap;
}
.menu-bar .menu-caret { font-size: 10px; opacity: .8; transition: transform .15s; }
.menu-group.open > .menu-top .menu-caret { transform: rotate(180deg); }
.menu-group.active > .menu-top, .menu-bar .menu-top:hover, .menu-group.open > .menu-top { color: #fff; text-decoration: none; filter: none; }
.menu-bar .menu-top:hover, .menu-group.open > .menu-top { background: rgba(62, 198, 255, .12); }
.menu-bar .menu-top:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
.menu-panel {
  display: none; position: absolute; top: 100%; left: 0; min-width: 220px; margin: 0; padding: 6px 0; list-style: none;
  background: var(--panel-solid); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); z-index: 60; max-height: min(70vh, 520px); overflow-y: auto;
}
.menu-panel > li { list-style: none; margin: 0; }
.menu-heading {
  padding: 10px 18px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px;
}
.menu-heading:first-child { border-top: 0; margin-top: 0; }
.top-actions .menu-group.menu-settings > .menu-panel { left: auto; right: 0; }
.menu-group.open > .menu-panel, html:not(.js) .menu-group:hover > .menu-panel, html:not(.js) .menu-group:focus-within > .menu-panel { display: block; }
.menu-panel a { display: block; padding: 8px 18px; color: var(--ink); white-space: nowrap; }
.menu-panel a:hover, .menu-panel a:focus { background: rgba(62, 198, 255, .12); text-decoration: none; }
.menu-panel a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.menu-panel a.active { color: var(--brand); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.menu-search { padding: 4px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-search form { display: flex; gap: 6px; }
.top-search { align-self: center; flex: 1 1 180px; max-width: 320px; min-width: 140px; padding: 8px 0; }
.top-search input[type=search] {
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; border-radius: 8px;
}
.top-search input[type=search]::placeholder { color: #b7c4db; }
.top-search input[type=search]:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
/* Mute left of Settings dropdown (decision #85; amends UX1 button). */
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 8px 0; }
.top-actions .menu-settings { align-items: center; }
.top-actions .menu-settings > .menu-top.top-btn { min-height: 32px; padding: 0 12px; }
.top-mute, .top-mute form { display: flex; align-items: center; margin: 0; }
.top-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 6px; white-space: nowrap;
  font: inherit; font-weight: 500; color: #fff; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .3); cursor: pointer;
}
.top-btn:hover { background: rgba(62, 198, 255, .2); color: #fff; text-decoration: none; }
.top-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.top-btn[aria-current=page], .menu-settings.active > .top-btn { background: rgba(62, 198, 255, .22); }
.top-btn.is-muted { background: #fff; color: var(--bad); border-color: #fff; }
.top-btn.is-muted:hover { background: #ffe3e3; color: var(--bad); }
.top-btn:disabled { opacity: .55; cursor: not-allowed; }
.top-btn .top-icon { flex: none; }
.menu-overflow { display: none; }
@media (max-width: 760px) {
  header.top { gap: 8px; padding: 0 10px; padding-top: max(0px, env(safe-area-inset-top)); }
  .menu-overflow {
    display: inline-flex; align-items: center; align-self: center; min-height: 44px; padding: 0 12px;
    margin-left: auto;
  }
  header.top .top-actions { margin-left: 0; }
  nav.menu { display: none; flex: 1 0 100%; order: 5; }
  header.top.nav-open nav.menu { display: flex; }
  .menu-bar { flex-direction: column; align-items: stretch; }
  .menu-bar .menu-top { padding: 0 10px; min-height: 44px; }
  .menu-panel { position: static; min-width: 0; box-shadow: none; border-radius: 0; max-height: none; }
  input, select, textarea { font-size: 16px; }
  main { padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .panel { overflow-x: auto; }
}
main { max-width: 1400px; margin: 0 auto; padding: 20px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px;
  backdrop-filter: blur(8px); box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
}
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1000px) { .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: 1fr; } }
.table-scroll { overflow-x: auto; }
td.actions { min-width: 9em; }
td.actions form, td.actions a { display: inline-block; margin: 2px 4px 2px 0; }
.stat { font-size: 26px; font-weight: 700; }
.cc-kpis { gap: 8px; margin-bottom: 8px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cc-kpis .panel { padding: 8px 10px; margin-bottom: 0; min-width: 0; }
.cc-kpis .stat { font-size: 20px; line-height: 1.2; }
@media (max-width: 1100px) { .cc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cc-kpis { grid-template-columns: 1fr 1fr; } }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table { width: 100%; border-collapse: collapse; background: transparent; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; background: rgba(8, 14, 28, .75); position: sticky; top: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:hover td { background: rgba(62, 198, 255, .06); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; margin: 1px 2px 1px 0; white-space: nowrap; border: 1px solid transparent; }
.badge.ok { background: rgba(61, 214, 140, .18); color: var(--ok); border-color: rgba(61, 214, 140, .4); }
.badge.warn { background: rgba(240, 180, 41, .18); color: var(--warn); border-color: rgba(240, 180, 41, .4); }
.badge.bad { background: rgba(255, 107, 107, .18); color: var(--bad); border-color: rgba(255, 107, 107, .4); }
.badge.info { background: rgba(110, 168, 255, .18); color: var(--info); border-color: rgba(110, 168, 255, .4); }
.badge.state-qualified { background: rgba(61, 214, 140, .18); color: var(--ok); }
.badge.state-strategic_exception { background: rgba(110, 168, 255, .18); color: var(--info); }
.badge.state-research_pending { background: rgba(240, 180, 41, .18); color: var(--warn); }
.badge.state-excluded { background: rgba(168, 179, 201, .15); color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash.ok { background: rgba(61, 214, 140, .15); border: 1px solid rgba(61, 214, 140, .4); }
.flash.err { background: rgba(255, 107, 107, .15); border: 1px solid rgba(255, 107, 107, .4); }
.flash.warn { background: rgba(240, 180, 41, .15); border: 1px solid rgba(240, 180, 41, .4); }
form.inline { display: inline; }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 3px; }
details > summary { cursor: pointer; margin: 4px 0; }
details[open] { margin-bottom: 8px; }
button[disabled] { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=search], input[type=number], input[type=password], input[type=email], input[type=url], input[type=date], select, textarea {
  width: 100%; padding: 6px 8px; border: 1px solid rgba(140, 170, 220, .35); border-radius: 5px; font: inherit;
  background: rgba(8, 14, 28, .65); color: var(--ink);
}
/* Dark page: native calendar glyphs default to black; lighten them. Light modals keep the dark glyph. */
input[type=date] { color-scheme: dark; }
input[type=date]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: 1;
  filter: invert(1) brightness(1.15);
}
.modal-form input[type=date] { color-scheme: light; }
.modal-form input[type=date]::-webkit-calendar-picker-indicator { filter: none; }
textarea { min-height: 70px; }
button, .btn { display: inline-block; padding: 6px 14px; border-radius: 5px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; }
button.secondary, .btn.secondary { background: transparent; color: var(--brand); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button:hover { filter: brightness(1.08); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters > div { min-width: 140px; }
.evidence { background: #fbfaf3; border-left: 3px solid #e6d27a; padding: 6px 10px; font-size: 12px; margin: 4px 0; white-space: pre-wrap; }
.excerpt { white-space: pre-wrap; font-family: Consolas, monospace; font-size: 12px; background: #f7f8fa; padding: 10px; border-radius: 5px; border: 1px solid var(--line); }
.progress { height: 8px; background: #e6e9ef; border-radius: 4px; overflow: hidden; min-width: 120px; }
.progress > div { height: 100%; background: var(--brand); }
.score { font-weight: 700; font-size: 15px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 4px 12px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.logs { font-family: Consolas, monospace; font-size: 11px; max-height: 420px; overflow: auto; background: #10151f; color: #cfd6e4; padding: 10px; border-radius: 6px; white-space: pre-wrap; }
.right { text-align: right; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.warnbox { border: 1px solid #f6d39a; background: #fffaf0; padding: 10px 12px; border-radius: 6px; }

/* Contacts workspace (CRM Phase 1 M4): list left, details centre, timeline right on a wide monitor; below 1400px the
   timeline moves under the details, below 1000px everything stacks. Side panels collapse (app.js). */
main.wide { max-width: none; padding: 12px 16px; }
/* On the full-width pages the details, edit forms, History table and the New deal form keep the 1400 px page column,
   so a 3440 px screen does not stretch them edge to edge; the boards still use the whole width. */
main.wide .capped { max-width: 1400px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.workspace { display: grid; grid-template-columns: auto minmax(0, 1400px) auto; justify-content: center; gap: 14px; align-items: start; }
.ws-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.ws-center { background: none; border: 0; padding: 0; }
.ws-left { width: 340px; }
.ws-right { width: clamp(360px, 28vw, 640px); }
.ws-left, .ws-right { position: sticky; top: 12px; max-height: calc(100vh - 88px); overflow-y: auto; }
.ws-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ws-head h1, .ws-head h2 { margin: 0; font-size: 17px; }
.ws-panel.collapsed { width: 48px; padding: 8px 6px; overflow: hidden; }
.ws-panel.collapsed .ws-body { display: none; }
.ws-panel.collapsed .ws-head { flex-direction: column-reverse; }
.ws-panel.collapsed .ws-head h1, .ws-panel.collapsed .ws-head h2 { writing-mode: vertical-rl; font-size: 14px; }
.ws-toggle:focus-visible, .dir-row:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ws-empty { padding: 48px 20px; text-align: center; }
.dir-search label { margin-top: 10px; }
.dir-filter { display: flex; gap: 6px; margin-top: 6px; }
.dir-list { list-style: none; margin: 6px 0; padding: 0; }
.dir-row { display: block; padding: 6px 8px; border-radius: 6px; color: var(--ink); border-bottom: 1px solid var(--line); }
.dir-row:hover, .dir-row:focus { background: #eef3f9; text-decoration: none; }
.dir-row.selected { background: #e8edfb; box-shadow: inset 3px 0 0 var(--brand); }
.dir-meta { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.crm-search { max-width: 760px; margin-bottom: 16px; }
.crm-search-row { display: flex; gap: 8px; }
.crm-search label.crm-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }
.crm-results { max-width: 960px; }
.crm-group { margin-bottom: 18px; }
.crm-group h2 { font-size: 16px; margin: 0 0 4px; }
.crm-empty { padding: 24px 0; }
.person-head { margin-bottom: 10px; }
.person-name { margin: 0; font-size: 20px; }
.snapshot { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.snap-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; overflow-wrap: anywhere; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; margin: 0; }
.fields dt { font-size: 12px; color: var(--muted); }
.fields dd { margin: 0; overflow-wrap: anywhere; }
.fields .wide-field { grid-column: 1 / -1; }
.grid.compact { gap: 10px; }
.timeline { list-style: none; margin: 10px 0 0; padding: 0; }
.timeline li { padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.timeline li:target { background: #fff8d6; }
.log-form textarea { min-height: 48px; margin: 4px 0 6px; }
.log-form details { margin: 0 0 6px; }
.tl-filters { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 10px 0 0; font-size: 13px; }
.tl-filters a.active { font-weight: 600; text-decoration: none; }
.tl-actions { display: flex; gap: 12px; margin-top: 3px; }
.transcript { list-style: none; margin: 10px 0 0; padding: 0; }
.transcript li { padding: 4px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.transcript li.hit { background: #fffbe6; }
.transcript .who { font-weight: 600; }
.copy-box { width: 100%; min-height: 160px; font-family: Consolas, monospace; font-size: 12px; }
.field-err { color: var(--bad); font-size: 12px; margin-top: 2px; }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--bad); }
.points { border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px 10px; margin: 10px 0 0; min-width: 0; }
.point-row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.point-value { flex: 1 1 200px; }
.point-check label { display: inline-flex; gap: 4px; align-items: center; margin: 0 0 8px; color: var(--ink); font-size: 13px; }
.edit-actions { margin-top: 12px; position: sticky; bottom: 0; background: var(--panel); padding: 8px 0; }
@media (max-width: 1399px) {
  .workspace { grid-template-columns: auto minmax(0, 1fr); }
  .ws-left { grid-row: span 2; }
  .ws-right { grid-column: 2; width: auto; position: static; max-height: none; }
  .ws-right.collapsed { width: auto; }
}
@media (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .ws-left, .ws-right { grid-column: 1; grid-row: auto; width: auto; position: static; max-height: none; }
  .snapshot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields { grid-template-columns: 1fr; }
}

/* Sales Assistant */
.asst { display: grid; grid-template-columns: 240px 1fr 260px; gap: 16px; align-items: start; }
.asst-side h3 { margin-top: 18px; }
.asst-thread { display: block; padding: 6px 8px; border-radius: 6px; color: var(--ink); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; }
.asst-thread .small { display: block; }
.asst-thread.active, .asst-thread:hover { background: #e8edfb; text-decoration: none; }
.asst-main { min-height: 60vh; display: flex; flex-direction: column; }
.asst-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.asst-log { flex: 1; display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow-y: auto; padding: 4px 2px 12px; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 10px; }
.msg p { margin: 0 0 6px; }
.msg p:last-child { margin-bottom: 0; }
.msg ul { margin: 4px 0 6px 18px; padding: 0; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: #f3f5f9; border: 1px solid var(--line); }
.msg.tools { align-self: flex-start; padding: 0 4px; }
.msg.note { align-self: center; background: #fbfaf3; border: 1px solid #e6d27a; }
.msg-meta { margin-top: 6px; }
.chip { display: inline-block; background: #eef0f3; border-radius: 10px; padding: 0 7px; margin-left: 4px; }
.action-card { align-self: flex-start; max-width: 80%; border: 1px solid #c4d0f2; border-left: 4px solid var(--info); background: #fff; border-radius: 8px; padding: 10px 12px; }
.action-card.status-done { border-left-color: var(--ok); }
.action-card.status-failed { border-left-color: var(--bad); }
.action-card.status-cancelled, .action-card.status-expired { opacity: .7; border-left-color: var(--muted); }
.action-card ul { margin: 6px 0; padding-left: 18px; }
.action-title { font-weight: 600; }
.asst-input { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.asst-input textarea { flex: 1; min-height: 48px; }
.suggest { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
button.small { padding: 3px 9px; font-size: 12px; }
.memory { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* Voice status (Samantha page) */
.voice-status { padding: 8px 10px; border: 1px solid var(--border, #d0d7de); border-radius: 8px; margin-bottom: 8px; }
.voice-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: #8c959f; vertical-align: middle; }
.voice-dot.state-listening { background: #2ea043; }
.voice-dot.state-awake, .voice-dot.state-speaking { background: #1f6feb; }
.voice-dot.state-thinking, .voice-dot.state-loading { background: #bf8700; }
.voice-dot.state-error { background: #cf222e; }
.mode-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.9em; background: #dafbe1; color: #116329; }
.mode-pill.mode-quiet { background: #eee5ff; color: #6639ba; }
.mode-pill.mode-text { background: #e8e1f7; color: #4b2a8f; }
.mode-pill.mode-namesake { background: #fff1e0; color: #8a4b00; }
.mode-pill.mode-asleep { background: #ddf4ff; color: #0a3069; }
.mode-pill.mode-off { background: #eaeef2; color: #57606a; }
.mode-pill.mode-meeting { background: #ffebe9; color: #cf222e; font-weight: 600; }
.mode-pill.mode-driving { background: #fff8c5; color: #7d4e00; font-weight: 600; }
.mode-pill.mode-guest { background: #ddf4ff; color: #0a3069; font-weight: 600; }
.meeting-notes h3 { margin: 16px 0 6px; }
.meeting-notes ul { margin: 0 0 8px 18px; padding: 0; }

/* Deals and Leads boards (CRM M10): a column per stage; each card keeps its own "Move to" form. */
.board { display: grid; gap: 10px; overflow-x: auto; align-items: start; }
.board-col { background: #f6f8fa; border: 1px solid #d0d7de; border-radius: 6px; padding: 8px; min-height: 80px; }
.board-col.retired { background: #fff8c5; }
.board-col.drop-over { outline: 2px dashed #1f6feb; outline-offset: 2px; }
.board-head { margin: 0; font-size: 1em; }
.board-card { background: #fff; border: 1px solid #d0d7de; border-radius: 6px; padding: 6px; margin-top: 8px; }
.board-card[draggable="true"] { cursor: grab; }
.board-card.dragging { opacity: 0.5; }
.move-form { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.move-form select, .move-form input[type="text"] { font-size: 0.85em; padding: 2px 4px; max-width: 100%; }
.move-form input[aria-invalid="true"] { border-color: #cf222e; }

/* Page heading with its action at the right (UX2). */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; }
.page-head h1 { margin: 0; }
.page-help { margin: 0 0 4px; }
.page-help p { margin: 4px 0 8px; max-width: 110ch; }

/* Pop-up forms (UX2): one native <dialog> for every form; scrolls inside on short screens, buttons stay visible. */
.modal { width: min(640px, 94vw); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.modal::backdrop { background: rgba(15, 23, 42, 0.45); }
.modal-form { padding: 18px 20px 0; }
.modal-form h2 { margin: 0 0 8px; }
.modal-form input[type="text"], .modal-form input[type="date"], .modal-form select { width: 100%; box-sizing: border-box; }
.modal-form input[type="date"] { padding: 6px 8px; border: 1px solid #c6ccd6; border-radius: 5px; font: inherit; background: #fff; }
.modal-form fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 12px 0 0; padding: 4px 12px 10px; }
.modal-form legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.modal-form label.check { display: flex; align-items: center; gap: 6px; }
.modal-form label.check input { width: auto; }
.modal-actions { position: sticky; bottom: 0; display: flex; gap: 8px; justify-content: flex-end; padding: 12px 0 16px; margin-top: 12px; background: var(--panel); border-top: 1px solid var(--line); }
.modal-form textarea { width: 100%; box-sizing: border-box; }
.modal-form .grid { gap: 0 12px; }
.modal-form label.check-inline { display: inline-flex; align-items: center; gap: 4px; margin: 4px 12px 0 0; color: inherit; }
.modal-form .field-err { color: var(--bad); margin-top: 2px; }
.modal-form input[type="search"] { width: 100%; box-sizing: border-box; }
.pick-results { min-height: 3em; }
.modal-form .pick-list { max-height: 18rem; overflow-y: auto; }
.modal-form label.pick-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; margin: 0; padding: 6px 2px; color: inherit; font-size: 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.modal-form label.pick-row:last-child { border-bottom: 0; }
.modal-form label.pick-row input { width: auto; }
.dup-warning ul { margin: 6px 0 4px 18px; padding: 0; }
.dup-warning p { margin: 4px 0 0; }
.page-actions { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.form-page { max-width: 640px; }
.form-page .modal-form { padding: 0; }
.form-page .modal-actions { position: static; }

/* A company's deals (UX5): forecasts and actual sales side by side but separately labelled; the new deal highlighted. */
#company-deals .ws-head h3 { margin: 0; }
.deal-totals { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 8px 0; }
.deal-totals strong { font-size: 18px; }
.company-deals tbody tr:hover { background: #f5f7fc; }
.company-deals tr.selected { background: #e8edfb; box-shadow: inset 3px 0 0 var(--brand); }
.company-deals a:focus-visible, .deal-filter a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Leads and Deals workspace (UX6): the list left at the Contacts width (collapsible), the record right in the 1400 px
   column; "Loading" while a record is on its way; below 1000px the list sits above the record, at most half a screen. */
.ws-page-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ws-page-actions .view-switch { margin: 0; }
.goal-year { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.goal-year label { margin: 0; }
.goal-year select { width: auto; }

/* Dashboard sales panels (UX8) */
.cc-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; }
.cc-head h2 { margin: 0; }
.cc-panel > summary { list-style-position: inside; }
.cc-panel > summary h3, .cc-panel > summary h4 { display: inline; margin: 0; }
.cc-panel h4 { margin: 10px 0 4px; }
.cc-list { margin: 6px 0; padding-left: 18px; }
.cc-list li { margin-bottom: 4px; }
.cc-goal .progress { margin: 6px 0; }
.cc-gauges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.cc-gauge-row { grid-column: 1 / -1; margin: 8px 0 0; font-size: 15px; }
@media (max-width: 319px) { .cc-gauges { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 1280px) { .cc-gauges { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .cc-gauge-row { display: none; } }
.crm-phone-links { display: none; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.crm-phone-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--brand); color: var(--brand); font-weight: 600;
}
@media (max-width: 760px) { .crm-phone-links { display: flex; } }
.cc-goal { min-width: 0; }
.cc-goal .small, .cc-goal .stat { overflow-wrap: anywhere; }
.cc-goal .gauge { display: block; width: 220px; max-width: 100%; height: auto; margin: 0 0 6px; }
@media (max-width: 760px) { .cc-goal .gauge { width: 150px; } }
.deal-facts .deal-rmr { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.deal-facts h4 { margin: 0 0 8px; }
.info-tip { display: inline-block; position: relative; vertical-align: middle; margin-left: 4px; }
/* backdrop-filter on .panel gives each card its own layer, so the next card paints over a tip that hangs past the edge. Lift the open card. */
.panel:has(.info-tip[open]) { position: relative; z-index: 30; }
.info-tip[open] { z-index: 30; }
.info-tip > summary.info-btn { list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; padding: 0; border-radius: 50%; border: 1px solid var(--brand); background: transparent; color: var(--brand); font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; }
.info-tip > summary.info-btn::-webkit-details-marker { display: none; }
.info-tip > summary.info-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.info-tip .info-pop { position: absolute; z-index: 30; left: 0; top: 1.6rem; width: min(42rem, 80vw); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.info-tip .info-pop p { margin: 0 0 6px; }
.info-tip .info-pop p:last-child { margin-bottom: 0; }
.task-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; }
.task-filters label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); }
.task-filters form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.task-filters select, .task-reschedule input[type=date] { width: auto; }
.task-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.task-more { position: relative; }
.task-more > summary { list-style: none; width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.task-more > summary::-webkit-details-marker { display: none; }
.task-more-menu { position: absolute; right: 0; z-index: 5; display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 8rem; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.record-actions { flex-wrap: wrap; gap: 8px; }
.cc-panel .cc-group-head { margin: 4px 0 8px; }
.gauge .g-track { stroke: rgba(200, 207, 214, 0.35); }
.gauge .g-over { stroke: #8FB8DE; opacity: 0.85; }
.gauge .g-minor { stroke: #C8CFD6; opacity: 0.9; }
.gauge .g-major { stroke: #F7FBFF; }
.gauge .g-over-tick { stroke: #8FB8DE; }
.gauge .g-goal-tick { stroke: #FFFFFF; }
.gauge text { font-family: 'Arial Narrow', 'Segoe UI', sans-serif; fill: #F7FBFF; stroke: #0B0E13; stroke-width: 1; paint-order: stroke; }
.gauge .g-label { font-size: 19px; font-weight: 700; }
.gauge .g-goal-label { font-size: 22px; }
.gauge .g-goal-word { font-size: 12px; font-weight: 700; letter-spacing: 2px; }
.gauge .g-over-word { font-size: 11px; font-weight: 700; letter-spacing: 1px; fill: #8FB8DE; }
.gauge .g-readout { font-size: 24px; font-weight: 700; }
.gauge .g-readout-sub { font-size: 18px; fill: #C8CFD6; }
.gauge .g-pace { fill: #0B3D91; stroke: #FFFFFF; stroke-width: 1.5; }
.gauge .g-needle { transform-box: view-box; transform-origin: 180px 180px; transform: rotate(var(--needle));
  animation: g-sweep 0.9s ease-out; }
@keyframes g-sweep { from { transform: rotate(-240deg); } }
@media (prefers-reduced-motion: reduce) { .gauge .g-needle { animation: none; } }
.cc-bar { width: 30%; }
.cc-trend { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.cc-trend label { margin: 0; }
.cc-trend select { width: auto; }
.ws-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.ws-filters > div:first-child { grid-column: 1 / -1; }
.ws-filters details { grid-column: 1 / -1; margin-top: 6px; }
.ws-filters select, .ws-filters input[type=text] { width: 100%; }
.dir-search > .secondary { margin-top: 8px; }
.ws-totals { margin: 4px 0; }
.dir-flags { display: block; margin-top: 2px; }
.ws-rec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ws-rec-head h2 { margin: 0 0 6px; font-size: 20px; }
.ws-detail { position: relative; min-height: 240px; }
.ws-detail.htmx-request > * { opacity: .45; }
.ws-detail.htmx-request::before { content: "Loading…"; position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px; font-size: 13px; }
@media (max-width: 1000px) { .ws-two .ws-left { max-height: 50vh; overflow-y: auto; } }

/* Task rows (UX2): company, contact and creation time without opening the task; long names truncate. */
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 2px; color: var(--muted); }
.task-assoc a { display: inline-block; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (max-width: 900px) { .task-assoc a { max-width: none; white-space: normal; } }

/* Web UI/UX v0.5: Settings jump, back to top, attention chip, Up next. */
.settings-jump {
  position: sticky; top: 52px; z-index: 40; display: flex; flex-wrap: wrap; align-items: end; gap: 10px;
  margin: 0 0 14px; padding: 10px 12px; background: rgba(8, 14, 28, .9); border: 1px solid var(--line);
  border-radius: 8px; backdrop-filter: blur(8px);
}
.settings-jump label { margin: 0; }
.settings-jump select { width: min(100%, 420px); }
.back-to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 70; padding: 8px 12px; border-radius: 999px;
  background: rgba(8, 14, 28, .9); color: var(--ink); border: 1px solid var(--line); font: inherit; font-weight: 600;
  cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.back-to-top:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cc-attn-count {
  display: inline-block; min-width: 1.4em; padding: 0 6px; margin-left: 6px; border-radius: 999px;
  background: rgba(240, 180, 41, .25); color: var(--warn); font-size: 12px; font-weight: 700; vertical-align: middle;
}
.cc-upnext { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 14px; padding: 8px 14px; }
.cc-upnext strong { margin: 0; }
.cc-upnext .cc-list { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 0; padding: 0; list-style: none; }
.cc-upnext .cc-list li { white-space: nowrap; }
.modal { background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line); }
.dir-row:hover, .dir-row:focus { background: rgba(62, 198, 255, .1); }
.dir-row.selected { background: rgba(62, 198, 255, .16); }
.msg.bot { background: rgba(18, 26, 46, .9); border-color: var(--line); }
.board-col { background: rgba(8, 14, 28, .55); border-color: var(--line); }
.board-card { background: rgba(18, 26, 46, .92); border-color: var(--line); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.remote-login { max-width: 24rem; margin: 2rem auto; padding: 1rem; box-sizing: border-box; }
.remote-login form { display: flex; flex-direction: column; gap: 8px; }
.remote-login input, .remote-login button { font-size: 16px; width: 100%; box-sizing: border-box; }

/* Sales document intake drop zone (Knowledge, company, and deal pages). */
.proposal-drop {
  border: 2px dashed var(--line, #d0d7de); border-radius: 8px; padding: 28px 16px; text-align: center;
  margin: 8px 0 12px; background: rgba(8, 14, 28, .25); cursor: pointer;
}
.proposal-drop:hover, .proposal-drop:focus { border-color: var(--focus, #1f6feb); outline: none; }
.proposal-drop.drag-over { border-color: #1f6feb; background: rgba(31, 111, 235, .12); }
.proposal-drop input[type="file"] { display: block; margin: 10px auto 0; max-width: 100%; }

.deal-change-orders { margin-top: 10px; }
.deal-change-orders table { width: 100%; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.attn-count { display: inline-block; min-width: 1.2em; padding: 0 6px; border-radius: 999px; background: var(--warn); color: #1a1408; font-size: 12px; font-weight: 700; }
.attn-panel { min-width: 18rem; max-width: 24rem; padding: 8px 12px; }
.attn-item { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin: 6px 0; }
.attn-item a { min-height: 44px; display: inline-flex; align-items: center; }
.dir-row { min-height: 44px; }
.dir-age-30 strong { color: #c5cedd; }
.dir-age-90 strong { color: #b0bacb; }
.dir-age-365 strong { color: #9aa6bb; }
.cal-head, .cal-nav, .cal-switch { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-head { justify-content: space-between; }
.cal-switch a, .cal-slot button, .cal-date { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.cal-switch a[aria-current="true"] { font-weight: 700; text-decoration: underline; }
.cal-workspace { display: grid; grid-template-columns: minmax(0, 65%) minmax(16rem, 35%); gap: 16px; }
.cal-month { width: 100%; table-layout: fixed; }
.cal-month td { vertical-align: top; height: 6.5rem; border: 1px solid var(--line); padding: 2px; }
.cal-month td.today { outline: 2px solid var(--focus); }
.cal-month td.out { opacity: .55; }
.cal-chip { display: flex; gap: 4px; align-items: center; margin: 2px 0; padding: 2px 4px; border-radius: 4px; text-decoration: none; color: var(--ink); }
.cal-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #3ec6ff; }
.cal-work { background: rgba(62, 198, 255, .18); }
.cal-personal { background: rgba(186, 154, 255, .22); }
.cal-personal .cal-dot, .cal-dot.cal-personal { background: #ba9aff; }
.cal-tentative, .cal-proposed { background: rgba(240, 180, 41, .2); }
.cal-tentative .cal-dot, .cal-proposed .cal-dot, .cal-dot.cal-tentative, .cal-dot.cal-proposed { background: #f0b429; }
.cal-allday { font-weight: 600; }
.cal-slot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 44px; border-top: 1px solid var(--line); }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
#event-modal, #attn-dismiss { padding: 16px; max-width: 28rem; width: calc(100% - 24px); }
@media (max-width: 800px) {
  .cal-workspace, .cal-week { grid-template-columns: 1fr; }
  .cal-chip-label { display: none; }
  .cal-month td { height: auto; min-height: 44px; }
}

