:root {
  --red: #9c4a2e;
  --red-light: #f5ece8;
  --red-muted: #d9b4a3;
  --ink: #1a1a1a;
  --ink-mid: #5a5a5a;
  --ink-light: #9a9a9a;
  --rule: #e4e0db;
  --bg: #f4f1ed;
  --card: #ffffff;
  --up: #2A7A4B;
  --down: #9c4a2e;
  --sidebar-w: 220px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.topbar {
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-logo { height: 36px; width: auto; display: block; }
.account-menu { margin-left: auto; position: relative; }
.account-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  color: var(--ink-mid);
}
.account-btn:hover { border-color: var(--red-muted); background: var(--red-light); color: var(--red); }
.account-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--card); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08); min-width: 140px; overflow: hidden; z-index: 200;
}
.account-menu:hover .account-dropdown { display: block; }
.account-dropdown a {
  display: block; padding: 10px 16px; font-size: 13px; font-weight: 400;
  color: var(--ink); text-decoration: none; transition: background 0.1s;
}
.account-dropdown a:hover { background: var(--bg); }
.account-dropdown a.logout { color: var(--red); border-top: 1px solid var(--rule); }

.breadcrumb {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--ink-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── LAYOUT ── */
.layout { display: flex; flex: 1; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--rule);
  padding: 28px 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}

.sidebar-logo { display: none; }
.logo-img { height: 36px; width: auto; display: block; }

.venue-selector-wrapper { margin: 20px 16px; }
.venue-selector {
  width: 100%; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink);
  transition: border-color 0.15s; font-family: 'DM Sans', sans-serif;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235a5a5a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px;
}
.venue-selector:hover { border-color: var(--red-muted); }
.venue-selector:focus { outline: none; border-color: var(--red); }

.nav-section { padding: 20px 0 0; flex: 1; }
.nav-label { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 24px;
  font-size: 13.5px; font-weight: 400; color: var(--ink-mid); cursor: pointer;
  transition: all 0.12s; border-left: 2px solid transparent; text-decoration: none;
}
.nav-item:hover { color: var(--ink); background: var(--bg); }
.nav-item.active { color: var(--red); font-weight: 500; border-left-color: var(--red); background: var(--red-light); }
.nav-icon { display: none; }

