/* Intrpret operator portal — self-contained styles in the marketing site's
   visual language (website/src/styles/global.css). Same palette, same brand
   typeface, same radius/button vocabulary, tuned dense for an operator tool.
   Nothing here loads from another origin: the one webfont is a file in
   ./fonts/, copied from @fontsource/space-grotesk. */

/* The wordmark face the marketing site uses (@fontsource/space-grotesk,
   latin-700 — the only weight the site imports). Bundled, not fetched. */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/space-grotesk-latin-700-normal.woff2") format("woff2");
}

:root {
  /* --- palette, lifted from the site's token layer --- */
  --void: #05050c;
  --night: #070713;
  --night-soft: #0a0b19;
  --panel: #101122;
  --panel-light: #15172b;
  --white: #f7f8ff;
  --text: rgba(238, 241, 255, 0.72);
  --muted: rgba(238, 241, 255, 0.43);
  --faint: rgba(238, 241, 255, 0.2);
  --line: rgba(255, 255, 255, 0.09);
  --line-bright: rgba(255, 255, 255, 0.16);
  --violet: #8b7cff;
  --indigo: #6575ff;
  --cyan: #48e5df;
  --mint: #73f7c7;
  --pink: #f76ec5;
  --orange: #ffb369;

  /* --- operator states, kept inside the palette --- */
  --ok: var(--mint);
  --warn: var(--orange);
  --danger: #ff6b81;

  /* --- shape --- */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --shell: 1100px;

  --display: "Space Grotesk", "Segoe UI Variable Display", Inter, system-ui, sans-serif;
  --body:
    "Segoe UI Variable Display", "Segoe UI Variable Text", Inter, "Aptos",
    "Microsoft JhengHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Cascadia Mono", monospace;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -8%, rgba(93, 73, 225, 0.16), transparent 70%),
    var(--night);
  color: var(--white);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------------ */
/* Brand mark, same construction as the site's header                        */
/* ------------------------------------------------------------------------ */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: #fbfbff;
}

.brand-word {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 1;
  text-shadow: 0 0 28px rgba(139, 124, 255, 0.18);
}

.brand-symbol {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.2), transparent 50%),
    linear-gradient(135deg, rgba(139, 124, 255, 0.3), rgba(72, 229, 223, 0.12));
  box-shadow:
    0 10px 30px rgba(101, 117, 255, 0.15),
    inset 0 1px rgba(255, 255, 255, 0.16);
}

.brand-symbol i {
  display: block;
  width: 2.5px;
  border-radius: 3px;
  background: linear-gradient(var(--cyan), var(--violet));
}

.brand-symbol i:nth-child(1) { height: 9px; }
.brand-symbol i:nth-child(2) { height: 18px; }
.brand-symbol i:nth-child(3) { height: 13px; }
.brand-symbol i:nth-child(4) { height: 7px; }

.brand-symbol.small {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.brand-symbol.small i:nth-child(1) { height: 7px; }
.brand-symbol.small i:nth-child(2) { height: 15px; }
.brand-symbol.small i:nth-child(3) { height: 11px; }
.brand-symbol.small i:nth-child(4) { height: 6px; }

/* ------------------------------------------------------------------------ */
/* Sign-in screen                                                            */
/* ------------------------------------------------------------------------ */

.login-screen {
  display: grid;
  min-height: 100vh;
  align-content: center;
  justify-items: center;
  padding: 40px 18px;
}

.login-card {
  width: min(100%, 440px);
  padding: 38px 34px 30px;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 34%),
    rgba(13, 14, 29, 0.86);
  box-shadow:
    0 50px 120px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(139, 124, 255, 0.07),
    inset 0 1px rgba(255, 255, 255, 0.05);
}

.login-title {
  margin: 22px 0 0;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1.05;
}

.login-lead {
  margin: 8px 0 26px;
  color: var(--text);
  font-size: 0.88rem;
}

.login-footer {
  margin: 16px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
}

