:root {
  --bg: #0b0d10;
  --bg-alt: #11151a;
  --bg-soft: rgba(255, 255, 255, 0.018);
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #edf2f7;
  --muted: #9aa6b2;
  --subtle: #5f6b76;
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --radius-lg: 22px;
  --warning: #f6c35b;
  --warning-soft: rgba(246, 195, 91, 0.1);
  --warning-line: rgba(246, 195, 91, 0.24);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.1);
  --danger-line: rgba(248, 113, 113, 0.24);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.1);
  --ok-line: rgba(74, 222, 128, 0.22);
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.11);
  --accent-line: rgba(96, 165, 250, 0.24);
  --focus: rgba(96, 165, 250, 0.42);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.08) 0, transparent 320px),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.04) 0, transparent 380px),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  color: var(--text);
  font: 14px/1.6 "Sora", sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus);
}

input, select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.76rem 0.88rem;
}

input::placeholder { color: var(--subtle); }
.hidden { display: none !important; }

.eyebrow {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

#app { padding: 1.6rem; width: 100%; }

.login-shell {
  min-height: calc(100vh - 3.2rem);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(460px, 100%);
  padding: 1.35rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.shell-sidebar {
  position: sticky;
  top: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.sidebar-branding { display: flex; flex-direction: column; gap: 0.3rem; }
.sidebar-brand { font-size: 1.1rem; line-height: 1.18; margin: 0; }
.sidebar-copy, .section-copy { color: var(--muted); margin: 0; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 0;
}

.top-section {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  animation: fadeIn 240ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading { display: flex; flex-direction: column; gap: 0.48rem; }
.panel-copy { margin-bottom: 1rem; max-width: 46ch; }

.section-heading h2,
.card-head h3 {
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0;
}

.section-heading h2 { font-size: 1.55rem; line-height: 1.14; }

.primary-nav { display: flex; flex-direction: column; gap: 0.24rem; }

.nav-link {
  width: 100%;
  justify-content: flex-start;
  padding: 0.72rem 0.82rem;
  background: transparent;
  color: var(--muted);
}

.nav-link.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text);
}

.operator-card,
.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.operator-card { padding: 1rem 1.04rem; }
.operations-ledger-card { background: rgba(255, 255, 255, 0.028); }
.operations-review-card { background: rgba(255, 255, 255, 0.045); }

.card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
}

.summary-card { padding: 1rem; }
.summary-card .eyebrow { color: var(--subtle); }

.summary-value {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.summary-card.attention {
  border-color: var(--warning-line);
  background: linear-gradient(180deg, var(--warning-soft) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.summary-card.attention .summary-value,
.summary-card.attention .eyebrow {
  color: var(--warning);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.58rem;
  font-size: 0.76rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.status-pill.warning {
  color: var(--warning);
  border-color: var(--warning-line);
  background: var(--warning-soft);
}

.status-pill.danger {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-soft);
}

.status-pill.ok {
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-soft);
}

.status-pill.accent {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.feed-list,
.account-list,
.output-groups,
.batch-list,
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 0.75rem;
  margin-bottom: 0.95rem;
}

.feed-item,
.batch-row,
.account-row,
.output-group,
.list-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.88rem 0.96rem;
  background: rgba(255, 255, 255, 0.015);
}

.feed-item,
.account-row,
.output-group {
  background: var(--bg-soft);
}

.output-preview-media {
  width: min(100%, 260px);
  margin-top: 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: var(--shadow-soft);
}

.feed-item.warning { border-color: var(--warning-line); background: var(--warning-soft); }
.feed-item.danger { border-color: var(--danger-line); background: var(--danger-soft); }

.batch-row,
.list-button {
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.batch-row:hover,
.list-button:hover { background: var(--surface-hover); }

.batch-row.active,
.list-button.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.list-button.active {
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.08);
}

.row-meta {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
}

.row-meta.compact {
  gap: 0.4rem 0.65rem;
  font-size: 0.82rem;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.81rem;
}

.operations-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
  gap: 1rem;
  align-items: start;
}

.operations-main-column,
.operations-side-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

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

.kv-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.88rem;
  background: rgba(255, 255, 255, 0.015);
}

