:root {
  --bg: #f5efe5;
  --bg-deep: #e8dcc9;
  --panel: rgba(255, 251, 244, 0.82);
  --panel-strong: rgba(255, 252, 248, 0.92);
  --panel-soft: rgba(247, 241, 232, 0.76);
  --nav: #143032;
  --nav-strong: #102326;
  --nav-muted: rgba(232, 241, 239, 0.72);
  --text: #17130f;
  --muted: #61584e;
  --line: rgba(23, 19, 15, 0.09);
  --line-strong: rgba(23, 19, 15, 0.14);
  --accent: #c05d31;
  --accent-strong: #dd7a39;
  --accent-soft: rgba(192, 93, 49, 0.14);
  --sea: #1f676a;
  --sea-soft: rgba(31, 103, 106, 0.12);
  --gold: #b89842;
  --shadow: 0 24px 70px rgba(61, 39, 20, 0.14);
  --shadow-soft: 0 14px 36px rgba(61, 39, 20, 0.08);
  --radius-xxl: 38px;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter",
    "Segoe UI", "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 8% 14%, rgba(221, 122, 57, 0.14), transparent 26%),
    radial-gradient(circle at 84% 18%, rgba(31, 103, 106, 0.12), transparent 24%),
    radial-gradient(circle at 80% 86%, rgba(184, 152, 66, 0.1), transparent 20%),
    linear-gradient(180deg, #fcf8f1 0%, var(--bg) 52%, var(--bg-deep) 100%);
}

body {
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background-image:
    linear-gradient(rgba(23, 19, 15, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 19, 15, 0.026) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black 34%, transparent 88%);
}

body::after {
  background:
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.72), transparent 28%),
    radial-gradient(circle at 86% 22%, rgba(221, 122, 57, 0.12), transparent 18%);
}

a {
  color: inherit;
}

code {
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
  font-size: 0.88rem;
}

input {
  width: 100%;
  padding: 0.92rem 1rem;
  border: 1px solid rgba(23, 19, 15, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

input:hover {
  background: rgba(255, 255, 255, 0.92);
}

input:focus {
  outline: none;
  border-color: rgba(31, 103, 106, 0.5);
  box-shadow: 0 0 0 4px rgba(31, 103, 106, 0.12);
}

input[type="file"] {
  padding: 0.6rem 0.75rem;
  border-style: dashed;
}

input[type="file"]::file-selector-button {
  margin-right: 0.85rem;
  border: 0;
  border-radius: 999px;
  padding: 0.58rem 0.92rem;
  background: rgba(23, 19, 15, 0.08);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 0;
  border-radius: 999px;
  padding: 0.92rem 1.25rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  color: #fffaf3;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 16px 34px rgba(192, 93, 49, 0.22);
}

.button-secondary {
  background: rgba(23, 19, 15, 0.08);
  color: var(--text);
}

.button-ghost {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: #f5f1ea;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.overline {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.overline-light {
  color: rgba(248, 242, 233, 0.76);
}

.display-title,
.nav-title,
.hero-heading,
.card-title-lg {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  letter-spacing: -0.04em;
}

.display-title {
  max-width: 11ch;
  font-size: clamp(2.7rem, 5.2vw, 5rem);
  line-height: 0.92;
}

.display-copy,
.subtle-copy,
.nav-copy,
.hero-support,
.entity-copy,
.empty-copy,
.fact-list li {
  color: var(--muted);
  line-height: 1.58;
}

.auth-shell,
.dashboard-shell {
  position: relative;
  z-index: 1;
  max-width: 1580px;
  margin: 0 auto;
  padding: 1rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(22rem, 0.92fr);
  gap: 1rem;
  align-items: stretch;
}

.auth-stage,
.auth-column {
  min-width: 0;
}

.auth-stage {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: start;
  gap: 1.35rem;
  padding: clamp(1.8rem, 3vw, 3rem);
  border-radius: var(--radius-xxl);
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 253, 249, 0.9), rgba(243, 236, 225, 0.78)),
    var(--panel);
  box-shadow: var(--shadow);
}

