:root {
  color-scheme: light dark;
  --bg: #f6f2ea;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --ink: #171717;
  --muted: #6f6a61;
  --line: rgba(23, 23, 23, 0.12);
  --accent: #0f8f7f;
  --accent-soft: rgba(15, 143, 127, 0.12);
  --danger: #b3261e;
  --shadow: 0 24px 70px rgba(34, 30, 24, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    linear-gradient(135deg, rgba(15, 143, 127, 0.10), transparent 34%),
    linear-gradient(315deg, rgba(19, 51, 59, 0.10), transparent 38%),
    var(--bg);
  color: var(--ink);
}

button {
  border: 0;
  font: inherit;
}

input,
select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100svh;
}

.rail {
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  font-weight: 800;
  font-size: 24px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item,
.ghost-button {
  min-height: 42px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-item {
  width: 100%;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--ink);
}

.nav-item:active,
.ghost-button:active {
  transform: scale(0.98);
}

.workspace {
  padding: 30px;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 64px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.subtitle {
  max-width: 620px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
}

.user-pill {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--line);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 92px;
  padding: 18px;
  background: var(--surface-strong);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  margin-top: 18px;
}

.feed-panel,
.context-panel {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.section-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.section-head.compact {
  min-height: 68px;
}

.ghost-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.job-list,
.topic-list {
  display: grid;
}

.job {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 120px;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  animation: rise 260ms ease both;
}

.job:last-child {
  border-bottom: 0;
}

.status {
  width: fit-content;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.status.failed {
  background: rgba(179, 38, 30, 0.12);
  color: var(--danger);
}

.job-main {
  min-width: 0;
}

.job-title,
.job-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-title {
  font-weight: 760;
}

.job-url,
.job-note,
.job-meta,
.topic-meta {
  color: var(--muted);
  font-size: 13px;
}

.job-note {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.assign-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  max-width: 520px;
  margin-top: 12px;
}

.assign-form select,
.assign-form button,
.topic-form input,
.topic-form button {
  min-height: 38px;
}

.assign-form select,
.topic-form input {
  padding: 0 10px;
}

.assign-form button,
.topic-form button {
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface-strong);
  cursor: pointer;
}

.topic {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.topic-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.topic:last-child {
  border-bottom: 0;
}

.topic strong {
  overflow-wrap: anywhere;
}

.empty {
  padding: 36px 18px;
  color: var(--muted);
}

.empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111311;
    --surface: rgba(27, 30, 28, 0.82);
    --surface-strong: #1b1e1c;
    --ink: #f3f0e9;
    --muted: #aaa49a;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #39d5bd;
    --accent-soft: rgba(57, 213, 189, 0.14);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  }
}

@media (max-width: 900px) {
  .shell {
    display: block;
    padding-bottom: 78px;
  }

  .rail {
    display: none;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 42px;
  }

  .metric-row,
  .split {
    grid-template-columns: 1fr;
  }

  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .job {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .assign-form,
  .topic-form {
    grid-template-columns: 1fr;
  }

  .job-meta {
    text-align: left;
  }

  .mobile-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.76);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
  }

  .mobile-nav .nav-item {
    text-align: center;
  }
}