.progress-stack {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.progress-meta,
.progress-detail {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.progress-label,
.progress-percent {
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 280ms ease;
  background: linear-gradient(90deg, var(--accent) 0%, #7cc0ff 100%);
}

.progress-fill.ok {
  background: linear-gradient(90deg, var(--ok) 0%, #86efac 100%);
}

.progress-fill.warning {
  background: linear-gradient(90deg, var(--warning) 0%, #f9d77b 100%);
}

.progress-fill.danger {
  background: linear-gradient(90deg, var(--danger) 0%, #fca5a5 100%);
}

.progress-detail {
  justify-content: flex-start;
}

.kv-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kv-value {
  margin-top: 0.32rem;
  font-weight: 600;
  word-break: break-word;
}

.empty-state {
  color: var(--muted);
  margin: 0;
  line-height: 1.65;
}

.snippet {
  margin-top: 0.56rem;
  color: var(--text);
  font-size: 0.91rem;
  line-height: 1.55;
}

.tab-bar {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 0.95rem;
}

.tab-btn {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 0.5rem 0.95rem;
  font-size: 0.87rem;
}

.tab-btn:hover { background: rgba(255, 255, 255, 0.04); }

.tab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.context-strip {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.78rem 0.88rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.015);
}

.feedback-banner {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.72rem 0.88rem;
  font-size: 0.9rem;
}

.feedback-banner.ok {
  border-color: var(--ok-line);
  background: var(--ok-soft);
  color: var(--ok);
}

.feedback-banner.danger {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}

.feedback-banner.info {
  border-color: var(--accent-line);
  background: rgba(96, 165, 250, 0.09);
  color: var(--text);
}

.context-strip-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.015) 100%);
}

.context-strip-hero strong {
  display: block;
  color: var(--text);
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}

.context-strip-attention {
  border-color: var(--warning-line);
  background: linear-gradient(180deg, rgba(246, 195, 91, 0.12) 0%, rgba(255, 255, 255, 0.02) 100%);
  color: #e8c980;
}

.detail-stack {
  display: flex;
  flex-direction: column;
  gap: 0.88rem;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.82rem 0.9rem;
  background: rgba(255, 255, 255, 0.015);
}

.detail-section.attention {
  border-color: var(--warning-line);
  background: linear-gradient(180deg, rgba(246, 195, 91, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.detail-section.healthy {
  border-color: var(--ok-line);
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.detail-section h4 {
  margin: 0 0 0.5rem;
  font-size: 0.96rem;
  letter-spacing: -0.02em;
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.editor-form .section-note {
  margin: 0;
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.36rem;
}

.form-field label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
}

.form-field textarea {
  min-height: 112px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.76rem 0.88rem;
}

.form-field.full {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  color: var(--muted);
}

.checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.86rem;
}

.form-actions {
  display: flex;
  gap: 0.56rem;
  flex-wrap: wrap;
}

.primary-action {
  padding: 0.58rem 0.88rem;
  border-radius: 10px;
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text);
}

.primary-action:hover {
  background: rgba(96, 165, 250, 0.18);
}

.primary-action.compact {
  padding: 0.45rem 0.72rem;
}

.secondary-action {
  background: rgba(255, 255, 255, 0.04);
}

.preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.action-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.72rem;
}

.inline-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.mini-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.24rem 0.54rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.024);
  font-size: 0.77rem;
}

.mini-stat strong {
  color: var(--text);
  font-size: 0.8rem;
}

.soft-divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0.25rem 0 0;
}

.focus-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ghost-action,
.inline-action {
  padding: 0.45rem 0.72rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  color: var(--muted);
}

.ghost-action:hover,
.inline-action:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-strong);
  color: var(--text);
}

.list-button-reset {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.run-detail-panel {
  margin-top: 1.45rem;
  padding-top: 1.45rem;
  border-top: 1px solid var(--line);
}

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

.triage-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0.8rem;
}

.section-note {
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 1160px) {
  .overview-grid,
  .operations-workspace,
  .triage-grid,
  .context-strip-hero {
    grid-template-columns: 1fr;
  }

  .context-strip-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 980px) {
  #app { padding: 1rem; }
  .app-shell { grid-template-columns: 1fr; gap: 1.4rem; }
  .shell-sidebar { position: static; }
  .primary-nav { flex-direction: row; flex-wrap: wrap; }
  .filter-bar,
  .kv-grid,
  .dual-column,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
