:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2547d0;
  --brand-dark: #16308f;
  --brand-soft: #e9eeff;
  --up: #0a8a4f;
  --up-soft: #e3f6ec;
  --down: #c62828;
  --down-soft: #fdeaea;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --card: #161b22;
    --ink: #e6edf3;
    --muted: #8b949e;
    --line: #2a313c;
    --brand: #6d8cff;
    --brand-dark: #0f1d55;
    --brand-soft: #1c2647;
    --up: #3fb950;
    --up-soft: #12261a;
    --down: #f85149;
    --down-soft: #2d1416;
    --warn: #e3b341;
    --warn-soft: #2b2311;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top {
  background: var(--brand-dark);
  color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.top .wrap { display: flex; align-items: center; gap: 10px; height: 56px; }
.logo { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; font-size: 19px; letter-spacing: -.3px; }
.logo img { width: 30px; height: 30px; border-radius: 8px; }
.logo span { color: #9fb4ff; }
.top .spacer { flex: 1; }
.top .tag { font-size: 12px; color: #c7d2fe; }

/* Hero */
.hero { padding: 22px 0 6px; }
.hero h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.4px; }
.hero p { margin: 0; color: var(--muted); }

/* Tabs + filters */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 16px 0 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap;
}
.tab .n { color: var(--muted); font-weight: 500; margin-left: 4px; }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab.on .n { color: #dbe3ff; }
.filters { display: flex; gap: 6px; padding-bottom: 10px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 4px 11px; border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer;
}
.chip.on { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

/* Cards */
.list { display: grid; gap: 12px; grid-template-columns: 1fr; padding-bottom: 24px; }
@media (min-width: 720px) { .list { grid-template-columns: 1fr 1fr; } }
.card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow);
}
a.card:hover { border-color: var(--brand); }
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-head h3 { margin: 0; font-size: 16px; flex: 1; line-height: 1.3; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 8px; border-radius: 6px; text-transform: uppercase; white-space: nowrap;
}
.b-main { background: var(--brand-soft); color: var(--brand); }
.b-sme { background: var(--warn-soft); color: var(--warn); }
.b-open { background: var(--up-soft); color: var(--up); }
.b-upcoming { background: var(--brand-soft); color: var(--brand); }
.b-closed { background: var(--warn-soft); color: var(--warn); }
.b-listed { background: var(--line); color: var(--muted); }
.when { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.stat .v { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.small { font-size: 12.5px; font-weight: 600; }

.empty, .err {
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 28px 16px; text-align: center; color: var(--muted);
}
.err { border-color: var(--down); color: var(--down); }

/* Detail page */
.back { display: inline-block; margin: 16px 0 6px; font-weight: 600; font-size: 14px; }
.d-title { margin: 6px 0 6px; font-size: 24px; letter-spacing: -.4px; line-height: 1.25; }
.d-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.panel h2 { font-size: 15px; margin: 0 0 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: repeat(3, 1fr); } }
.gmp-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gmp-big .num { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
td.r, th.r { text-align: right; }
tr.total td { font-weight: 800; border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline li.done { color: var(--muted); }
.timeline li.next { font-weight: 700; color: var(--brand); }
.docs { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--brand);
  color: var(--brand); background: transparent; border-radius: 10px; padding: 8px 14px;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
}
.btn.solid { background: var(--brand); color: #fff; }
.btn.danger { border-color: var(--down); color: var(--down); }
.btn:disabled { opacity: .5; cursor: default; }
.spark { width: 100%; height: 90px; display: block; }
.about { white-space: pre-line; }

/* Footer */
.foot { color: var(--muted); font-size: 12.5px; padding-top: 18px; padding-bottom: 40px; border-top: 1px solid var(--line); margin-top: 10px; }
.foot p { margin: 4px 0; }

/* Admin */
.form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 12px; }
@media (min-width: 720px) { .form { grid-template-columns: repeat(4, 1fr); } }
.form label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.form .wide { grid-column: 1 / -1; }
.form .half { grid-column: span 2; }
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.check input { width: auto; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.admin-table td { vertical-align: middle; }
.admin-table input { width: 80px; padding: 6px 8px; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-weight: 600; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; }
.hidden { display: none !important; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0; }
legend { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 6px; }
ol.plain { margin: 0; padding-left: 20px; }
ol.plain li { padding: 5px 0; line-height: 1.4; }
table.fin th, table.fin td { white-space: nowrap; padding-left: 10px; }
table.fin td:first-child, table.fin th:first-child { padding-left: 4px; position: sticky; left: 0; background: var(--card); }
table.fin-edit { min-width: 640px; }
table.fin-edit th { font-size: 12px; }
table.fin-edit td { padding: 4px; border-bottom: 0; }
table.fin-edit input { padding: 6px 8px; font-size: 13px; }
table.fin-edit td:first-child { color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.score { float: right; font-size: 12.5px; font-weight: 700; color: var(--up); background: var(--up-soft); padding: 2px 8px; border-radius: 999px; }
ul.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
@media (min-width: 720px) { ul.checks { grid-template-columns: 1fr 1fr; } }
ul.checks li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
ul.checks .dot { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; margin-top: 1px; }
.chk-good .dot { background: var(--up-soft); color: var(--up); }
.chk-warn .dot { background: var(--warn-soft); color: var(--warn); }
.chk-bad .dot { background: var(--down-soft); color: var(--down); }
.swot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 720px) { .swot { gap: 10px; } }
.swot-box { border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); }
.swot-box h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.swot-box ul { margin: 0; padding-left: 18px; font-size: 14px; }
.swot-box li { padding: 2px 0; }
.swot-box.s { background: var(--up-soft); } .swot-box.s h3 { color: var(--up); }
.swot-box.w { background: var(--down-soft); } .swot-box.w h3 { color: var(--down); }
.swot-box.o { background: var(--brand-soft); } .swot-box.o h3 { color: var(--brand); }
.swot-box.t { background: var(--warn-soft); } .swot-box.t h3 { color: var(--warn); }
ul.flags { list-style: none; margin: 0; padding: 0; }
ul.flags li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
ul.flags li:last-child { border-bottom: 0; }
.sev { display: inline-block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; margin-right: 6px; }
.sev-high { background: var(--down-soft); color: var(--down); }
.sev-medium { background: var(--warn-soft); color: var(--warn); }
.sev-low { background: var(--line); color: var(--muted); }
tr.me td { background: var(--brand-soft); }
.tagline { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.pill-score { font-size: 11.5px; font-weight: 700; color: var(--up); background: var(--up-soft); padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.swot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.swot-score { font-size: 22px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.swot-score small { font-size: 12px; font-weight: 600; opacity: .7; margin-left: 1px; }
.swot-box.s .swot-score { color: var(--up); } .swot-box.w .swot-score { color: var(--down); }
.swot-box.o .swot-score { color: var(--brand); } .swot-box.t .swot-score { color: var(--warn); }
.swot-bar { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); margin: 6px 0 8px; overflow: hidden; }
.swot-bar i { display: block; height: 100%; border-radius: 99px; }
.swot-box.s .swot-bar i { background: var(--up); } .swot-box.w .swot-bar i { background: var(--down); }
.swot-box.o .swot-bar i { background: var(--brand); } .swot-box.t .swot-bar i { background: var(--warn); }
.swot-box ul { list-style: none; padding-left: 0; }
.swot-box li { display: grid; grid-template-columns: 78px 1fr; gap: 8px; align-items: baseline; padding: 4px 0; border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); }
.swot-box li:first-child { border-top: 0; }
.swot-box .fig { font-size: 15.5px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swot-box .fig.dim { opacity: .4; font-weight: 400; }
.swot-box.s .fig { color: var(--up); } .swot-box.w .fig { color: var(--down); }
.swot-box.o .fig { color: var(--brand); } .swot-box.t .fig { color: var(--warn); }
.swot-box .empty { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
/* Phones: keep the 2×2 chart, put each key figure above its point */
@media (max-width: 719px) {
  .swot-box { padding: 8px 9px; min-width: 0; }
  .swot-box h3 { font-size: 11.5px; letter-spacing: .2px; }
  .swot-score { font-size: 19px; }
  .swot-box ul { font-size: 12.5px; line-height: 1.35; }
  .swot-box li { display: block; padding: 5px 0; }
  .swot-box .fig { display: block; font-size: 14px; }
  .swot-box .fig.dim { display: none; }
}
.swot-tiles { display: none; }
.swot-tile { border-radius: 10px; padding: 8px 6px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.swot-tile .l { font-size: 11px; font-weight: 800; opacity: .75; }
.swot-tile b { font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.swot-tile small { font-size: 10.5px; color: var(--muted); }
.swot-tile.s { background: var(--up-soft); color: var(--up); } .swot-tile.w { background: var(--down-soft); color: var(--down); }
.swot-tile.o { background: var(--brand-soft); color: var(--brand); } .swot-tile.t { background: var(--warn-soft); color: var(--warn); }
@media (min-width: 720px) { .swot-tiles { display: none; } }

/* Ads (AdSense) — hidden until an ad unit is set up */
.ad-slot { display: none; }
.ad-slot.on { display: block; margin: 14px 0; min-height: 100px; }
.ad-label { font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); text-align: center; margin-bottom: 4px; }
