/* Desktop office view — same Jedd Social-derived palette as the phone app. */
:root {
  --canvas: #f6f4ef; --card: #fff; --ink: #253b57; --ink-strong: #12305a; --muted: #5b6676; --line: #e5e7df;
  --brand: #2b7d64; --brand-dark: #1f6650; --forest: #12305a; --sage: #52a087; --sage-wash: #e9f4ef;
  --cream: #fffaf0; --sand: #e9d9b4; --gold: #7d5b1f;
  --red: #b9452c; --red-bg: #fdefe9; --red-line: #f1cbbd;
  --amber: #7d5b1f; --amber-bg: #fffaf0; --amber-line: #e9d9b4;
  --green: #2b7d64; --green-bg: #ecf5f0; --green-line: #bfe0d3;
  --blue: #436e60; --blue-bg: #f0f3ea; --blue-line: #dedfd5;
  --shadow: 0 1px 3px rgb(20 20 30 / 4%), 0 8px 24px -8px rgb(20 20 30 / 8%);
  --display: 'Schibsted Grotesk', 'Instrument Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'Instrument Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; color: var(--ink-strong); letter-spacing: -0.015em; }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100%; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 24px 18px; display: flex; flex-direction: column; gap: 6px;
  background: var(--sage); color: #fff;
}
.side-logo { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 22px; }
.logo-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--sand); }
.side-agency { margin: 2px 0 22px 22px; font-size: 12px; color: var(--brand-dark); font-weight: 600; }
.side-nav { display: grid; gap: 4px; }
.side-nav a { padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--ink); }
.side-nav a:hover { background: rgb(255 255 255 / 45%); color: var(--ink-strong); }
.side-nav a.on { background: #fff; color: var(--brand-dark); }
.side-phone { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--sand); color: var(--ink-strong); font-weight: 800; font-size: 14px; text-align: center; }
.side-note { font-size: 11px; color: var(--ink); line-height: 1.5; margin: 10px 2px 0; }

.main { padding: 32px 40px 60px; max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 34px; font-weight: 800; }
.eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.lead { color: var(--muted); font-size: 15px; line-height: 1.55; margin: 8px 0 16px; max-width: 640px; }
.lead strong { color: var(--ink-strong); }
.muted { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.hint.center { text-align: center; margin-top: 18px; }

.btn {
  display: inline-block; cursor: pointer; text-align: center; white-space: nowrap;
  border: 1.5px solid var(--line); background: var(--card); padding: 11px 18px; border-radius: 12px; font-weight: 700; font-size: 14px;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.small { padding: 5px 10px; font-size: 12px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); display: grid; gap: 4px; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; }
.stat strong { font-family: var(--display); font-size: 34px; font-weight: 800; color: var(--ink-strong); }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat.red::after { background: var(--red); } .stat.red strong { color: var(--red); }
.stat.amber::after { background: #c9a35c; } .stat.amber strong { color: var(--gold); }
.stat.blue::after { background: var(--sage); }
.stat.green::after { background: var(--brand); } .stat.green strong { color: var(--brand); }

/* panels + tables */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.panel-head h2 { font-size: 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }
.table td strong { color: var(--ink-strong); }
.table.compact td { padding: 10px 12px; }
.table tr.dim td { opacity: 0.6; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; }
.badge.red { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.badge.amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.badge.green { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.badge.blue { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-line); }
.source { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 8px; background: var(--blue-bg); color: var(--blue); }
.source.rex, .source.csv { background: var(--sage-wash); color: var(--brand-dark); }
.source.contract, .source.auto-filled { background: var(--cream); color: var(--gold); border: 1px solid var(--sand); }

/* add listing */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 9px 16px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--sage-wash); color: var(--brand-dark); }
.add-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.form { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fld { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-strong); }
.fld em { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand); background: var(--sage-wash); padding: 2px 6px; border-radius: 6px; margin-left: 4px; }
.fld input, .fld select, .input { width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 14px; font-weight: 500; }
.fld input:focus, .fld select:focus, .input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.fld.filled input, .fld.filled select { background: var(--sage-wash); border-color: var(--green-line); }
.seg { display: inline-flex; gap: 4px; padding: 4px; border: 1.5px solid var(--line); border-radius: 12px; width: fit-content; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--brand); color: #fff; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.notice { background: var(--cream); border: 1px solid var(--sand); color: var(--gold); padding: 12px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; line-height: 1.5; margin-bottom: 4px; }
.notice strong { color: var(--ink-strong); }
.warn-line { margin: 0; color: var(--red); font-size: 13px; font-weight: 600; }
.inline { display: flex; gap: 10px; }

