@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Nocturne, rendered light: the neutral and accent ramps flipped end for end.
   Values are the resolved ones from the design handoff — see
   documentation/210-Dashboard.md. */
:root {
  --color-bg: #f3f5fe;
  --color-surface: #fbfcff;
  --color-text: #14151f;
  --color-divider: #b6bbd2;
  --color-accent: #574aa3;
  --color-accent-300: #5d5294;
  --color-accent-400: #796cbf;
  --color-neutral-300: #3f424d;
  --color-neutral-400: #52566a;
  --color-neutral-500: #6b6f85;
  --color-neutral-600: #8a8fa5;
  --color-neutral-700: #b6bbd2;
  --color-neutral-800: #d3d8ea;
  --color-neutral-900: #e6eaf6;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;

  --shadow-sm: 0 1px 2px rgba(33, 35, 46, 0.06);

  --warn-bg: #fdf6e7;
  --warn-border: #e3cf9a;
  --warn-text: #6d5518;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 48px;
  background: var(--color-bg);
  color: var(--color-text);
  font: 400 16px/1.55 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Never the browser default ring. */
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ---- Panel ---- */
.shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-neutral-800);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-neutral-800);
}
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; }
.brand-logo { height: 52px; width: auto; display: block; }
.brand-divider { width: 1px; height: 22px; background: var(--color-neutral-700); flex: none; }
.brand-name { font-size: 16px; font-weight: 500; color: var(--color-neutral-300); }

.shell-body { padding: 40px 48px 32px; }
.landing { display: flex; flex-direction: column; gap: 32px; }

/* The signature rule: fades to transparent over the outer 48px rather than
   stopping cleanly. Not a border. */
.rule {
  height: 1px;
  background: linear-gradient(to right,
    transparent, var(--color-neutral-800) 48px,
    var(--color-neutral-800) calc(100% - 48px), transparent);
}

/* ---- Headline figures ---- */
.headline { display: flex; align-items: flex-end; gap: 48px; flex-wrap: wrap; }

.metric { display: flex; flex-direction: column; gap: 4px; }
.metric-value { margin: 0; font-size: 26px; font-weight: 500; color: var(--color-text); }
.metric-label { margin: 0; font-size: 14px; color: var(--color-neutral-400); }

.metric-lead { gap: 6px; }
.metric-lead .metric-value {
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.metric-lead .metric-label { font-size: 15px; }

/* ---- Ranked lists ---- */
.ranks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }

.stat-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.stat-head h2 { margin: 0; font-size: 16px; font-weight: 500; color: var(--color-text); }
.stat-caption { font-size: 13px; color: var(--color-neutral-500); white-space: nowrap; }

.stat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }

.stat-link {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 8px;
  margin: 0 -8px;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}
a.stat-link { cursor: pointer; }
a.stat-link:hover { background: var(--color-neutral-900); }

.stat-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.stat-label { color: var(--color-text); min-width: 0; }
.stat-value { color: var(--color-neutral-400); font-variant-numeric: tabular-nums; }

/* The sector labels are long enough to wrap, so this column truncates. */
.stat-col-sectors .stat-line { gap: 12px; }
.stat-col-sectors .stat-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-col-sectors .stat-value { flex: none; }

.bar { height: 4px; background: var(--color-neutral-900); border-radius: 2px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--color-accent); border-radius: 2px; }

/* ---- Search form ---- */
.search { display: flex; flex-direction: column; gap: 16px; }
.search-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-neutral-400);
}
.field input, .field select {
  width: 100%;
  height: 40px;
  padding: 6px 10px;
  font: inherit;
  font-size: 16px;
  color: var(--color-text);
  caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.field input::placeholder { color: var(--color-neutral-600); }
.field input:hover, .field select:hover {
  border-color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.field input:focus-visible, .field select:focus-visible {
  border-color: var(--color-accent);
  outline-offset: 0;
}

.search-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* Outlined, never filled — the accent is a line here, not a ground. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 28px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.btn-primary { color: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.btn-primary:active { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }

.btn-ghost { color: var(--color-accent); padding: 0 3px; }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }

.filter-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-neutral-400);
}
.filter-status .icon { width: 14px; height: 14px; color: var(--color-accent); flex: none; }
.filter-hint { font-size: 14px; color: var(--color-neutral-600); }

@media (max-width: 900px) {
  body { padding: 24px; }
  .shell-body { padding: 32px 24px 24px; }
  .ranks { grid-template-columns: 1fr; }
  .search-grid { grid-template-columns: repeat(2, 1fr); }
  .rule { background: linear-gradient(to right,
    transparent, var(--color-neutral-800) 24px,
    var(--color-neutral-800) calc(100% - 24px), transparent); }
}
@media (max-width: 600px) {
  body { padding: 0; }
  .shell { border: 0; border-radius: 0; box-shadow: none; }
  .topbar { padding: 14px 20px; }
  .shell-body { padding: 24px 20px 20px; }
  .search-grid { grid-template-columns: 1fr; }
  .metric-lead .metric-value { font-size: 38px; }
}

