:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #18212d;
  --muted: #64748b;
  --border: #dbe3ec;
  --brand: #0f766e;
  --brand-2: #14b8a6;
  --green: #16a34a;
  --amber: #d97706;
  --blue: #2563eb;
  --red: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Sora', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 68px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}
.brand-block, .top-actions, .filter-row, .card-head, .legend, .form-actions, .area-tabs {
  display: flex;
  align-items: center;
}
.brand-block { gap: 12px; min-width: 230px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f766e, #0ea5e9);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
}
.brand-title { font-weight: 800; letter-spacing: .01em; }
.brand-subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }
.top-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.tab {
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.tab.active { background: var(--surface); color: var(--brand); box-shadow: 0 4px 12px rgba(15, 23, 42, .08); }
.top-actions { gap: 8px; }
.icon-btn, .primary-btn, .ghost-btn, .mini-btn {
  border-radius: 9px;
  border: 1px solid var(--border);
  min-height: 36px;
  padding: 8px 12px;
  font-weight: 800;
}
.icon-btn, .ghost-btn, .mini-btn { background: var(--surface); color: var(--text); }
.primary-btn { background: var(--brand); color: white; border-color: var(--brand); }
.primary-btn:hover { background: #115e59; }
.ghost-btn:hover, .icon-btn:hover, .mini-btn:hover { border-color: #b8c4d2; background: #f8fafc; }

.workspace { padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.control-panel, .main-card, .side-panel, .panel-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.control-panel { padding: 14px; }
.filter-row { gap: 10px; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select, textarea {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 10px;
  color: var(--text);
  background: white;
  outline: none;
  min-height: 38px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(20, 184, 166, .12); }
.search-field { flex: 1; min-width: 240px; }
.stats-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1; }
.stat-label { color: var(--muted); font-size: 11px; margin-top: 6px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.main-card { padding: 16px; min-height: 620px; }
.card-head { justify-content: space-between; gap: 16px; margin-bottom: 12px; }
h1 { font-size: 22px; margin: 0; }
p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.area-tabs { gap: 6px; flex-wrap: wrap; }
.area-btn { border: 1px solid var(--border); background: #f8fafc; color: var(--muted); border-radius: 999px; padding: 7px 11px; font-weight: 800; }
.area-btn.active { background: #ecfdf5; color: var(--brand); border-color: rgba(15, 118, 110, .28); }
.legend { gap: 14px; color: var(--muted); font-size: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; margin-right: 6px; }
.dot.free { background: var(--green); }
.dot.requested { background: #64748b; }
.dot.reserved { background: var(--amber); }
.dot.seated { background: var(--blue); }
.dot.blocked { background: var(--red); }
.floor-plan { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 12px; }
.booking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 12px; align-items: start; }
.booking-card, .report-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #fbfdff;
}
.booking-card { display: flex; flex-direction: column; gap: 12px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.slot-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.slot-btn span { font-weight: 800; color: var(--brand); }
.slot-btn small { color: var(--muted); font-size: 11px; }
.slot-btn.active { border-color: var(--brand); background: #ecfdf5; box-shadow: 0 0 0 3px rgba(20, 184, 166, .12); }
.slot-empty { color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; padding: 12px; font-size: 13px; }
.rule-list { display: flex; flex-direction: column; gap: 9px; color: var(--muted); font-size: 13px; }
.rule-list strong { color: var(--text); }
.reports-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.report-section { margin-top: 12px; }
.bar-report { display: flex; flex-direction: column; gap: 8px; }
.bar-row, .report-row, .notification-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  padding: 9px 10px;
}
.bar-row span { width: 54px; font-size: 12px; color: var(--muted); font-weight: 800; }
.bar-row strong, .report-row strong { margin-left: auto; }
.bar-track { flex: 1; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.split-report { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mini-report-title { color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.notification-log { display: flex; flex-direction: column; gap: 8px; }
.notification-item { justify-content: space-between; align-items: flex-start; }
.notification-subject { font-weight: 800; }
.table-card {
  position: relative;
  min-height: 116px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fbfdff;
  padding: 12px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  text-align: left;
}
.table-card:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(15, 23, 42, .1); }
.table-card.free { border-color: rgba(22, 163, 74, .35); }
.table-card.requested { border-color: rgba(100, 116, 139, .45); background: #f8fafc; }
.table-card.reserved { border-color: rgba(217, 119, 6, .45); background: #fffaf0; }
.table-card.seated { border-color: rgba(37, 99, 235, .4); background: #eff6ff; }
.table-card.blocked { border-color: rgba(220, 38, 38, .35); background: #fff1f2; }
.table-number { font-size: 25px; font-weight: 800; }
.table-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.status-pill { position: absolute; right: 10px; top: 10px; border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 800; }
.status-pill.free { background: #dcfce7; color: #166534; }
.status-pill.requested { background: #f1f5f9; color: #475569; }
.status-pill.reserved { background: #fef3c7; color: #92400e; }
.status-pill.seated { background: #dbeafe; color: #1d4ed8; }
.status-pill.blocked { background: #fee2e2; color: #991b1b; }
.table-guest { margin-top: 14px; font-size: 12px; color: var(--text); font-weight: 700; }
.table-time { color: var(--muted); font-size: 11px; margin-top: 3px; }
.side-panel { padding: 12px; display: flex; flex-direction: column; gap: 12px; box-shadow: none; }
.panel-section { padding: 14px; box-shadow: none; }
.section-title { font-size: 13px; font-weight: 800; margin-bottom: 12px; }
.reservation-form, .waitlist-form, .settings-form { display: flex; flex-direction: column; gap: 10px; }
.form-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
textarea { resize: vertical; }
.form-actions { justify-content: space-between; gap: 8px; }
.form-actions button { flex: 1; }
.timeline-list { display: flex; flex-direction: column; gap: 8px; }
.timeline-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: #fbfdff; }
.timeline-item-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.timeline-time { font-weight: 800; color: var(--brand); }
.timeline-name { font-weight: 800; margin-top: 3px; }
.timeline-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.timeline-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.mini-btn { min-height: 29px; padding: 5px 8px; font-size: 11px; }
.badge { border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge.confirmed { background: #fef3c7; color: #92400e; }
.badge.seated { background: #dbeafe; color: #1d4ed8; }
.badge.completed { background: #dcfce7; color: #166534; }
.badge.cancelled, .badge.no_show { background: #fee2e2; color: #991b1b; }
.badge.requested, .badge.deposit_required, .badge.waitlisted, .badge.logged { background: #f1f5f9; color: #475569; }
.guest-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.guest-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fbfdff; }
.guest-name { font-weight: 800; }
.guest-info { color: var(--muted); font-size: 12px; margin-top: 5px; }
.settings-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.settings-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: #fbfdff; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; margin-bottom: 12px; }
.service-hours { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: white; }
.service-hour-row {
  display: grid;
  grid-template-columns: 92px 1fr 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.service-hour-row span { color: var(--muted); font-size: 12px; font-weight: 800; }
.table-management { grid-column: 1 / -1; }
.table-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.table-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: white; }
.table-row-main { min-width: 0; }
.table-row-name { font-weight: 800; }
.table-row-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.danger-mini { color: var(--red); border-color: rgba(220, 38, 38, .25); }
.danger-mini:hover { background: #fff1f2; border-color: rgba(220, 38, 38, .45); }
.closed-date-list { display: flex; flex-wrap: wrap; gap: 8px; }
.closed-date-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 7px 6px 10px;
  background: white;
  font-size: 12px;
  font-weight: 800;
}
.waitlist-form { display: grid; grid-template-columns: 1fr 72px auto; gap: 8px; }
.waitlist { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.wait-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px dashed var(--border); border-radius: 9px; padding: 8px; font-size: 12px; }
.wait-item span { display: flex; flex-direction: column; gap: 3px; }
.wait-item small { color: var(--muted); font-size: 11px; }
.source-title { margin-top: 14px; }
.hidden { display: none !important; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #0f172a;
  color: white;
  box-shadow: 0 18px 35px rgba(15, 23, 42, .22);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all .2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
.public-booking-page { background: #eef2f6; }
.public-booking-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0;
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}
.public-booking-hero {
  padding: 20px 0;
  position: sticky;
  top: 24px;
}
.public-booking-hero h1 { margin: 26px 0 0; font-size: 38px; }
.public-booking-hero p { font-size: 15px; max-width: 360px; }
.public-booking-card { box-shadow: var(--shadow); background: white; }

@media (max-width: 1100px) {
  .content-grid { grid-template-columns: 1fr; }
  .side-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .booking-layout { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .topbar { height: auto; padding: 12px; flex-wrap: wrap; }
  .brand-block { min-width: 0; }
  .top-tabs { order: 3; width: 100%; overflow-x: auto; }
  .content-grid, .side-panel, .stats-grid { grid-template-columns: 1fr; }
  .filter-row { align-items: stretch; }
  .filter-row label, .search-field { width: 100%; min-width: 0; }
  .card-head { align-items: flex-start; flex-direction: column; }
  .waitlist-form, .form-grid.two, .settings-layout, .inline-form, .split-report, .service-hour-row { grid-template-columns: 1fr; }
  .public-booking-shell { grid-template-columns: 1fr; padding: 18px 0; }
  .public-booking-hero { position: static; }
  .public-booking-hero h1 { font-size: 30px; }
}