.auth-stage::before,
.auth-stage::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.auth-stage::before {
  top: -6rem;
  right: -4rem;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(31, 103, 106, 0.12), transparent 58%),
    conic-gradient(from 120deg, rgba(255, 255, 255, 0), rgba(221, 122, 57, 0.1), rgba(255, 255, 255, 0));
}

.auth-stage::after {
  right: 2rem;
  bottom: 1.5rem;
  width: 10rem;
  height: 10rem;
  border-radius: 28px;
  background-image:
    linear-gradient(rgba(31, 103, 106, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 103, 106, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.72;
  transform: rotate(8deg);
}

.auth-stage > * {
  position: relative;
  z-index: 1;
}

.brand-lockup {
  display: grid;
  gap: 0.9rem;
  max-width: 42rem;
}

.display-copy {
  max-width: 36rem;
  font-size: 1rem;
}

.signal-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem;
}

.signal-card,
.blueprint-panel,
.auth-card,
.surface-card,
.stat-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.signal-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  padding: 1rem 1.05rem;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-soft);
}

.signal-card h2,
.signal-card p {
  margin: 0;
}

.signal-card h2 {
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.signal-number {
  display: inline-flex;
  width: 2.35rem;
  height: 2.35rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(31, 103, 106, 0.18);
  background: var(--sea-soft);
  color: var(--sea);
  font-weight: 800;
}

.blueprint-panel {
  position: relative;
  overflow: hidden;
  margin-top: auto;
  padding: 1.3rem 1.35rem;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.86), rgba(244, 237, 228, 0.84));
  box-shadow: var(--shadow-soft);
}

.blueprint-panel::after {
  content: "";
  position: absolute;
  inset: auto -2.4rem -2.4rem auto;
  width: 9rem;
  height: 9rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 103, 106, 0.18), transparent 68%);
}

.blueprint-panel-soft::after {
  background: radial-gradient(circle, rgba(192, 93, 49, 0.16), transparent 68%);
}

.blueprint-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.95rem;
}

.blueprint-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--accent);
}

.blueprint-label,
.helper-label,
.chip-label,
.stat-label,
.snippet-label,
.user-kicker {
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.blueprint-list {
  counter-reset: blueprint-step;
  list-style: none;
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
}

.blueprint-list li {
  position: relative;
  min-height: 1.9rem;
  padding-left: 2.5rem;
}

.blueprint-list li::before {
  counter-increment: blueprint-step;
  content: counter(blueprint-step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.65rem;
  height: 1.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(31, 103, 106, 0.16);
  background: rgba(255, 255, 255, 0.76);
  color: var(--sea);
  font-size: 0.8rem;
  font-weight: 800;
}

.fact-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding-left: 1.1rem;
}

.auth-column {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: min(33rem, 100%);
  padding: 1.7rem;
  background: rgba(255, 251, 246, 0.92);
  box-shadow: var(--shadow);
}

.auth-card-elevated {
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.95), rgba(248, 242, 234, 0.9)),
    var(--panel-strong);
}

.auth-card-header {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.35rem;
}

.card-title-lg {
  font-size: clamp(1.7rem, 2.7vw, 2.8rem);
  line-height: 0.96;
}

.form-stack {
  display: grid;
  gap: 1rem;
}

.form-stack > .button {
  width: 100%;
}

.form-tight {
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.45rem;
  font-weight: 700;
}

