/* DCE console. Design language (DCE2-24): dark top bar, light grey nav with square markers, one
   coral accent, square corners, uppercase letter-spaced labels. System fonts only (the CSP allows
   no web fonts). */
:root {
  --fg: #1f1f1f;
  --muted: #6b6b6b;
  --bg: #f4f4f2;
  --panel: #ffffff;
  --line: #e2e2de;
  --nav-bg: #ececea;
  --nav-active: #e0e0dc;
  --top-bg: #1f1f1f;
  --top-fg: #ffffff;
  --top-muted: #a8a8a8;
  --accent: #e8573f;
  --accent-ink: #c2412b;
  --accent-soft: #fdebe7;
  --grey-pill: #ececea;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4e00;
  --err-bg: #fde7e7;
  --err-fg: #8a1c1c;
  --ok-bg: #e6f6ea;
  --ok-fg: #1d5b2c;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg); }

/* ---- shell ---- */
.top { display: flex; gap: 16px; align-items: center; height: 52px; padding: 0 20px; background: var(--top-bg); color: var(--top-fg); }
.brand { font-weight: 800; letter-spacing: .22em; font-size: 15px; }
.tenant { color: var(--top-muted); padding-left: 16px; border-left: 1px solid #3a3a3a; }
.who { margin-left: auto; color: var(--top-fg); }
.avatar { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-weight: 700; }
.avatar:empty { display: none; }
.layout { display: flex; min-height: calc(100vh - 52px); }
.nav { width: 232px; padding: 14px 0; background: var(--nav-bg); border-right: 1px solid var(--line); }
.nav h2 { margin: 18px 20px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.nav h2:first-child { margin-top: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 20px; color: var(--fg); text-decoration: none; }
.nav a::before { content: ""; width: 9px; height: 9px; border: 1.5px solid currentColor; flex: none; opacity: .55; }
.nav a:hover { background: var(--nav-active); }
.nav a[aria-current="page"] { color: var(--accent-ink); font-weight: 700; background: var(--nav-active); }
.nav a[aria-current="page"]::before { background: var(--accent); border-color: var(--accent); opacity: 1; }
.main { flex: 1; padding: 28px 32px; max-width: 1180px; }
.main h1 { margin: 0 0 14px; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.page-head { display: flex; align-items: flex-end; gap: 16px; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 0; }
.page-head .subtitle { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---- feedback ---- */
.banner { padding: 10px 14px; margin-bottom: 16px; border-left: 3px solid currentColor; }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); }
.banner.error { background: var(--err-bg); color: var(--err-fg); }
.banner.ok { background: var(--ok-bg); color: var(--ok-fg); }
.empty { padding: 32px; background: var(--panel); border: 1px dashed var(--line); color: var(--muted); }
.skeleton { height: 120px; background: linear-gradient(90deg, #ebebe8 25%, #f4f4f2 50%, #ebebe8 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- controls ---- */
button { font: inherit; font-weight: 600; padding: 7px 16px; border-radius: 0; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
button:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
button.secondary { background: transparent; color: var(--fg); border-color: #bdbdb8; }
button.secondary:hover { border-color: var(--fg); background: transparent; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 12px 0; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; max-width: 520px; }
.field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.field input[type="text"], .field input[type="number"], .field input[type="search"], .field input[type="datetime-local"], .field select, input[type="date"], textarea {
  font: inherit; padding: 7px 9px; border: 1px solid #cfcfca; border-radius: 0; background: #fff;
}
textarea { width: 100%; max-width: 520px; }
input[type="file"] { font: inherit; }
.hint { color: var(--muted); font-size: 12px; margin: 2px 0; }
.mono { font-family: var(--mono); }
.field-errors { color: var(--err-fg); background: var(--err-bg); padding: 10px 10px 10px 28px; }
.filters .field { margin: 0; min-width: 150px; }

/* ---- pills ---- */
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; background: var(--grey-pill); color: var(--muted); white-space: nowrap; }
.pill.live { background: var(--accent-soft); color: var(--accent-ink); }
.flag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; margin: 0 4px 2px 0; background: var(--warn-bg); color: var(--warn-fg); }
.flag.code { background: var(--accent-soft); color: var(--accent-ink); }

/* ---- tables and panels ---- */
table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); }
table.grid th, table.grid td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.grid th { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
table.grid tbody tr:hover td { background: #fafaf8; }
table.grid a, .card a, .plan-offers a { color: var(--accent-ink); text-decoration: none; font-weight: 700; }
table.grid a:hover, .card a:hover { text-decoration: underline; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; background: var(--panel); border: 1px solid var(--line); padding: 16px; }
dl.facts dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
dl.facts dd { margin: 0; }
section.step { background: var(--panel); border: 1px solid var(--line); padding: 18px; }
ol.versions { background: var(--panel); border: 1px solid var(--line); padding: 12px 12px 12px 32px; }

/* ---- offer editor (DCE2-19) ---- */
ol.steps { display: flex; flex-wrap: wrap; gap: 0; list-style: none; padding: 0; margin: 8px 0 16px; border-bottom: 1px solid var(--line); }
ol.steps a { display: block; padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
ol.steps li[aria-current="step"] a { border-bottom-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.cards { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); padding: 14px 16px; }
.card h2 { margin: 0 0 6px; font-size: 16px; }
.money { display: flex; gap: 12px; flex-wrap: wrap; }
.money .field { margin: 0; }
.plan { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.plan-name { flex: 1; }

/* ---- approvals (DCE2-20) ---- */
table.diff th[scope="row"] { color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 13px; width: 180px; }
table.diff tr.changed td, table.diff tr.changed th { background: #fff7e0; }
table.diff tr.changed td:last-child { font-weight: 600; }

/* ---- redemptions (DCE2-23) ---- */
table.redemptions tr.flagged td { background: #fff7e0; }

/* ---- plans (DCE2-24) ---- */
.sync-strip { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.sync { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; gap: 4px; border-top: 3px solid var(--line); }
.plan-card.live { border-top-color: var(--accent); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.type-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.plan-card h2 { margin: 6px 0 0; font-size: 19px; font-weight: 800; }
.plan-card > .hint { margin: 0 0 6px; }
.prices { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; }
.price { display: flex; align-items: baseline; gap: 6px; }
.big { font-size: 22px; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.stat-value { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-offers { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.plan-offers li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }

/* ---- overview (DCE2-25) ---- */
.stat-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-bottom: 16px; }
.stat-card { display: flex; flex-direction: column; gap: 4px; border-top: 3px solid var(--accent); }
.stat-card .big { font-size: 30px; line-height: 1.15; }
.stat-card a { margin-top: auto; padding-top: 6px; font-size: 13px; }
.setup { margin-bottom: 16px; border-left: 3px solid var(--accent); }
.setup h2 { margin: 6px 0 8px; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist li::before { content: ""; width: 12px; height: 12px; border: 1.5px solid var(--muted); flex: none; }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist li.done::before { background: var(--accent); border-color: var(--accent); }
.attention { margin-bottom: 20px; }
.attention-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attention-list li { display: flex; align-items: center; gap: 10px; }
.setup a, .attention a, .stat-card a, .plan-card h2 a { color: var(--accent-ink); text-decoration: none; font-weight: 700; }
.setup a:hover, .attention a:hover, .stat-card a:hover, .plan-card h2 a:hover { text-decoration: underline; }
.section-title { margin: 8px 0 12px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

/* ---- connections (DCE2-26) ---- */
.conn-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.conn-card dl.facts.compact { padding: 10px 0 0; border: 0; border-top: 1px solid var(--line); margin: 10px 0 0; gap: 4px 14px; font-size: 13px; }
.conn-card dl.facts.compact dd { overflow-wrap: anywhere; }
.conn-card .banner { margin: 10px 0 0; }
.conn-card .toolbar { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.checks { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.checks li.ok strong { color: var(--ok-fg); }
.checks li.failed strong { color: var(--err-fg); }
.conn-form { margin-bottom: 18px; border-top: 3px solid var(--accent); }
.conn-form .type-label { display: block; margin-bottom: 4px; }

/* ---- brand and widget (DCE2-29) ---- */
.brand-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.preview-slot { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.colour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }
.colour { display: flex; align-items: center; gap: 8px; }
.colour input[type="color"] { width: 36px; height: 36px; padding: 0; border: 1px solid #cfcfca; background: #fff; flex: none; margin-top: 16px; }
.colour .field { margin: 6px 0; flex: 1; }
textarea[data-origins] { font-family: var(--mono); }
.preview-box { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid; }
.preview-title { font-size: 16px; }
.preview-offer { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid; }
.preview-save, .preview-muted, .preview-error { font-size: 13px; }
.preview-code { display: flex; gap: 8px; }
.preview-input { flex: 1; padding: 7px 10px; border: 1px solid; font-size: 13px; }
.preview-button { padding: 7px 14px; font-weight: 700; font-size: 13px; }

/* ---- webhooks (DCE2-30) ---- */
.secret-panel { margin-bottom: 18px; border-top: 3px solid var(--warn-fg); background: var(--warn-bg); }
.secret-value { display: block; padding: 10px 12px; margin: 8px 0; background: var(--panel); border: 1px solid var(--line); overflow-wrap: anywhere; user-select: all; }
.endpoint-url { font-size: 15px; overflow-wrap: anywhere; }
.event-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; }
.event { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.delivery-log { margin-top: 10px; }
.delivery-log table.grid { font-size: 12px; }
.delivery-log table.grid th, .delivery-log table.grid td { padding: 6px 8px; }

/* ---- developers and MCP (DCE2-31) ---- */
.copy-row { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.copy-value { overflow-wrap: anywhere; font-size: 13px; }
.copy-row button { padding: 4px 10px; font-size: 12px; }

/* ---- team and roles (DCE2-32) ---- */
table.team tr.waiting td { background: #fff7e0; }
table.team select { font: inherit; padding: 5px 8px; border: 1px solid #cfcfca; border-radius: 0; background: #fff; }
table.team .hint { margin-top: 4px; max-width: 380px; }
.pill.you { margin-left: 8px; }
[data-section="roles"] { margin-top: 20px; }

/* ---- audit log (DCE2-34) ---- */
table.audit td { vertical-align: top; font-size: 13px; }
table.audit td.hint { max-width: 380px; overflow-wrap: anywhere; }

/* ---- sign-in screen (DCE2-36) ---- */
.signin { max-width: 440px; margin: 48px auto; padding: 36px 32px; text-align: center; border-top: 3px solid var(--accent); }
.signin-mark { font-weight: 800; letter-spacing: .22em; font-size: 28px; color: var(--accent-ink); margin-bottom: 12px; }
.signin h1 { margin: 0 0 6px; }
.signin .subtitle { margin: 0 0 24px; color: var(--muted); }
.signin button { width: 100%; padding: 11px 16px; font-size: 15px; }
.signin .hint { margin-top: 16px; }
/* DCE's own login page (DCE2-40) */
.signin-form, .signin-extra, .signin-msg { text-align: left; }
.signin-msg { margin: 0 0 12px; }
.signin-form .field { max-width: none; }
.signin-form .field input, .signin-form .field select { font: inherit; padding: 9px 10px; border: 1px solid #cfcfca; border-radius: 0; background: #fff; width: 100%; box-sizing: border-box; }
.signin-form button[type="submit"] { margin-top: 8px; }
.signin-form button.secondary { width: auto; padding: 6px 12px; font-size: 13px; }
.signin-links { margin-top: 16px; display: flex; justify-content: center; gap: 16px; }
.workspace-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.workspace-list button { text-align: left; }
button.link { background: none; border: 0; padding: 0; width: auto; color: var(--accent-ink); font-weight: 600; text-decoration: underline; font-size: 13px; }
button.link:hover { background: none; color: var(--fg); }
.nav .signout { margin: 24px 20px 0; padding: 6px 12px; font-size: 13px; }

@media (max-width: 700px) {
  .conn-grid { grid-template-columns: 1fr; }
  .signin { margin: 24px auto; padding: 28px 20px; }
  .copy-row { grid-template-columns: 1fr auto; }
  .copy-row .stat-label { grid-column: 1 / -1; }
  .delivery-log table.grid { display: block; overflow-x: auto; }
  .brand-layout { grid-template-columns: 1fr; }
  .preview-slot { position: static; }
  .top { padding: 0 16px; }
  .tenant { display: none; }
  .layout { flex-direction: column; }
  .nav { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 20px 16px; }
  .page-head { flex-wrap: wrap; }
  .page-head .actions { margin-left: 0; }
  table.grid { display: block; overflow-x: auto; }
}