.preview {
  border-radius: 14px; padding: 22px; color: var(--ink); position: relative; overflow: hidden;
  background: var(--sage-wash); border: 1px solid var(--green-line); border-top: 4px solid var(--brand);
}
.preview .eyebrow { color: var(--brand-dark); }
.preview h3 { color: var(--ink-strong); font-size: 20px; margin-bottom: 14px; position: relative; }
.pv { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; position: relative; }
.pv li { background: #fff; border-radius: 10px; padding: 10px 12px; border-left: 3px solid var(--sage); }
.pv li.amber { border-left-color: #c9a35c; background: var(--cream); }
.pv li.red { border-left-color: var(--red); background: var(--red-bg); }
.pv strong { display: block; font-size: 13px; color: var(--ink-strong); }
.pv small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.preview .hint { color: var(--muted); margin: 14px 0 0; position: relative; }

.address { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--sage-wash); border: 1px solid var(--green-line); font-family: ui-monospace, monospace; font-weight: 700; color: var(--brand-dark); margin-bottom: 14px; }
.email { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; background: #fcfbf8; }
.email-meta { margin: 0 0 10px; font-size: 13px; line-height: 1.6; }
.email pre { margin: 0; font-family: inherit; font-size: 13px; white-space: pre-wrap; color: var(--muted); }
.drop { border: 2px dashed var(--sage); border-radius: 18px; padding: 36px; text-align: center; display: grid; gap: 8px; justify-items: center; background: var(--sage-wash); }
.drop span { color: var(--muted); font-size: 13px; }
.drop .btn { margin-top: 8px; }
.extract-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; }
.extract-head > strong { font-family: var(--display); font-size: 26px; color: var(--brand-dark); }
.extract .notice { margin-top: 12px; }

/* connect */
.crm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.crm { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.crm.on { border-color: var(--brand); box-shadow: inset 0 4px 0 var(--brand); }
.crm-top { display: flex; gap: 12px; align-items: center; }
.crm-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-family: var(--display); font-weight: 800; font-size: 18px; }
.crm h3 { font-size: 16px; }
.crm small { color: var(--muted); font-size: 12px; }
.crm p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1; }
.crm .btn { align-self: flex-start; }
.crm-status { color: var(--brand-dark) !important; font-weight: 700; flex: none !important; }

