/* Lodestar operator UI — professional-with-character, aligned to the
   secondBot Operator (Control UI) design language: a clean sans system,
   layered surfaces with whisper-thin borders and modern radii, compact
   component shapes (stat rows, pills, status dots), and restrained motion.
   Lodestar keeps its own signature: the guiding-star gold accent. No JS. */

:root {
  --gold: #A9761C;
  --gold-soft: #C79A4D;

  /* Layered surfaces: page < panel < input. Card sits above the page. */
  --bg: #F7F5F0;
  --surface: #FDFCF9;
  --surface-2: #FFFFFF;

  --ink: #20272F;
  --ink-soft: #5C6570;
  --ink-faint: #8A8F97;

  --line: #E4DFD3;
  --line-strong: #D3CCBB;

  --ready: #2F8F62;
  --progress: #B07A26;
  --waiting: #8A93A0;

  --danger: #B4433A;

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(40, 34, 20, 0.06);
  --shadow-md: 0 6px 20px rgba(40, 34, 20, 0.08);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --gold: #DFAE55;
    --gold-soft: #B98F45;

    --bg: #10151D;
    --surface: #182029;
    --surface-2: #1E2732;

    --ink: #E6E9ED;
    --ink-soft: #97A0AB;
    --ink-faint: #6D7681;

    --line: #28313D;
    --line-strong: #38434F;

    --ready: #4FB584;
    --progress: #CE9A45;
    --waiting: #76808D;

    --danger: #E5837B;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--gold); color: #fff; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

a { color: inherit; }
main { flex: 1; width: 100%; max-width: 64rem; margin: 0 auto; padding: 2rem 1.4rem 3.5rem; }

/* top bar — sticky chrome */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.45em;
  font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em;
  text-decoration: none;
}
.star { color: var(--gold); font-size: 0.9em; }
.top nav { display: flex; gap: 0.4rem; align-items: center; }
.top nav a {
  text-decoration: none; color: var(--ink-soft);
  font-size: 0.82rem; font-weight: 500;
  padding: 0.32rem 0.6rem; border-radius: var(--r-sm);
  transition: color 0.12s var(--ease), background 0.12s var(--ease);
}
.top nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.top nav a.active { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }

footer {
  font-family: var(--mono); font-size: 0.72rem; color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding: 1.1rem 1.4rem;
}

/* headings & sections */
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; }
h2 {
  font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.9rem; display: flex; align-items: center; gap: 0.55em;
}
h3 {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold); margin: 1.5rem 0 0.5rem; font-weight: 600;
}
aside h3:first-child { margin-top: 0; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.crumb { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-faint); margin-bottom: 0.4rem; }
.crumb a { color: var(--gold); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.actions { display: flex; gap: 0.55rem; }

/* stat tiles — the board's at-a-glance row */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.7rem; margin-bottom: 1.4rem;
}
.stat {
  display: flex; flex-direction: column; gap: 0.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 0.7rem 0.85rem; text-decoration: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.16s var(--ease);
}
.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-n { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-l { display: inline-flex; align-items: center; gap: 0.45em; font-size: 0.72rem; font-weight: 500; color: var(--ink-soft); }

/* count badges in section headers and tables */
.count {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500; color: var(--ink-faint);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-full);
  padding: 0.05em 0.55em; font-variant-numeric: tabular-nums;
}

/* board columns as panels */
main > section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.1rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
main > section:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
main > section.login { background: none; border: none; box-shadow: none; padding: 0; }
main > section { scroll-margin-top: 4.2rem; }

/* collapsible closed section — <details>, no JS */
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary h2 { margin-bottom: 0; }
details[open] summary h2 { margin-bottom: 0.9rem; }
.chev { display: inline-block; font-size: 0.85em; transition: transform 0.16s var(--ease); }
details[open] .chev { transform: rotate(90deg); }

/* lists */
.issues { list-style: none; }
.issues li {
  padding: 0.5rem 0.1rem;
  border-bottom: 1px solid var(--line);
  display: flex; gap: 0.55rem; align-items: baseline; flex-wrap: wrap;
}
.issues li:last-child { border-bottom: none; }
.issues a { text-decoration: none; font-weight: 500; }
.issues a:hover { color: var(--gold); }
.ref { font-family: var(--mono); font-size: 0.78rem; color: var(--gold); text-decoration: none; font-weight: 500; }
.meta { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-faint); }

/* tables */
table { border-collapse: collapse; width: 100%; }
th {
  font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-faint); text-align: left; padding: 0.35rem 0.7rem 0.55rem 0.1rem;
}
td { padding: 0.55rem 0.7rem 0.55rem 0.1rem; border-top: 1px solid var(--line); vertical-align: baseline; }
td a { text-decoration: none; font-weight: 500; }
td a:hover { color: var(--gold); }