button.block {
  display: block;
  width: 100%;
  margin-right: 0;
  margin-top: 6px;
}

.login-footer a {
  color: #b7afff;
  font-weight: 650;
  text-decoration: none;
}

.login-footer a:hover {
  color: var(--white);
  text-decoration: underline;
}

/* ------------------------------------------------------------------------ */
/* Console header                                                            */
/* ------------------------------------------------------------------------ */

.topbar {
  padding: 18px 24px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 20, 0.6);
  backdrop-filter: blur(18px) saturate(1.2);
}

.topbar-row {
  display: flex;
  max-width: var(--shell);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1.1;
}

.topbar h1 span { color: var(--muted); }

.subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.topbar-session {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Connected-state indicator, shown in every view. */
.conn {
  margin: 0;
  max-width: 20rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conn.ok { color: var(--mint); font-weight: 650; }

.viewnav {
  display: flex;
  max-width: var(--shell);
  gap: 8px;
  margin: 16px auto 0;
  flex-wrap: wrap;
}

.navlink {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 650;
  max-width: 22rem;
  overflow: hidden;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navlink:hover { color: var(--white); }

.navlink.active {
  border-color: rgba(139, 124, 255, 0.28);
  background: linear-gradient(180deg, rgba(139, 124, 255, 0.16), rgba(139, 124, 255, 0.05));
  color: var(--white);
}

/* ------------------------------------------------------------------------ */
/* Layout                                                                    */
/* ------------------------------------------------------------------------ */

main {
  display: grid;
  max-width: var(--shell);
  min-width: 0;
  margin: 0 auto;
  padding: 24px;
  gap: 18px;
}

/* Views are swapped by the hash router; only one is ever visible. */
.view {
  display: grid;
  gap: 18px;
  min-width: 0;
}

/* min-width:0 all the way down: a grid item's automatic minimum is its
   content's, and a wide table would otherwise push the whole page sideways
   instead of scrolling inside its own box on a narrow window. */
.card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 30%),
    rgba(11, 12, 27, 0.82);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}

.card h2 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.045em;
}

.card h3 {
  margin: 24px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.035em;
}

/* ------------------------------------------------------------------------ */
/* Forms                                                                     */
/* ------------------------------------------------------------------------ */

.field { margin-bottom: 16px; }

/* A period picker sitting next to its refresh button. */
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar .field { margin-bottom: 0; }
/* A period picker is a short value; it should not stretch across the card. */
.field.inline { flex: 0 1 18rem; min-width: 12rem; }

/* A checkbox and its wording read as one line, so the box does not stretch to
   the card's width the way a text input does. */
.field.check label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 0;
  cursor: pointer;
}

.field.check input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--violet);
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

input,
select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  color: var(--white);
  font: inherit;
  font-size: 0.88rem;
}

input::placeholder { color: var(--faint); }

input:focus,
select:focus {
  border-color: rgba(72, 229, 223, 0.5);
  outline: none;
  box-shadow: 0 0 0 3px rgba(72, 229, 223, 0.13);
}

select option {
  background: var(--panel);
  color: var(--white);
}

.hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--mono);
  font-size: 0.85em;
}

button {
  margin: 4px 8px 0 0;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

button.primary {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 32px rgba(139, 124, 255, 0.2);
  color: var(--night);
}

button.primary:hover {
  background: #f0edff;
  box-shadow: 0 14px 40px rgba(139, 124, 255, 0.34);
}

button.ghost {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

button.ghost:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--white);
}

button.danger {
  border-color: rgba(255, 107, 129, 0.4);
  background: rgba(255, 107, 129, 0.08);
  color: var(--danger);
}

button.danger:hover {
  border-color: rgba(255, 107, 129, 0.65);
  background: rgba(255, 107, 129, 0.14);
}

