/* Galaxy Perks back office — deliberately a console, not a storefront:
   dark rail, dense filterable tables, readable statuses, work-shaped record cards. */
:root {
  --ink: #0e1420;
  --body: #2c3444;
  --muted: #6b7489;
  --line: #e3e6ec;
  --line-soft: #eef0f4;
  --paper: #ffffff;
  --shell: #f6f7f9;
  --rail: #101826;
  --rail-soft: #1b2435;
  --rail-text: #9aa6bd;
  --teal: #0f8a7e;
  --teal-dark: #0a6a61;
  --teal-wash: #e6f4f1;
  --amber: #a86500;
  --amber-wash: #fdf2dd;
  --red: #b3261e;
  --red-wash: #fdecea;
  --blue: #1b47d6;
  --blue-wash: #eef1fe;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--shell); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
a { color: var(--teal); }
.loading { padding: 3rem; color: var(--muted); }

.console { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.work { display: flex; flex-direction: column; min-width: 0; }

/* -------------------------------------------------------------------- rail */
.side { background: var(--rail); color: var(--rail-text); padding: 1rem .75rem 2rem; }
.side .mark { display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem 1.4rem; }
.side .mark img { width: 30px; height: 30px; }
.side .mark strong { color: #fff; font-size: 1rem; letter-spacing: .02em; display: block; }
.side .mark small { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: #5f6c85; }
.side .group { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase;
  color: #55617a; padding: 1rem .6rem .35rem; }
.side a {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .5rem .6rem; margin-bottom: 1px; border-radius: 8px;
  color: var(--rail-text); text-decoration: none; font-size: .88rem; font-weight: 500;
}
.side a:hover { background: var(--rail-soft); color: #fff; }
.side a.on { background: var(--teal); color: #fff; font-weight: 600; }
.side a .tag {
  min-width: 1.4rem; text-align: center; padding: 0 .35rem; border-radius: 999px;
  background: var(--rail-soft); color: #cdd6e6; font-size: .7rem; font-weight: 700;
}
.side a.on .tag { background: rgba(255, 255, 255, .22); color: #fff; }
.side .foot { margin-top: 1.4rem; padding: .7rem .6rem; border-top: 1px solid #222c3f;
  font-size: .72rem; color: #55617a; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem 1.4rem; background: var(--paper); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.12rem; }
.topbar .crumb { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.topbar .right { display: flex; align-items: center; gap: .9rem; }
.langswitch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.langswitch button {
  font: inherit; font-size: .76rem; font-weight: 700; letter-spacing: .04em;
  border: 0; background: var(--paper); color: var(--muted); padding: .32rem .7rem; cursor: pointer;
}
.langswitch button:hover { background: var(--teal-wash); color: var(--teal-dark); }
.langswitch button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.me { text-align: right; line-height: 1.25; }
.me strong { display: block; font-size: .82rem; }
.me span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.me a { font-size: .72rem; }

/* -------------------------------------------------------------------- view */
.view { padding: 1.3rem 1.4rem 3rem; min-width: 0; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 1rem; }
.card > header {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line-soft);
}
.card > header h2 { font-size: .95rem; }
.card > header .hint { font-size: .76rem; color: var(--muted); }
.card .pad { padding: 1rem; }
.cols { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.cols.even { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tiles { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1rem; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .85rem 1rem; }
.tile dt { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tile dd { margin: .25rem 0 0; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile dd small { font-size: .78rem; font-weight: 500; color: var(--muted); }
.tile.warn { border-left: 3px solid var(--amber); }
.tile.good { border-left: 3px solid var(--teal); }

/* ------------------------------------------------------------------ tables */
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.grid th, table.grid td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--line-soft); }
table.grid thead th {
  position: sticky; top: 0; background: #fafbfc; z-index: 1;
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--line);
}
table.grid tbody tr:hover { background: #fbfcfd; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid td.mono { font-family: var(--mono); font-size: .8rem; white-space: nowrap; }
table.grid .sub { display: block; color: var(--muted); font-size: .74rem; }
table.grid tr.clickable { cursor: pointer; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: .85rem; }

.pill {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--line-soft); color: var(--body); white-space: nowrap;
}
.pill.teal { background: var(--teal-wash); color: var(--teal-dark); }
.pill.amber { background: var(--amber-wash); color: var(--amber); }
.pill.red { background: var(--red-wash); color: var(--red); }
.pill.blue { background: var(--blue-wash); color: var(--blue); }

/* ------------------------------------------------------------------ forms */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
label.f { display: block; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; }
label.f span { display: block; margin-bottom: .22rem; }
input, select, textarea {
  font: inherit; font-size: .85rem; width: 100%; padding: .42rem .55rem; color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; background: var(--paper);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
input[type=search] { min-width: 15rem; }
.row { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: .8rem; }
.btn {
  display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-size: .82rem; font-weight: 600;
  padding: .45rem .85rem; border-radius: 7px; border: 1px solid transparent; cursor: pointer;
  background: var(--teal); color: #fff; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--teal-dark); }
.btn:disabled { background: #b9c0cc; cursor: not-allowed; }
.btn.ghost { background: var(--paper); color: var(--body); border-color: var(--line); }
.btn.ghost:hover { background: var(--shell); color: var(--ink); }
.btn.danger { background: var(--paper); color: var(--red); border-color: #e9c4c1; }
.btn.danger:hover { background: var(--red-wash); }
.btn.dark { background: var(--ink); }
.btn.dark:hover { background: #000; }
.btn.tiny { font-size: .74rem; padding: .25rem .55rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

dl.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; margin: 0; font-size: .84rem; }
dl.facts dt { color: var(--muted); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; padding-top: .1rem; }
dl.facts dd { margin: 0; font-weight: 500; }
.msg { padding: .6rem .8rem; border-radius: 8px; font-size: .82rem; margin-bottom: .8rem; }
.msg.bad { background: var(--red-wash); color: #8b1f18; border: 1px solid #f0cbc7; }
.msg.good { background: var(--teal-wash); color: var(--teal-dark); border: 1px solid #bfe3dc; }
.msg.info { background: var(--blue-wash); color: #17317f; border: 1px solid #ccd6fb; }
.msg.warn { background: var(--amber-wash); color: var(--amber); border: 1px solid #f0dcb4; }
.trail { list-style: none; margin: 0; padding: 0; font-size: .8rem; }
.trail li { padding: .45rem 0; border-bottom: 1px solid var(--line-soft); }
.trail li:last-child { border-bottom: 0; }
.trail time { color: var(--muted); font-size: .72rem; display: block; }
.trail code { font-family: var(--mono); font-size: .74rem; color: var(--body); word-break: break-word; }

/* ------------------------------------------------------------- box office */
.lookup { max-width: 34rem; }
.lookup input { font-family: var(--mono); font-size: 1.5rem; letter-spacing: .1em;
  text-align: center; padding: .7rem; }
.verdict { border-radius: 10px; padding: 1.1rem 1.2rem; margin-top: 1rem; border: 1px solid; }
.verdict.valid { background: var(--teal-wash); border-color: #a9d8d0; }
.verdict.stop { background: var(--red-wash); border-color: #f0bdb8; }
.verdict.hold { background: var(--amber-wash); border-color: #f0dcb4; }
.verdict h2 { font-size: 1.3rem; margin-bottom: .3rem; }
.verdict .big { font-family: var(--mono); font-size: 1.3rem; letter-spacing: .08em; font-weight: 700; }

@media (max-width: 900px) {
  .console { grid-template-columns: 1fr; }
  .side { display: flex; flex-wrap: wrap; gap: .2rem; padding: .6rem; }
  .side .mark { width: 100%; padding: .3rem .4rem .6rem; }
  .side .group, .side .foot { display: none; }
  .side a { flex: 1 1 auto; }
  .cols { grid-template-columns: 1fr; }
}