/* status dots — subtle signature glow */
.dot { width: 8px; height: 8px; border-radius: var(--r-full); display: inline-block; flex-shrink: 0; }
.dot.ready { background: var(--ready); box-shadow: 0 0 7px color-mix(in srgb, var(--ready) 55%, transparent); }
.dot.progress { background: var(--progress); box-shadow: 0 0 7px color-mix(in srgb, var(--progress) 55%, transparent); }
.dot.waiting { background: var(--waiting); }
.dot.offered { background: var(--gold); box-shadow: 0 0 7px color-mix(in srgb, var(--gold) 55%, transparent); }

/* state pills */
.state {
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500;
  padding: 0.28em 0.7em; border-radius: var(--r-full);
  border: 1px solid var(--line); color: var(--ink-soft); background: var(--surface-2);
  white-space: nowrap;
}
.state.todo { color: var(--waiting); }
.state.in_progress { color: var(--progress); border-color: color-mix(in srgb, var(--progress) 45%, var(--line)); background: color-mix(in srgb, var(--progress) 8%, transparent); }
.state.done { color: var(--ready); border-color: color-mix(in srgb, var(--ready) 45%, var(--line)); background: color-mix(in srgb, var(--ready) 8%, transparent); }
.state.offered, .state.claimed { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: color-mix(in srgb, var(--gold) 8%, transparent); }
.state.completed { color: var(--ready); }
.state.canceled, .state.withdrawn { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-faint) 55%, transparent); }

/* two-column detail layout */
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.5fr); gap: 1.4rem; align-items: start; }
.cols > .prose {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.3rem 1.5rem;
}
aside {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem;
}
aside form { margin-bottom: 0.3rem; }
aside p { font-size: 0.85rem; }

/* dependency rows with inline remove */
.deps { list-style: none; margin-bottom: 0.6rem; }
.deps li { display: flex; align-items: center; gap: 0.5rem; padding: 0.22rem 0; }
.deps form { margin: 0 0 0 auto; display: inline-flex; }
.xbtn {
  background: none; border: none; color: var(--ink-faint); cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 0.15rem 0.35rem; border-radius: var(--r-sm);
}
.xbtn:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); box-shadow: none; filter: none; }
@media (max-width: 46rem) {
  .cols { grid-template-columns: 1fr; }
}

/* prose (rendered markdown) */
.prose { font-size: 0.95rem; }
.prose > * + * { margin-top: 0.85em; }
.prose h1, .prose h2, .prose h3 {
  font-family: var(--sans); text-transform: none; letter-spacing: -0.02em;
  color: var(--ink); margin-top: 1.3em; display: block; font-weight: 650;
}
.prose h1 { font-size: 1.35rem; } .prose h2 { font-size: 1.15rem; } .prose h3 { font-size: 1rem; color: var(--ink); }
.prose a { color: var(--gold); text-underline-offset: 2px; }
.prose code { font-family: var(--mono); font-size: 0.85em; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0.1em 0.36em; }
.prose pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 0.9rem 1rem; overflow-x: auto; }
.prose pre code { border: none; background: none; padding: 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose blockquote { border-left: 3px solid var(--gold-soft); padding-left: 0.9rem; color: var(--ink-soft); }

/* forms */
.stack { display: flex; flex-direction: column; gap: 1.05rem; max-width: 42rem; }
.row { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.78rem; font-weight: 500; color: var(--ink-soft); }
input, textarea, select {
  font-family: var(--sans); font-size: 0.92rem; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 0.55rem 0.72rem; width: 100%;
  transition: border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent);
}
textarea { font-family: var(--mono); font-size: 0.85rem; line-height: 1.5; resize: vertical; }

button, .button {
  font-size: 0.82rem; font-weight: 550; letter-spacing: -0.01em;
  background: var(--gold); color: #fff; border: 1px solid var(--gold);
  border-radius: var(--r-md); padding: 0.5rem 0.95rem; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  transition: filter 0.12s var(--ease), background 0.12s var(--ease), border-color 0.12s var(--ease);
}
button:hover, .button:hover { filter: brightness(1.06); box-shadow: var(--shadow-sm); }
.button.ghost, button.ghost {
  background: var(--surface-2); color: var(--ink); border-color: var(--line);
}
.button.ghost:hover, button.ghost:hover { border-color: var(--line-strong); background: var(--surface); filter: none; }
button.danger {
  background: var(--surface-2); color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}
button.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: var(--danger); filter: none; }
button.linkish {
  background: none; border: none; color: var(--ink-soft); padding: 0.32rem 0.6rem;
  border-radius: var(--r-sm); font-weight: 500;
}
button.linkish:hover { color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); box-shadow: none; filter: none; }

/* login — a single elevated card */
.login {
  max-width: 23rem; margin: 12vh auto 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.7rem 1.6rem; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 1rem;
}
.login h1 { font-size: 1.4rem; }
.login form { display: flex; flex-direction: column; gap: 0.8rem; }

.muted { color: var(--ink-soft); }
.error { color: var(--danger); font-family: var(--mono); font-size: 0.8rem; }
.footnote { margin-top: 2rem; font-size: 0.85rem; }
.footnote a { color: var(--gold); }