.sidebar-footer { padding: 20px 16px; border-top: 1px solid var(--rule); }
.export-btn {
  width: 100%; padding: 9px 16px; background: var(--ink); color: white; border: none;
  border-radius: 7px; font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; transition: background 0.15s;
}
.export-btn:hover { background: #333; }

/* ── MAIN ── */
.main { flex: 1; padding: 32px 36px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
.page-title { font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 400; color: var(--ink); line-height: 1; margin-bottom: 6px; }
.page-subtitle { font-size: 13px; color: var(--ink-light); }
.date-range-label { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 0.05em; background: var(--red-light); color: var(--red); padding: 4px 10px; border-radius: 4px; font-weight: 500; }

/* ── PERFORMANCE TIER BAR ── */
.perf-tier-wrapper { margin-bottom: 16px; }
.perf-tier-bar { display: flex; border-radius: 10px; overflow: hidden; height: 52px; }
.perf-tier-segment { flex: 1; display: flex; align-items: center; justify-content: center; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; }
.perf-tier-segment.inactive { background: #ede9e4; color: var(--ink-light); }
.perf-tier-segment.active { background: var(--red); color: #fff; }

/* ── PROFIT OPPORTUNITY ── */
.profit-opportunity { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 32px 48px; text-align: center; margin-bottom: 28px; }
.profit-opp-label { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 400; color: var(--ink); letter-spacing: 0; margin-bottom: 16px; }
.profit-opp-divider { width: 40px; height: 1px; background: var(--red-muted); margin: 0 auto 24px; }
.profit-opp-number { font-family: 'Playfair Display', serif; font-size: 68px; font-weight: 400; color: var(--red); line-height: 1; margin-bottom: 16px; }
.profit-opp-body { font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--ink); line-height: 1.7; margin-bottom: 24px; max-width: 420px; margin-left: auto; margin-right: auto; }
.profit-opp-highlight { color: var(--red); font-weight: 500; }
.profit-opp-comparison { display: flex; align-items: center; justify-content: center; gap: 28px; }
.profit-opp-col { text-align: center; }
.profit-opp-col-number { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 400; color: var(--ink); line-height: 1; margin-bottom: 6px; }
.profit-opp-col-number.potential { color: var(--red); }
.profit-opp-col-label { font-family: 'DM Mono', monospace; font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-light); }
.profit-opp-arrow { font-size: 22px; color: var(--ink-light); margin-top: -8px; }

/* ── TIME FILTER ── */
.time-filter { margin-bottom: 28px; }
.time-filter-dropdown {
  padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule); border-radius: 8px;
  cursor: pointer; font-family: 'DM Sans', sans-serif; min-width: 200px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235a5a5a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; transition: border-color 0.15s;
}
.time-filter-dropdown:hover { border-color: var(--red-muted); }
.time-filter-dropdown:focus { outline: none; border-color: var(--red); }

/* ── KPI STRIP ── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  animation: fadeUp 0.4s ease both;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: default;
}

.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.10s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.20s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.kpi-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.07); transform: translateY(-1px); }

.kpi-top-label { display: flex; align-items: center; gap: 7px; margin-bottom: 14px; }
.kpi-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.kpi-metric-name {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mid);
  font-weight: 500;
  line-height: 1.3;
}

.kpi-my-house-block { margin-bottom: 4px; }
.kpi-my-house-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-light);
  font-weight: 500;
  margin-bottom: 1px;
}

.kpi-big-number {
  font-family: 'Times New Roman', Times, serif;
  font-size: 40px;
  font-weight: bold;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.5px;
}

.kpi-comp-block {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 10px;
}

.kpi-comp-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-light);
  font-weight: 500;
  flex-shrink: 0;
}

.kpi-comp-number {
  font-family: 'Times New Roman', Times, serif;
  font-size: 18px;
  font-weight: bold;
  color: var(--ink-light);
  line-height: 1;
  margin-left: auto;
}

.kpi-delta-sentence { font-size: 12.5px; color: var(--ink-mid); line-height: 1.45; }
.kpi-delta-sentence .delta-highlight { font-weight: 600; }
.kpi-delta-sentence .delta-highlight.positive { color: var(--up); }
.kpi-delta-sentence .delta-highlight.negative { color: var(--down); }

/* ── INSIGHTS BOX ── */
.insights-box {
  background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
  padding: 24px; margin-bottom: 28px; animation: fadeUp 0.4s ease both; animation-delay: 0.3s;
}
.insights-header { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.insights-icon { width: 20px; height: 20px; border-radius: 4px; background: var(--red-light); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.insights-title { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 400; color: var(--ink); }
.insight-item { padding: 16px 0; border-bottom: 1px solid var(--bg); display: flex; align-items: flex-start; gap: 14px; }
.insight-item:last-child { border-bottom: none; padding-bottom: 0; }
.insight-item:first-child { padding-top: 0; }
.insight-badge { flex-shrink: 0; width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; margin-top: 2px; }
.insight-badge.positive { background: #e8f4ed; }
.insight-badge.negative { background: #f5ece8; }
.insight-badge.neutral  { background: var(--bg); }
.insight-content { flex: 1; }
.insight-text { font-size: 13.5px; color: var(--ink); line-height: 1.5; margin-bottom: 4px; }
.insight-metric { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--ink-light); letter-spacing: 0.02em; }

/* ── PRICING METRICS ── */
.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.category-card { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 0; overflow: clip; animation: fadeUp 0.4s ease both; }
.category-card:nth-child(1)  { animation-delay: 0.05s; }
.category-card:nth-child(2)  { animation-delay: 0.10s; }
.category-card:nth-child(3)  { animation-delay: 0.15s; }
.category-card:nth-child(4)  { animation-delay: 0.20s; }
.category-card:nth-child(5)  { animation-delay: 0.25s; }
.category-card:nth-child(6)  { animation-delay: 0.30s; }
.category-card:nth-child(7)  { animation-delay: 0.35s; }
.category-card:nth-child(8)  { animation-delay: 0.40s; }
.category-card:nth-child(9)  { animation-delay: 0.45s; }
.category-card:nth-child(10) { animation-delay: 0.50s; }
.category-header { padding: 18px 20px; border-bottom: 1px solid var(--rule); }
.category-title { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 400; color: var(--ink); }
.pricing-table { width: 100%; border-collapse: collapse; }
.pricing-table thead tr th {
  font-family: 'DM Mono', monospace; font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-light); padding: 12px 12px 10px;
  text-align: left; border-bottom: 1px solid var(--bg); font-weight: 400; background: var(--bg);
}
.pricing-table thead tr th:first-child { padding-left: 20px; width: 120px; }
.pricing-table thead tr th:nth-child(2) { text-align: center; }
.pricing-table thead tr th:nth-child(3),
.pricing-table thead tr th:nth-child(4),
.pricing-table thead tr th:nth-child(5) { text-align: right; }
.pricing-table tbody tr td { padding: 11px 12px; font-size: 13px; border-bottom: 1px solid var(--bg); color: var(--ink-mid); }
.pricing-table tbody tr td:first-child { padding-left: 20px; color: var(--ink); font-weight: 500; font-size: 13.5px; }
.pricing-table tbody tr td:nth-child(2) { text-align: center; font-family: 'DM Mono', monospace; font-size: 11px; }
.pricing-table tbody tr td:nth-child(3),
.pricing-table tbody tr td:nth-child(4),
.pricing-table tbody tr td:nth-child(5) { text-align: right; font-family: 'DM Mono', monospace; font-size: 12.5px; position: relative; }
.price-highest { background: #f5ece8 !important; font-weight: 600 !important; color: var(--ink) !important; }
.price-lowest  { background: #e8f4ed !important; font-weight: 600 !important; color: var(--ink) !important; }
.pricing-table tbody tr:last-child td { border-bottom: none; }
.pricing-table tbody tr:hover td { background: rgba(200, 56, 42, 0.02); }
.pricing-table tbody tr.subject-row td { background: #f0f0f0 !important; font-weight: 600 !important; }
.pricing-table tbody tr.subject-row td:first-child { color: var(--ink) !important; }
.pricing-table tbody tr.subject-row td:nth-child(3),
.pricing-table tbody tr.subject-row td:nth-child(4),
.pricing-table tbody tr.subject-row td:nth-child(5) { color: var(--ink) !important; }
.na-value { color: var(--ink-light); font-style: italic; font-size: 11px; }
.count-badge { display: inline-block; background: var(--bg); color: var(--ink-mid); font-size: 11px; padding: 2px 6px; border-radius: 3px; font-family: 'DM Mono', monospace; }
.subject-row .count-badge { background: var(--red); color: white; }

/* ── LEGEND ── */
.legend { display: flex; gap: 20px; padding: 16px 20px; background: var(--bg); border-radius: 8px; margin-bottom: 28px; animation: fadeUp 0.4s ease both; animation-delay: 0.05s; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-mid); }
.legend-box { width: 32px; height: 20px; border-radius: 4px; border: 1px solid var(--rule); }
.legend-box.avg { background: linear-gradient(to right, var(--bg) 0%, var(--card) 100%); }
.legend-box.low { background: #e8f4ed; }
.legend-box.high { background: #f5ece8; }
.legend-label { font-family: 'DM Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-light); }

/* ── ITEM PRICE COMPARISON ── */
.item-compare-table { width: 100%; border-collapse: collapse; }
.item-compare-table thead tr th { font-family: 'DM Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-light); font-weight: 400; padding: 0 16px 12px; text-align: left; border-bottom: 1px solid var(--rule); }
.item-compare-table thead tr th:last-child { text-align: right; }
.item-compare-table tbody tr { border-bottom: 1px solid var(--rule); }
.item-compare-table tbody tr:last-child { border-bottom: none; }
.item-compare-table tbody tr td { padding: 13px 16px; font-size: 13px; color: var(--ink); vertical-align: middle; }
.item-compare-table tbody tr.subject-row td { background: var(--red-light); }
.item-compare-name { font-weight: 500; }
.item-compare-restaurant { font-size: 11px; color: var(--ink-light); margin-top: 2px; }
.item-compare-price { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 500; }
.item-compare-delta { font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 600; text-align: right; }
.item-compare-delta.above { color: var(--down); }
.item-compare-delta.below { color: var(--up); }
.item-compare-delta.same { color: var(--ink-light); }

.section-divider { height: 1px; background: var(--rule); margin: 32px 0; position: relative; }
.section-divider-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--bg); padding: 0 16px; font-family: 'DM Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-light); }

.insights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.insight-column h4 { font-family: 'DM Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-light); margin-bottom: 12px; font-weight: 400; }
.insight-list { list-style: none; }
.insight-list li { padding: 10px 0; border-bottom: 1px solid var(--bg); font-size: 13.5px; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.insight-list li:last-child { border-bottom: none; padding-bottom: 0; }
.insight-list li:first-child { padding-top: 0; }
.insight-list .insight-badge { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; }
.insight-badge.above { background: var(--down); }
.insight-badge.below { background: var(--up); }
.insight-badge.competitive { background: var(--ink-light); }
.insight-delta { margin-left: auto; font-family: 'DM Mono', monospace; font-size: 11px; color: var(--ink-light); white-space: nowrap; }

/* ── REVIEWS ── */
.reviews-card { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 24px; margin-bottom: 16px; animation: fadeUp 0.4s ease both; animation-delay: 0.05s; }
.reviews-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.reviews-table { width: 100%; border-collapse: collapse; }
.reviews-table thead tr th {
  font-family: 'DM Mono', monospace; font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-light); padding: 12px 12px 14px;
  text-align: center; border-bottom: 1px solid var(--rule); font-weight: 400; background: var(--bg); vertical-align: middle;
}
.reviews-table thead tr th:first-child { text-align: left; padding-left: 16px; }
.reviews-table tbody tr td { padding: 14px 12px; font-size: 13px; border-bottom: 1px solid var(--bg); text-align: center; color: var(--ink-mid); vertical-align: middle; }
.reviews-table tbody tr td:first-child { text-align: left; padding-left: 16px; color: var(--ink); font-weight: 500; font-size: 13.5px; }
.reviews-table tbody tr:last-child td { border-bottom: none; }
.reviews-table tbody tr:hover td { background: rgba(200, 56, 42, 0.02); }
.reviews-table tbody tr.subject-row td { background: #f0f0f0 !important; font-weight: 600 !important; }
.reviews-table tbody tr.subject-row td:first-child { color: var(--ink) !important; }
.platform-logo { height: 18px; width: auto; display: inline-block; vertical-align: middle; }
.star-rating { font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 500; color: var(--ink); }
.star-rating.aggregate { font-size: 15px; font-weight: 600; }
.michelin-special { font-size: 11px; font-weight: 500; color: var(--ink); font-style: italic; }
.count-display { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 500; color: var(--ink-mid); }
.highlight-best  { background: #e8f4ed !important; color: var(--up)   !important; font-weight: 600 !important; }
.highlight-worst { background: #f5ece8 !important; color: var(--down) !important; font-weight: 600 !important; }
.response-badge { display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.response-badge.yes     { background: #e8f4ed; color: var(--up); }
.response-badge.no      { background: #f5ece8; color: var(--down); }
.response-badge.partial { background: var(--bg); color: var(--ink-mid); }
.chart-title { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 400; color: var(--ink); margin-bottom: 4px; }
.chart-meta  { font-size: 12px; color: var(--ink-light); }
.chart-header { margin-bottom: 20px; }
.sgr-display { display: flex; align-items: center; justify-content: center; gap: 0; padding: 24px 0 8px; }
.sgr-item { flex: 1; text-align: center; }
.sgr-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-light); margin-bottom: 10px; }
.sgr-number { font-family: 'Playfair Display', serif; font-size: 42px; font-weight: 400; color: var(--ink); line-height: 1; }
.sgr-number.sgr-comp { color: var(--ink-mid); }
.sgr-divider { width: 1px; height: 60px; background: var(--rule); flex-shrink: 0; }

/* Guest Retention Bars */
.retention-bars { padding: 4px 0 0; }
.retention-bar-row { margin-bottom: 16px; }
.retention-bar-label { font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 500; color: var(--ink); margin-bottom: 7px; }
.retention-bar { display: flex; height: 48px; border-radius: 8px; overflow: hidden; }
.retention-bar-fill { display: flex; align-items: center; justify-content: center; font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600; }
.retention-bar-fill.returning { background: #9c4a2e; color: #fff; }
.retention-bar-fill.new { background: #e8e0d8; color: var(--ink-mid); }
.retention-insight { border-top: 1px solid var(--rule); margin-top: 20px; padding-top: 16px; text-align: center; font-family: 'DM Sans', sans-serif; font-size: 13px; color: #9c4a2e; font-weight: 500; }
.period-badge { display: inline-block; font-size: 16px; font-weight: 600; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; text-align: center; }
.period-badge.yes { color: var(--up); background: #e8f4ed; }
.period-badge.no  { color: var(--down); background: #f5ece8; }
.reviews-table tbody tr.turns-below td { background: #fdf1f0 !important; }
.reviews-table tbody tr.turns-above td { background: #edf7f2 !important; }
.reviews-table tbody tr.turns-below td, .reviews-table tbody tr.turns-above td { border-bottom: 1px solid var(--rule) !important; }

/* ── LABOR ── */
.labor-section-card { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 0; margin-bottom: 20px; overflow: hidden; animation: fadeUp 0.4s ease both; }
.labor-section-card:nth-child(2) { animation-delay: 0.05s; }
.labor-section-card:nth-child(3) { animation-delay: 0.10s; }
.labor-section-card:nth-child(4) { animation-delay: 0.15s; }
.labor-section-header { padding: 18px 20px; border-bottom: 1px solid var(--rule); background: var(--card); display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.labor-section-header:hover { background: var(--bg); }
.labor-section-title { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 400; color: var(--ink); }
.labor-section-arrow { font-size: 11px; color: var(--red-muted); transition: transform 0.2s ease; }
.labor-section-card.collapsed .labor-section-arrow { transform: rotate(-90deg); }
.labor-section-card.collapsed .labor-section-header { border-bottom: none; }
.labor-section-card.collapsed .labor-grid { display: none; }
.labor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0; }
.labor-position-card { padding: 20px 24px; border-bottom: 1px solid var(--bg); border-right: 1px solid var(--bg); transition: background 0.15s; }
.labor-position-card:hover { background: rgba(200, 56, 42, 0.02); }
.labor-position-name { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 14px; }
.labor-wage-comparison { display: flex; gap: 16px; margin-bottom: 16px; }
.labor-wage-item { flex: 1; }
.labor-wage-label { font-family: 'DM Mono', monospace; font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-light); margin-bottom: 4px; }
.labor-wage-value { font-family: 'DM Mono', monospace; font-size: 20px; font-weight: 600; color: var(--ink); }
.labor-wage-item.me   .labor-wage-value { color: var(--red); }
.labor-wage-item.comp .labor-wage-value { color: var(--ink-mid); }
.labor-range { margin-top: 12px; }
.labor-range-label { font-family: 'DM Mono', monospace; font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-light); margin-bottom: 8px; }
.labor-range-bar { position: relative; height: 8px; background: var(--bg); border-radius: 4px; margin-bottom: 6px; }
.labor-range-fill { position: absolute; top: 0; height: 100%; background: var(--red-muted); border-radius: 4px; }
.labor-range-marker { position: absolute; top: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid var(--card); box-shadow: 0 2px 4px rgba(0,0,0,0.15); cursor: help; transform: translateX(-50%); z-index: 2; }
.labor-range-marker.comp-marker { background: var(--ink-mid); z-index: 1; }
.labor-range-marker.below { background: var(--down); }
.labor-range-marker.favorable { background: var(--up); }
.labor-range-marker.premium { background: #b33a20; }
.cost-supplier { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--ink-light); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.labor-range-values { display: flex; justify-content: space-between; font-family: 'DM Mono', monospace; font-size: 10px; color: var(--ink-light); }

/* ── AUTH ── */
.auth-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 40px 20px; }
.auth-container { width: 100%; max-width: 440px; animation: fadeUp 0.5s ease both; }
.auth-logo { text-align: center; margin-bottom: 48px; }
.auth-logo-img { width: 200px; height: auto; display: inline-block; }
.auth-card { background: var(--card); border: 1px solid var(--rule); border-radius: 16px; padding: 48px 40px; box-shadow: 0 4px 24px rgba(0,0,0,0.06); }
.auth-header { margin-bottom: 16px; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 28px; border: 2px solid var(--rule); border-radius: 10px; overflow: hidden; }
.auth-tab { flex: 1; padding: 10px 16px; font-size: 14px; font-weight: 500; font-family: 'DM Sans', sans-serif; color: var(--ink-mid); background: transparent; border: none; cursor: pointer; transition: all 0.2s; }
.auth-tab.active { background: var(--red); color: white; }
.auth-tab:not(.active):hover { background: var(--bg); color: var(--ink); }
.auth-title { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 400; color: var(--ink); margin-bottom: 8px; line-height: 1.2; }
.auth-subtitle { font-size: 15px; color: var(--ink-mid); line-height: 1.5; }
.auth-form { display: flex; flex-direction: column; gap: 24px; }
.auth-input-group { display: flex; flex-direction: column; gap: 8px; }
.auth-label { font-family: 'DM Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mid); font-weight: 500; }
.auth-input { width: 100%; padding: 18px 20px; font-size: 18px; font-family: 'DM Sans', sans-serif; color: var(--ink); background: var(--bg); border: 2px solid var(--rule); border-radius: 12px; transition: all 0.2s; outline: none; }
.auth-input:focus { border-color: var(--red); background: var(--card); }
.auth-input::placeholder { color: var(--ink-light); }
.auth-button { width: 100%; padding: 18px 24px; font-size: 16px; font-weight: 600; font-family: 'DM Sans', sans-serif; color: white; background: var(--red); border: none; border-radius: 12px; cursor: pointer; transition: all 0.2s; }
.auth-button:hover { background: #a32d24; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(156,74,46,0.3); }
.auth-footer { text-align: center; margin-top: 32px; }
.auth-footer p { font-size: 13px; color: var(--ink-light); line-height: 1.5; }
.auth-resend-hint { font-size: 14px; color: var(--ink-mid); text-align: center; margin-top: 24px; }
.auth-link { background: none; border: none; color: var(--red); font-size: 14px; font-weight: 500; cursor: pointer; padding: 8px 0; font-family: 'DM Sans', sans-serif; transition: opacity 0.2s; }
.auth-link:hover { opacity: 0.7; }
.otp-input-container { display: flex; gap: 12px; justify-content: center; margin-bottom: 16px; }
.otp-digit { width: 56px; height: 64px; font-size: 28px; font-weight: 600; font-family: 'DM Mono', monospace; text-align: center; color: var(--ink); background: var(--bg); border: 2px solid var(--rule); border-radius: 12px; transition: all 0.2s; outline: none; }
.otp-digit:focus { border-color: var(--red); background: var(--card); transform: scale(1.05); }
.otp-digit.filled { border-color: var(--red); background: var(--red-light); }
.otp-error { text-align: center; color: var(--down); font-size: 13px; font-weight: 500; min-height: 20px; margin-bottom: 8px; }

/* ── PROFIT OPPORTUNITY P&L TABLE ── */
.pl-wrapper { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; margin-bottom: 28px; animation: fadeUp 0.4s ease both; animation-delay: 0.1s; }
.pl-table { width: 100%; border-collapse: collapse; }
.pl-table .pl-lv   { background: #b55430; color: #fff; }
.pl-table .pl-comp { background: #1f3c3b; color: #fff; }
.pl-table .pl-save { background: #2e7e6e; color: #fff; }
.pl-table thead th { padding: 18px 20px; text-align: center; vertical-align: middle; }
.pl-table thead th.pl-th-label { background: var(--bg); width: 38%; }
.pl-table thead th.pl-lv, .pl-table thead th.pl-comp, .pl-table thead th.pl-save { width: 21%; }
.pl-th-main { font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; line-height: 1.4; }
.pl-th-sub  { font-family: 'DM Mono', monospace; font-size: 9px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.8; margin-top: 4px; }
.pl-table tbody .pl-lv,
.pl-table tbody .pl-comp,
.pl-table tbody .pl-save { padding: 14px 20px; text-align: center; font-family: 'Playfair Display', serif; font-size: 15px; font-weight: 400; }
.pl-table td.pl-label { padding: 14px 20px; font-size: 14px; color: var(--ink); background: #fff; }
.pl-table tr.pl-revenue td.pl-label { background: #f0ece7; font-size: 14px; font-weight: 600; }
.pl-table tr.pl-section td { background: #f0ece7; padding: 10px 20px; font-family: 'DM Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mid); font-weight: 500; border-top: 1px solid var(--rule); }
.pl-table tr.pl-data td.pl-label   { border-bottom: 1px solid var(--bg); }
.pl-table tr.pl-data td.pl-lv,
.pl-table tr.pl-data td.pl-comp,
.pl-table tr.pl-data td.pl-save    { border-bottom: 1px solid rgba(0,0,0,0.07); }
.pl-table tr.pl-total td.pl-label  { background: #e8e2db; font-weight: 700; border-top: 1px solid #d0c8bf; border-bottom: 1px solid var(--rule); }
.pl-table tr.pl-total td.pl-lv    { background: #8f3f22; border-top: 1px solid rgba(0,0,0,0.12); }
.pl-table tr.pl-total td.pl-comp  { background: #152928; border-top: 1px solid rgba(0,0,0,0.12); }
.pl-table tr.pl-total td.pl-save  { background: #236658; border-top: 1px solid rgba(0,0,0,0.12); }
.pl-table tr.pl-ebitda td.pl-label { background: #1c1814; color: #fff; font-size: 14px; font-weight: 700; letter-spacing: 0.04em; border-top: 2px solid rgba(0,0,0,0.2); padding: 18px 20px; }
.pl-table tr.pl-ebitda td.pl-lv   { background: #702f18; font-size: 18px; font-weight: 400; padding: 18px 20px; border-top: 2px solid rgba(0,0,0,0.15); }
.pl-table tr.pl-ebitda td.pl-comp { background: #152928; font-size: 18px; font-weight: 400; padding: 18px 20px; border-top: 2px solid rgba(0,0,0,0.15); }
.pl-table tr.pl-ebitda td.pl-save { background: #236658; font-size: 18px; font-weight: 400; padding: 18px 20px; border-top: 2px solid rgba(0,0,0,0.15); }
.pl-pct  { font-size: 10px; opacity: 0.75; margin-left: 3px; }
.pl-dash { opacity: 0.45; }
.pl-footnote { font-size: 11.5px; color: var(--ink-light); line-height: 1.6; padding: 14px 20px; background: var(--bg); border-top: 1px solid var(--rule); font-style: italic; }

/* ── NAV SUB-NAV ── */
.nav-subnav { padding: 0; }
.nav-sub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 24px 6px 38px;
  font-size: 12.5px; font-weight: 400; color: var(--ink-light);
  cursor: pointer; transition: all 0.12s;
  border-left: 2px solid transparent; text-decoration: none;
}
.nav-sub-item:hover { color: var(--ink-mid); background: var(--bg); }
.nav-sub-item.active { color: var(--red); font-weight: 500; border-left-color: var(--red); background: var(--red-light); }
.nav-item.parent-active { color: var(--ink); font-weight: 500; }

/* ── DISH BY DISH ── */
.dbd-card { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; overflow: clip; margin-bottom: 16px; animation: fadeUp 0.4s ease both; }
.dbd-card:nth-child(1) { animation-delay: 0.05s; }
.dbd-card:nth-child(2) { animation-delay: 0.10s; }
.dbd-card:nth-child(3) { animation-delay: 0.15s; }
.dbd-card:nth-child(4) { animation-delay: 0.20s; }
.dbd-card:nth-child(5) { animation-delay: 0.25s; }
.dbd-card:nth-child(6) { animation-delay: 0.30s; }
.dbd-card-header { padding: 18px 20px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; background: var(--card); position: sticky; top: 56px; z-index: 11; }
.dbd-card-header:hover { background: var(--bg); }
.dbd-card-title { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 400; color: var(--ink); line-height: 1; }
.dbd-card-arrow { font-size: 12px; color: var(--red-muted); transition: transform 0.2s ease; }
.dbd-card.collapsed .dbd-card-arrow { transform: rotate(-90deg); }
.dbd-card.collapsed .dbd-card-header { border-bottom: none; }
.dbd-card.collapsed .dbd-card-body { display: none; }
.dbd-col-headers { display: grid; grid-template-columns: 1fr 1fr 80px 80px 68px; background: var(--bg); padding: 10px 20px; border-bottom: 1px solid var(--rule); position: sticky; top: 109px; z-index: 10; }
.dbd-col-header { font-family: 'DM Mono', monospace; font-size: 9px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-light); font-weight: 400; }
.dbd-col-header:nth-child(3), .dbd-col-header:nth-child(4), .dbd-col-header:nth-child(5) { text-align: right; }
.dbd-item-group { border-bottom: 1px solid var(--rule); }
.dbd-item-group:last-child { border-bottom: none; }
.dbd-lv-row { display: grid; grid-template-columns: 1fr 1fr 80px 80px 68px; padding: 14px 20px 12px; background: #f7f5f2; align-items: start; }
.dbd-comp-row { display: grid; grid-template-columns: 1fr 1fr 80px 80px 68px; padding: 10px 20px; border-top: 1px solid var(--bg); align-items: start; }
.dbd-comp-row:hover { background: rgba(156,74,46,0.03); }
.dbd-lv-name { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.dbd-lv-desc { font-size: 11px; color: var(--ink-light); line-height: 1.4; margin-top: 3px; }
.dbd-match-badge { display: inline-block; background: var(--red-light); color: var(--red); font-family: 'DM Mono', monospace; font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 3px; margin-top: 6px; letter-spacing: 0.03em; }
.dbd-comp-restaurant { font-size: 11px; font-weight: 600; color: var(--red); margin-bottom: 2px; letter-spacing: 0.02em; }
.dbd-comp-name { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.3; }
.dbd-comp-desc { font-size: 11px; color: var(--ink-light); line-height: 1.4; margin-top: 2px; }
.dbd-lv-price { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; padding-top: 3px; }
.dbd-their-price { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 500; color: var(--ink-mid); text-align: right; padding-top: 3px; }
.dbd-diff { font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 600; text-align: right; padding-top: 5px; }
.dbd-diff.above { color: var(--down); }
.dbd-diff.below { color: var(--up); }
.dbd-diff.same  { color: var(--ink-light); }

/* ── RESPONSIVE ── */
@media (max-width: 1200px) { .kpi-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1024px) { .category-grid { grid-template-columns: repeat(2, 1fr); } .labor-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  body { overflow-x: hidden; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; top: 0; border-right: none; border-bottom: 1px solid var(--rule); padding: 16px 0; min-height: auto; }
  .sidebar-logo { padding: 0 20px 16px; }
  .venue-selector-wrapper { margin: 12px 16px; }
  .nav-section { padding: 12px 0 0; display: flex; flex-direction: row; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .nav-section::-webkit-scrollbar { display: none; }
  .nav-label { display: none; }
  .nav-item { padding: 8px 14px; white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; font-size: 13px; }
  .nav-item.active { border-left: none; border-bottom-color: var(--red); background: transparent; }
  .nav-subnav { display: flex; flex-direction: row; }
  .nav-sub-item { padding: 8px 12px; white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; font-size: 12px; }
  .nav-sub-item.active { border-left: none; border-bottom-color: var(--red); background: transparent; color: var(--red); }
  .sidebar-footer { display: none; }

  .main { padding: 20px 16px 40px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 20px; }
  .page-title { font-size: 22px; }
  .page-subtitle { font-size: 12px; }
  .date-range-label { font-size: 11px; }

  /* KPI strip */
  .kpi-strip { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-big-number { font-size: 30px; }
  .kpi-card { padding: 16px 14px 14px; }

  /* Category / pricing — fit all columns without horizontal scroll */
  .category-grid { grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
  .category-card { overflow: clip; }
  .pricing-table { min-width: unset; width: 100%; table-layout: fixed; }
  .pricing-table thead tr th { padding: 8px 4px 7px; font-size: 8px; letter-spacing: 0.03em; }
  .pricing-table thead tr th:first-child { padding-left: 10px; width: 34%; }
  .pricing-table thead tr th:nth-child(2) { width: 10%; text-align: center; }
  .pricing-table thead tr th:nth-child(3),
  .pricing-table thead tr th:nth-child(4) { width: 18%; }
  .pricing-table thead tr th:nth-child(5) { width: 18%; padding-right: 10px; }
  .pricing-table tbody tr td { padding: 9px 4px; font-size: 11.5px; }
  .pricing-table tbody tr td:first-child { padding-left: 10px; font-size: 12px; word-break: break-word; }
  .pricing-table tbody tr td:nth-child(2) { font-size: 10.5px; }
  .pricing-table tbody tr td:nth-child(3),
  .pricing-table tbody tr td:nth-child(4) { font-size: 11.5px; }
  .pricing-table tbody tr td:nth-child(5) { font-size: 11.5px; padding-right: 10px; }

  /* Reviews / tables — fit all columns without horizontal scroll */
  .reviews-grid { grid-template-columns: 1fr; }
  .reviews-card { overflow: visible; }
  .reviews-table { min-width: unset; width: 100%; table-layout: fixed; }
  .reviews-table thead tr th { padding: 8px 4px 8px; font-size: 8px; letter-spacing: 0.03em; }
  .reviews-table thead tr th:first-child { padding-left: 10px; width: 38%; text-align: left; }
  .reviews-table thead tr th:last-child { padding-right: 10px; }
  .reviews-table tbody tr td { padding: 10px 4px; font-size: 12px; }
  .reviews-table tbody tr td:first-child { padding-left: 10px; font-size: 12.5px; }
  .reviews-table tbody tr td:last-child { padding-right: 10px; }

  /* Item compare table */
  .item-compare-table { min-width: unset; width: 100%; table-layout: fixed; }
  .item-compare-table thead tr th { padding: 8px 4px 8px; font-size: 8px; }
  .item-compare-table thead tr th:first-child { padding-left: 10px; width: 32%; }
  .item-compare-table thead tr th:last-child { padding-right: 10px; }
  .item-compare-table tbody tr td { padding: 10px 4px; font-size: 12px; }
  .item-compare-table tbody tr td:first-child { padding-left: 10px; }
  .item-compare-table tbody tr td:last-child { padding-right: 10px; }

  /* Guest retention bars */
  .retention-bar { height: auto; min-height: 44px; }
  .retention-bar-fill { font-size: 11px; padding: 8px 6px; line-height: 1.3; text-align: center; white-space: normal; }

  /* Legend */
  .legend { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }

  /* Insights */
  .insights-grid { grid-template-columns: 1fr; gap: 20px; }

  /* Labor */
  .labor-grid { grid-template-columns: 1fr; }

  /* P&L table */
  .pl-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pl-table { min-width: 500px; }

  /* Dish by dish — keep sticky headers, enable horizontal scroll on body */
  .dbd-card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dbd-col-headers { min-width: 420px; }
  .dbd-lv-row { min-width: 420px; }
  .dbd-comp-row { min-width: 420px; }

  /* Profit opportunity */
  .profit-opportunity { padding: 24px 20px; }
  .profit-opp-number { font-size: 52px; }
  .profit-opp-comparison { gap: 16px; }
  .profit-opp-col-number { font-size: 24px; }

  /* Performance tier */
  .perf-tier-segment { font-size: 11px; letter-spacing: 0.04em; }
}
@media (max-width: 480px) {
  .topbar { padding: 0 16px; }
  .main { padding: 16px 12px 32px; }
  .page-title { font-size: 20px; }

  /* KPI */
  .kpi-strip { grid-template-columns: 1fr; gap: 8px; }
  .kpi-big-number { font-size: 36px; }
  .kpi-delta-sentence { font-size: 12px; }

  /* Auth / OTP */
  .auth-card { padding: 32px 20px; }
  .otp-input-container { gap: 6px; }
  .otp-digit { width: 44px; height: 54px; font-size: 22px; border-radius: 10px; }

  /* Profit opportunity */
  .profit-opp-number { font-size: 44px; }
  .profit-opp-col-number { font-size: 20px; }
  .profit-opp-comparison { flex-wrap: wrap; justify-content: center; gap: 12px; }
  .profit-opp-arrow { display: none; }
  .perf-tier-segment { font-size: 10px; padding: 0 4px; }

  /* Insights */
  .insight-text { font-size: 13px; }
  .sgr-number { font-size: 34px; }
}

@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }
