:root {
  --ink: #1c2b26;
  --muted: #6b7c74;
  --line: #dfe5df;
  --paper: #f6f4ee;
  --card: #ffffff;
  --green: #123f35;
  --green-soft: #e4ede8;
  --gold: #c58a2e;
  --gold-soft: #fbf1dd;
  --danger: #a83b34;
  --danger-soft: #fbe9e7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 32, .06), 0 8px 24px rgba(20, 40, 32, .05);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -.01em;
}

a { color: var(--green); }

.boot { padding: 60px; text-align: center; color: var(--muted); }

.boot-error {
  margin: 80px auto;
  max-width: 520px;
  background: var(--card);
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  text-align: center;
}

.app-shell {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--green);
  color: #eef3ef;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(140deg, #e9c46a, #c58a2e);
  color: #2a1c06; display: grid; place-items: center;
  font-family: Georgia, serif; font-size: 21px; font-weight: 700;
}
.brand-name { font-size: 19px; line-height: 1.1; color: #fff; }
.brand-sub { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: #a8c2b8; }

.biz-switch { padding: 0 8px; }
.biz-switch label {
  color: #a8c2b8; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  margin: 0 0 5px;
}
.biz-switch select {
  width: 100%; background: rgba(0, 0, 0, .22); color: #fff; border-color: rgba(255, 255, 255, .16);
  font-size: 13px; padding: 8px 9px;
}
.biz-switch select:focus { border-color: #7fb9a4; box-shadow: 0 0 0 3px rgba(127, 185, 164, .2); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: #d4e2db; text-decoration: none;
  font-size: 14.5px; transition: background .12s, color .12s;
}
.nav a svg { width: 17px; height: 17px; opacity: .8; flex: none; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
.nav a.active svg { opacity: 1; color: var(--gold); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.who {
  background: rgba(0, 0, 0, .16); border-radius: 11px; padding: 11px 12px;
  display: flex; align-items: center; gap: 9px; font-size: 13px;
}
.who-dot { width: 8px; height: 8px; border-radius: 50%; background: #7fd1a8; }
.who small { display: block; color: #a8c2b8; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.side-foot .btn {
  width: 100%; color: #eef3ef; background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .18);
}
.side-foot .btn:hover { background: rgba(255, 255, 255, .17); }

/* ---------- layout ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 26px 30px 18px;
}
.topbar h1 { font-size: 27px; margin: 0; }
.topbar .sub { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }
.topbar-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.content { padding: 0 30px 46px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 17.5px; margin: 0; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 16px 20px 0; margin-bottom: 10px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .lab { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat .val { font-family: Georgia, serif; font-size: 26px; margin-top: 7px; }
.stat .met { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat.accent { background: var(--green); border-color: var(--green); color: #fff; }
.stat.accent .lab, .stat.accent .met { color: #a8c2b8; }
.stat.accent .val { color: #f6e7c1; }
.stat.gold { background: var(--gold-soft); border-color: #ecd8ae; }
.stat.gold .val { color: #7a5210; }

.two-col { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; align-items: start; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #fbfaf6;
}
td { padding: 11px 12px; border-bottom: 1px solid #eef1ec; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fcfbf7; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 600; background: #fbfaf6; border-top: 1px solid var(--line); }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 20px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 20px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }

.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-track { flex: 1; height: 6px; background: #eef1ec; border-radius: 20px; overflow: hidden; min-width: 40px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #2f6d5b, #6aa88f); border-radius: 20px; }

/* ---------- buttons + inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font: inherit; font-size: 13.5px;
  cursor: pointer; transition: background .12s, border-color .12s, transform .06s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f7f8f4; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #0d322a; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #2a1c06; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { color: var(--danger); border-color: #edd3d0; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

label { display: block; font-size: 12.5px; font-weight: 600; color: #46564f; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  background: #fff; border: 1px solid #d7dfd8; border-radius: 9px;
  padding: 9px 11px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #4b8a76; box-shadow: 0 0 0 3px rgba(75, 138, 118, .13); }
textarea { resize: vertical; }
.field { margin-bottom: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .f { min-width: 130px; }
.filters .f.grow { flex: 1; min-width: 190px; }
.filters label { margin-bottom: 4px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 100px;
  padding: 6px 13px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }

.hint-text { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 100px;
  font-size: 11.5px; font-weight: 600; background: #eef1ec; color: #55655d;
}
.badge.live { background: #e3f2e9; color: #256b4c; }
.badge.out { background: #f1efe8; color: #7a6f52; }
.badge.owner { background: var(--gold-soft); color: #7a5210; }
.badge.manager { background: var(--green-soft); color: #235c4b; }
.neg { color: var(--danger); }
.pos { color: #1f6f4c; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.spacer { flex: 1; }

/* ---------- auth ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 10% -10%, #1b5748, #0c2a23 60%);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px; background: #fdfcf8;
  border-radius: 18px; padding: 30px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-card h2 { font-size: 24px; margin: 0 0 6px; }
.auth-card p.lede { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; line-height: 1.55; }
.auth-card .btn { width: 100%; padding: 11px; }
.auth-note { margin-top: 16px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.auth-error { color: var(--danger); font-size: 13px; margin: 0 0 12px; }

/* ---------- account / auth extras ---------- */
.auth-form { margin-top: 4px; }
.auth-form .btn { margin-top: 4px; }
.auth-error {
  background: var(--danger-soft); color: #8d322c; border: 1px solid #f0d2cf;
  border-radius: 9px; padding: 9px 11px; font-size: 12.5px; margin: 0 0 12px;
}
.auth-btn { display: flex; width: 100%; padding: 11px; }
.auth-actions { display: flex; gap: 9px; align-items: center; }
.auth-actions .btn { flex: 1; }
.auth-secure {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; gap: 7px; flex-wrap: wrap; justify-content: center;
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}
.signout-form { margin: 0; }
.signout-form .btn { width: 100%; }
.who-name {
  display: block; font-size: 12.5px; color: #fff; max-width: 152px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.who-role {
  display: block; font-size: 10px; letter-spacing: .09em;
  text-transform: uppercase; color: #a8c2b8;
}
.badge.role-owner { background: var(--gold-soft); color: #7a5210; }
.badge.role-manager { background: var(--green-soft); color: #235c4b; }
.badge.role-pending { background: #fdf1d8; color: #8a6a17; }
.badge.role-blocked { background: var(--danger-soft); color: #8d322c; }

/* ---------- modal ---------- */
.backdrop {
  position: fixed; inset: 0; background: rgba(16, 34, 28, .46);
  display: grid; place-items: center; padding: 22px; z-index: 50;
  overflow-y: auto; backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 560px; background: var(--card); border-radius: 16px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .3); display: flex; flex-direction: column;
  max-height: calc(100vh - 44px); margin: auto;
}
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-head h3 { margin: 0; font-size: 19px; }
.x { border: 0; background: transparent; font-size: 15px; color: var(--muted); cursor: pointer; padding: 5px 8px; border-radius: 7px; }
.x:hover { background: #f0f2ee; }
.modal-body { padding: 8px 20px 4px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px 18px; border-top: 1px solid var(--line); margin-top: 8px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #16281f; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 90;
  max-width: 90vw;
}
.toast.error { background: #7d2b26; }

/* ---------- guest detail ---------- */
.guest-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.guest-head h1 { margin: 0 0 4px; font-size: 26px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.detail-grid .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.detail-grid .v { margin-top: 3px; font-size: 14.5px; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.section-title h2 { font-size: 17.5px; margin: 0; }
.section-title .sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.print-sheet { color: #000; font-family: Georgia, "Times New Roman", serif; }
.print-sheet h1 { font-size: 21px; margin: 0 0 2px; }
.print-sheet .meta { font-size: 12.5px; color: #333; margin-bottom: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
.print-sheet table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.print-sheet th, .print-sheet td { border-bottom: 1px solid #999; padding: 6px 8px; text-align: left; }
.print-sheet th { background: #f0f0ec; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.print-sheet td.num, .print-sheet th.num { text-align: right; }
.print-sheet tfoot td { font-weight: 700; border-top: 1.5px solid #000; }
.print-sheet .print-total { margin-top: 14px; display: flex; justify-content: flex-end; gap: 30px; font-size: 14px; }
.print-sheet .sign { margin-top: 46px; display: flex; justify-content: space-between; font-size: 12px; }

#print-root { display: none; }

@media print {
  #app, #modal-root, .toast { display: none !important; }
  #print-root { display: block; }
  body { background: #fff; }
  @page { margin: 14mm; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 12px; padding: 12px 14px; flex-wrap: wrap; overflow-x: auto;
  }
  .brand-sub, .who small, .side-foot .who-text { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav a { padding: 8px 10px; font-size: 13px; }
  .nav a span { display: none; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .side-foot .btn { width: auto; }
  .biz-switch { flex: 1 1 100%; padding: 0; }
  .biz-switch select { max-width: 260px; }
  .topbar { padding: 18px 16px 12px; }
  .content { padding: 0 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat .val { font-size: 23px; }
}
