/* Cetus shared theme (landing, login, explorer, admin dashboard).
   Standard: DARK by default; a header toggle switches to LIGHT and the choice
   lives in localStorage (theme.js, applied before first paint). The OS color
   preference is deliberately NOT consulted. Colors live ONLY in the two variable blocks below;
   TestThemeContrast (cmd/cetus/theme_test.go) parses them and fails if any
   text/background pair drops under WCAG AA 4.5:1 (strong text 12:1, muted text
   7:1 / AAA) in either theme.
   --strong = headings, labels, table headers, active tab, status and key values
   (near-white on dark, near-black on light); --text = body; --muted = secondary. */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg:      #0f1419;  /* page */
  --panel:   #151b22;  /* header, cards */
  --panel2:  #1d2630;  /* inputs, hover */
  --inset:   #0c1015;  /* status/console box */
  --sel:     #1b2a44;  /* selected table row */
  --line:    #3a4654;
  --strong:  #ffffff;
  --text:    #f5f7fa;
  --muted:   #cdd6e0;
  --accent:  #a8c7ff;
  --btn:     #1d4ed8;
  --btntext: #ffffff;
  --red:     #ff8a8a;  /* BETA, errors */
  --ok:      #4ade80;
  --warn:    #fcd34d;
  --err:     #ff8a8a;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg:      #f4f6f8;
  --panel:   #ffffff;
  --panel2:  #e8edf2;
  --inset:   #eef2f6;
  --sel:     #dbe7fb;
  --line:    #8a97a5;
  --strong:  #000000;
  --text:    #0b0f14;
  --muted:   #38424d;
  --accent:  #1d4ed8;
  --btn:     #1d4ed8;
  --btntext: #ffffff;
  --red:     #b91c1c;
  --ok:      #065f46;
  --warn:    #92400e;
  --err:     #b91c1c;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.4 system-ui, sans-serif; background: var(--bg); color: var(--text); }
.top { display: flex; align-items: center; gap: .75rem; padding: .35rem .9rem;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.top .name { font-weight: 700; font-size: 1rem; color: var(--strong); }
.top .ver { color: var(--muted); font-size: .85rem; }
.beta { color: var(--red); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.grow { flex: 1; }
.user { color: var(--text); font-size: .85rem; }
.muted { color: var(--muted); }
.link, a.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
a { color: var(--accent); }
.inline { display: inline; margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn, .themebtn { background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: .3rem .7rem; font: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover, .themebtn:hover { border-color: var(--accent); }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--btntext); font-weight: 600; }
.btn.quiet { background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.themebtn { min-width: 4.2rem; font-size: .85rem; }

/* generic page + cards */
main.page { padding: 1.25rem; max-width: 960px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; }
.card { padding: .9rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.card h2 { margin: 0 0 .4rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--strong); }
.card .v { font-size: 1.05rem; word-break: break-word; color: var(--strong); }
.jobrow { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin: 1.25rem 0; }
.jobbox { font-family: ui-monospace, monospace; font-size: .85rem; white-space: pre-wrap;
  padding: 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--inset); color: var(--text); }
.ok { color: var(--ok); } .err { color: var(--err); } .run { color: var(--warn); }
.expired { margin: 1rem 0; padding: .75rem 1rem; border: 1px solid var(--red); border-radius: 8px;
  background: var(--panel); color: var(--text); font-weight: 600; }

/* landing */
.hero h1 { font-size: 1.5rem; margin: 1.5rem 0 .5rem; color: var(--strong); }
.hero p { max-width: 42rem; line-height: 1.55; }
.links { list-style: none; padding: 0; margin: 1.25rem 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.links li a { display: inline-block; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--panel); text-decoration: none; }
.links li a:hover { border-color: var(--accent); }
.links li a.primary { background: var(--btn); border-color: var(--btn); color: var(--btntext); font-weight: 600; }

/* login */
.wrap { max-width: 360px; margin: 8vh auto; padding: 1.5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.wrap h1 { font-size: 1.1rem; margin: 0 0 1rem; color: var(--strong); }
.wrap label { display: block; margin: .6rem 0 .2rem; font-size: .85rem; color: var(--strong); font-weight: 600; }
.wrap input[type=text], .wrap input[type=password] {
  width: 100%; padding: .5rem .6rem; border-radius: 4px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font: inherit; }
.wrap button[type=submit] { margin-top: 1rem; width: 100%; padding: .55rem; border: 0; border-radius: 4px;
  background: var(--btn); color: var(--btntext); font: inherit; font-weight: 600; cursor: pointer; }
.pwrow { position: relative; }
.pwrow input[type=password], .pwrow input[type=text] { padding-right: 4.2rem; }
button.eye { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); width: auto; margin: 0;
  padding: .25rem .55rem; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
button.eye:hover { border-color: var(--accent); }
.wrap .err { color: var(--red); font-size: .9rem; margin-bottom: .75rem; font-weight: 600; }

/* freshness (landing + explorer): last / next update */
.fresh { display: flex; flex-wrap: wrap; gap: .4rem 1.75rem; margin: .75rem 0 .25rem; }
.fresh > div { display: flex; gap: .5rem; align-items: baseline; }
.fresh dt { color: var(--strong); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.fresh dd { margin: 0; color: var(--strong); }
.fresh .sep { color: var(--muted); }
.freshnote { margin: .1rem 0 .75rem; color: var(--muted); font-size: .85rem; max-width: 46rem; }
/* dashboard downloads log */
.dlpanel { margin-top: 1.5rem; }
.dlpanel h2 { font-size: 1rem; color: var(--strong); margin: 0 0 .5rem; }
.dlpanel .tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; max-height: 24rem; }
.dlpanel table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.dlpanel th, .dlpanel td { padding: .3rem .6rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dlpanel th { position: sticky; top: 0; background: var(--panel); color: var(--strong); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.dlpanel td.num, .dlpanel th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dlpanel td.syms { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, monospace; }
.dlpanel .empty { text-align: center; color: var(--muted); padding: 1rem; }
