:root {
  --paper:   #E7EAEE;
  --panel:   #FBFCFD;
  --ink:     #12171D;
  --ink-2:   #4A5763;
  --rule:    #C2CAD3;
  --rule-2:  #DCE1E7;
  --accent:  #0E6B62;
  --signal:  #9A5B12;
  --bar:     #C3D0DD;
  --row-h:   30px;

  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "Space Grotesk", var(--sans);
}

/* Dark palette. Applied when the user explicitly picks dark via the header
   toggle (data-theme="dark"), OR when the OS prefers dark and the user hasn't
   forced light (data-theme="light"). Same values in both, kept in sync. */
:root[data-theme="dark"] {
  --paper: #10151A;
  --panel: #161C23;
  --ink:   #DFE6ED;
  --ink-2: #8E9DAB;
  --rule:  #2A343E;
  --rule-2:#212A33;
  --accent:#4FC3B4;
  --signal:#D69B4A;
  --bar:   #253340;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10151A;
    --panel: #161C23;
    --ink:   #DFE6ED;
    --ink-2: #8E9DAB;
    --rule:  #2A343E;
    --rule-2:#212A33;
    --accent:#4FC3B4;
    --signal:#D69B4A;
    --bar:   #253340;
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
}

body {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

/* ------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.wordmark .mark { color: var(--ink); }
.wordmark .mark.alt { color: var(--accent); }
.rule-tick {
  display: inline-block;
  width: 26px;
  height: 7px;
  margin-left: 8px;
  border: 1px solid var(--rule);
  border-top: 0;
  border-image: repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 6px) 1;
  border-bottom: 1px solid var(--rule);
  transform: translateY(-2px);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-left: auto;
}

.field { display: grid; gap: 4px; }
.field > span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

select, .ghost, input {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 5px 8px;
  height: 28px;
}
select { min-width: 160px; }

/* Make the Region / OS dropdowns obvious: accent border, subtle tint, and an
   explicit caret so they clearly read as selectable controls. */
.field select {
  -webkit-appearance: none;
  appearance: none;
  height: 34px;
  font-size: 13px;
  min-width: 190px;
  padding: 6px 30px 6px 10px;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  background-color: color-mix(in srgb, var(--accent) 8%, var(--panel));
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='6'%3E%3Cpath%20d='M1,1L5,5L9,1'%20fill='none'%20stroke='%230E6B62'%20stroke-width='1.6'%20stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}
.field select:hover {
  background-color: color-mix(in srgb, var(--accent) 15%, var(--panel));
}
:root[data-theme="dark"] .field select {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='6'%3E%3Cpath%20d='M1,1L5,5L9,1'%20fill='none'%20stroke='%234FC3B4'%20stroke-width='1.6'%20stroke-linecap='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .field select {
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='6'%3E%3Cpath%20d='M1,1L5,5L9,1'%20fill='none'%20stroke='%234FC3B4'%20stroke-width='1.6'%20stroke-linecap='round'/%3E%3C/svg%3E");
  }
}

/* Header theme toggle (Auto / Light / Dark) */
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; }
.theme-toggle svg { width: 15px; height: 15px; flex: none; }

