/* Ascendo control panel (13 Oct 2026).

   Every colour is a variable rendered from brand/tokens.py (panel_style.py);
   no hex value appears here, and tests/test_panel_brand.py fails the build if
   one does. The kit rules this file keeps:
   - Crimson is never set on Midnight (2.94:1 fails at every size). Small
     labels on the Midnight sidebar use Blush Tint, the kit-recorded colour
     for exactly that.
   - Mist, Line and Paper are grounds and rules, never text.
   - Inter throughout. Body 15px (the kit's floor); nothing under 14px; no
     capitals for labels.
   - Focus outlines are never removed: 3px Midnight, 2px offset (white on the
     sidebar).
   - Controls at least 44px tall. Corners: inputs 4px, buttons 8px, cards 12px.
*/

/* ---- base ------------------------------------------------------------ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font);
       font-size: 15px; line-height: 24px; font-feature-settings: "cv11", "ss01";
       -webkit-font-smoothing: antialiased; }
a { color: var(--midnight); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--midnight); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden;
                   clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--white);
        color: var(--midnight); padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 12px; }
/* A link to a section (#log, #timeline) lands below the sticky bar. */
main [id] { scroll-margin-top: 80px; }
.icon { flex: 0 0 auto; vertical-align: middle; }

/* ---- shell ----------------------------------------------------------- */
/* minmax(0, 1fr), not 1fr: a plain 1fr column grows to its widest content,
   so the pipeline board or a wide table pushed the page sideways. */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.nav-toggle, .topbar, .scrim { display: none; }
.workspace { display: flex; flex-direction: column; min-width: 0; }
main { width: 100%; max-width: 1180px; padding: 28px 32px 64px; min-width: 0; }

/* ---- sidebar (Midnight) ---------------------------------------------- */
.side { background: var(--midnight); color: var(--white); position: sticky; top: 0;
        height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side :focus-visible { outline: 3px solid var(--white); outline-offset: 2px; }
.side__brand { padding: 22px 20px 18px; border-bottom: 1px solid var(--hover); }
.side__logo { width: 150px; height: auto; display: block; }
.side__sub { display: block; margin-top: 10px; color: var(--blush); font-size: 14px;
             font-weight: 600; line-height: 20px; }
.side__group { padding: 14px 10px 2px; }
.side__label { color: var(--blush); font-size: 14px; font-weight: 600; line-height: 20px;
               padding: 0 10px 6px; }
.side__item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 10px;
              margin: 1px 0; border-radius: 8px; color: var(--white); text-decoration: none;
              font-weight: 500; line-height: 20px; }
.side__item:hover { background: var(--hover); color: var(--white); }
.side__item:active { background: var(--pressed); }
.side__item.is-active { background: var(--white); color: var(--midnight); font-weight: 700; }
.side__text { flex: 1; min-width: 0; }
.side__meta { display: block; color: var(--blush); font-size: 14px; font-weight: 500; line-height: 18px;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__item.is-active .side__meta { color: var(--muted); }
.side__count { margin-left: auto; background: var(--blush); color: var(--midnight); font-size: 14px;
               font-weight: 700; line-height: 20px; border-radius: 999px; padding: 1px 9px;
               white-space: nowrap; }
.side__foot { margin-top: auto; padding: 16px 20px 20px; border-top: 1px solid var(--hover);
              font-size: 14px; line-height: 20px; }
.side__user strong { color: var(--white); }
.side__role { display: block; color: var(--blush); font-weight: 600; }
.side__signout { margin-top: 10px; background: transparent; color: var(--white);
                 border: 1px solid var(--blush); min-height: 40px; padding: 0 14px; font-size: 14px; }
.side__signout:hover { background: var(--hover); }

/* ---- header ---------------------------------------------------------- */
.hdr { position: sticky; top: 0; z-index: 10; height: 64px; display: flex; align-items: center;
       gap: 16px; padding: 0 32px; background: var(--white); border-bottom: 1px solid var(--line); }
.hdr__crumbs { min-width: 0; font-size: 14px; line-height: 20px; color: var(--muted);
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr__crumbs a { color: var(--steel); font-weight: 600; text-decoration: none; }
.hdr__crumbs a:hover { text-decoration: underline; }
.hdr__here { color: var(--ink); font-weight: 600; }
.hdr__search { margin-left: auto; position: relative; width: min(340px, 40vw); }
.hdr__search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
                     color: var(--muted); pointer-events: none; }
.hdr__search input[type=search] { padding-left: 40px; background: var(--paper); min-height: 40px; }
.hdr__me { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: var(--midnight);
           color: var(--white); display: grid; place-items: center; font-size: 14px; font-weight: 700; }

/* ---- type ------------------------------------------------------------ */
h1 { font-size: 24px; line-height: 30px; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 6px;
     display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 17px; line-height: 24px; font-weight: 700; margin: 28px 0 10px; color: var(--ink); }
h3 { font-size: 15px; line-height: 24px; font-weight: 700; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 8px; max-width: 72ch; }
.help { font-weight: 400; color: var(--muted); font-size: 14px; line-height: 21px; margin-top: 4px; }
code { background: var(--mist); color: var(--ink); padding: 1px 6px; border-radius: 4px;
       font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
pre { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px;
      font-size: 14px; overflow-x: auto; }

/* ---- page header (ui.page_header) ------------------------------------ */
.ph { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ph__text { flex: 1 1 360px; min-width: 0; }
.ph__text .sub { margin: 0; }
.ph__actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ph__actions form { margin: 0; }

/* ---- surfaces ---------------------------------------------------------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 12px;
        padding: 20px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stat { font-size: 28px; line-height: 32px; font-weight: 700; color: var(--midnight); }
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; white-space: pre-wrap;
         background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--midnight); }
.flash.error { border-left-color: var(--crimson); }
.empty { color: var(--muted); margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---- forms ------------------------------------------------------------- */
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=email],
input[type=date], input[type=url], textarea, select {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px;
  font: inherit; color: var(--ink); background: var(--white); }
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--midnight); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--midnight);
                                          vertical-align: -3px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.row > * { flex: 1; min-width: 0; }
