:root {
  --bg: #f3f0ea;
  --bg-soft: #faf8f3;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --line: #d8d2c8;
  --line-strong: #c8c1b6;
  --text: #2f312d;
  --muted: #6c6b65;
  --accent: #55695b;
  --accent-soft: #e7ede8;
  --danger: #9b5a50;
  --success: #456952;
  --shadow: 0 18px 40px rgba(51, 48, 42, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 26%),
    linear-gradient(180deg, #f8f6f1 0%, var(--bg) 100%);
}

form {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar,
.footer,
.hero,
.panel,
.stat-card,
.flash {
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 18px 22px;
  margin-bottom: 28px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: inline-block;
  font-family: "Fraunces", serif;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 10px 14px;
  color: var(--muted);
  border-radius: 999px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.nav-links a:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.flash {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.flash-success {
  border-color: rgba(69, 105, 82, 0.18);
  background: rgba(231, 237, 232, 0.92);
}

.flash-error {
  border-color: rgba(155, 90, 80, 0.18);
  background: rgba(248, 237, 234, 0.92);
}

.content {
  display: grid;
  gap: 22px;
}

.hero,
.page-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}

.hero {
  padding: 34px;
  border-radius: calc(var(--radius) + 6px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 241, 236, 0.94)),
    var(--surface-strong);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.hero h1,
.page-header h1,
.product-results-head h2,
.panel h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.hero h1 {
  max-width: 720px;
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1.02;
}

.hero-copy {
  display: grid;
  gap: 12px;
}

.hero-text,
.page-text,
.empty-state,
.product-description {
  color: var(--muted);
  line-height: 1.65;
}

.hero-actions,
.inline-actions,
.card-actions,
.form-actions,
.pagination,
.export-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.eyebrow,
.stat-label,
.meta-label,
.table-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.panel,
.stat-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}

.stat-card {
  padding: 22px;
  display: grid;
  gap: 10px;
}

.stat-card strong {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  letter-spacing: -0.04em;
}

.split-panel {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}

.panel {
  padding: 24px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

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

.button-primary {
  color: #ffffff;
  background: var(--accent);
}

.button-secondary {
  color: var(--text);
  background: var(--surface-strong);
  border-color: var(--line);
}

.button-tertiary {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.button-danger {
  color: #ffffff;
  background: var(--danger);
}

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

.field {
  display: grid;
  gap: 9px;
}

.field-span {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font: inherit;
}

.field textarea {
  min-height: 120px;
  padding: 14px;
  resize: vertical;
  line-height: 1.5;
}

.field input[type="file"] {
  padding: 12px 14px;
}

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

.checkbox-field input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.section-divider {
  height: 1px;
  margin: 26px 0;
  background: var(--line);
}

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

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

.data-table th,
.data-table td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-cell-stacked {
  min-width: 260px;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}

.pill-light {
  background: var(--bg-soft);
  color: var(--muted);
}

.pill-warning {
  background: #f7eed8;
  color: #8a6725;
}

.pill-danger {
  background: rgba(248, 237, 234, 0.95);
  color: var(--danger);
}

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

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.list-link {
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.list-link:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

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

.meta-grid strong {
  display: block;
  margin-top: 6px;
}

.error-box {
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(155, 90, 80, 0.2);
  border-radius: 18px;
  background: rgba(248, 237, 234, 0.75);
}

.error-box pre {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  color: var(--muted);
}

.log-details {
  margin: 10px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(250, 248, 243, 0.95);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.log-details summary {
  cursor: pointer;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  color: var(--text);
}

.log-details pre {
  margin: 12px 0 0;
  white-space: pre-wrap;
}

.article-builder-layout {
  align-items: start;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
}

.article-form {
  display: grid;
}

.article-guide {
  position: sticky;
  top: 18px;
}

.article-type-card {
  align-items: flex-start;
}

.article-type-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.article-output {
  display: grid;
  gap: 18px;
}

.article-preview {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.article-preview h2 {
  margin: 0 0 10px;
  font-family: "Fraunces", serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  letter-spacing: -0.03em;
}

.article-markdown {
  margin: 18px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Manrope", sans-serif;
  line-height: 1.65;
  color: var(--text);
}

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

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

.product-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.product-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #ebe7df;
}

.product-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-body h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.product-body p {
  margin: 0;
}

.product-price {
  font-size: 1.15rem;
  font-weight: 700;
}

.product-detail-line {
  color: var(--muted);
  font-size: 0.94rem;
}

.text-link {
  color: var(--accent);
  font-weight: 600;
}

.inline-edit-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.inline-edit-form input[type="text"] {
  min-width: 160px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font: inherit;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.checkbox-inline input {
  margin: 0;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding: 16px 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 20px;
}

@media (max-width: 980px) {
  .stats-grid,
  .split-panel,
  .article-builder-layout,
  .product-grid,
  .compact-grid,
  .filters,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero,
  .page-header,
  .topbar,
  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 18px;
  }

  .stats-grid,
  .split-panel,
  .article-builder-layout,
  .product-grid,
  .compact-grid,
  .filters,
  .form-grid,
  .meta-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .article-guide {
    position: static;
  }

  .panel,
  .hero {
    padding: 20px;
  }

  .product-card img {
    aspect-ratio: 9 / 16;
  }
}
