:root {
  --bg: #f4efe7;
  --bg-mist: rgba(255, 255, 255, 0.42);
  --surface: rgba(255, 252, 247, 0.82);
  --surface-strong: rgba(255, 251, 245, 0.95);
  --surface-soft: rgba(255, 255, 255, 0.56);
  --ink: #1d2928;
  --muted: #6f7b78;
  --line: rgba(30, 43, 41, 0.12);
  --line-strong: rgba(30, 43, 41, 0.18);
  --accent: #b45b3a;
  --accent-soft: rgba(180, 91, 58, 0.12);
  --ok: #2b7960;
  --warn: #a87417;
  --danger: #a24433;
  --shadow: 0 20px 50px rgba(65, 53, 39, 0.08);
  --shadow-soft: 0 10px 26px rgba(65, 53, 39, 0.05);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "IBM Plex Sans", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(230, 199, 177, 0.56), transparent 24%),
    radial-gradient(circle at top right, rgba(204, 218, 210, 0.58), transparent 22%),
    linear-gradient(180deg, #f8f5ee 0%, #f2ede3 52%, #ede4d8 100%);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.auth-shell {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(23, 31, 30, 0.34);
  backdrop-filter: blur(12px);
  z-index: 40;
}

.auth-shell.visible {
  display: grid;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: end;
  background: rgba(23, 31, 30, 0.22);
  backdrop-filter: blur(10px);
  z-index: 35;
}

.detail-drawer.visible {
  display: flex;
}

.detail-sheet {
  width: min(560px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 20px;
  border-left: 1px solid var(--line);
  background: rgba(252, 249, 244, 0.96);
  box-shadow: -18px 0 42px rgba(43, 34, 22, 0.08);
}

.auth-panel {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.shell {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 20px;
  border-right: 1px solid var(--line);
  background: rgba(248, 243, 236, 0.78);
  backdrop-filter: blur(16px);
}

.brand-kicker,
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  font-weight: 700;
}

.brand h1,
.hero h2,
.section h3,
.auth-panel h2,
.panel h4 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", serif;
}

.brand h1 {
  font-size: 28px;
  line-height: 1.04;
}

.brand p,
.hero-text,
.card-meta,
.muted {
  color: var(--muted);
}

.brand p,
.hero-text,
.card-meta {
  line-height: 1.55;
}

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

.nav a {
  display: block;
  padding: 9px 11px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 13px;
  color: rgba(29, 41, 40, 0.92);
  transition: background 140ms ease, transform 140ms ease, color 140ms ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.54);
  transform: translateX(3px);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.content {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.hero,
.section,
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 360px;
  gap: 18px;
  padding: 24px;
  border-radius: 30px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.46), transparent 44%),
    linear-gradient(215deg, rgba(180, 91, 58, 0.12), transparent 48%);
  pointer-events: none;
}

.hero-copy,
.hero-panel {
  position: relative;
  z-index: 1;
}

.hero h2 {
  max-width: 11ch;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.06;
}

.hero-text {
  max-width: 56ch;
  margin-top: 10px;
  font-size: 13px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.panel,
.hero-panel {
  border-radius: var(--radius-lg);
}

.panel {
  padding: 16px;
  background: var(--surface-strong);
}

.section {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 24px;
}

.detail-content {
  display: grid;
  gap: 14px;
}

.detail-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

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

.detail-term {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-text {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.65;
  word-break: break-word;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.section-head h3 {
  font-size: 22px;
}

.mini-head,
.form-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 12px;
}

.source-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.source-list {
  display: grid;
  gap: 10px;
}

.summary-card,
.source-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.summary-card {
  padding: 14px;
}

.source-card {
  padding: 12px;
}

.source-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.source-name {
  font-size: 14px;
  font-weight: 600;
}

.source-meta,
.card-meta,
.muted {
  font-size: 11px;
}

.source-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form-actions {
  margin-top: 2px;
}

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

.summary-label {
  font-size: 11px;
}

.summary-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.pill {
  background: rgba(29, 41, 40, 0.06);
}

.pill.ok,
.status-badge.done,
.status-badge.sent {
  color: var(--ok);
}

.pill.warn,
.status-badge.pending,
.status-badge.processing,
.status-badge.queued {
  color: var(--warn);
}

.pill.danger,
.status-badge.failed {
  color: var(--danger);
}

.status-badge {
  background: rgba(29, 41, 40, 0.08);
}

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

.form-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
}

label span {
  font-size: 11px;
  color: var(--muted);
}

label.wide {
  grid-column: span 2;
}

label.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 24px;
}

input,
select {
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(29, 41, 40, 0.11);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(180, 91, 58, 0.38);
  box-shadow: 0 0 0 3px rgba(180, 91, 58, 0.08);
}

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  padding: 0;
}

button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fffdf9;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease, box-shadow 140ms ease;
  box-shadow: 0 8px 18px rgba(180, 91, 58, 0.16);
}

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

button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background: rgba(29, 41, 40, 0.06);
  color: var(--ink);
  box-shadow: none;
}

button.tiny {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

.filters form,
.form-panel form {
  display: grid;
  gap: 14px;
}

.table-panel {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.44);
}

.article-title {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.score-stack {
  display: grid;
  gap: 3px;
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(29, 41, 40, 0.92);
  color: #fff;
  font-size: 12px;
  box-shadow: var(--shadow);
  animation: slideUp 180ms ease;
  z-index: 50;
}

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

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero,
  .source-grid,
  .form-grid,
  .form-grid.compact,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  label.wide {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 16px;
  }

  .hero,
  .section,
  .panel,
  .auth-panel,
  .detail-sheet {
    padding: 16px;
    border-radius: 18px;
  }

  .hero-actions,
  .section-head,
  .source-card-head,
  .mini-head,
  .form-title,
  .source-actions,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero h2 {
    max-width: 100%;
  }

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