:root {
  --ink: #221c18;
  --muted: #6b5f56;
  --paper: #f6f1ea;
  --panel: #fffaf4;
  --line: #e0d4c6;
  --accent: #9a3412;
  --ink-soft: #3f342c;
  --radius: 0.9rem;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --ui: "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 0% 0%, #efe2d2, transparent 45%),
    var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  line-height: 1.55;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app {
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2.5rem;
}

.app-nav a { color: #f8ebe2; font-weight: 700; text-decoration: none; }

.app-hero {
  margin-bottom: 1rem;
  padding: 1.8rem 1.5rem;
  background: linear-gradient(135deg, #3b2418, #9a3412 70%);
  border-radius: 1.15rem;
  color: #fff;
}

.app-hero h1 {
  margin: 0.4rem 0 0.35rem;
  font-family: var(--display);
  font-size: clamp(2rem, 3.5vw, 2.7rem);
}

.app-hero p { margin: 0; max-width: 34rem; opacity: 0.93; }

.mode-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.mode-tabs button {
  background: #efe6db;
  color: var(--ink);
}

.mode-tabs button.is-active {
  background: var(--accent);
  color: #fff;
}

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

.layout > *,
.panel {
  min-width: 0;
}

.panel {
  padding: 1.15rem 1.2rem 1.35rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(34, 28, 24, 0.05);
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-size: 1.3rem;
}

.field { margin-bottom: 0.85rem; }
.field label,
.field > span {
  display: block;
  margin-bottom: 0.28rem;
  font-weight: 650;
  font-size: 0.9rem;
}

.field input,
.field select,
.field textarea,
.toolbar input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  font: inherit;
  background: #fff;
}

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

button {
  padding: 0.55rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.secondary { background: #efe6db; color: var(--ink); }
button.linkish { background: transparent; color: var(--accent); padding: 0.2rem 0.4rem; }
button.danger { color: #7f1d1d; background: transparent; }

.message { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.9rem; }
.message.is-error { color: #9a3412; }
.message.is-ok { color: #3f6212; }
.help { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.85rem; }

.dropzone {
  min-height: 7rem;
  border: 1px dashed var(--line);
  background: #fff;
  border-radius: 0.65rem;
}

.toolbar { margin-bottom: 0.75rem; }

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 32rem;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td { padding: 0.5rem 0.35rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th.sort { cursor: pointer; }

.status-pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #f3e8df;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.preview-meta { color: var(--muted); font-size: 0.92rem; }
.preview-cover {
  margin: 0.75rem 0 1rem;
  min-height: 10rem;
  border-radius: 0.75rem;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
}

.preview-body {
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.preview-body p { margin: 0 0 0.85rem; }

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .app {
    width: min(72rem, calc(100% - 1.25rem));
  }
}