.field span {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.field-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.helper-panel {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(31, 103, 106, 0.08);
  border: 1px solid rgba(31, 103, 106, 0.14);
}

.helper-panel code {
  display: inline-block;
  margin-top: 0.2rem;
}

.auth-footer {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

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

.text-link {
  color: var(--sea);
  font-weight: 800;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.dashboard-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.nav-panel {
  position: sticky;
  top: 1rem;
  min-height: calc(100vh - 2rem);
  padding: 1.35rem 1.1rem;
  border-radius: var(--radius-xxl);
  background:
    radial-gradient(circle at 18% 18%, rgba(221, 122, 57, 0.2), transparent 28%),
    linear-gradient(180deg, var(--nav) 0%, var(--nav-strong) 100%);
  color: #f6efe6;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(7, 18, 19, 0.28);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  overflow: hidden;
}

.nav-panel > * {
  position: relative;
  z-index: 1;
}

.nav-brand {
  display: grid;
  gap: 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-title {
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  line-height: 1.1;
  max-width: 100%;
}

/* Chinese is denser than English — shrink a touch more so 5-char titles
   like "材料控制台" don't wrap in the narrow sidebar. */
body.lang-zh .nav-title {
  font-size: clamp(1.3rem, 1.8vw, 1.5rem);
}

.nav-copy {
  color: var(--nav-muted);
}

.nav-links {
  display: grid;
  gap: 0.6rem;
}

.nav-link {
  display: block;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  color: #eef4ef;
  text-decoration: none;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(1px);
}

.nav-link-current {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
  border-color: rgba(255, 255, 255, 0.14);
}

.user-panel {
  margin-top: auto;
}

.user-pill {
  display: grid;
  gap: 0.28rem;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-pill strong {
  font-size: 1.02rem;
}

.user-pill span:last-child {
  overflow-wrap: anywhere;
}

.content-shell {
  min-width: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.hero-banner {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(15rem, 0.65fr);
  gap: 1rem;
  align-items: start;
  padding: 1.35rem 1.45rem;
  border-radius: var(--radius-xxl);
  background:
    radial-gradient(circle at top right, rgba(221, 122, 57, 0.16), transparent 26%),
    linear-gradient(180deg, rgba(255, 252, 247, 0.94), rgba(247, 240, 231, 0.88));
  border: 1px solid rgba(23, 19, 15, 0.08);
  box-shadow: var(--shadow);
}

.hero-banner::after {
  content: "";
  position: absolute;
  inset: auto -3rem -4rem auto;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(221, 122, 57, 0.2), transparent 70%);
}

.hero-banner > * {
  position: relative;
  z-index: 1;
}

.hero-banner-wide {
  align-items: center;
}

.hero-heading {
  font-size: clamp(1.72rem, 2.55vw, 2.8rem);
  line-height: 0.94;
  max-width: 14ch;
}

.hero-support {
  max-width: 52rem;
  margin-top: 0.7rem;
}

.endpoint-chip,
.hero-side-note {
  min-width: 0;
  padding: 1rem 1.05rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 19, 15, 0.08);
  display: grid;
  gap: 0.38rem;
}

.endpoint-chip code,
.hero-side-note strong {
  display: block;
  word-break: break-word;
}

.stat-grid,
.content-grid {
  display: grid;
  gap: 0.95rem;
}

.stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-grid-wide {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: start;
}

.stack-column {
  display: grid;
  gap: 1rem;
}

.stat-card,
.surface-card {
  padding: 1.2rem 1.25rem;
}

.stat-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(247, 240, 231, 0.78));
  box-shadow: var(--shadow-soft);
}

.surface-card {
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.84), rgba(248, 242, 234, 0.8));
  box-shadow: var(--shadow);
}

