:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #23251f;
  --muted: #6a6c62;
  --accent: #6b7a4b;
  --accent-dark: #55623a;
  --line: #e3ddd0;
  --danger: #b3261e;
  --ok-bg: #eef2e6;
  --radius: 12px;
  --body: "Inter", system-ui, sans-serif;
  --display: "Cormorant Garamond", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-dark); }
h1 { font-size: 26px; font-weight: 600; margin: 0 0 20px; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.logo { font-family: var(--display); font-size: 26px; font-weight: 600; text-decoration: none; color: var(--accent-dark); }
.bar nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.bar nav form { margin: 0; }
.who { color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .who { display: none; } }

.wrap { max-width: 920px; margin: 0 auto; padding: 32px 16px 96px; }
.wrap.narrow { max-width: 460px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { background: transparent; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-dark); text-decoration: underline; cursor: pointer; }

.notice { padding: 12px 16px; border-radius: var(--radius); background: var(--ok-bg); border: 1px solid #cfd8bd; }
.notice.error { background: #fbeceb; border-color: #f0c4c0; color: var(--danger); }

/* Forms */
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
.form input:not([type="checkbox"]):not([type="radio"]), .form textarea, .form select {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
.form textarea { resize: vertical; }
.form input:focus, .form textarea:focus, .form select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form .hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.form .invalid input, .form .invalid textarea { border-color: var(--danger); }
.form .error-text { font-weight: 400; font-size: 13px; color: var(--danger); }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form input[type="checkbox"], .form input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
.slug-input { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--muted); }

.editor fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 20px; margin: 0; display: grid; gap: 14px; }
.editor legend { font-weight: 600; font-size: 16px; padding: 0 6px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.row.schedule { grid-template-columns: 110px 1fr 1.4fr; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.row.faq { grid-template-columns: 1fr 1.6fr; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
@media (max-width: 640px) {
  .row.schedule, .row.faq { grid-template-columns: 1fr; }
}
.themes { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-choice {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  min-width: 150px;
}
.theme-choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-choice.theme-garden { background: linear-gradient(135deg, #e8e4d6, #f7f4ee); }
.theme-choice.theme-classic { background: #1c1c1c; color: #f6f1ea; }
.sections { display: grid; gap: 8px; }
.section-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.section-row .order { width: 72px !important; }
.sticky-save {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 14px 0;
  background: linear-gradient(transparent, var(--bg) 30%);
}

/* Dashboard */
.site-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.site-head p { margin: 4px 0 0; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #eee; white-space: nowrap; }
.pill.published { background: var(--ok-bg); color: var(--accent-dark); }
.pill.draft { background: #f3efe6; color: #7a6a43; }
.pill.expired, .pill.suspended { background: #fbeceb; color: var(--danger); }
.stats { display: flex; gap: 16px; color: var(--muted); margin: 14px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { margin: 0; }
.retention { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; margin-bottom: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.retention p, .retention form { margin: 0; }

.title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.title-row h1 { margin: 0; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.summary div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; }
.summary b { font-size: 26px; font-weight: 600; }
.summary span { color: var(--muted); font-size: 13px; }
@media (max-width: 560px) { .summary { grid-template-columns: repeat(2, 1fr); } }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; background: #faf8f4; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.msg { min-width: 200px; }

/* Delivery sheet (admin → print / save as PDF) */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px; }
.sheet-logo { font-family: var(--display); font-size: 32px; font-weight: 600; color: var(--accent-dark); margin: 0 0 16px; }
.sheet h1 { font-size: 24px; }
.sheet h2 { margin-top: 24px; margin-bottom: 6px; }
.sheet-link { word-break: break-all; background: var(--ok-bg); padding: 12px 14px; border-radius: 10px; font-weight: 500; }
.sheet-foot { margin-top: 32px; color: var(--muted); font-size: 13px; }

@media print {
  body { background: #fff; }
  .bar, .no-print { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .sheet { border: 0; padding: 0; }
}

/* Photos, guests, sharing */
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }
.btn.danger { color: var(--danger); border-color: #f0c9c5; }
.btn.danger:hover { background: #fbeceb; }
.danger-text { color: var(--danger); font-weight: 600; }
form.inline .small { margin-left: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--accent-dark); cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
.btn svg { margin-right: 2px; }
.upload { position: relative; overflow: hidden; margin-top: 12px; }
.upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 12px 0; }
.photo-grid figure { margin: 0; display: grid; gap: 6px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
.row-actions { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }
.share-url { font-size: 20px; font-weight: 600; word-break: break-all; }
.qr-card { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.qr { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.inline-form { grid-template-columns: 1fr auto; align-items: end; }
@media (max-width: 560px) { .inline-form { grid-template-columns: 1fr; } }
.stats { flex-wrap: wrap; }
.sheet ul { padding-left: 20px; }
.wrap.wide { max-width: 1240px; }

/* App shell: left menu + content */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 61px); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; }
.side a { display: block; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px; }
.side a:hover { background: var(--bg); }
.side a.active { background: var(--ok-bg); color: var(--accent-dark); }
.side-group { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.side-title { margin: 0 0 4px; padding: 0 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.content { padding: 32px 32px 96px; max-width: 1000px; width: 100%; }
.content.wide { max-width: 1320px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; min-height: 0; }
  /* The menu becomes a horizontally scrolling strip under the top bar. */
  .side { flex-direction: row; align-items: center; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); gap: 4px; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side a { white-space: nowrap; padding: 8px 12px; }
  .side-group { flex-direction: row; align-items: center; margin: 0; padding: 0 0 0 4px; border-top: 0; border-left: 1px solid var(--line); gap: 4px; }
  .side-title { display: none; }
  .content { padding: 24px 16px 80px; }
}

/* Dashboards */
.site-overview { display: grid; gap: 16px; margin-bottom: 32px; }
.site-overview .card { margin: 0; }
.site-card .hosting { margin: 12px 0 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 2px; color: var(--ink); text-decoration: none; }
a.stat:hover { border-color: var(--accent); }
.stat b { font-size: 26px; font-weight: 600; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }
.section-title { margin: 28px 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; }
.checklist { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist .tick { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; }
.checklist li.done .tick { background: var(--accent); border-color: var(--accent); }
.checklist li.done span:last-child { color: var(--muted); text-decoration: line-through; }
.card.retention { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 20px 24px; }
.card.retention h2 { margin-bottom: 6px; }
@media print { .side { display: none !important; } .shell { display: block; } .content { padding: 0; max-width: none; } }
.side > .side-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
@media (max-width: 860px) { .side > .side-group:first-child { border-left: 0; padding-left: 0; } }

/* Overlays */
dialog.modal { border: 0; padding: 0; border-radius: 16px; background: transparent; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); color: var(--ink); }
dialog.modal::backdrop { background: rgba(35, 37, 31, 0.45); }
dialog.modal:not(:modal) { position: relative; margin: 0 auto 24px; box-shadow: 0 0 0 1px var(--line); }
.modal-body { background: var(--surface); border-radius: 16px; padding: 22px 24px 24px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head form { margin: 0; }
.modal .notice { margin: 0 0 16px; }
.modal .form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
[hidden] { display: none !important; }
.logo { display: inline-flex; align-items: center; }
.logo-img { display: block; height: 30px; width: auto; }
.sheet-logo .logo-img { height: 44px; }
a.icon-btn { text-decoration: none; }
.refund-note { display: block; margin: 4px 0 0 !important; }
td.row-icons { white-space: nowrap; }
td.row-icons > * { vertical-align: middle; }
td.row-icons > * + * { margin-left: 6px; }
.table-wrap th, .table-wrap td { padding: 10px; }
.table-wrap th:first-child, .table-wrap td:first-child { padding-left: 14px; }
.getting-started { border-color: #cfd8bd; background: linear-gradient(180deg, #f4f7ee, var(--surface) 70%); }
.gs-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.gs-bar { height: 6px; border-radius: 999px; background: var(--line); margin: 12px 0 4px; overflow: hidden; }
.gs-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
a.pill { text-decoration: none; }
