/* Project Orrery — site styles.
   Hand-written, no framework, no build step. */

:root {
  --bg:        #07080d;
  --bg-soft:   #0c0e16;
  --panel:     #11141d;
  --panel-2:   #171b27;
  --line:      #232839;
  --line-soft: #1a1e2b;
  --text:      #e4e9f2;
  --dim:       #8b95a8;
  --faint:     #5d6678;
  --accent:    #6f9cff;
  --accent-dk: #3f6fd8;
  --good:      #4fc98a;
  --warn:      #e0a75a;
  --bad:       #e8705c;
  --r:         12px;
}

/* Native controls -- the date picker, scrollbars, the select arrow -- follow this
   rather than defaulting to a white widget dropped into a dark panel. */
:root { color-scheme: dark; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

/* Starfield-ish wash, so the page reads as "space game" without a hero image
   nobody has drawn yet. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 520px at 12% -8%, #1a2247 0%, transparent 62%),
    radial-gradient(760px 460px at 88% 4%, #102733 0%, transparent 58%),
    radial-gradient(600px 600px at 50% 110%, #171132 0%, transparent 60%);
  opacity: 0.85;
}

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

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

header.site {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 15px 26px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 8, 13, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 13px;
  color: #eef2fb;
  white-space: nowrap;
}
header.site nav {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 14px;
}
header.site nav a { color: var(--dim); }
header.site nav a:hover { color: var(--text); text-decoration: none; }
.whoami {
  color: var(--text);
  font-weight: 600;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 13px;
}

/* ---- layout ------------------------------------------------------------- */

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 44px 22px 72px; }
main.narrow { max-width: 420px; }
main.wide   { max-width: 1120px; }

h1 { font-size: 30px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 15px; margin: 0 0 4px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dim); }
.lede { color: var(--dim); margin: 0 0 30px; font-size: 16px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  margin-bottom: 16px;
}
.panel + .panel { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }

/* ---- forms -------------------------------------------------------------- */

label { display: block; font-size: 13px; color: var(--dim); margin: 0 0 6px; font-weight: 500; }
.field { margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 0; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date] {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  transition: border-color .12s;
}
input::placeholder { color: var(--faint); }
input.compact, select.compact { width: auto; }

/* Matches the text inputs. A select styled by the browser in a dark panel comes
   out white-on-white in more than one of them. */
select {
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}
select:focus { outline: none; border-color: var(--accent-dk); }
input:focus { outline: none; border-color: var(--accent-dk); background: var(--panel-2); }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; }

/* Numbered steps. Roomier than a default list, because these are read once and
   followed, not skimmed. */
.steps { margin: 14px 0 0; padding-left: 20px; color: var(--muted); font-size: 14.5px; }
.steps li { margin-bottom: 10px; line-height: 1.55; }
.steps strong { color: var(--text); }

button {
  padding: 11px 18px;
  background: var(--accent);
  color: #08101f;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter .12s;
}
button:hover:not(:disabled) { filter: brightness(1.1); }
button:disabled { opacity: .45; cursor: default; }
button.block { width: 100%; margin-top: 20px; }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--bad); border: 1px solid #45231d; }
button.small { padding: 6px 12px; font-size: 13px; }

/* ---- messages ----------------------------------------------------------- */

.msg { margin-top: 16px; padding: 11px 13px; border-radius: 8px; font-size: 14px; display: none; white-space: pre-wrap; word-break: break-word; }
.msg.show { display: block; }
.msg.ok   { background: #0f2a1d; color: var(--good); border: 1px solid #1d4a34; }
.msg.bad  { background: #2b1512; color: var(--bad);  border: 1px solid #4d2219; }
.msg.info { background: #111a2d; color: var(--dim);  border: 1px solid #1f2a45; }

/* ---- bits --------------------------------------------------------------- */

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--dim); font-size: 13.5px; }
.faint { color: var(--faint); font-size: 12.5px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; word-break: break-all; }
.center { text-align: center; }
.stack > * + * { margin-top: 10px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.badge.good { background: #0f2a1d; color: var(--good); }
.badge.warn { background: #2c2214; color: var(--warn); }
.badge.bad  { background: #2b1512; color: var(--bad); }
.badge.flat { background: var(--panel-2); color: var(--dim); }

/* Big readable status line — the one thing people come to the account page for. */
.status-line { font-size: 22px; font-weight: 600; margin: 2px 0 6px; letter-spacing: -0.01em; }
.status-line.good { color: var(--good); }
.status-line.bad  { color: var(--bad); }
.status-line.warn { color: var(--warn); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; color: var(--dim); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:hover td { background: var(--panel-2); }

pre.mail {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-word;
  color: var(--dim); margin: 8px 0 0;
}

footer.site {
  border-top: 1px solid var(--line-soft);
  padding: 20px 26px;
  color: var(--faint);
  font-size: 13px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
footer.site a { color: var(--dim); }

/* ---- admin ---------------------------------------------------------------
   The panel is read before it is used: the counters say what kind of day it is,
   and the table is narrowed to one account before anything is changed. */

.spread { display: flex; justify-content: space-between; align-items: center; gap: 14px; }

/* Counters. auto-fit rather than a fixed column count, so seven tiles become two
   rows on a laptop and one column on a phone without a second breakpoint. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.stat {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat-value { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.stat-value.good { color: var(--good); }
.stat-value.warn { color: var(--warn); }
.stat-value.bad  { color: var(--bad); }
.stat-label { color: var(--faint); font-size: 12px; margin-top: 4px; }

/* Filters. Buttons, not a <select>: which slice you are looking at is worth
   seeing without opening anything, and one of these is always true. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
button.chip {
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-soft);
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 20px;
}
button.chip.on { background: var(--panel-2); color: var(--text); border-color: var(--accent-dk); }

/* The expanded account. A row rather than a modal, so the list it came from
   stays on screen -- support work is comparing one account with the next. */
tr.drawer:hover td { background: none; }
tr.drawer > td { background: var(--bg-soft); padding: 18px; }
.drawer-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(300px, 1.4fr);
  gap: 26px;
}
.drawer-title {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); margin: 0 0 10px; font-weight: 600;
}
.drawer-sub {
  font-size: 13px; color: var(--dim); font-weight: 600;
  margin: 18px 0 8px;
}
.drawer-grid .hint { margin-top: 0; flex: 1 1 220px; }
.drawer-grid .row { align-items: center; }

/* Audit lines. Three columns so the verb, the sentence and the time line up
   down the list rather than wrapping around each other. */
.log-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.log-line:last-child { border-bottom: none; }
.log-what strong { color: var(--text); font-weight: 600; }
.log-line .faint { white-space: nowrap; }

@media (max-width: 720px) {
  .drawer-grid { grid-template-columns: 1fr; gap: 18px; }
  .log-line { grid-template-columns: auto 1fr; }
  .log-line .faint { grid-column: 2; }
}

@media (max-width: 560px) {
  main { padding: 30px 16px 56px; }
  h1 { font-size: 25px; }
  header.site { padding: 13px 16px; gap: 12px; }
  header.site nav { gap: 12px; font-size: 13px; }
}