/* ---- Notices ---- */
.notice {
  padding: 12px 14px;
  font-size: 15px;
  background: var(--color-surface);
  border: 1px solid var(--color-neutral-800);
  border-radius: var(--radius-md);
  color: var(--color-neutral-400);
}
.notice.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }

/* ---- Results ---- */
.results-block { display: flex; flex-direction: column; gap: 14px; }
.results-head { margin: 0; font-size: 15px; color: var(--color-neutral-400); }

.btn-link { color: var(--color-accent-300); font-size: 15px; text-decoration: none; white-space: nowrap; }
.btn-link:hover { color: var(--color-accent); text-decoration: underline; }

/* An action sitting inside a table row, next to links. Outlined like the rest of
   the buttons here — the accent is a line, not a ground — and one step quieter
   than .btn-primary, which owns the search. A <button> arrives with the
   browser's own chrome (its own font, its filled background), so unlike an
   anchor it has to be told all of it. */
.btn-quiet {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  padding: 3px 10px;
  color: var(--color-accent-300);
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--color-neutral-700);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-quiet:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
}
.btn-quiet:active { background: color-mix(in srgb, var(--color-accent) 16%, transparent); }

/* button_to wraps its button in a form, which would otherwise take the width of
   the cell and push anything beside it onto its own line. */
form.button_to { display: inline-block; }

table.results {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-neutral-800);
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: 15px;
}
table.results th, table.results td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-neutral-800);
  vertical-align: top;
}
table.results th {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-neutral-400);
  background: var(--color-bg);
}
table.results tr:last-child td { border-bottom: 0; }
table.results tbody tr:hover td { background: var(--color-neutral-900); }
table.results a { color: var(--color-accent-300); text-decoration: none; }
table.results a:hover { color: var(--color-accent); }

/* Registry numbers line up and stay legible next to Greek text. */
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 12px;
  color: var(--color-accent);
  background: var(--color-neutral-900);
  border-radius: 999px;
}

.pager { display: flex; gap: 16px; align-items: center; }

/* ---- Detail page ----
   Stacked with margins rather than the landing's flex gap: the view is a flat
   list of optional sections, so each one carries its own spacing. */
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 4px; font-size: 26px; font-weight: 500; letter-spacing: -0.015em; }
.muted { color: var(--color-neutral-400); margin: 0; font-size: 15px; }

.card {
  margin-bottom: 16px;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-neutral-800);
  border-radius: var(--radius-md);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-neutral-400);
}
.card table.results { border: 0; border-radius: 0; }

dl.detail { display: grid; grid-template-columns: 200px 1fr; gap: 8px 20px; margin: 0; font-size: 15px; }
dl.detail dt { color: var(--color-neutral-400); }
dl.detail dd { margin: 0; }
@media (max-width: 600px) { dl.detail { grid-template-columns: 1fr; gap: 2px 0; } dl.detail dd { margin-bottom: 10px; } }

ul.plain { margin: 0; padding-left: 18px; font-size: 15px; }
.objective { color: var(--color-neutral-400); max-width: 78ch; font-size: 15px; }

a { color: var(--color-accent-300); text-decoration: none; }
a:hover { color: var(--color-accent); }

/* ---- Sign in ---- */
/* The one page reachable without a session (documentation/360). Narrow and centred
   rather than filling the shell: there is one decision to make on it. */
.signin { max-width: 360px; margin: 32px auto 48px; }
.signin-title {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 600;
}
.signin-form { display: flex; flex-direction: column; gap: 16px; }
.signin-form .btn { align-self: flex-start; margin-top: 4px; }

.signin-alert, .signin-notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid;
  border-radius: var(--radius-md);
}
.signin-alert { color: var(--warn-text); background: var(--warn-bg); border-color: var(--warn-border); }
.signin-notice { color: var(--color-neutral-300); background: var(--color-neutral-900); border-color: var(--color-neutral-800); }

.signin-note { margin: 24px 0 0; font-size: 14px; color: var(--color-neutral-500); }

/* The session controls sit opposite the brand, so the topbar has to space them. */
.topbar-session {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
}
.topbar-session form { margin: 0; }
.topbar-user { font-size: 14px; color: var(--color-neutral-500); }

/* On a narrow screen the brand and the controls stack rather than crushing each other. */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .topbar-session { margin-left: 0; width: 100%; gap: 12px; }
}

/* ---- Accounts ---- */
.page-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.page-title { margin: 0; font-size: 20px; font-weight: 600; }
.page-head .btn { margin-left: auto; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 12px;
  color: var(--color-neutral-400);
  background: var(--color-neutral-900);
  border-radius: 999px;
}

.row-actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.row-actions form { margin: 0; }
/* A link, not a button: destructive, but not the thing the eye should land on first. */
.btn-danger { color: var(--warn-text); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.btn-danger:hover { text-decoration: underline; }

.field-hint { margin: 0; font-size: 13px; color: var(--color-neutral-500); }
.field-check { display: flex; align-items: center; gap: 10px; }
.field-check input { width: auto; height: auto; margin: 0; }
.field-check label { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--color-text); }

.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