.row.tight { align-items: center; }
.row.tight > button, .row.tight > .btn { flex: 0 0 auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* ---- buttons ----------------------------------------------------------- */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
               min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--midnight);
               background: var(--midnight); color: var(--white); font: inherit; font-weight: 600;
               line-height: 20px; cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { background: var(--ink); border-color: var(--ink); color: var(--white); }
button.secondary, .btn.secondary { background: var(--white); color: var(--midnight); }
button.secondary:hover, .btn.secondary:hover { background: var(--mist); color: var(--midnight);
                                               border-color: var(--midnight); }
button.danger, .btn.danger { background: var(--crimson); border-color: var(--crimson); }
button.danger:hover, .btn.danger:hover { background: var(--ink); border-color: var(--ink); }
button.link { background: none; border: 0; color: var(--steel); padding: 0; min-height: 44px; }
button.link:hover { color: var(--midnight); text-decoration: underline; background: none; }
button:disabled { opacity: .55; cursor: not-allowed; }

/* ---- tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; background: var(--mist); color: var(--ink); font-size: 14px; font-weight: 600;
     line-height: 20px; padding: 10px 12px; }
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

/* ---- status tags (ui.tag; .badge on older markup). Always words. -------- */
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px;
         border: 1px solid transparent; font-size: 14px; font-weight: 600; line-height: 22px;
         white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.blocked { background: var(--wait-bg); color: var(--wait); }
.badge.err { background: var(--white); color: var(--crimson); border-color: var(--crimson); }
.badge.neutral { background: var(--mist); color: var(--midnight); }
/* Sentence case for every status, whatever the template wrote ("waiting on
   setup" reads "Waiting on setup"): the kit's labels are sentence case. The
   markup keeps its words, so nothing that reads them changes. */
.badge::first-letter { text-transform: uppercase; }
a.badge { text-decoration: none; }
a.badge.neutral:hover { border-color: var(--midnight); }

/* ---- figures (ui.stat) -------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px;
        margin-bottom: 20px; }
.kpi { display: block; background: var(--white); border: 1px solid var(--line); border-radius: 12px;
       padding: 16px 18px; color: var(--ink); text-decoration: none; }
a.kpi:hover { border-color: var(--midnight); color: var(--ink); }
.kpi__label { display: block; color: var(--muted); font-size: 14px; font-weight: 600; line-height: 20px; }
.kpi__value { display: block; margin-top: 6px; font-size: 28px; line-height: 32px; font-weight: 700;
              color: var(--midnight); font-variant-numeric: tabular-nums; }
.kpi__note { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; line-height: 20px; }

/* ---- "Needs you" (ui.attention_row). Crimson's one job. ----------------- */
.panel-card { background: var(--white); border: 1px solid var(--line); border-radius: 12px;
              margin-bottom: 16px; overflow: hidden; }
.panel-card__head { display: flex; align-items: center; gap: 8px; padding: 14px 18px;
                    border-bottom: 1px solid var(--line); font-size: 17px; line-height: 24px;
                    font-weight: 700; margin: 0; }
