:root {
  --ink: #241c14;
  --muted: #6d6256;
  --paper: #f6f1e8;
  --card: #fffdf8;
  --line: #e4d9c8;
  --accent: #6b3f24;
  --accent-2: #1f3d4d;
  --ok: #1f6b45;
  --bad: #9b2c2c;
  --shadow: 0 10px 30px rgba(36, 28, 20, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  padding: 24px 16px 80px;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, #efe2cc 0%, transparent 50%),
    var(--paper);
}
.page {
  width: min(1400px, 100%);
  margin: 0 auto;
}

h1, h2, h3 { font-family: Georgia, "Iowan Old Style", serif; font-weight: 600; margin: 0 0 8px; }
h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 22px; margin-bottom: 10px; }
h2 small { font-family: inherit; color: var(--muted); font-size: 0.7em; }
h3 { font-size: 16px; margin-top: 24px; }

.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; color: var(--accent); }
.muted { color: var(--muted); }
code { font-size: 0.92em; background: #efe6d8; padding: 1px 5px; border-radius: 4px; }

.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 20px; }
.top-meta { display: flex; gap: 12px; align-items: center; color: var(--muted); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 22px; }
.tabs a {
  color: var(--accent-2);
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
}
.tabs a:hover { border-color: var(--accent); }

.pages { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.pages a {
  color: var(--accent-2);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 14px;
}
.pages a.active {
  background: var(--accent-2);
  color: #fff;
  border-color: var(--accent-2);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.accounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.account-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fff;
  display: grid;
  gap: 10px;
}
.account-card h3 { margin: 0 0 4px; font-size: 17px; }
@media (max-width: 900px) { .accounts { grid-template-columns: 1fr; } }

.stack { display: grid; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } .top { flex-direction: column; align-items: flex-start; } }

label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, textarea, select, button {
  font: inherit;
  color: var(--ink);
}
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
textarea { resize: vertical; }
button {
  border: 0;
  background: var(--accent-2);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  width: fit-content;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }
button.ghost { background: transparent; color: var(--accent-2); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--bad); border: 1px solid #ead2d2; padding: 8px 12px; }

.row-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.row-form input, .row-form select { width: auto; flex: 1 1 160px; }
.row-form.tight { margin: 0; }
.row-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.tiny { font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.tiny input { width: auto; }

.soon, .people { list-style: none; padding: 0; margin: 12px 0 0; }
.soon li, .people li {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.soon em { color: var(--accent); font-style: normal; font-size: 13px; }

.spoiler {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.spoiler summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  color: var(--accent-2);
  font-size: 14px;
  user-select: none;
}
.spoiler summary::-webkit-details-marker { display: none; }
.spoiler summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.spoiler[open] summary::before { transform: rotate(90deg); }
.spoiler .table-wrap,
.spoiler .people {
  padding: 0 16px 12px;
  margin-top: 0;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 0; }
td { padding: 8px 0; vertical-align: top; }
.wrap { word-break: break-word; }

.preview-img img, .preview-frame img { max-width: 400px; width: 100%; border-radius: 12px; display: block; margin: 0 auto; }
.preview-frame {
  border: 1px dashed var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #f3eee6;
}

.flash { padding: 10px 12px; border-radius: 10px; margin: 0 0 10px; }
.flash.ok { background: #e7f5ec; color: var(--ok); }
.flash.error { background: #fbeaea; color: var(--bad); }
.flashes { margin-bottom: 12px; }

.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.badge.ok { background: #e7f5ec; color: var(--ok); }
.badge.error { background: #fbeaea; color: var(--bad); }
.badge.test { background: #eef3f6; color: var(--accent-2); }

footer { color: var(--muted); font-size: 13px; margin-top: 8px; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  max-width: none;
}
.login-card {
  width: min(420px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 8px 0 10px; }
.login-card .stack { margin-top: 18px; }
.login-card button { width: 100%; }
