:root {
  color-scheme: light;

  --bg: #f7f4ef;
  --ink: #202124;
  --muted: #60646c;
  --line: #d8d2c7;
  --panel: #ffffff;
  --panel-warm: #fffdfa;
  --sidebar: #26342f;
  --sidebar-line: rgba(255, 255, 255, 0.16);
  --sidebar-ink: #f8f6f0;
  --sidebar-muted: #c8d0cc;
  --accent: #1d6f65;
  --accent-ink: #ffffff;
  --warn: #a15c00;

  --status-todo-bg: #e8e1d4;
  --status-todo-ink: #4d4437;
  --status-doing-bg: #f5d681;
  --status-doing-ink: #5b4100;
  --status-done-bg: #a7dccb;
  --status-done-ink: #123e36;
  --status-found-bg: #d6e7ff;
  --status-found-ink: #173b68;

  --radius: 8px;
  --radius-pill: 999px;
  --shadow: 0 10px 30px rgba(32, 33, 36, 0.08);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  font-size: 1.45rem;
}

h2 {
  max-width: 780px;
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
}

h3 {
  font-size: 1.08rem;
}

/* Layout */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

aside {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 28px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
}

main {
  min-width: 0;
  padding: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #e9c46a;
  color: var(--sidebar);
  font-weight: 900;
}

.subtle {
  margin: 0;
  color: var(--muted);
}

aside .subtle {
  color: var(--sidebar-muted);
}

.privacy-note {
  margin: 24px 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.92rem;
}

.sidebar-section {
  margin-top: 24px;
}

.side-label {
  margin-bottom: 10px;
  color: var(--sidebar-muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.site-list,
.nav-list,
.steps,
.links,
.query-list,
.broker-table,
.form-grid {
  display: grid;
  gap: 10px;
}

.site-button,
.nav-button {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--sidebar-ink);
  cursor: pointer;
  text-align: left;
}

.site-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-button {
  font-weight: 800;
}

.site-button[aria-current="true"],
.nav-button[aria-current="true"] {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
}

/* Status chips */
.pill {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.todo {
  background: var(--status-todo-bg);
  color: var(--status-todo-ink);
}

.doing {
  background: var(--status-doing-bg);
  color: var(--status-doing-ink);
}

.done {
  background: var(--status-done-bg);
  color: var(--status-done-ink);
}

.found {
  background: var(--status-found-bg);
  color: var(--status-found-ink);
}

/* Content areas */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.toolbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar {
  padding: 18px;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

progress {
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: #e5ded2;
}

progress::-webkit-progress-bar {
  background: #e5ded2;
}

progress::-webkit-progress-value {
  background: var(--accent);
}

progress::-moz-progress-bar {
  background: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(300px, 0.55fr);
  gap: 24px;
  align-items: start;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-body {
  padding: 20px;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-warm);
}

.step input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.step strong {
  display: block;
  margin-bottom: 3px;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

/* Actions and forms */
.actions,
.broker-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.actions {
  margin-top: 16px;
}

.btn,
.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.btn {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  gap: 8px;
}

.btn.secondary {
  background: transparent;
  color: var(--accent);
}

.btn.neutral {
  border-color: var(--line);
  background: var(--panel-warm);
  color: var(--ink);
}

.mini-btn {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.86rem;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-warm);
  color: var(--ink);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.callout {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-left: 4px solid var(--warn);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #fff7e7;
  color: #4b3410;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.link-row:last-child {
  border-bottom: 0;
}

.broker-queue,
.onboarding-steps {
  display: grid;
  gap: 14px;
}

.broker-card,
.mini-step {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-warm);
}

.broker-card-head,
.discovery-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.broker-card-head {
  margin-bottom: 12px;
}

.broker-card p,
.mini-step p,
.discovery-step p {
  margin: 4px 0 0;
}

.discovery-step {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.expanded-steps {
  margin-top: 14px;
}

.found-action {
  border-color: var(--accent);
  color: var(--accent);
}

.broker-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.7fr) minmax(130px, 0.6fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-warm);
}

.broker-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.broker-actions {
  justify-content: flex-end;
}

.small {
  font-size: 0.9rem;
}

.sources {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.86rem;
}

.spaced {
  margin-top: 24px;
}

/* Responsive */
@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  aside {
    position: relative;
    height: auto;
  }

  .hero,
  .grid,
  .broker-row,
  .broker-card-head,
  .discovery-step {
    grid-template-columns: 1fr;
  }

  .broker-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  main,
  aside {
    padding: 20px;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .panel-head {
    display: grid;
  }

  .btn {
    width: 100%;
  }
}