.surface-card-accent {
  background:
    radial-gradient(circle at top right, rgba(31, 103, 106, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(255, 252, 248, 0.86), rgba(245, 239, 231, 0.82));
}

.reveal-card {
  background:
    radial-gradient(circle at top right, rgba(192, 93, 49, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(255, 252, 248, 0.9), rgba(247, 241, 232, 0.86));
}

.stat-value {
  display: block;
  margin-top: 0.32rem;
  font-size: 2rem;
  line-height: 1;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

.stat-note {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.card-topline,
.section-head,
.entity-head,
.entity-footer,
.copy-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mini-pill {
  display: inline-flex;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--sea-soft);
  color: var(--sea);
  font-size: 0.76rem;
  font-weight: 800;
}

.mini-pill-dark {
  background: var(--accent-soft);
  color: var(--accent);
}

.snippet-stack {
  display: grid;
  gap: 0.9rem;
}

.snippet-box {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 19, 15, 0.08);
}

.copy-box {
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 19, 15, 0.08);
}

.copy-value {
  display: block;
  overflow-x: auto;
}

.stack-list {
  display: grid;
  gap: 0.85rem;
}

.entity-card {
  position: relative;
  display: grid;
  gap: 0.65rem;
  padding: 1rem 1.15rem 1rem 1.25rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(252, 247, 239, 0.72));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 2px 8px rgba(61, 39, 20, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.entity-card::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sea);
  opacity: 0.75;
}

.entity-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 6px 18px rgba(61, 39, 20, 0.08);
  transform: translateY(-1px);
}

.entity-card:has(.status-muted)::before {
  background: rgba(23, 19, 15, 0.18);
  opacity: 0.6;
}

.entity-card-large {
  gap: 1rem;
}

.entity-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text);
}

.entity-meta,
.entity-copy {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  align-items: center;
}

.entity-prefix {
  font-family: "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(23, 19, 15, 0.06);
  color: var(--text);
  letter-spacing: 0.01em;
}

.entity-meta-dot {
  color: rgba(23, 19, 15, 0.28);
  font-weight: 700;
}

.entity-last-used {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.entity-last-used::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(23, 19, 15, 0.2);
}

.entity-last-used.entity-last-used-live::before {
  background: var(--sea);
  box-shadow: 0 0 0 3px rgba(31, 103, 106, 0.18);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-ok {
  color: #0c6957;
  background: rgba(12, 105, 87, 0.12);
}

.status-warn {
  color: #965014;
  background: rgba(221, 122, 57, 0.16);
}

.status-muted {
  color: #655a4d;
  background: rgba(23, 19, 15, 0.08);
}

/* Pipeline history list — themed, replaces the old inline Tailwind-gray block. */
.history-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title status"
    "meta  meta";
  gap: 0.3rem 0.8rem;
  align-items: center;
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 0.85rem 0.95rem 0.85rem 1.05rem;
  margin-bottom: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(252, 247, 239, 0.7));
  font: inherit;
  color: var(--text);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.history-row::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background 140ms ease;
}

.history-row:hover {
  border-color: var(--line-strong);
  box-shadow: 0 4px 14px rgba(61, 39, 20, 0.06);
  transform: translateY(-1px);
}

.history-row:hover::before {
  background: rgba(31, 103, 106, 0.35);
}

.history-row-selected,
.history-row-selected:hover {
  border-color: rgba(192, 93, 49, 0.45);
  background: linear-gradient(180deg, rgba(255, 246, 236, 0.92), rgba(249, 232, 214, 0.82));
  box-shadow: 0 6px 18px rgba(192, 93, 49, 0.12);
}

.history-row-selected::before {
  background: var(--accent);
}

.history-row-title {
  grid-area: title;
  display: block;
  font-weight: 700;
  font-size: 0.96rem;
  letter-spacing: -0.005em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-row-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.history-row-meta code {
  font-family: "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
  font-size: 0.72rem;
  padding: 0.08rem 0.4rem;
  border-radius: 5px;
  background: rgba(23, 19, 15, 0.06);
  color: var(--muted);
}

.history-row-meta-dot {
  color: rgba(23, 19, 15, 0.28);
  font-weight: 700;
}

.history-row .status-pill {
  grid-area: status;
  justify-self: end;
}

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

.toggle-tile {
  display: grid;
  grid-template-columns: 1rem 1fr;
  gap: 0.85rem;
  align-items: start;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 19, 15, 0.1);
  background: rgba(255, 255, 255, 0.68);
}

.toggle-tile input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.18rem;
  padding: 0;
  accent-color: var(--sea);
}

