/* One World, All Words: deep space blues, greys and blacks with gentle blue highlights. */
:root {
  --bg: #04070d;
  --surface: #0c1422;                       /* solid controls: inputs, dialogs, menus */
  --surface-2: rgba(120, 160, 220, .08);    /* quiet fills inside panels */
  --panel: rgba(9, 15, 27, .78);            /* frosted glass over the Earth */
  --border: rgba(140, 175, 225, .16);
  --border-strong: rgba(140, 175, 225, .3);
  --text: #e6edf6;
  --muted: #94a3b8;
  --accent: #5aa7ff;
  --accent-strong: #8cc3ff;
  --accent-soft: rgba(90, 167, 255, .14);
  --on-accent: #ffffff;
  --ok: #6dd6a2;
  --ok-soft: rgba(109, 214, 162, .13);
  --warn: #f2c46b;
  --warn-soft: rgba(242, 196, 107, .12);
  --bad: #ff8a8a;
  --bad-soft: rgba(255, 138, 138, .12);
  --radius: 14px;
  --shadow: 0 14px 34px rgba(0, 0, 0, .38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(4, 7, 13, .15) 0%, rgba(4, 7, 13, .55) 60%, rgba(4, 7, 13, .85) 100%),
    url("/static/assets/space.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  font: 15px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", sans-serif;
}

h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---- header ---- */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 1.15rem; }
.brand p { color: var(--muted); font-size: .85rem; }
.logo {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 1rem; letter-spacing: -1px;
}
.logo span { font-size: .8rem; margin-left: 1px; }
.status { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .8rem; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.ok::before { background: var(--ok); }
.pill.warn::before { background: var(--warn); }
.pill.off::before { background: transparent; border: 1.5px solid var(--muted); }

.banner {
  margin: 16px 24px 0; padding: 12px 16px; border-radius: var(--radius);
  background: var(--warn-soft); color: var(--text); border: 1px solid var(--warn);
}
.banner code { background: transparent; font-weight: 600; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 4px; padding: 16px 24px 0; border-bottom: 1px solid var(--border); }
.tabs button {
  appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600;
  padding: 10px 14px; border-bottom: 3px solid transparent; cursor: pointer; border-radius: 6px 6px 0 0;
}
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.count {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: .75rem; text-align: center;
}
.count:empty { display: none; }

main { padding: 20px 24px 48px; max-width: 1400px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid[hidden] { display: none; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } main, .tabs, .topbar { padding-left: 16px; padding-right: 16px; } .banner { margin-left: 16px; margin-right: 16px; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card > h2 { margin-bottom: 14px; }
.muted { color: var(--muted); font-size: .9rem; }
.empty { color: var(--muted); padding: 24px 8px; text-align: center; }

/* ---- form controls ---- */
.field-label { display: block; font-weight: 600; font-size: .88rem; margin: 16px 0 6px; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.links { display: flex; gap: 12px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible,
a:focus-visible, summary:focus-visible, .dropzone:focus-within, .chips label:focus-within,
.segmented label:focus-within {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

button, .button {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font: inherit; font-weight: 600; color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
button:hover, .button:hover { background: var(--surface-2); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.link {
  padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: .85rem;
}
button.link:hover { text-decoration: underline; background: none; }
button.danger { color: var(--bad); }
#submit { width: 100%; margin-top: 18px; padding: 11px; font-size: 1rem; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px; text-align: center; border-radius: 7px; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 14px;
  padding: 26px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.dropzone span { color: var(--muted); font-size: .85rem; }
#text-mode textarea { margin-top: 0; }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.chips label {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; font-size: .9rem;
}
.chips label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chips label:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.chips input, .check input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; margin: 0; }

.options { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.options summary { cursor: pointer; font-weight: 600; color: var(--accent); width: fit-content; border-radius: 4px; }
.check { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; cursor: pointer; }
.check input { margin-top: 3px; }
.check em { color: var(--muted); font-style: normal; font-size: .85rem; }
.error { color: var(--bad); margin-top: 12px; font-weight: 600; }

/* ---- jobs ---- */
.jobs { display: flex; flex-direction: column; gap: 10px; }
.job { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.job-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; width: 100%; text-align: left;
  padding: 12px 14px; border: 0; border-radius: 0; background: var(--surface); font-weight: 400;
}
.job-head:hover { background: var(--surface-2); }
.job-name { font-weight: 700; overflow-wrap: anywhere; }
.job-meta { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; }
.job-stage { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; }
.progress { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s ease; }
.badge { align-self: start; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge.queued, .badge.running { background: var(--accent-soft); color: var(--accent); }
.badge.completed { background: var(--ok-soft); color: var(--ok); }
.badge.failed { background: var(--bad-soft); color: var(--bad); }

.job-body { padding: 4px 14px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.job-body h3 { margin: 18px 0 8px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; color: var(--muted); font-size: .88rem; }
.facts b { color: var(--text); font-weight: 600; }
.notice { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: .9rem; }
.notice.bad { background: var(--bad-soft); border: 1px solid var(--bad); }
.notice.warn { background: var(--warn-soft); border: 1px solid var(--warn); }
.notice ul { margin: 0; padding-left: 18px; }
.notice li + li { margin-top: 4px; }
.job-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.items li { padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: .9rem; overflow-wrap: anywhere; }
.items .quote { font-weight: 600; }
.items .sub { color: var(--muted); display: block; margin-top: 2px; }
.tag {
  display: inline-block; padding: 0 8px; margin-right: 6px; border-radius: 999px; font-size: .74rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); text-transform: capitalize; vertical-align: 1px;
}
.tag.review, .tag.rule { background: var(--warn-soft); color: var(--warn); }
.term-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.term-suggestions button { font-size: .85rem; padding: 4px 10px; font-weight: 500; }

.lang { border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; }
.lang > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; cursor: pointer; font-weight: 700; border-radius: 8px;
}
.lang > summary:hover { background: var(--surface-2); }
.lang > summary small { color: var(--muted); font-weight: 500; }
.lang-body { padding: 4px 12px 12px; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.files a { font-weight: 500; font-size: .9rem; }
.files a small { color: var(--muted); }
.files a.primary-link { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.files a.primary-link:hover { background: var(--accent-strong); }
.preview {
  margin: 10px 0 0; padding: 10px 12px; max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface-2); border-radius: 8px; font: inherit; font-size: .92rem;
}
video.player { width: 100%; max-height: 420px; margin-top: 10px; border-radius: 8px; background: #000; }

/* ---- terms ---- */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.toolbar > div:first-child { max-width: 560px; }
.toolbar h2 { margin-bottom: 4px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; align-self: flex-start; }
.toolbar-actions input[type="search"] { width: 200px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
td.source { font-weight: 700; min-width: 140px; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button { padding: 4px 10px; font-size: .85rem; }
.tr { display: inline-block; margin: 0 6px 4px 0; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); }
.tr b { color: var(--muted); font-weight: 600; font-size: .8rem; margin-right: 4px; }

dialog {
  width: min(720px, calc(100vw - 32px)); padding: 22px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
dialog::backdrop { background: rgba(10, 16, 22, .55); }
fieldset { margin: 18px 0 0; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: 10px; }
fieldset:disabled { opacity: .5; }
legend { padding: 0 6px; font-weight: 600; font-size: .88rem; }
.locale-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px 14px; }
.locale-grid label { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 8px; font-size: .88rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }

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

/* ---- data colours (chart marks only; text never takes these) ---- */
:root {
  --series-1: #4c9dff;
  --viz-grid: rgba(150, 180, 220, .12);
  --viz-axis: rgba(150, 180, 220, .3);
  --viz-muted: #94a3b8;
}

.small { font-size: .85rem; }
section[role="tabpanel"] > .card + .card, section[role="tabpanel"] > .card + .viz-grid,
section[role="tabpanel"] > .viz-grid + .card, section[role="tabpanel"] > .viz-grid + .viz-grid { margin-top: 16px; }
.card h3 { margin-bottom: 6px; }

/* ---- toolbars, timeframe and filter buttons ---- */
.overview-toolbar { align-items: flex-end; }
.range { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.range button {
  border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 600; color: var(--muted);
}
.range button:hover { background: var(--surface); color: var(--text); }
.range button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.custom-range {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: -4px 0 16px;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.custom-range[hidden] { display: none; }
.custom-range label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.custom-range input { width: auto; }

/* ---- stat tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0;
}
.tile-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.tile-value { font-size: 1.6rem; font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.tile.hero .tile-value { font-size: 2.2rem; }
.tile-sub { color: var(--muted); font-size: .82rem; }

/* ---- charts ---- */
.viz-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
.viz-grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .viz-grid, .viz-grid.even { grid-template-columns: minmax(0, 1fr); } }
.viz-grid > * { min-width: 0; }
table.data .nowrap { white-space: nowrap; }
.chart { margin-top: 8px; }
.column-chart { width: 100%; height: auto; display: block; overflow: visible; }
.column-chart .bar { fill: var(--series-1); }
.column-chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.column-chart .axis { stroke: var(--viz-axis); stroke-width: 1; }
.column-chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.column-chart .hit { fill: transparent; cursor: default; }
.column-chart .hit:hover, .column-chart .hit:focus-visible { fill: var(--text); fill-opacity: .04; outline: none; }

.bars { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.bar-row {
  display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr); align-items: center; gap: 10px;
  padding: 3px 4px; border-radius: 6px;
}
.bar-row:hover, .bar-row:focus-visible { background: var(--surface-2); outline: none; }
.bar-name { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-fill { display: block; height: 14px; background: var(--series-1); border-radius: 0 4px 4px 0; flex: none; max-width: calc(100% - 48px); }
.bar-value { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.viz-tip {
  position: absolute; z-index: 20; display: flex; flex-direction: column; gap: 1px; max-width: 280px;
  padding: 8px 10px; border-radius: 8px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: 0 4px 16px rgba(16, 24, 40, .18); font-size: .82rem; pointer-events: none;
}
.viz-tip[hidden] { display: none; }
.viz-tip span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- data tables ---- */
table.data { font-size: .9rem; }
table.data th { white-space: nowrap; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.wrap { overflow-wrap: anywhere; min-width: 160px; }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover, table.data tr.clickable:focus-visible { background: var(--surface-2); outline: none; }
table.data.compact { margin-top: 10px; }
table.data.compact th, table.data.compact td { padding: 6px 10px; }
.footnote { margin-top: 14px; max-width: 900px; }

/* ---- jobs tab ---- */
.totals-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.totals-strip:empty { display: none; }
.mini { display: flex; flex-direction: column; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; min-width: 0; }
.mini span { color: var(--muted); font-size: .8rem; font-weight: 600; }
.mini b { font-size: 1.15rem; }
.mini small { color: var(--muted); font-size: .78rem; }
.job-cost { grid-column: 1 / -1; color: var(--text); font-size: .85rem; font-variant-numeric: tabular-nums; }
.toolbar-actions input[type="search"]#jobs-search { width: 220px; }

/* ---- new job ---- */
.form-card { max-width: 760px; margin: 0 auto; }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow: auto; }
.file-list[hidden] { display: none; }
.file-list li { padding: 5px 10px; background: var(--surface-2); border-radius: 6px; font-size: .88rem; overflow-wrap: anywhere; }
.file-list small { color: var(--muted); }
.estimate { margin-top: 16px; font-size: .92rem; }
.estimate:empty { display: none; }

#toast.interactive { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
.toast-action { padding: 4px 10px; font-size: .85rem; background: transparent; color: inherit; border-color: currentColor; }
.toast-action:hover { background: rgba(127, 127, 127, .2); }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button { white-space: nowrap; flex: none; }


/* =====================================================================
   Theme: the Earth behind, frosted glass in front
   ===================================================================== */
.space { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.space canvas { position: absolute; display: block; }
#space-back, #space-front { inset: 0; width: 100%; height: 100%; }
.topbar, .banner, .tabs, main { position: relative; z-index: 1; }
#toast { z-index: 30; }

/* The header is a hero: name and status on the left, the Earth in the open space on the right. */
.topbar {
  background: transparent; border-bottom: 0; min-height: 250px; padding: 44px 32px 22px;
  flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 18px;
}
.topbar > * { max-width: min(780px, 56vw); }
.brand { gap: 18px; }
.brand .logo {
  width: 64px; height: 64px; display: block; background: none; border-radius: 0;
  filter: drop-shadow(0 0 16px rgba(90, 167, 255, .5));
}
.brand h1 {
  font-size: 2.6rem; font-weight: 600; letter-spacing: -.005em; line-height: 1.1;
  background: linear-gradient(100deg, #f4f8ff 0%, #c9defa 45%, #7fb7ff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand p { color: #a9b8cc; font-size: 1.02rem; margin-top: 4px; }
.topbar-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status { justify-content: flex-start; }
.pill { background: rgba(9, 15, 27, .62); border-color: var(--border); color: var(--muted); backdrop-filter: blur(8px); }
.pill.ok::before { background: var(--ok); box-shadow: 0 0 8px rgba(109, 214, 162, .6); }
.pill.warn::before { background: var(--warn); }
.motion-toggle {
  padding: 4px 12px; font-size: .8rem; font-weight: 600; color: var(--muted);
  background: rgba(9, 15, 27, .55); border-color: var(--border); backdrop-filter: blur(8px);
}
.motion-toggle:hover { color: var(--text); background: rgba(120, 160, 220, .14); }

.banner { background: rgba(60, 46, 14, .78); border-color: rgba(242, 196, 107, .45); backdrop-filter: blur(10px); }

.tabs { padding: 0 32px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, transparent, rgba(4, 7, 13, .35)); }
.tabs button { color: var(--muted); border-radius: 8px 8px 0 0; background: none; border-top: 0; border-left: 0; border-right: 0; }
.tabs button:hover { color: var(--text); background: rgba(120, 160, 220, .08); }
.tabs button[aria-selected="true"] {
  color: #ffffff; border-bottom-color: var(--accent); text-shadow: 0 0 14px rgba(90, 167, 255, .55);
}
.count { background: rgba(90, 167, 255, .18); color: var(--accent-strong); }
main { padding-top: 22px; }

/* Panels: frosted glass with a faint top highlight. */
.card, .tile, .custom-range {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.tile.hero { border-color: rgba(90, 167, 255, .32); box-shadow: var(--shadow), 0 0 30px rgba(90, 167, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .06); }
.tile.hero .tile-value {
  background: linear-gradient(100deg, #ffffff, #9ccaff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tile-label, .mini span { color: var(--muted); letter-spacing: .01em; }
.mini { background: rgba(120, 160, 220, .07); border: 1px solid rgba(140, 175, 225, .08); }
h2 { font-weight: 600; letter-spacing: .005em; }

/* Controls */
button, .button { background: rgba(120, 160, 220, .08); border-color: var(--border); color: var(--text); }
button:hover, .button:hover { background: rgba(120, 160, 220, .16); border-color: var(--border-strong); }
button.primary, .files a.primary-link {
  background: linear-gradient(135deg, #2c6bd0, #4a94f2); border-color: transparent; color: #ffffff;
  box-shadow: 0 6px 20px rgba(44, 107, 208, .35);
}
button.primary:hover, .files a.primary-link:hover { background: linear-gradient(135deg, #3577de, #5aa2fa); border-color: transparent; }
button.danger { color: var(--bad); }
button.link, button.link:hover { color: var(--accent); background: none; border: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], select, textarea {
  background: rgba(3, 7, 14, .6); border-color: var(--border); color: var(--text);
}
input::placeholder, textarea::placeholder { color: #6b7a8f; }
select option { background: var(--surface); color: var(--text); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible,
a:focus-visible, summary:focus-visible, .dropzone:focus-within, .chips label:focus-within,
.segmented label:focus-within { outline-color: var(--accent); }

.segmented, .range { background: rgba(120, 160, 220, .07); border: 1px solid rgba(140, 175, 225, .08); }
.segmented input:checked + span, .range button[aria-pressed="true"] {
  background: rgba(90, 167, 255, .2); color: #ffffff; box-shadow: inset 0 0 0 1px rgba(90, 167, 255, .35);
}
.range button { background: none; border: 0; }
.range button:hover { background: rgba(120, 160, 220, .1); }

.dropzone { background: rgba(120, 160, 220, .05); border-color: var(--border-strong); }
.dropzone:hover, .dropzone.dragover, .dropzone.has-file { background: var(--accent-soft); border-color: var(--accent); }
.chips label { border-color: var(--border); background: rgba(3, 7, 14, .35); }
.chips label:has(input:checked) { border-color: rgba(90, 167, 255, .6); background: var(--accent-soft); }
.file-list li, .items li { background: rgba(120, 160, 220, .07); }
.preview { background: rgba(3, 7, 14, .6); }

/* Jobs */
.job { border-color: var(--border); background: rgba(5, 10, 19, .45); }
.job-head, .job-body { background: transparent; }
.job-head:hover { background: rgba(120, 160, 220, .07); }
.progress { background: rgba(120, 160, 220, .12); }
.progress > div { background: linear-gradient(90deg, #2c6bd0, #6db3ff); box-shadow: 0 0 10px rgba(90, 167, 255, .55); }
.badge.queued, .badge.running { background: var(--accent-soft); color: var(--accent-strong); }
.badge.completed { background: var(--ok-soft); color: var(--ok); }
.badge.failed { background: var(--bad-soft); color: var(--bad); }
.lang { border-color: var(--border); }
.lang > summary:hover { background: rgba(120, 160, 220, .07); }
.tag { background: var(--accent-soft); color: var(--accent-strong); }
.tag.review, .tag.rule { background: var(--warn-soft); color: var(--warn); }
.notice.warn { background: var(--warn-soft); border-color: rgba(242, 196, 107, .4); }
.notice.bad { background: var(--bad-soft); border-color: rgba(255, 138, 138, .4); }

/* Tables and charts */
th { color: var(--muted); }
th, td { border-bottom-color: var(--border); }
table.data tfoot td { border-top-color: var(--border-strong); }
table.data tr.clickable:hover, table.data tr.clickable:focus-visible, .bar-row:hover, .bar-row:focus-visible {
  background: rgba(120, 160, 220, .08);
}
.column-chart .bar, .bar-fill { filter: drop-shadow(0 0 6px rgba(76, 157, 255, .35)); }
.viz-tip { background: rgba(10, 17, 30, .96); border-color: var(--border-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }

/* Dialog and toast */
dialog { background: #0b1320; border-color: var(--border-strong); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
dialog::backdrop { background: rgba(2, 4, 8, .7); backdrop-filter: blur(4px); }
#toast { background: rgba(12, 20, 34, .96); color: var(--text); border: 1px solid var(--border-strong); }
#toast.bad { background: #5a1d1d; color: #ffffff; }

@media (max-width: 900px) {
  .topbar { min-height: 0; padding: 22px 16px 14px; }
  .topbar > * { max-width: 100%; }
  .brand { padding-right: 34vw; }
  .brand .logo { width: 44px; height: 44px; }
  .brand h1 { font-size: 1.6rem; }
  .brand p { font-size: .9rem; }
  .tabs { padding: 0 16px; }
}
@media (prefers-reduced-transparency: reduce) {
  .card, .tile, .custom-range { background: #0b1320; backdrop-filter: none; }
}
/* Controls that sit on the open background get their own glass, so passing phrases never cross their text. */
.overview-toolbar .range, .overview-toolbar .button, .motion-toggle {
  background: rgba(9, 15, 27, .74); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.overview-toolbar .button:hover { background: rgba(30, 45, 70, .85); }
/* Keep the name and tagline crisp where they cross the globe. */
.brand h1 { filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .65)); }
.brand p { text-shadow: 0 1px 10px rgba(0, 0, 0, .85); }
@media (max-width: 900px) { .brand { padding-right: 22vw; } }


/* =====================================================================
   Accounts: sign-in, the account chip, plans and administration
   ===================================================================== */
[hidden] { display: none !important; }

/* Signed out: only the name, the Earth and the sign-in card. */
body.signed-out .tabs, body.signed-out main, body.signed-out #status, body.signed-out #account { display: none; }
.auth { position: relative; z-index: 1; display: flex; padding: 8px 32px 64px; }
.auth-card { width: min(430px, 100%); padding: 26px 28px 22px; }
.auth-card h2 { font-size: 1.35rem; margin-bottom: 4px; }
.auth-card form { display: flex; flex-direction: column; }
.auth-card .field-label { margin-top: 14px; }
.auth-card input { width: 100%; }
.auth-card button.primary { margin-top: 18px; padding: 10px 16px; font-size: 1rem; }
.auth-card .notice { margin-top: 14px; background: var(--accent-soft); border: 1px solid rgba(90, 167, 255, .35); border-radius: 8px; padding: 8px 12px; }
.auth-card .error { margin-top: 14px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 16px; }

.account {
  display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px; border-radius: 999px;
  background: rgba(9, 15, 27, .62); border: 1px solid var(--border); backdrop-filter: blur(8px); font-size: .85rem;
}
.account-email { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.account .link { padding: 2px 8px; }
.account-notice { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius); backdrop-filter: blur(10px); }

/* What costs to run is shown to administrators only. */
body.no-costs .costs-only { display: none; }
body:not(.no-costs) .usage-only { display: none; }
body.no-costs #breakdowns { grid-template-columns: minmax(0, 1fr); }

/* Usage against the plan */
.meter-block { margin-top: 10px; }
.meter { height: 10px; border-radius: 999px; background: rgba(120, 160, 220, .14); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2c6bd0, #6db3ff); }
.meter.high > span { background: linear-gradient(90deg, #b9892f, #f2c46b); }
.meter.full > span { background: linear-gradient(90deg, #b94a4a, #ff8a8a); }
.meter-block p { margin-top: 6px; }
.tile.wide { grid-column: span 2; }
@media (max-width: 700px) { .tile.wide { grid-column: auto; } }

/* Plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin: 16px 0; }
.plan {
  display: flex; flex-direction: column; gap: 8px; padding: 22px 22px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.plan.current { border-color: rgba(90, 167, 255, .55); box-shadow: var(--shadow), 0 0 30px rgba(90, 167, 255, .14); }
.plan h3 { font-size: 1.15rem; }
.plan-price { color: var(--muted); }
.plan-price b { font-size: 2rem; font-weight: 650; color: var(--text); margin-right: 4px; }
.plan-tagline { min-height: 2.6em; }
.plan-features { list-style: none; margin: 6px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.plan-features li { padding-left: 22px; position: relative; font-size: .93rem; }
.plan-features li::before {
  content: ""; position: absolute; left: 3px; top: .45em; width: 9px; height: 5px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg);
}
.plan button, .plan .button { width: 100%; padding: 9px 14px; text-align: center; }
#plans-body > .card, #plans-body > .notice { margin-bottom: 16px; }
#plans-body > .notice { padding: 10px 14px; border-radius: var(--radius); }

/* Administration */
#admin-body > .card { margin-top: 16px; }
.card.attention { border-color: rgba(242, 196, 107, .45); }
.approvals { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.approvals li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: 10px;
  background: rgba(120, 160, 220, .07);
}
.approvals .who { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
select.compact { width: auto; padding: 5px 28px 5px 10px; font-size: .88rem; }
.row-actions { display: inline-flex; gap: 6px; }
.row-actions button { padding: 4px 10px; font-size: .82rem; }
table.data .sub { display: block; font-size: .8rem; }
.activity { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.activity li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.activity li:last-child { border-bottom: 0; }
.activity li span { overflow-wrap: anywhere; }
@media (max-width: 700px) { .activity li { grid-template-columns: 1fr; gap: 0; } }
.badge.queued, .badge.running, .badge.completed, .badge.failed { white-space: nowrap; }

/* A job opened from the admin tab */
.job-dialog { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 22px 24px; color: var(--text); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.dialog-head h2 { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .auth { padding: 8px 16px 48px; }
  .account-email { max-width: 150px; }
}

/* Sign-in sits under the name, beside the Earth. */
body.signed-out .topbar { min-height: 0; padding-bottom: 10px; }
.auth { padding-top: 18px; }
