:root {
  --bg: #efe6d6;
  --bg-soft: #f7f1e6;
  --surface: #fffcf7;
  --ink: #2c3224;
  --muted: #6b6358;
  --line: rgba(176, 141, 78, 0.28);
  --line-strong: rgba(143, 120, 78, 0.42);
  --accent: #5f6b45;
  --accent-hover: #4d5838;
  --accent-soft: rgba(95, 107, 69, 0.12);
  --gold: #b08d4e;
  --ok: #3f6b4a;
  --ok-bg: #e8f3ea;
  --warn: #9a5b12;
  --warn-bg: #f8eedf;
  --err: #8a3b3b;
  --err-bg: #f8eaea;
  --pending: #8a6a14;
  --radius: 16px;
  --shadow: 0 10px 24px rgba(60, 50, 30, 0.06);
  --font: "Josefin Sans", "Segoe UI", sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --top: 58px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,252,246,0.85), transparent 48%),
    radial-gradient(ellipse at 100% 10%, rgba(176, 141, 78, 0.12), transparent 40%),
    linear-gradient(180deg, #f3eadc, var(--bg));
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }

.shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--top);
  padding: 0 22px;
  background: rgba(255, 252, 247, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(180deg, #859268, var(--accent));
  color: #f7f1e6;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 14px rgba(60, 50, 30, 0.16);
}
.topbar-brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.topbar-brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.top-link {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
}
.top-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.tabs {
  position: sticky;
  top: var(--top);
  z-index: 29;
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(255, 252, 247, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.tabs a:hover {
  background: rgba(95, 107, 69, 0.08);
  color: var(--ink);
  text-decoration: none;
}
.tabs a.on {
  background: var(--accent);
  color: #f7f1e6;
  box-shadow: 0 8px 16px rgba(60, 50, 30, 0.14);
}

.content {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 16px;
  align-items: flex-end;
  margin-bottom: 22px;
}
.page-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 38px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #3d4a32;
}
.page-head .lead {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 52ch;
}
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.panel, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 0 0 14px;
}
.panel h2, .card h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: #3d4a32;
}
.panel-grid, .card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.hub-panel .hub-meta {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}
.hub-panel .hub-meta strong { color: var(--ink); font-weight: 600; }

.kpis, .stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi, .stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.kpi b, .stat b {
  display: block;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.kpi span, .stat span {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
}
.toolbar .search { max-width: 260px; margin: 0; }
.toolbar .spacer { flex: 1; }

.flash {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(63, 107, 74, 0.25);
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 14px;
}
.flash.error, .flash.bad {
  background: var(--err-bg);
  color: var(--err);
  border-color: rgba(138, 59, 59, 0.25);
}
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.warn {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid rgba(154, 91, 18, 0.22);
  font-size: 14px;
}

label {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hint {
  margin: -2px 0 12px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(95, 107, 69, 0.16);
}
textarea { min-height: 84px; resize: vertical; }
textarea.tall { min-height: 110px; }
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.row-3 { grid-template-columns: 1fr 1fr 1fr; }
.row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.section-title {
  margin: 22px 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title:first-child { margin-top: 0; }

.details-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 0 0 12px;
  box-shadow: var(--shadow);
}
.details-block > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 18px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  color: #3d4a32;
  user-select: none;
}
.details-block > summary::-webkit-details-marker { display: none; }
.details-block > summary::after {
  content: "+";
  float: right;
  color: var(--muted);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
}
.details-block[open] > summary::after { content: "–"; }
.details-block .details-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
}

.repeat {
  display: grid;
  grid-template-columns: 88px 1.1fr 1.4fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: start;
}
.repeat input { margin: 0; }

.btn, button.btn, .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(180deg, #859268, var(--accent));
  color: #f7f1e6;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 18px rgba(60, 50, 30, 0.14);
}
.btn:hover, .btn-primary:hover {
  filter: brightness(1.05);
  text-decoration: none;
}
.btn-secondary, .ghost, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
}
.ghost:hover, .btn-ghost:hover, .btn-secondary:hover {
  background: var(--bg-soft);
  text-decoration: none;
}
.btn-danger {
  background: #fff;
  color: var(--err);
  border: 1px solid rgba(138, 59, 59, 0.28);
}
.btn-danger:hover { background: var(--err-bg); }
.btn-link {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-link:hover { color: var(--err); }
.btn-link.edit:hover { color: var(--accent); }

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding: 12px 0 4px;
  background: linear-gradient(180deg, rgba(239, 230, 214, 0), var(--bg) 30%);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.panel table, .card table {
  box-shadow: none;
  margin: 0;
}
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 14px;
}
th {
  background: #f5efe4;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
.table-wrap { overflow-x: auto; }

.guest-row-edit {
  display: none;
  padding: 12px 14px 16px;
  background: #faf6ef;
  border-bottom: 1px solid var(--line);
}
tr.is-editing + .guest-row-edit { display: table-row; }
tr.is-editing { background: #faf6ef; }
.guest-edit-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.6fr) 100px auto;
  gap: 10px;
  align-items: end;
}
.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(120px, 1.5fr) 72px 72px auto;
  gap: 6px;
  align-items: center;
}
.inline-form input { margin: 0; padding: 8px 10px; font-size: 13px; }
.money-form {
  display: grid;
  grid-template-columns: minmax(140px, 1.8fr) 100px 100px 90px auto;
  gap: 6px;
  align-items: center;
}
.money-form input { margin: 0; padding: 8px 10px; font-size: 13px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge.confirmed { background: var(--ok-bg); color: var(--ok); }
.badge.declined { background: var(--err-bg); color: var(--err); }
.badge.pending { background: #f4ecd4; color: var(--pending); }

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
}
.search { max-width: 280px; margin: 0; }
.copylink {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}
.copylink span { font-size: 12px; color: var(--muted); grid-column: 1 / -1; }
.copylink input { font-family: var(--mono); font-size: 12px; }

.empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.grid-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.grid-photos figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.grid-photos img, .grid-photos video {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}
.grid-photos figcaption { padding: 8px 10px 10px; font-size: 12px; }
.inline { display: inline; }
.muted { color: var(--muted); font-size: 12px; }

.account-block {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.account-block summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.account-block[open] summary { margin-bottom: 12px; }

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255,252,246,0.9), transparent 50%),
    linear-gradient(180deg, #f3eadc, var(--bg));
}
.login {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px 26px;
  box-shadow: var(--shadow);
}
.login .brand {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}
.login h1 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #3d4a32;
}

@media (max-width: 960px) {
  .topbar { padding: 0 14px; }
  .tabs { padding: 8px 10px; }
  .content { padding: 20px 14px 48px; }
  .kpis, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid, .card-grid, .row, .row-3, .row-4, .repeat { grid-template-columns: 1fr; }
  .guest-edit-grid, .inline-form, .money-form { grid-template-columns: 1fr 1fr; }
  .guest-edit-grid button,
  .inline-form button,
  .money-form .row-actions { grid-column: 1 / -1; }
  .row-actions { justify-content: stretch; }
  .row-actions .ghost,
  .row-actions .btn-danger,
  .row-actions button { flex: 1; }
}
@media (max-width: 560px) {
  .topbar-brand small { display: none; }
  .top-link:not(button) { display: none; }
}
@media print {
  .topbar, .tabs, .tools, .toolbar, .no-print, .sticky-actions, .page-actions { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; width: 100%; }
  body { background: white; }
  table, .panel, .card, .kpi, .stat { box-shadow: none; }
}
