:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #e4e9f2;
  --text: #182033;
  --muted: #667085;
  --primary: #1769ff;
  --primary-soft: #eaf1ff;
  --danger: #d92d20;
  --danger-soft: #fff1f0;
  --success: #16835d;
  --warning: #b85d00;
  --shadow: 0 18px 48px rgba(26, 42, 74, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.15;
}

h2 {
  font-size: 26px;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
}

.muted {
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.8;
}

.login-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 14px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 255, 0.12);
}

.login-form button,
.secondary-button,
.ghost-button,
.action-button {
  height: 40px;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 700;
}

.login-form button,
.secondary-button {
  background: var(--primary);
  color: white;
}

.ghost-button {
  width: 100%;
  background: var(--surface-soft);
  color: var(--muted);
}

.action-button {
  background: var(--primary-soft);
  color: var(--primary);
}

.action-button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.form-message {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-weight: 900;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  height: 42px;
  border-radius: 10px;
  background: transparent;
  color: #344054;
  text-align: left;
  padding: 0 12px;
  font-weight: 700;
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar .ghost-button {
  margin-top: auto;
}

.content {
  padding: 26px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 18px;
  background: linear-gradient(to bottom, var(--bg) 76%, rgba(245, 247, 251, 0));
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.panel,
.list-card,
.table-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(26, 42, 74, 0.04);
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

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

.panel {
  padding: 16px;
}

.panel-title,
.card-head,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  margin-bottom: 12px;
}

.panel-title span,
.pill {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.pill.pending {
  background: #fff7ed;
  color: var(--warning);
}

.pill.running,
.pill.manual_review {
  background: #eef4ff;
  color: #1d4ed8;
}

.pill.handled,
.pill.published,
.pill.approved {
  background: #ecfdf3;
  color: var(--success);
}

.pill.rejected,
.pill.hidden,
.pill.failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.pill.skipped {
  background: #f2f4f7;
  color: #475467;
}

.stack {
  display: grid;
  gap: 12px;
}

.list-card {
  padding: 14px;
}

.card-head {
  margin-bottom: 8px;
}

.card-title {
  min-width: 0;
  font-weight: 800;
}

.card-meta {
  color: var(--muted);
  font-size: 12px;
}

.card-text {
  margin-top: 10px;
  color: #344054;
  line-height: 1.65;
  white-space: pre-wrap;
}

.danger-text {
  color: var(--danger);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.icon-button {
  height: 34px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0 12px;
  font-weight: 700;
}

.context-dialog {
  width: min(680px, calc(100vw - 32px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: transparent;
}

.context-dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(6px);
}

.context-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.context-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.context-section.highlighted {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.context-section strong {
  display: block;
  margin-bottom: 8px;
}

.context-section p {
  color: #344054;
  line-height: 1.7;
  white-space: pre-wrap;
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  margin-bottom: 14px;
}

.toolbar input {
  max-width: 360px;
}

.table-like {
  display: grid;
  gap: 10px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr 0.8fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.row-main strong {
  display: block;
  margin-bottom: 4px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 920px) {
  .login-panel,
  .app-shell,
  .two-column {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .table-row {
    grid-template-columns: 1fr;
  }
}