button.small {
  margin-top: 0;
  padding: 6px 12px;
  font-size: 0.74rem;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

.auth-panel { margin-top: 4px; }
.hidden { display: none; }
.view.hidden { display: none; }
.navlink.hidden { display: none; }

/* ------------------------------------------------------------------------ */
/* Readouts, messages, badges                                                */
/* ------------------------------------------------------------------------ */

.readout { margin-bottom: 18px; font-size: 0.88rem; }

.readout dl {
  display: grid;
  grid-template-columns: minmax(8rem, auto) 1fr;
  gap: 7px 18px;
  margin: 0;
}

.readout dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.readout dd {
  margin: 0;
  color: var(--white);
  word-break: break-word;
}

.muted { color: var(--muted); }

.status {
  margin: 14px 0 0;
  font-size: 0.8rem;
  min-height: 1.2em;
}

.status.ok { color: var(--mint); }
.status.err { color: var(--danger); }

.message {
  margin: 0;
  font-size: 0.84rem;
}

/* A standing warning about the deployment, not about one action. */
.banner {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid rgba(255, 179, 105, 0.32);
  border-radius: var(--radius-md);
  background: rgba(255, 179, 105, 0.08);
  color: var(--warn);
  font-size: 0.83rem;
}

/* The one-time setup link. Deliberately loud: it is shown once, and an
   operator who scrolls past it has to mint another one. */
.setup-link {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(115, 247, 199, 0.3);
  border-radius: var(--radius-md);
  background: rgba(115, 247, 199, 0.07);
}

/* Inside the panel the heading is the panel's own title, so it drops the
   section rule .card h3 normally draws above itself. */
.setup-link h3 {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  color: var(--mint);
}

.setup-link input {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.message.ok { color: var(--mint); }
.message.err { color: var(--danger); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.yes {
  border-color: rgba(115, 247, 199, 0.24);
  background: rgba(115, 247, 199, 0.1);
  color: var(--mint);
}

.badge.no {
  border-color: rgba(255, 107, 129, 0.26);
  background: rgba(255, 107, 129, 0.1);
  color: var(--danger);
}

/* ------------------------------------------------------------------------ */
/* Listings                                                                  */
/* ------------------------------------------------------------------------ */

/* Tables stay readable on a narrow window by scrolling sideways rather than
   squeezing the numeric columns into nothing. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.16);
}

.table-wrap > .muted {
  margin: 0;
  padding: 16px;
  font-size: 0.85rem;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

table.grid th,
table.grid td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

table.grid tbody tr:last-child td { border-bottom: 0; }

table.grid th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--cyan);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

table.grid td { color: var(--text); }

table.grid th.num,
table.grid td.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

table.grid tbody tr[data-index] { cursor: pointer; }

table.grid tbody tr:hover { background: rgba(139, 124, 255, 0.07); }

table.grid a {
  color: #b7afff;
  font-weight: 650;
  text-decoration: none;
}

table.grid a:hover { color: var(--white); text-decoration: underline; }

.mono {
  font-family: var(--mono);
  font-size: 0.82em;
}

.warn {
  color: var(--warn);
  font-weight: 650;
  white-space: normal;
}

.warn-row { background: rgba(255, 179, 105, 0.07); }

.row-actions { display: flex; gap: 6px; }

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.78rem;
}

.pager button { margin: 0; }

.counts {
  margin: 0;
  padding-left: 1.1rem;
}

/* ------------------------------------------------------------------------ */
/* Narrow windows (down to ~380px)                                           */
/* ------------------------------------------------------------------------ */

@media (max-width: 640px) {
  .topbar { padding: 14px 14px 0; }

  .topbar-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-session {
    width: 100%;
    justify-content: space-between;
  }

  main { padding: 16px 14px 28px; }

  .card { padding: 18px 16px; }

  .login-screen { padding: 24px 12px; }

  .login-card { padding: 26px 20px 22px; }

  .brand-word { font-size: 1.4rem; }

  .readout dl { grid-template-columns: 1fr; gap: 2px 0; }

  .readout dd { margin-bottom: 10px; }

  .navlink { font-size: 0.74rem; padding: 8px 12px; }
}