.panel-card__head .count { color: var(--crimson); }
.panel-card__head a { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--steel);
                      text-decoration: none; }
.panel-card__body { padding: 4px 18px 8px; }
.attn, .line-row { display: flex; align-items: center; gap: 14px; padding: 12px 0;
                   border-top: 1px solid var(--line); }
.attn:first-child, .line-row:first-child { border-top: 0; }
.attn__mark { width: 4px; align-self: stretch; border-radius: 2px; background: var(--crimson);
              flex: 0 0 4px; }
.attn__text, .line-row__text { flex: 1; min-width: 0; }
.attn__text strong, .line-row__text strong { display: block; font-weight: 600; }
.attn__text .help, .line-row__text .help { margin: 0; }
.btn-sm { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 8px;
          background: var(--midnight); color: var(--white); font-weight: 600; text-decoration: none;
          white-space: nowrap; }
.btn-sm:hover { background: var(--ink); color: var(--white); }
.overview { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px;
            align-items: start; }

/* ---- disclosure cards ---------------------------------------------------- */
details.card > summary { cursor: pointer; list-style: none; font-weight: 600; min-height: 24px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "+"; display: inline-block; width: 20px; font-weight: 700;
                                 color: var(--midnight); }
details.card[open] > summary::before { content: "–"; }
details.card[open] > summary { margin-bottom: 12px; }

/* ---- agent chat ----------------------------------------------------------- */
.msg { padding: 10px 14px; border-radius: 12px; margin-bottom: 8px; max-width: 80%; }
.msg.user { background: var(--mist); margin-left: auto; }
.msg.assistant { background: var(--paper); border: 1px solid var(--line); white-space: pre-wrap; }
.chat__thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; max-height: 560px;
                overflow-y: auto; padding-right: 4px; }
.chat .msg { max-width: 86%; margin: 0; white-space: normal; }
.chat .flash { white-space: normal; }
.chat .msg.user { align-self: flex-end; }
.chat .msg.assistant { align-self: flex-start; }
.msg__who { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.msg__text { white-space: pre-wrap; }
.draft-card { margin-top: 10px; padding: 10px 12px; background: var(--white); border: 1px solid var(--line);
              border-radius: 8px; display: flex; gap: 12px; align-items: center;
              justify-content: space-between; flex-wrap: wrap; }
.chat__form textarea { min-height: 64px; margin-bottom: 8px; }

/* ---- phones and small tablets ------------------------------------------- */
@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
            background: var(--midnight); color: var(--white); padding: 8px 10px; min-height: 56px; }
  .topbar :focus-visible { outline: 3px solid var(--white); outline-offset: 2px; }
  .topbar__logo { width: 120px; height: auto; margin-right: auto; }
  .topbar__btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px;
                 color: var(--white); cursor: pointer; }
  .topbar__btn:hover { background: var(--hover); color: var(--white); }
  .side { position: fixed; left: 0; top: 0; z-index: 40; width: min(300px, 86vw); height: 100%;
          transform: translateX(-100%); transition: transform .2s ease; }
  .nav-toggle:checked ~ .shell .side { transform: none; }
  .nav-toggle:checked ~ .shell .scrim { display: block; position: fixed; inset: 0; z-index: 30;
                                        background: var(--ink); opacity: .45; }
  .hdr { display: none; }
  main { padding: 20px 16px 48px; }
  h1 { font-size: 22px; line-height: 28px; }
  .row { flex-wrap: wrap; }
  .row > * { flex: 1 1 220px; }
  .overview { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi__value { font-size: 24px; line-height: 28px; }
  .card { padding: 16px; }
  .msg, .chat .msg { max-width: 100%; }
  /* A wide table scrolls inside its own box rather than pushing the page
     sideways: every table, so a screen added later is covered too. */
  main table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (prefers-reduced-motion: reduce) {
  .side { transition: none; }
}

/* ---- notices: something is missing or needs doing ---------------------- */
.notice { border-left: 4px solid var(--wait); }
.notice ul { margin: 8px 0 0 18px; padding: 0; }

/* ---- pipeline board ------------------------------------------------------ */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board .col { flex: 0 0 248px; background: var(--mist); border-radius: 12px; padding: 10px; }
.board .col.closed { background: var(--paper); border: 1px solid var(--line); }
.board .col h3 { margin: 2px 4px 8px; font-size: 14px; font-weight: 600; line-height: 20px;
                 display: flex; justify-content: space-between; color: var(--ink); }
.board .deal { display: block; background: var(--white); border: 1px solid var(--line); border-radius: 8px;
               padding: 10px 12px; margin-bottom: 8px; text-decoration: none; color: var(--ink); }
.board .deal:hover { border-color: var(--midnight); color: var(--ink); }
.board .deal strong { display: block; font-size: 15px; line-height: 22px; }
.board .deal .help { margin: 2px 0 0; }
.board .tag { font-size: 14px; font-weight: 600; line-height: 20px; border-radius: 999px; padding: 0 8px;
              background: var(--mist); color: var(--midnight); border: 1px solid var(--mist); }
.board .tag.ind { background: var(--white); border-color: var(--line); color: var(--ink); }

/* ---- deal timeline --------------------------------------------------------- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { border-left: 2px solid var(--line); padding: 4px 0 14px 18px; position: relative; }
.tl li::before { content: ""; position: absolute; left: -8px; top: 9px; width: 14px; height: 14px;
                 border-radius: 50%; background: var(--white); border: 2px solid var(--muted); }
.tl li.linkedin::before { border-color: var(--steel); }
.tl li.stage::before, .tl li.assigned::before, .tl li.research::before { border-color: var(--midnight); }
.tl li.stage::before { background: var(--midnight); }
.tl .when { font-size: 14px; line-height: 20px; color: var(--muted); }
.tl .text { white-space: pre-wrap; margin-top: 2px; }

@media (max-width: 899px) {
  .board { flex-direction: column; overflow-x: visible; }
  .board .col { flex: none; width: 100%; }
}

/* Names that open their record: ink, underlined only on hover. */
.line-row__text strong a, .attn__text strong a { color: var(--ink); text-decoration: none; }
.line-row__text strong a:hover, .attn__text strong a:hover { color: var(--midnight); text-decoration: underline; }

/* ---- search page ------------------------------------------------------------ */
.search-page__form { margin-bottom: 20px; max-width: 640px; }
@media (min-width: 900px) { .search-page__form { display: none; } }   /* the header has the box */

/* ---- filter chips (which records a list shows) ------------------------------ */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
        border: 1px solid var(--line); background: var(--white); color: var(--ink); font-weight: 600;
        text-decoration: none; }
