:root {
  --paper: #f4efe8;
  --card: #ffffff;
  --ink: #1f2a30;
  --ink-soft: #4a5458;
  --muted: #7a8084;
  --line: #e6ddd1;
  --accent: #8a5a3c;
  --accent-ink: #ffffff;
  --green: #4f6f5c;
  --green-bg: #e8f0ea;
  --amber-bg: #fbf1dd;
  --amber: #8a6512;
  --red: #a2372c;
  --red-bg: #fbe9e6;
  --radius: 10px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: normal; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(28px, 5vw, 44px); }
h2 { font-size: 26px; }
h3 { font-size: 19px; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* Header */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 20px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: var(--ink-soft); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: 15px; }
.topbar nav a[aria-current="page"], .topbar nav a:hover { background: var(--paper); color: var(--ink); }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 10px 18px; font: 600 15px var(--sans);
  cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { filter: brightness(1.07); }
.btn[disabled] { opacity: .55; cursor: not-allowed; filter: none; }
.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.link { background: none; color: var(--accent); padding: 0; min-height: 0; border: 0; font-weight: 600; }
.btn.danger { background: var(--card); color: var(--red); border-color: var(--line); }
label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 6px; }
.hint { font-weight: normal; color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; font: 16px var(--sans); color: var(--ink); background: #fff; border: 1px solid #cfc6ba;
  border-radius: 8px; padding: 10px 12px; min-height: 44px; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid rgba(138, 90, 60, .25); outline-offset: 1px; border-color: var(--accent); }
input[type="checkbox"] { width: auto; min-height: 0; margin-right: 8px; }
.field { margin-bottom: 16px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-family: var(--serif); font-size: 28px; }
main { padding: 28px 0 60px; }
main.wrap { padding-top: 28px; padding-bottom: 60px; }

.notice { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }
.notice.ok { background: var(--green-bg); color: var(--green); }
.notice.warn { background: var(--amber-bg); color: var(--amber); }
.notice.error { background: var(--red-bg); color: var(--red); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px; background: var(--paper); color: var(--ink-soft); }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.error { background: var(--red-bg); color: var(--red); }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist .mark { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 14px;
  background: var(--paper); color: var(--muted); font-weight: 700; }
.checklist .done .mark { background: var(--green-bg); color: var(--green); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td.actions-cell { white-space: nowrap; text-align: right; }

/* Switch */
.switch { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.switch input { appearance: none; width: 48px; height: 28px; min-height: 0; border-radius: 999px; background: #cfc6ba; position: relative; cursor: pointer; border: 0; padding: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 23px; }
.switch input:disabled { opacity: .5; cursor: not-allowed; }

/* Preview frame */
.preview-frame { width: 100%; min-height: 900px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }

/* Auth pages */
.auth-card { max-width: 440px; margin: 40px auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 12px; font: 600 15px var(--sans); color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Landing */
.hero { padding-top: 64px; padding-bottom: 40px; }
.hero p.lead { font-size: 20px; color: var(--ink-soft); max-width: 640px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.price { font-family: var(--serif); font-size: 48px; }
footer.site { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
footer.site a { color: var(--muted); }

[hidden] { display: none !important; }
.loading { color: var(--muted); padding: 24px 0; }

/* Legal pages */
.legal { max-width: 820px; margin-left: auto; margin-right: auto; }
.legal h2 { font-size: 22px; margin-top: 28px; }
.legal h3 { font-size: 17px; margin-top: 16px; }
.legal li { margin-bottom: 6px; }
.legal mark { background: #fff2cc; padding: 0 3px; border-radius: 3px; }
