/* Campaign Commander Portfolio */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1d222b;
  --muted: #687080;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --grey: #9ca3af;
  --danger: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 24px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; color: var(--text); }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.prose { white-space: normal; margin: 0; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: #151a23; color: #e6e8ec;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand svg { fill: #8b85ff; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: #b8bec9; padding: 6px 12px; border-radius: 6px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.on { color: #fff; background: rgba(255,255,255,.12); }
.who { display: flex; align-items: center; gap: 10px; color: #c9ced6; }
.who .link { color: #b8bec9; }

.page { max-width: 1240px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; align-items: center; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 2px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.narrow { max-width: 560px; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.columns-wide { grid-template-columns: 3fr 2fr; }
.empty { text-align: center; padding: 40px 20px; }
.empty h2 { font-size: 18px; }
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 12px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow);
}
.stat-value { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-value.small { font-size: 15px; padding-top: 6px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-warn .stat-value { color: var(--red); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); background: #fafbfc; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: #f8f9fc; }
.table tr.dim td { opacity: .55; }
.card .table th, .card .table td { padding-left: 0; }
.card-flush .table th, .card-flush .table td { padding-left: 14px; }
.col-health { width: 28px; }
table.mini { border-collapse: collapse; width: 100%; font-size: 13px; }
table.mini th, table.mini td { border-bottom: 1px solid var(--border); padding: 4px 8px 4px 0; text-align: left; vertical-align: top; }
table.mini th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* Health, tags, chips, badges */
.health { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
h1 .health { width: 12px; height: 12px; }
.health-green { background: var(--green); }
.health-amber { background: var(--amber); }
.health-red { background: var(--red); }
.health-grey { background: var(--grey); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #eef0f3; color: #4b5260; }
.tag-active { background: #e7f6ec; color: #15803d; }
.tag-draft { background: #eef0f3; color: #4b5260; }
.tag-paused { background: #fdf3e2; color: #b45309; }
.tag-retired { background: #f1f1f1; color: #8a8f98; }
.chip { display: inline-block; padding: 1px 9px; margin: 0 4px 4px 0; border-radius: 999px; background: var(--accent-soft); color: #3730a3; font-size: 12px; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: #3730a3; color: #fff; }
.count { font-size: 11px; color: var(--muted); }
.count-empty { color: var(--amber); }

/* Tabs and pills */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.pills { display: flex; gap: 4px; align-items: center; }
.pills a { padding: 4px 12px; border-radius: 999px; color: var(--muted); }
.pills a:hover { background: #eceef2; text-decoration: none; }
.pills a.on { background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 600; }
.pills-quiet a { padding: 4px 8px; }

/* Forms */
.field { margin-bottom: 14px; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.field-check label { font-weight: 500; display: flex; align-items: center; gap: 8px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: inherit;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 7px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.help { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
form.inline { display: inline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer;
  background: #fff; color: var(--text); border: 1px solid var(--border-strong); border-radius: 7px;
}
.btn:hover { background: #f4f5f8; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: #f0c4c4; }
.btn-danger:hover { background: #fdf1f1; }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link-danger { color: var(--danger); }
.icon { background: none; border: 0; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 6px; }
.icon:hover { color: var(--danger); }

/* Flash and notices */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash-success { background: #effaf2; border-color: #c6ead2; color: #166534; }
.flash-error { background: #fdf1f1; border-color: #f3caca; color: #991b1b; }
.flash-info { background: #f1f4fd; border-color: #d3dcf6; color: #1e3a8a; }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; background: #fdf8ec; border: 1px solid #f1e3bd; color: #7c5a12; }

/* Definition */
.def-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.def-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.def-nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); display: flex; justify-content: space-between; }
.def-nav a:hover { background: #eceef2; color: var(--text); text-decoration: none; }
.def-section { scroll-margin-top: 16px; }
.def-section .intro { margin-top: -4px; }
.def-list { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; margin: 0; }
.def-list dt { color: var(--muted); }
.def-list dd { margin: 0; }
.group { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; margin-bottom: 8px; }
table.grid th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 6px 4px 0; }
table.grid td { padding: 0 6px 6px 0; vertical-align: top; }
table.grid td input[type=checkbox] { margin-top: 10px; }
table.grid td:last-child { width: 30px; }
.savebar {
  position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center;
  padding: 12px 0; margin-top: 8px; background: linear-gradient(to bottom, rgba(245,246,248,0), var(--bg) 30%);
}
.savebar input { flex: 1; }

/* Lists */
.people, .feed { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }
.people li:last-child, .feed li:last-child { border-bottom: 0; }
.feed li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--border); }
details.run { border-bottom: 1px solid var(--border); padding: 8px 0; }
details.run:last-child { border-bottom: 0; }
details.run summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
details.run p { margin-top: 8px; color: #343a46; }

/* Sign-in */
.signin { max-width: 380px; margin: 64px auto; }
.signin h1 { font-size: 20px; }

@media (max-width: 900px) {
  .columns, .columns-wide, .def-layout { grid-template-columns: 1fr; }
  .def-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .def-list { grid-template-columns: 1fr; }
  .topbar { gap: 12px; padding: 0 12px; }
  .page { padding: 16px; }
  .page-head { flex-direction: column; }
}
