/* CompanyCurrent: navy / blue / white with restrained gold. System fonts only (no external requests). */
:root {
  --navy: #0b1f3a; --navy-2: #13294b; --blue: #1f5fbf; --blue-ink: #174a96; --blue-wash: #eaf1fb;
  --gold: #b8902f; --gold-wash: #f7f0de; --ink: #14213d; --muted: #52627a; --line: #d8e0ea; --bg: #f6f8fb; --white: #fff;
  --ok: #1d7a4f; --ok-wash: #e6f4ec; --warn: #8a5a00; --warn-wash: #fff4dc; --bad: #a3262e; --bad-wash: #fbe9ea;
  --radius: 10px; --shadow: 0 1px 2px rgba(11, 31, 58, .06), 0 4px 16px rgba(11, 31, 58, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--blue-ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.boot { padding: 48px; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #dbe5f3; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); font-weight: 700; letter-spacing: .2px; font-size: 17px; padding: 4px 8px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--blue), var(--navy-2)); border: 1px solid var(--gold); display: grid; place-items: center; font-size: 13px; color: var(--gold); }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a { display: block; padding: 9px 12px; border-radius: 8px; color: #dbe5f3; text-decoration: none; }
.nav a:hover { background: var(--navy-2); color: var(--white); }
.nav a[aria-current="page"] { background: var(--navy-2); color: var(--white); box-shadow: inset 3px 0 0 var(--gold); }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8fa3c0; padding: 10px 12px 4px; }
.side-foot { margin-top: auto; font-size: 13px; color: #b8c6da; padding: 8px 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-foot strong { color: var(--white); }
.main { padding: 28px clamp(16px, 4vw, 44px) 64px; max-width: 1180px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
h1 { font-size: 24px; margin: 0; color: var(--navy); letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; color: var(--navy); }
h3 { font-size: 15px; margin: 0 0 6px; }
.lede { color: var(--muted); margin: 4px 0 0; }

/* Cards, grid, stats */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-size: 30px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat.gold .n { color: var(--gold); }

/* Forms */
form.stack, .stack { display: grid; gap: 12px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
label { font-weight: 600; font-size: 13px; color: var(--ink); display: grid; gap: 5px; }
.hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid #b9c6d6; border-radius: 8px; background: var(--white); color: var(--ink); width: 100%; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 3px solid rgba(31, 95, 191, .25); }
.btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 16px; border: 1px solid var(--blue); background: var(--blue); color: var(--white); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center; text-decoration: none; }
.btn:hover { background: var(--blue-ink); }
.btn.secondary { background: var(--white); color: var(--blue-ink); }
.btn.secondary:hover { background: var(--blue-wash); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue-ink); padding: 6px 10px; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Badges, lists, tables */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.b-known { background: var(--ok-wash); color: var(--ok); border-color: #b6dfc8; }
.b-inferred { background: var(--warn-wash); color: var(--warn); border-color: #f0d79a; }
.b-flag { background: var(--bad-wash); color: var(--bad); border-color: #efc2c5; }
.b-muted { background: #eef2f7; color: var(--muted); border-color: var(--line); }
.b-gold { background: var(--gold-wash); color: #7a5d16; border-color: #e8d6a6; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.events { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.event { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--white); }
.event .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.event.unread { border-left: 4px solid var(--gold); }
.nav .count { display: inline-block; margin-left: 8px; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--navy); font-size: 12px; font-weight: 700; text-align: center; line-height: 20px; }
.btn.ghost[aria-current="page"] { background: var(--blue-wash); }
.event .claim { font-size: 15px; margin: 0 0 8px; }
.event blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--gold); background: var(--bg); color: #33435c; font-size: 13.5px; }
.script { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 14px; margin: 8px 0; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty h3 { color: var(--navy); }
.note { background: var(--blue-wash); border: 1px solid #c9daf3; border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
.note.warn { background: var(--warn-wash); border-color: #f0d79a; }
.error { color: var(--bad); font-weight: 600; }
.event .error:empty { display: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { font: inherit; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--gold); }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f6f8fb 37%, #eef2f7 63%); background-size: 400% 100%; animation: sk 1.2s ease infinite; border-radius: 8px; height: 18px; margin: 8px 0; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--navy); color: var(--white); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); border-left: 4px solid var(--gold); max-width: 360px; }

/* Auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, #1d3e70 100%); }
.auth .card { width: min(440px, 100%); padding: 28px; }
.auth .brand { color: var(--navy); padding: 0 0 12px; }
.auth .brand-mark { color: var(--gold); }
.foot-links { display: flex; justify-content: space-between; font-size: 13.5px; margin-top: 8px; flex-wrap: wrap; gap: 8px; }

/* Responsive: sidebar becomes a top bar */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side > nav { width: 100%; min-width: 0; }
  .main { min-width: 0; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 8px; position: sticky; top: 0; z-index: 5; }
  .nav { display: flex; overflow-x: auto; gap: 2px; width: 100%; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .nav-group, .side-foot { display: none; }
}
@media print { .side, .actions, .btn { display: none !important; } .shell { display: block; } }

/* Utilities (no inline styles: strict CSP) */
.mt { margin-top: 16px; }
.mt-s { margin-top: 12px; }
.narrow { max-width: 180px; }
.offscreen { position: fixed; left: -9999px; }
.auth .card.wide { width: min(620px, 100%); }
td > .badge { white-space: normal; margin: 2px 4px 2px 0; }

.feedback-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.feedback summary { cursor: pointer; color: var(--blue-ink); font-size: 13px; font-weight: 600; }
.feedback summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.check input[type=checkbox] { width: auto; flex: none; margin: 0; }

/* Sales profile, report identity, collection summary and sales brief. */
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; }
legend { font-weight: 600; padding: 0 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; }
.checks .check { font-weight: 400; }
.facts { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 4px 14px; margin: 8px 0; font-size: 13.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.collection summary { cursor: pointer; font-weight: 600; color: var(--blue-ink); }
.collection ul { margin: 8px 0; padding-left: 18px; font-size: 13.5px; }
.brief-section { border-top: 1px solid var(--line); padding-top: 12px; }
.brief-section h3, .brief-section h4 { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } }

/* Continue with Google (Google's branding: white button, multicolour G, dark text). */
.btn.google { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%23EA4335' d='M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z'/%3E%3Cpath fill='%234285F4' d='M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z'/%3E%3Cpath fill='%23FBBC05' d='M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z'/%3E%3Cpath fill='%2334A853' d='M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z'/%3E%3C/svg%3E") no-repeat 14px center / 18px 18px; color: #1f1f1f; border: 1px solid #747775; padding-left: 44px; justify-content: center; text-decoration: none; font-weight: 600; }
.btn.google:hover { background-color: #f2f2f2; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

/* Seller-specific suggestion: visibly separate from the observed facts. */
.hypothesis { border-left: 3px solid var(--gold, #c9a227); padding: 4px 0 4px 10px; margin: 6px 0; font-size: 14px; }

.card.highlight { border: 2px solid var(--gold, #c9a227); }

/* ---------------------------------------------------------------- Workspaces (navigation redesign) */
.side nav + nav { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; }
.nav-primary a { padding: 11px 12px; }
.nav-primary .nav-label { font-weight: 700; font-size: 15.5px; color: inherit; }
.nav-sub { display: block; font-size: 12px; color: #9fb1cb; margin-top: 2px; line-height: 1.35; }
.nav-primary a[aria-current="page"] .nav-sub { color: #c9d6ea; }
.nav-secondary a { font-size: 14px; padding: 7px 12px; color: #b8c6da; }
.workspace > .ws-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.ws-head h1 { font-size: 28px; }
.ws-head .lede { font-size: 15.5px; max-width: 62ch; }
.tabs a { display: inline-block; padding: 9px 14px; color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--navy); }
.tabs a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--gold); }
.workspace > .note { margin: 0 0 14px; }
.center { justify-content: center; }
.label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 0 0 4px; }
.strong { font-weight: 600; margin: 0; }
.stack-s { display: grid; gap: 6px; justify-items: start; }

/* Search panel: three plain filters and one button; the rest folds away. */
.search-panel { border-top: 3px solid var(--navy); }
.search-row { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; }
.search-go { display: flex; align-items: end; }
.search-go .btn { min-height: 41px; padding: 9px 22px; }
.more-filters summary { cursor: pointer; color: var(--blue-ink); font-weight: 600; font-size: 14px; }

/* Result cards: observed facts on the left, the (labelled) suggestion on the right, then actions. */
.results { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 14px; }
.result { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 12px; }
.result-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-head h3 { font-size: 17px; color: var(--navy); margin: 0; }
.result-head .hint { margin: 2px 0 0; }
.result-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.result-body > div { border-radius: 8px; padding: 10px 12px; }
.result-body p { margin: 0 0 4px; }
.result .fact { background: var(--bg); border: 1px solid var(--line); }
.result .why { background: var(--gold-wash); border: 1px solid #e8d6a6; }
.result .next { margin: 0; font-size: 14px; }
.why-cell { margin: 0; font-size: 13.5px; max-width: 34ch; border-left: 3px solid var(--gold); padding-left: 8px; }
.portfolio td { font-size: 14px; }

/* First run: two clear choices. */
.start { max-width: 880px; margin: 24px auto 0; text-align: center; }
.start h1 { font-size: 30px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; text-align: left; }
.choice { display: flex; flex-direction: column; gap: 10px; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--navy); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.choice:hover, .choice:focus-visible { border-top-color: var(--gold); transform: translateY(-2px); }
.choice h2 { font-size: 21px; margin: 0; }
.choice p { margin: 0; color: var(--muted); flex: 1; }
.choice .btn { align-self: flex-start; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two-col > .card + .card { margin-top: 0; }
details.card summary { cursor: pointer; font-weight: 600; color: var(--navy); }
@media (prefers-reduced-motion: reduce) { .choice { transition: none; } .choice:hover { transform: none; } }

@media (max-width: 860px) {
  .nav-sub { display: none; }
  .side nav + nav { border-top: 0; padding-top: 0; }
  .nav-primary a { padding: 8px 12px; }
  .nav-primary .nav-label { font-size: 15px; }
  .nav-secondary a { padding: 5px 10px; font-size: 13px; }
  .ws-head h1, .start h1 { font-size: 23px; }
  .ws-head .actions { width: 100%; }
  /* Every tab stays visible on a phone: wrap onto a second line rather than scroll sideways. */
  .tabs { flex-wrap: wrap; }
  .tabs a { white-space: nowrap; padding: 8px 10px; }
  .search-row, .result-body, .choices, .two-col { grid-template-columns: minmax(0, 1fr); }
  .search-go .btn { width: 100%; }
  .brand { width: 100%; }
}
.search-panel .error:empty, .result .error:empty, .result > div:empty, .card > .error:empty { display: none; }
.result .error, .search-panel .error { margin: 0; }
/* Grid stacks never grow wider than their container (wide tables scroll inside .table-wrap instead). */
form.stack, .stack { grid-template-columns: minmax(0, 1fr); }

/* Find companies: industry chips, coverage, result summary, three-part result cards. */
fieldset.plain { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.plain legend { font-weight: 600; font-size: 13px; color: var(--ink); padding: 0; margin-bottom: 6px; }
fieldset.plain .actions input[type=number] { max-width: 120px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-wash); color: var(--navy); border: 1px solid #c9daf3; border-radius: 999px; padding: 4px 4px 4px 12px; font-size: 13.5px; font-weight: 600; }
.chip-x { font: inherit; border: 0; background: transparent; color: var(--blue-ink); cursor: pointer; width: 26px; height: 26px; border-radius: 999px; font-size: 16px; line-height: 1; }
.chip-x:hover { background: #d7e5f8; }
.search-panel select[aria-label="Add an industry or trade"] { max-width: 360px; }
.result-summary { margin: 4px 0 10px; }
.result-summary .strong { font-size: 17px; color: var(--navy); }
.result-summary p { margin: 0 0 2px; }
.coverage { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0 14px; display: grid; gap: 10px; }
.coverage p { margin: 0 0 4px; }
.result-body.three { grid-template-columns: 1fr 1fr 1fr; }
.result .why.muted { background: var(--bg); border: 1px dashed var(--line); }
@media (max-width: 860px) { .result-body.three { grid-template-columns: minmax(0, 1fr); } }

/* The hidden attribute always wins over layout classes (e.g. a collapsed form with class "actions"). */
[hidden] { display: none !important; }