.toggle-tile strong,
.toggle-tile span {
  display: block;
}

.toggle-tile span {
  color: var(--muted);
  margin-top: 0.2rem;
}

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 0.75rem;
}

.timeline-step {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  min-height: 100%;
  padding: 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 19, 15, 0.08);
  background: rgba(255, 255, 255, 0.68);
}

.timeline-step h5,
.timeline-step p {
  margin: 0;
}

.timeline-step p {
  color: var(--muted);
  font-size: 0.84rem;
}

.timeline-badge {
  display: inline-flex;
  width: fit-content;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: rgba(31, 103, 106, 0.12);
  color: var(--sea);
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timeline-step-completed {
  border-color: rgba(12, 105, 87, 0.18);
  background: rgba(242, 252, 248, 0.82);
}

.timeline-step-todo,
.timeline-step-blocked {
  border-color: rgba(192, 93, 49, 0.18);
}

.timeline-step-skipped {
  border-color: rgba(23, 19, 15, 0.1);
  background: rgba(245, 243, 238, 0.8);
}

.cif-brief-shell {
  display: grid;
  gap: 0.9rem;
}

.cif-viewer-shell {
  padding: 0.8rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(23, 19, 15, 0.08);
}

.cif-viewer {
  position: relative;
  min-height: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(23, 19, 15, 0.08);
}

.cif-viewer::before {
  content: "";
  display: block;
  padding-top: 80%;
}

.cif-viewer canvas,
.cif-viewer > div,
.cif-viewer-empty {
  position: absolute;
  inset: 0;
}

.cif-viewer-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

.cif-brief-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.cif-brief-pill {
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(23, 19, 15, 0.08);
}

.cif-brief-pill strong,
.cif-brief-pill span {
  display: block;
}

.cif-brief-pill strong {
  margin-top: 0.28rem;
  overflow-wrap: anywhere;
}

.cif-brief-text {
  margin: 0;
  min-height: 13rem;
  max-height: 13rem;
  overflow: auto;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(17, 24, 26, 0.95);
  color: #edf0eb;
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  border: 1px solid rgba(17, 24, 26, 0.08);
}

.empty-copy,
.status-text {
  margin: 0;
}

.status-error {
  color: #b42318;
}

.status-success {
  color: #0c6957;
}

.hidden {
  display: none !important;
}

@media (max-width: 1240px) {
  .auth-shell,
  .dashboard-shell,
  .content-grid,
  .content-grid-wide,
  .stat-grid,
  .cif-brief-meta,
  .signal-row,
  .field-grid,
  .field-grid-3,
  .toggle-grid,
  .hero-banner {
    grid-template-columns: 1fr;
  }

  .dashboard-shell {
    align-items: stretch;
  }

  .nav-panel {
    position: static;
    min-height: auto;
  }

  .display-title,
  .hero-heading,
  .card-title-lg {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .auth-shell,
  .dashboard-shell {
    padding: 0.7rem;
  }

  .auth-stage,
  .auth-card,
  .nav-panel,
  .hero-banner,
  .surface-card,
  .stat-card {
    border-radius: 24px;
  }

  .auth-stage,
  .nav-panel,
  .hero-banner,
  .surface-card,
  .stat-card {
    padding: 1.15rem;
  }

  .auth-card {
    padding: 1.2rem;
  }

  .hero-banner,
  .section-head,
  .entity-head,
  .entity-footer,
  .copy-box {
    flex-direction: column;
    align-items: flex-start;
  }

  .copy-box {
    gap: 0.8rem;
  }

  .copy-box .button {
    width: 100%;
  }

  .cif-brief-text {
    min-height: 11rem;
    max-height: 11rem;
  }

  .endpoint-chip,
  .hero-side-note {
    width: 100%;
  }

  .display-title {
    font-size: clamp(2.2rem, 12vw, 3.35rem);
  }

  .nav-title {
    max-width: none;
  }

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