:root {
  --bg: #f5f4f0; --panel: #fff; --ink: #17191e; --ink-2: #4c5160; --ink-3: #8a8f9c; --line: #e4e2dc; --line-2: #efede8;
  --accent: #0c6b58; --accent-ink: #fff; --accent-soft: #e2f1ec;
  --ok: #1b7f4b; --ok-soft: #e3f4ea; --warn: #9a6200; --warn-soft: #fcf1dc; --bad: #b42323; --bad-soft: #fbe6e4; --info: #2a5bbf; --info-soft: #e5edfb;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,20,30,.05), 0 4px 16px rgba(20,20,30,.05);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; letter-spacing: -.01em; margin: 0; } h2 { font-size: 15px; margin: 0 0 12px; } h3 { font-size: 13px; margin: 0 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.mono { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: 12px; }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }

/* sidebar */
.side { background: #121418; color: #c9ccd4; display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 22px; color: #fff; }
.brand .mark { color: #5fd3b5; font-size: 20px; } .brand small { display: block; color: #7d828f; font-size: 11px; }
nav a { display: flex; justify-content: space-between; align-items: center; color: #c9ccd4; padding: 8px 10px; border-radius: 7px; margin-bottom: 2px; }
nav a:hover { background: #1d2027; text-decoration: none; } nav a.on { background: #23272f; color: #fff; }
.count { background: #b42323; color: #fff; border-radius: 9px; font-size: 11px; padding: 0 7px; } .count:empty { display: none; }
.side-foot { margin-top: auto; font-size: 12px; }
.int-status div { display: flex; align-items: center; gap: 6px; padding: 2px 8px; color: #9aa0ad; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #555; display: inline-block; } .dot.ok { background: #3ccf8e; } .dot.bad { background: #e5534b; } .dot.warn { background: #e0a43a; }
.me { border-top: 1px solid #23272f; margin-top: 10px; padding: 10px 8px 0; color: #9aa0ad; overflow: hidden; text-overflow: ellipsis; }

/* layout */
.view { padding: 26px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head .sub { color: var(--ink-3); margin-top: 3px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g2 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, 1fr); } }
.stack > * + * { margin-top: 16px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; min-width: 200px; }

/* controls */
button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 7px 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
button:hover, .btn:hover { border-color: #c9c6be; text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } button.primary:hover { background: #0a5949; }
button.ghost { border-color: transparent; background: transparent; color: var(--ink-2); } button.ghost:hover { background: var(--line-2); }
button.danger { color: var(--bad); } button.sm { padding: 4px 8px; font-size: 12px; } button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid #8fd6c3; outline-offset: 0; border-color: var(--accent); }
.toolbar select, .toolbar input { width: auto; }
label.f { display: block; } label.f span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; } .form .full { grid-column: 1 / -1; }
fieldset { border: 1px dashed var(--line); border-radius: 8px; padding: 12px; margin: 0; } legend { font-size: 12px; color: var(--ink-2); padding: 0 6px; }

/* table */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: #fafaf7; }
.tbl-wrap { overflow-x: auto; }
.co-name b { display: block; } .co-name small { color: var(--ink-3); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--info-soft); color: var(--info); }
.pills { display: flex; gap: 4px; flex-wrap: wrap; }

/* stats */
.stat .n { font-size: 26px; font-weight: 600; letter-spacing: -.02em; } .stat .l { color: var(--ink-3); font-size: 12px; }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line-2); margin-top: 10px; }
.bar i { display: block; height: 100%; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.funnel-row .track { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; } .funnel-row .track i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.funnel-row.gated .track i { background: #7aa99c; }

/* compliance checklist */
.check { list-style: none; padding: 0; margin: 0; }
.check li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.check li:last-child { border-bottom: 0; }
.check .ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; flex: none; margin-top: 1px; }
.check .ic.ok { background: var(--ok-soft); color: var(--ok); } .check .ic.bad { background: var(--bad-soft); color: var(--bad); } .check .ic.warn { background: var(--warn-soft); color: var(--warn); }
.gate-banner { border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-weight: 500; }
.gate-banner.ok { background: var(--ok-soft); color: var(--ok); } .gate-banner.bad { background: var(--bad-soft); color: var(--bad); }
.linkbox { display: flex; gap: 6px; margin-top: 8px; } .linkbox input { font-size: 12px; color: var(--ink-2); }

/* timeline */
.tl { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow: auto; }
.tl li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.tl .k { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; background: var(--line-2); }
.tl .k.kyb, .tl .k.kyc { background: var(--info-soft); color: var(--info); } .tl .k.aml { background: var(--warn-soft); color: var(--warn); }
.tl .k.gate { background: var(--bad-soft); color: var(--bad); } .tl .k.hubspot { background: #fde9df; color: #c2410c; } .tl .k.note { background: var(--accent-soft); color: var(--accent); }
.tl .meta { font-size: 11px; color: var(--ink-3); }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: #ecebe6; border-radius: var(--radius); padding: 10px; min-height: 240px; }
.col.gate { box-shadow: inset 3px 0 0 #b42323; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-h { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 10px; font-weight: 600; font-size: 13px; }
.col-h small { font-weight: 400; color: var(--ink-3); }
.gate-tag { font-size: 11px; color: var(--bad); font-weight: 500; padding: 0 4px 8px; }
.dcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.dcard:active { cursor: grabbing; } .dcard b { display: block; font-size: 13px; } .dcard .co { font-size: 12px; color: var(--ink-2); }
.dcard .row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; }
.dcard.locked { border-left: 3px solid #e0a43a; }

/* modal & toast */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; background: rgba(15, 17, 22, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { background: #fff; border-radius: 12px; width: min(680px, 100%); max-height: 90vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-card .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; }
.toast { background: #17191e; color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 420px; box-shadow: var(--shadow); font-size: 13px; }
.toast.bad { background: #8f1c1c; } .toast ul { margin: 6px 0 0; padding-left: 18px; }
.empty { text-align: center; padding: 40px 10px; color: var(--ink-3); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; } .kv dt { color: var(--ink-3); } .kv dd { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 10px; color: var(--ink-2); }
.tabs button.on { border-bottom-color: var(--accent); color: var(--ink); font-weight: 500; }
.setup-step { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