.chip:hover { border-color: var(--midnight); color: var(--midnight); }
.chip.is-on { background: var(--midnight); border-color: var(--midnight); color: var(--white); }

/* ---- My leads (a salesperson's phone-first list) --------------------------- */
.lead-group { margin-bottom: 8px; }
.lead-group h2 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.lead-group h2 .help { margin: 0; font-weight: 400; }
.lead-card { background: var(--white); border: 1px solid var(--line); border-radius: 12px;
             padding: 14px 16px; margin-bottom: 10px; max-width: 760px; }
.lead-card.is-overdue { border-left: 5px solid var(--crimson); }
.lead-card__top { display: flex; align-items: flex-start; gap: 12px; }
.lead-card__who { flex: 1; min-width: 0; }
.lead-card__who h3 { margin: 0; font-size: 17px; line-height: 24px; }
.lead-card__who h3 a { color: var(--ink); text-decoration: none; }
.lead-card__who h3 a:hover { color: var(--midnight); text-decoration: underline; }
.lead-card__who .help { margin: 0; }
.lead-card__due { margin: 8px 0 0; }
.lead-card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.lead-card__actions .btn { flex: 1 1 90px; }

/* ---- a salesperson's tab bar: phones only ---------------------------------- */
.tabbar { display: none; }
@media (max-width: 899px) {
  .tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0;
            bottom: 0; z-index: 25; background: var(--white); border-top: 1px solid var(--line);
            padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar__item { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px;
                  justify-content: center; color: var(--muted); font-size: 14px; font-weight: 600;
                  text-decoration: none; border-radius: 8px; }
  .tabbar__item.is-on { color: var(--midnight); }
  main.has-tabbar { padding-bottom: 96px; }
}

/* ---- Team: a salesperson's course areas (Hiring agent routing) -------------- */
.areas { margin-top: 6px; }
.areas summary { cursor: pointer; margin: 0; }
.areas__list { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0; }
.areas__list label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; min-height: 32px; }
/* ---- segmented choice (Log contact: call, email or meeting) ----------------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 8px;
       overflow: hidden; margin: 0 0 16px; padding: 0; }
.seg__opt { position: relative; margin: 0; font-weight: 600; }
.seg__opt + .seg__opt { border-left: 1px solid var(--line); }
.seg__opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg__opt span { display: grid; place-items: center; min-height: 44px; }
.seg__opt input:checked + span { background: var(--midnight); color: var(--white); }
.seg__opt input:focus-visible + span { outline: 3px solid var(--midnight); outline-offset: -3px; }
