/* The tools hub and the admin pages, in the site's navy and cyan. */
:root {
  /* The site's shared tokens (/_assets/theme.css), light and dark */
  --bg: var(--at-bg);
  --bg-alt: var(--at-surface-2);
  --card: var(--at-surface);
  --card-hover: var(--at-surface);
  --line: var(--at-border);
  --text: var(--at-text);
  --muted: var(--at-text-2);
  --accent: var(--at-accent);
  --good: var(--at-up);
  --bad: var(--at-down);
  --warn: var(--at-warn);
}
/* Dark: the navy of apnatrader.com, with the glow behind the top of the page. */
:root[data-theme="dark"] {
  --bg: var(--at-navy);
  --bg-alt: var(--at-navy-2);
  --card: rgba(255, 255, 255, 0.045);
  --card-hover: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.1);
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 500px at 50% -120px, var(--bg-alt), var(--bg) 70%) no-repeat, var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--at-font);
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Light: white cards and panels lifted off the grey page by a soft shadow. */
:root:not([data-theme="dark"]) .hub-card,
:root:not([data-theme="dark"]) .panel {
  box-shadow: var(--at-shadow);
}

/* ---------- Hub ---------- */
.hub {
  flex: 1;
  width: min(1100px, 100% - 32px);
  margin: 0 auto;
  padding-bottom: 48px;
}
.hub-hero {
  max-width: 680px;
  padding: 40px 0 32px;
}
.hub-hero h1 {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
}
.hub-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hub-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.hub-card:hover,
.hub-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: var(--card-hover);
  transform: translateY(-2px);
  outline: none;
}
.hub-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--at-accent-soft);
}
.hub-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hub-tag {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hub-name {
  margin: 4px 0 8px;
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.3;
}
.hub-desc {
  flex: 1;
  color: var(--muted);
  font-size: 0.95rem;
}
.hub-open {
  margin-top: 16px;
  color: var(--accent);
  font-weight: 600;
}

.hub-foot {
  width: min(1100px, 100% - 32px);
  margin: 0 auto;
  padding: 24px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}
.hub-foot p {
  margin: 0 0 4px;
}

/* ---------- Admin ---------- */
.admin {
  flex: 1;
  width: min(880px, 100% - 32px);
  margin: 0 auto;
  padding: 32px 0 48px;
}
.admin h1 {
  font-size: 1.9rem;
}
.admin-lead {
  margin: -4px 0 24px;
  color: var(--muted);
}
.panel {
  margin: 0 0 18px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.panel h2 {
  margin-bottom: 12px;
  font-size: 1.12rem;
}
.panel p {
  margin: 0 0 10px;
}
.panel-narrow {
  max-width: 440px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.88rem;
}

.form {
  display: grid;
  gap: 12px;
}
.form label {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 600;
}
.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}
.input {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--at-border-strong);
  border-radius: 8px;
  background: var(--at-surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.input:focus {
  border-color: var(--accent);
  outline: none;
}
.input-totp {
  width: 9.5em;
  letter-spacing: 0.15em;
  font-variant-numeric: tabular-nums;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--at-accent-ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: var(--at-accent-hover);
}
.btn-ghost {
  border-color: var(--at-border-strong);
  background: transparent;
  color: var(--text);
  font-weight: 600;
}
.btn-ghost:hover {
  background: var(--at-accent-softer);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid;
}
.notice-ok {
  border-color: color-mix(in srgb, var(--good) 45%, transparent);
  background: var(--at-up-soft);
}
.notice-error {
  border-color: color-mix(in srgb, var(--bad) 45%, transparent);
  background: var(--at-down-soft);
}

.checks {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
}
.checks dt {
  color: var(--muted);
}
.checks dd {
  margin: 0;
}
.ok {
  color: var(--good);
}
.bad {
  color: var(--bad);
}
.warn {
  color: var(--warn);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.code {
  display: block;
  overflow-x: auto;
  margin: 6px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--at-surface-2);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}

@media (max-width: 560px) {
  .hub-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 16px;
  }
  .checks {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .checks dd {
    margin-bottom: 8px;
  }
}
.form-gap {
  margin-top: 14px;
}
/* A URL path as a card's label (the local front page): shown as typed, not in capitals. */
.hub-tag-path {
  text-transform: none;
  letter-spacing: 0;
  font: 600 0.82rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Scheduled jobs on the admin page: name and status, then the full command line */
.jobs {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.job-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
  font-size: 0.95rem;
}
.code-wrap {
  margin-bottom: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Site colours on the admin page: one card per palette */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.palette-card {
  display: grid;
  align-content: start; /* cards in a row share a height: keep every card's name and swatches level */
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--at-surface-2);
  cursor: pointer;
}
.palette-card:hover {
  border-color: var(--at-border-strong);
}
.palette-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.palette-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.palette-card:has(input:focus-visible) {
  outline: 2px solid var(--at-focus);
  outline-offset: 2px;
}
.palette-name {
  font-weight: 700;
}
.palette-badge {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--at-accent-soft);
  color: var(--at-accent-text);
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: 2px;
}
.palette-swatches {
  width: 100%;
  height: 18px;
}
.palette-desc {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}
