:root {
  --ink: #16202c;
  --muted: #637083;
  --line: #e2e6ec;
  --bg: #f5f6f8;
  --card: #fff;
  --brand: #0f2742;
  --accent: #f26b1d;
  --accent-dark: #d4580f;
  --ok: #1f7a3a; --ok-bg: #e7f5ec;
  --warn: #9a5b00; --warn-bg: #fff3dc;
  --bad: #b42318; --bad-bg: #fdecea;
  --info: #1d4f91; --info-bg: #e8f0fb;
  --quiet-bg: #eef1f5;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 Inter, system-ui, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--info); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.bar { background: var(--brand); color: #fff; }
.bar .wrap { display: flex; align-items: center; gap: 24px; height: 52px; }
.bar .brand { color: #fff; text-decoration: none; font-weight: 800; letter-spacing: -.01em; }
.bar nav { display: flex; gap: 4px; flex: 1; }
.bar nav a { color: #c6d2e1; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-weight: 500; }
.bar nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.bar nav a.on { color: #fff; background: rgba(255,255,255,.14); }
.bar .site { color: #c6d2e1; font-size: 13px; text-decoration: none; }

.botpill { background: var(--accent); color: #fff; border: 0; border-radius: 99px; padding: 6px 14px; font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.botpill:hover { background: var(--accent-dark); }
.botpill.on { background: rgba(255,255,255,.14); color: #fff; cursor: default; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

main { padding: 24px 0 64px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .n { color: var(--muted); font-size: 12px; }
.stat.hot { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }

/* tabs + search */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: 13px; }
.tabs a:hover { background: var(--quiet-bg); color: var(--ink); }
.tabs a.on { background: var(--ink); color: #fff; }
.tabs .c { opacity: .7; margin-left: 4px; font-weight: 500; }
.search input { width: 260px; }

/* cards + tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
tr.link-row { cursor: pointer; }
td:first-child a strong { white-space: nowrap; }
tr.link-row:hover td { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* status pills */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--quiet-bg); color: var(--muted); }
.pill.you { background: var(--warn-bg); color: var(--warn); }
.pill.failed { background: var(--bad-bg); color: var(--bad); }
.pill.progress { background: var(--info-bg); color: var(--info); }
.pill.sent { background: #f1ecfb; color: #5b3aa8; }
.pill.won { background: var(--ok-bg); color: var(--ok); }
.pill.lost { background: var(--quiet-bg); color: var(--muted); }

/* forms */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-weight: 400; border: 1px solid #ccd3dd; border-radius: 7px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0 6px 0 0; vertical-align: -2px; }
td input[type=number] { width: 110px; margin: 0; }
.check { font-weight: 500; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1; min-width: 160px; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }

.btn { display: inline-block; border: 0; border-radius: 7px; padding: 9px 16px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--accent); color: #fff; }
.btn:hover { background: var(--accent-dark); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--quiet-bg); }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid #f1c5c0; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.good { background: var(--ok); }
.btn.good:hover { background: #17612e; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; background: var(--ok-bg); color: var(--ok); border: 1px solid #c6e7d0; }
.flash.bad { background: var(--bad-bg); color: var(--bad); border-color: #f1c5c0; }
.warn { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.err { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: 8px; margin: 10px 0; white-space: pre-wrap; }

/* request page layout */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
dl { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--line); margin-left: 4px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li.note::before { background: var(--accent); }
.timeline .t { color: var(--muted); font-size: 12px; }
.timeline li.note .x { background: #fff7f1; border: 1px solid #fde1cf; padding: 6px 10px; border-radius: 6px; margin-top: 2px; }
details.action { border-top: 1px solid var(--line); padding: 10px 0; }
details.action summary { cursor: pointer; font-weight: 600; }
details.action[open] summary { margin-bottom: 10px; }
.shot { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle input { margin-top: 3px; }

/* quote email preview */
dialog.preview { width: min(680px, calc(100vw - 24px)); height: min(860px, calc(100vh - 24px)); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.preview[open] { display: flex; flex-direction: column; }
dialog.preview::backdrop { background: rgba(15, 20, 30, .55); }
.preview-head, .preview-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: #fff; }
.preview-head { border-bottom: 1px solid var(--line); }
.preview-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.preview iframe { flex: 1; width: 100%; border: 0; background: #f3efe6; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .search input { width: 100%; }
  .bar .site.wide { display: none; }
}