.ghost { cursor: pointer; }
.ghost:hover { border-color: var(--accent); color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------------------------------------------------- query strip */

.querystrip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: 40px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.prompt {
  font-family: var(--display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

#query {
  flex: 1;
  height: 26px;
  border: 0;
  border-bottom: 1px dashed var(--rule);
  border-radius: 0;
  background: transparent;
  padding-left: 0;
  letter-spacing: 0.01em;
}
#query::placeholder { color: var(--ink-2); opacity: 0.6; }

.readout {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
}
.readout b { color: var(--ink); font-weight: 600; }

/* -------------------------------------------------------- column picker */

.columns-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
  max-height: 34vh;
  overflow: auto;
}
/* The [hidden] attribute (toggled by the Columns button) must win over the
   display rule above, or the panel stays open permanently. */
.columns-panel[hidden] { display: none; }
.columns-panel label {
  display: flex;
  gap: 6px;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  width: 210px;
}
.columns-panel .group-title {
  width: 100%;
  font-family: var(--display);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 6px;
}

/* --------------------------------------------------------------- sheet */

.sheet {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  position: relative;
}

.head, .filters, .row {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: stretch;
}

.head {
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 3;
}

.head .cell {
  font-family: var(--display);
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 8px 8px 6px;
  cursor: pointer;
  user-select: none;
  border-right: 1px solid var(--rule-2);
  line-height: 1.2;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}
.head .cell:hover { color: var(--accent); }
.head .cell.sorted { color: var(--accent); }
.head .cell .unit {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.75;
}
.head .cell .arrow { margin-left: auto; font-size: 10px; }

.filters {
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}
.filters input {
  width: 100%;
  height: 24px;
  border: 0;
  border-right: 1px solid var(--rule-2);
  border-radius: 0;
  background: transparent;
  font-size: 11px;
  padding: 2px 8px;
}
.filters input.active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.filters input::placeholder { color: var(--ink-2); opacity: 0.45; }

.scroller { overflow: auto; position: relative; }
.canvas { position: relative; }

.row {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--row-h);
  border-bottom: 1px solid var(--rule-2);
  contain: strict;
}
.row:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.row.odd { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.row.odd:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }

.row .cell {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--rule-2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  position: relative;
}
.cell.num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.cell.name { font-weight: 600; }
.cell.name a { color: var(--accent); text-decoration: none; }
.cell.name a:hover { text-decoration: underline; }
.cell.null { color: var(--ink-2); opacity: 0.45; }
.cell.money { color: var(--ink); }
.cell.flag-on { color: var(--accent); }
.cell.flag-off { color: var(--ink-2); opacity: 0.4; }

/* Signature: magnitude rule behind numeric values. Reads the column's own
   maximum, so scale is always relative to what is on screen. */
.mag {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  background: var(--bar);
}

.empty {
  position: absolute;
  inset: auto 0 0 0;
  top: 90px;
  display: grid;
  place-content: center;
  gap: 4px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
}
/* The [hidden] attribute (set in JS when rows > 0) must win over the display
   rule above, or the empty-state overlay stays visible on top of a full table. */
.empty[hidden] { display: none; }
.muted { color: var(--ink-2); }

/* ------------------------------------------------------------ colophon */

.colophon {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 18px;
  border-top: 1px solid var(--rule);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
}
.colophon .sep { opacity: 0.4; }

@media (max-width: 720px) {
  .masthead { gap: 10px; }
  .controls { margin-left: 0; width: 100%; }
  select { min-width: 0; flex: 1; }
  .querystrip { padding: 0 10px; }
  .readout { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- provider nav (multi-cloud) ------------------------------------ */
.providers { display: flex; gap: 2px; margin-left: 14px; }
.providers a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em;
  padding: 4px 10px; color: var(--ink); text-decoration: none;
  border: 1px solid var(--rule); border-radius: 6px; opacity: .7;
}
.providers a:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }
.providers a.active {
  color: var(--accent); border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); opacity: 1;
}

/* ---- landing page --------------------------------------------------- */
.landing { max-width: 900px; margin: 0 auto; padding: 40px 20px 60px; }
.landing-lede { font-size: 17px; color: var(--ink); opacity: .85; margin: 0 0 28px; max-width: 60ch; }
/* article link on the landing page */
.landing-more { margin-top: 22px; font-size: 15px; }
.landing-more a { color: var(--accent); font-weight: 600; text-decoration: none; }
.landing-more a:hover { text-decoration: underline; }

.provider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.provider-card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 20px;
  border: 1px solid var(--rule); border-radius: 10px; text-decoration: none;
  background: var(--panel); transition: border-color .12s, transform .12s;
}
.provider-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.pc-name { font-family: var(--display); font-size: 20px; color: var(--accent); }
.pc-blurb { font-size: 13px; color: var(--ink); opacity: .8; line-height: 1.4; }