/* modal */
.scrim { position: fixed; inset: 0; background: rgb(26 46 44 / 45%); z-index: 30; }
.modal-card {
  position: fixed; z-index: 31; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--canvas); border-radius: 22px; padding: 26px; box-shadow: 0 30px 80px rgb(26 46 44 / 35%);
}
.modal-card.wide { width: min(900px, calc(100vw - 32px)); }
.modal-card h2 { font-size: 24px; margin-bottom: 14px; }
.perm { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; font-size: 14px; }
.sync { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-weight: 600; color: var(--brand-dark); }
.sync .spin { color: var(--muted); }
.sync .spin::after { content: '…'; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.miss { color: var(--red); font-weight: 600; }
.alert { color: var(--gold) !important; font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 10px); z-index: 40;
  background: #fff; color: var(--ink-strong); border: 1px solid var(--line); box-shadow: 0 10px 30px -10px rgb(36 61 59 / 35%); border-radius: 14px; padding: 12px 18px; font-size: 14px; font-weight: 700;
  border-left: 4px solid var(--brand); opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .main { padding: 20px 16px 40px; }
  .stats, .crm-grid { grid-template-columns: 1fr 1fr; }
  .add-grid, .grid2 { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
}

/* ---------- editorial details ---------- */
.eyebrow, .stat strong, .address, .sync { font-family: var(--mono); }
.eyebrow { letter-spacing: 0.04em; font-weight: 500; }
.stat strong { font-weight: 600; letter-spacing: -0.03em; }
.page-head h1 { font-weight: 600; font-size: 38px; }
.stat, .panel, .crm { box-shadow: none; border-color: #dcdfd4; }
.stat { border-radius: 12px; }
.panel, .crm { border-radius: 14px; }
.badge { border-radius: 3px; text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; font-weight: 700; padding: 4px 8px; border: 0; }
.badge.red { background: var(--red); color: #fff; }
.badge.amber { background: var(--sand); color: var(--ink-strong); }
.badge.green { background: var(--brand); color: #fff; }
.badge.blue { background: var(--blue-bg); color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue-line); }
.source { border-radius: 3px; text-transform: uppercase; letter-spacing: 0.05em; font-size: 10px; }
.crm-mark { border-radius: 6px; font-family: var(--display); font-weight: 600; }
.side-nav a.on { box-shadow: inset 3px 0 0 var(--brand); }

/* Medium laptop widths: stack the deadline preview under the form instead of squeezing both. */
@media (max-width: 1200px) {
  .add-grid { grid-template-columns: 1fr; }
  .crm-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- logo ---------- */
/* The logo sits on its own white plate so the green wordmark stays crisp against the sage sidebar. */
.side-logo { display: block; background: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: 0 1px 0 #b5d9cb; }
.side-logo img { display: block; width: 100%; height: auto; }
.side-agency { margin: 10px 0 18px 4px !important; }

/* ---------- brand green #52a087 as the main colour ---------- */
.side-agency { color: #fff !important; }
.side-nav a { color: #fff; font-weight: 700; font-size: 15px; }
.side-nav a:hover { background: rgb(255 255 255 / 16%); color: #fff; }
.side-nav a.on { background: #fff; color: var(--ink-strong); box-shadow: none; }
.side-note { color: rgb(255 255 255 / 85%); }
.side-logo { box-shadow: none; }
.tabs button.on { background: var(--sage); color: #fff; }
.preview { border-top-color: var(--sage); }

/* ---------- traffic-light overview ---------- */
.lights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.light {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  text-align: left; cursor: pointer; padding: 18px 20px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff;
  transition: opacity 0.15s;
}
.light .lamp { grid-row: 1 / 3; width: 22px; height: 22px; border-radius: 50%; }
.light.red .lamp { background: var(--red); box-shadow: 0 0 0 6px var(--red-bg); }
.light.amber .lamp { background: #e0a43a; box-shadow: 0 0 0 6px var(--amber-bg); }
.light.green .lamp { background: var(--sage); box-shadow: 0 0 0 6px var(--sage-wash); }
.light strong { font-family: var(--mono); font-size: 32px; font-weight: 600; line-height: 1; color: var(--ink-strong); }
.light small { font-size: 13px; font-weight: 600; color: var(--muted); }
.light.red { border-color: var(--red-line); }
.light.amber { border-color: var(--amber-line); }
.light.green { border-color: var(--green-line); }
.light.on.red { background: var(--red); border-color: var(--red); }
.light.on.amber { background: #e0a43a; border-color: #e0a43a; }
.light.on.green { background: var(--sage); border-color: var(--sage); }
.light.on strong, .light.on small { color: #fff; }
.light.on .lamp { background: #fff; box-shadow: none; }
.light.dim { opacity: 0.5; }
.link-btn { border: 0; background: none; color: var(--brand); font-weight: 700; cursor: pointer; padding: 0; }

/* Slim traffic lights: one compact row so the campaign table gets the space. */
.lights { grid-template-columns: repeat(3, max-content); gap: 10px; margin-bottom: 16px; }
.light { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px; }
.light .lamp { width: 12px; height: 12px; }
.light.red .lamp, .light.amber .lamp, .light.green .lamp { box-shadow: none; }
.light strong { font-size: 18px; }
.light small { font-size: 13px; }

.side-interest { margin-top: auto; padding: 12px; border-radius: 12px; background: #fff; color: var(--ink-strong); font-weight: 800; font-size: 14px; text-align: center; }
.side-interest + .side-phone { margin-top: 8px; }
.side-note a { color: #fff; font-weight: 700; }
.planned { align-self: flex-start; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--canvas); border: 1px dashed #c9cdbf; padding: 5px 10px; border-radius: 3px; }

/* ---------- round-2 additions: principal view, listing page, accessibility ---------- */
/* Small text on the #52a087 sidebar uses very dark navy (white fails contrast at this size). */
.side { color: #0c2340; }
.side-nav a { color: #0c2340; min-height: 40px; display: flex; align-items: center; }
.side-nav a:hover { background: rgb(255 255 255 / 30%); color: #0c2340; }
.side-nav a.on { background: #fff; color: #0c2340; }
.side-agency { color: #0c2340 !important; }
.side-note, .side-note a { color: #0c2340 !important; }
.tabs button.on, .seg button.on { background: var(--brand); color: #fff; }
.light.on.green { background: var(--brand); border-color: var(--brand); }
.light.on.amber { background: #f3d9a4; border-color: #c9a35c; }
.light.on.amber strong, .light.on.amber small { color: var(--ink-strong); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.agent-chips { display: flex; gap: 8px; margin: -6px 0 18px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer; min-height: 36px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.row-link td a { color: var(--ink-strong); text-decoration: none; }
.row-link td a:hover strong { text-decoration: underline; }
.comply-pill { display: inline-block; font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 6px; background: var(--cream); border: 1px solid var(--sand); color: var(--gold); text-decoration: none; }
.comply-pill.all { background: var(--green-bg); border-color: var(--green-line); color: var(--brand-dark); }
.back-link { display: inline-block; margin-bottom: 10px; font-weight: 700; font-size: 14px; color: var(--brand); text-decoration: none; }
.listing-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; margin-bottom: 16px; }
.side-stack { display: grid; gap: 14px; }
.side-stack .btn { width: 100%; margin-top: 8px; }
.stage { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 8px; font-family: var(--sans); font-weight: 700; }
.comply { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.comply li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.comply li.done { background: var(--green-bg); border-color: var(--green-line); }
.comply li.na { opacity: 0.6; }
.comply .tick { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid #c9cdbf; background: #fff; font-weight: 800; color: #fff; cursor: pointer; }
.comply li.done .tick { background: var(--brand); border-color: var(--brand); }
.comply .tick:disabled { cursor: default; }
.comply-main { display: grid; gap: 3px; }
.comply-main strong { color: var(--ink-strong); font-size: 14px; }
.comply-main small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.comply-main .meta a { color: var(--brand); font-weight: 700; }
.help { font-weight: 700; }
.help.tracked { color: var(--brand-dark); }
.help.reminder { color: var(--gold); }
.help.planned { color: var(--muted); }
.deadlines { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.deadlines li { padding: 10px 12px; border-radius: 10px; border-left: 4px solid var(--line); background: var(--canvas); display: grid; gap: 2px; }
.deadlines li.red { border-left-color: var(--red); }
.deadlines li.amber { border-left-color: #c9a35c; }
.deadlines li.blue { border-left-color: var(--sage); }
.deadlines li.green { border-left-color: var(--brand); }
.deadlines strong { font-size: 13px; color: var(--ink-strong); }
.deadlines small { font-size: 12px; color: var(--muted); }
@media (max-width: 1100px) { .listing-grid { grid-template-columns: 1fr; } }
.link-reset { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: #0c2340; text-decoration: underline; cursor: pointer; }
.side-user { display: grid; gap: 4px; font-size: 12px; font-weight: 700; margin: 0 0 14px; color: #0c2340; }
.side-user select { padding: 8px; border-radius: 10px; border: 0; font: inherit; font-weight: 600; background: #fff; color: #0c2340; }
.side-phone + .side-phone { margin-top: 8px; background: transparent; border: 1.5px solid var(--sand); }
