:root {
  --ink: #16211d;
  --muted: #63706b;
  --line: #d9e1dc;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --green: #176b52;
  --amber: #b26a20;
  --rose: #a33b4b;
  --blue: #2d668f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.hidden { display: none !important; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f6f7f4 0%, #e9eee9 100%);
}
.login-card {
  width: min(960px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.login-card .brand { color: var(--ink); margin-bottom: 22px; }
.login-card .brand small { color: var(--muted); }
.login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  align-content: start;
}
.login-panel.staff { background: #f7faf8; }
.login-panel h1 { font-size: 24px; }
.login-panel p { color: var(--muted); margin: 8px 0 16px; line-height: 1.5; }

.sidebar {
  background: #101815;
  color: white;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f0c36d;
  color: #101815;
  font-weight: 800;
}
.brand small, .topbar p { color: #aab7b1; display: block; margin-top: 2px; }
nav { display: grid; gap: 6px; }
nav a {
  color: #dfe8e3;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 7px;
}
nav a.active, nav a:hover { background: #21312c; }
.sync-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.sync-card span {
  border: 1px solid #33443e;
  border-radius: 7px;
  padding: 10px;
  color: #dbe5e0;
}
.sync-card button {
  background: transparent;
  color: #dbe5e0;
  border-color: #33443e;
}

main { padding: 28px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}
h1, h2, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 16px; }
.topbar p { color: var(--muted); margin-top: 6px; }

button, select, input {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
}
button {
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 700;
}
button.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
button:disabled { opacity: .55; cursor: wait; }
input, select { padding: 10px; min-width: 0; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.dashboard-cockpit {
  margin-bottom: 14px;
}
.dashboard-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.dashboard-controls label {
  min-width: 210px;
}
.dashboard-controls span {
  margin-left: auto;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}
.compact-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.compact-metrics article {
  padding: 14px;
}
.compact-metrics strong {
  font-size: 22px;
  line-height: 1.1;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
}
.dashboard-main {
  min-height: 300px;
}
.panel-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.mini-toggle {
  border: 1px solid #78c287;
  color: var(--green);
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
}
.sales-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  min-height: 220px;
  border-top: 1px solid #dbe3df;
  border-bottom: 1px solid #dbe3df;
  padding: 16px 0 10px;
}
.chart-day {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 5px;
  min-width: 0;
  text-align: center;
}
.chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5px;
  min-height: 150px;
}
.bar {
  width: 15px;
  border-radius: 4px 4px 0 0;
  display: block;
}
.bar.selected { background: var(--green); }
.bar.compare { background: var(--blue); opacity: .35; }
.chart-day strong,
.chart-day small,
.hour-bar small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-legend {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
}
.green-dot,
.blue-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.green-dot { background: var(--green); }
.blue-dot { background: var(--blue); }
.hourly-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  min-height: 210px;
  align-items: end;
  border-top: 1px solid #dbe3df;
  border-bottom: 1px solid #dbe3df;
  padding-top: 18px;
}
.hour-bar {
  height: 170px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 7px;
  text-align: center;
  min-width: 0;
}
.hour-bar span {
  align-self: end;
  justify-self: center;
  width: 16px;
  border-radius: 4px 4px 0 0;
  background: var(--blue);
}
.compact-table {
  display: grid;
}
.compact-table > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
.compact-table > div:first-child { padding-top: 0; }
.compact-table > div:last-child { border-bottom: 0; }
.compact-table span,
.compact-table small {
  color: var(--muted);
  font-size: 12px;
}
.compact-table strong {
  text-align: right;
  font-size: 14px;
}
.compact-table strong small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.metrics article, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metrics article { padding: 18px; }
.metrics span { color: var(--muted); font-size: 13px; }
.metrics strong { display: block; font-size: 28px; margin-top: 8px; }
.metrics small, td small, .store-row small, .bar-label small, .code-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.metrics strong small { display: block; margin-top: 4px; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .55fr);
  gap: 14px;
  margin-bottom: 14px;
  align-items: start;
}
.panel { padding: 16px; min-width: 0; }
.panel.wide { min-height: 270px; grid-column: 1 / -1; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.inline-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-controls select { min-width: 130px; }

.store-rows { display: grid; gap: 10px; }
.store-row, .business-unit-row {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.business-unit-rows { display: grid; gap: 10px; }
.business-unit-row { grid-template-columns: 1.35fr repeat(4, minmax(0, .8fr)); }
.store-row span, .business-unit-row span { color: var(--muted); font-size: 12px; display: block; }
.business-unit-row small { display: block; color: var(--muted); margin-top: 3px; }
.business-unit-row b { font-weight: 800; }

.bars { display: grid; gap: 12px; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar-track { height: 9px; background: #edf1ee; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue); border-radius: 99px; }

form { display: grid; gap: 10px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}
legend {
  color: var(--muted);
  font-size: 13px;
  padding: 0 4px;
}
.payment-choice {
  display: grid;
  gap: 9px;
}
.payment-choice label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.payment-choice input { width: 18px; height: 18px; }
.dropzone {
  min-height: 132px;
  place-items: center;
  border: 1px dashed #91a19a;
  border-radius: 8px;
  background: #f8faf8;
  cursor: pointer;
}
.dropzone input { display: none; }
.dropzone span { color: var(--green); font-weight: 800; }
.compact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-form button { grid-column: 1 / -1; }
.guest-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
textarea {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 10px;
  resize: vertical;
}
.muted-copy {
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}
.ai-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ai-subtopics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}
.ai-subtopics button {
  display: grid;
  gap: 4px;
  text-align: left;
  min-height: 82px;
  align-content: start;
}
.ai-subtopics button.active {
  border-color: var(--green);
  background: #eef7f3;
}
.ai-subtopics small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}
.ai-report {
  display: grid;
  gap: 12px;
}
.ai-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8faf8;
}
.ai-summary span, .ai-summary small {
  color: var(--muted);
  font-size: 12px;
}
.ai-summary strong {
  display: block;
  font-size: 20px;
  margin: 5px 0 7px;
}
.ai-summary p, .ai-section p, .action-item p {
  color: var(--muted);
  line-height: 1.45;
}
.ai-section {
  display: grid;
  gap: 8px;
}
.ai-section h3 {
  margin: 4px 0 0;
  font-size: 14px;
}
.ai-section article, .action-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
}
.ai-section article small {
  display: block;
  color: var(--green);
  font-weight: 800;
  margin-top: 6px;
}
.ai-section.alerts article {
  border-left: 4px solid var(--amber);
}
.action-list {
  display: grid;
  gap: 9px;
}
.action-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
}
.action-item span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #e8f0ed;
  color: var(--green);
  font-weight: 800;
}
.insight-list, .report-list {
  display: grid;
  gap: 9px;
}
.insight-item, .report-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
}
.insight-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 10px;
  align-items: center;
}
.insight-item > * { min-width: 0; }
.insight-item small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.insight-item em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.report-item p {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 8px;
}
.report-item b { color: var(--ink); }
.guest-mix {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.guest-mix span {
  border-radius: 99px;
  background: #eef5f2;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
}

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td {
  padding: 11px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}
th { color: var(--muted); font-weight: 700; }
td small { display: block; color: var(--muted); margin-top: 3px; }
td input,
td select {
  width: 100%;
  padding: 8px;
}
td select[multiple] {
  min-height: 88px;
}
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.row-actions button {
  padding: 7px 9px;
  font-size: 12px;
}
.payment-actions {
  margin-top: 7px;
}
.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 99px;
  background: #eef5f2;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}
.code-pill {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  background: #e8f0ed;
  color: var(--green);
  font-weight: 800;
  font-size: 12px;
}
.code-list {
  display: grid;
  gap: 9px;
  max-height: 460px;
  overflow: auto;
}
.code-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
}
.code-row small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.code-row em { color: var(--muted); font-style: normal; font-size: 13px; white-space: nowrap; }
.staff-upload {
  max-width: 720px;
  margin: 0 auto;
}
.staff-mode .sidebar {
  height: auto;
  min-height: 100vh;
}

#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #101815;
  color: white;
  padding: 12px 14px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(8px);
  transition: .2s ease;
  max-width: 360px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  pointer-events: none;
  z-index: 100;
}
#toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#toast[data-level="error"] { background: #8a2218; border-left: 4px solid #ffb84d; }

@media (max-width: 620px) {
  #toast {
    left: 12px;
    right: 12px;
    bottom: auto;
    top: 12px;
    max-width: none;
    transform: translateY(-8px);
    font-size: 13px;
    padding: 10px 12px;
  }
  #toast.show { transform: translateY(0); }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }
  nav { grid-template-columns: repeat(3, 1fr); }
  .sync-card { grid-template-columns: repeat(2, 1fr); }
  .topbar, .grid { grid-template-columns: 1fr; display: grid; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .compact-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .login-grid { grid-template-columns: 1fr; }
  .ai-subtopics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  main { padding: 16px 16px 96px; }
  .app-shell { grid-template-rows: auto 1fr; }
  .sidebar {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    position: static;
    top: auto;
    height: auto;
    min-height: 0;
    gap: 12px;
    padding: 10px 14px;
    -webkit-overflow-scrolling: touch;
  }
  .staff-mode .sidebar { min-height: 0; height: auto; position: static; top: auto; }
  .sidebar .brand { flex-shrink: 0; }
  .sidebar nav { display: flex; gap: 4px; flex-shrink: 0; }
  .sidebar nav a { padding: 8px 10px; white-space: nowrap; font-size: 13px; }
  .sidebar .sync-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    margin-left: auto;
    flex-shrink: 0;
  }
  .sidebar .sync-card span { display: none; }
  .sidebar .sync-card button { padding: 7px 12px; font-size: 12px; white-space: nowrap; }
  .staff-upload { max-width: 100%; padding-bottom: 60px; }
  .staff-upload form textarea { min-height: 90px; }
  .insight-item {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .insight-item em {
    text-align: left;
    font-size: 13px;
  }
  .metrics, .compact-form, .guest-grid, .ai-subtopics { grid-template-columns: 1fr; }
  .compact-metrics, .sales-chart, .hourly-chart { grid-template-columns: 1fr; }
  .chart-day, .hour-bar { grid-template-rows: auto; grid-template-columns: 72px 1fr auto; align-items: center; height: auto; text-align: left; }
  .chart-bars { min-height: 28px; justify-content: start; }
  .bar, .hour-bar span { height: 14px !important; width: 100%; max-width: 180px; border-radius: 4px; }
  .hour-bar { height: auto; }
  .store-row, .business-unit-row { grid-template-columns: 1fr 1fr; }
}

/* CRM */
.crm-header .panel-head { align-items: center; }
.crm-actions { display: flex; align-items: center; gap: 12px; }
.crm-actions .muted-copy { font-size: 12px; }
.crm-filters { display: flex; gap: 8px; align-items: center; }
.crm-filters select, .crm-filters input { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border, #d8dadf); background: #fff; font-size: 13px; }
.segment-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.segment-card { padding: 12px 14px; border-radius: 12px; background: #f6f7f9; border: 1px solid #e4e6ea; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: transform 0.1s ease; }
.segment-card:hover { transform: translateY(-1px); }
.segment-card.active { background: #18352b; color: #f4f5f3; border-color: #18352b; }
.segment-card strong { font-size: 22px; }
.segment-card small { font-size: 11px; opacity: 0.75; }
.segment-card .segment-name { font-size: 13px; font-weight: 600; }
.segment-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.segment-pill.vip { background: #fce4a8; color: #7a4a06; }
.segment-pill.regular { background: #d9efe2; color: #1d5e3b; }
.segment-pill.new { background: #d8e7ff; color: #1c3d7a; }
.segment-pill.atrisk { background: #ffd9bd; color: #8a3a05; }
.segment-pill.dormant { background: #e7e7eb; color: #4b4d52; }
.segment-pill.tourist { background: #f4d7ec; color: #6e1f5e; }
.rfm-badge { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; background: #eef0f3; padding: 2px 6px; border-radius: 6px; }
.birthday-row { display: flex; align-items: center; gap: 8px; }
.birthday-soon { background: #fff5d5; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #7a4a06; }
.birthday-today { background: #ffb84d; color: #3a2200; }
.tag-pill { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #eef0f3; font-size: 10px; margin-right: 4px; color: #36383d; }
#crmCustomerRows td { font-size: 13px; vertical-align: top; }
#crmCustomerRows .menu-list { font-size: 11px; color: #54565b; }

@media (max-width: 960px) {
  .segment-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .segment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-actions { flex-direction: column; align-items: flex-start; }
}

/* Review queue */
.review-list { display: grid; gap: 10px; }
.review-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 12px 14px;
  border: 1px solid #f0c36d;
  background: #fffaf2;
  border-radius: 10px;
  align-items: center;
}
.review-card .review-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.review-card strong { font-size: 14px; }
.review-card small { color: var(--muted); font-size: 12px; }
.review-card .review-amount { font-size: 16px; font-weight: 600; color: #18352b; white-space: nowrap; }
.review-card .review-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.review-card .review-actions button {
  flex: 1 1 auto;
  min-width: 100px;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #c0c4cc;
  background: #fff;
  cursor: pointer;
}
.review-card .review-actions button.primary { background: #18352b; color: #fff; border-color: #18352b; }
.review-card .review-actions button.reject { background: #b13a2c; color: #fff; border-color: #b13a2c; }
.review-card .review-actions button.view { background: #eef0f3; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal-card {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px 18px;
  width: min(620px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-close { position: absolute; right: 14px; top: 12px; background: transparent; border: none; font-size: 18px; cursor: pointer; color: #54565b; }
.modal-card h2 { margin: 0 0 14px; font-size: 18px; }
.modal-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-size: 13px; margin-bottom: 14px; }
.modal-meta div { display: flex; justify-content: space-between; gap: 8px; }
.modal-meta div span:first-child { color: var(--muted); }
.modal-meta div span:last-child { font-weight: 500; text-align: right; }
.modal-preview { margin: 0 0 14px; }
.modal-preview img { max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid #e4e6ea; display: block; }
.modal-preview a { display: inline-block; padding: 8px 12px; border-radius: 6px; background: #eef0f3; color: #18352b; text-decoration: none; font-size: 13px; }
.modal-section { margin-bottom: 14px; }
.modal-section h3 { font-size: 13px; color: #54565b; margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.modal-section table { width: 100%; border-collapse: collapse; font-size: 12px; }
.modal-section table th, .modal-section table td { padding: 6px 4px; border-bottom: 1px solid #eef0f3; text-align: left; }
.modal-section table th { color: var(--muted); font-weight: 500; }
.modal-section table td.num { text-align: right; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.modal-actions button {
  flex: 1 1 auto;
  min-width: 110px;
  padding: 10px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #c0c4cc;
  background: #fff;
  cursor: pointer;
}
.modal-actions button.primary { background: #18352b; color: #fff; border-color: #18352b; }
.modal-actions button.reject { background: #b13a2c; color: #fff; border-color: #b13a2c; }

@media (max-width: 620px) {
  .modal-card { padding: 18px 16px; width: calc(100% - 16px); max-height: calc(100vh - 16px); }
  .modal-meta { grid-template-columns: 1fr; }
}

/* Audit log */
.audit-filters { display: flex; gap: 8px; }
.audit-filters select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border, #d8dadf); background: #fff; font-size: 13px; }
#auditLogRows td { vertical-align: top; }
#auditLogRows small { font-family: ui-monospace, SFMono-Regular, monospace; color: #54565b; }

/* Expense heatmap (store x day-of-week) */
.heatmap-controls { display: flex; gap: 8px; }
.heatmap-controls select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border, #d8dadf); background: #fff; font-size: 13px; }
.heatmap-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.heatmap-table th, .heatmap-table td { padding: 8px 6px; border: 1px solid #eef0f3; text-align: center; }
.heatmap-table th { background: #f6f7f9; font-weight: 600; color: #36383d; }
.heatmap-table th.store-col, .heatmap-table td.store-col { text-align: left; padding-left: 12px; min-width: 120px; }
.heatmap-table td.total-col, .heatmap-table th.total-col { background: #f0c36d12; font-weight: 600; }
.heatmap-table tr.total-row td { background: #f6f7f9; font-weight: 600; border-top: 2px solid #c0c4cc; }
.heatmap-cell { position: relative; transition: background 0.15s; }
.heatmap-cell strong { display: block; font-size: 13px; }
.heatmap-cell small { display: block; font-size: 10px; color: #6d7c87; }

@media (max-width: 620px) {
  .heatmap-controls { flex-direction: column; }
  .heatmap-table { font-size: 11px; }
  .heatmap-table th, .heatmap-table td { padding: 5px 3px; }
  .heatmap-table th.store-col, .heatmap-table td.store-col { min-width: 80px; padding-left: 6px; }
  .heatmap-cell small { display: none; }
}

/* Manager role - hide owner-only sections */
body.manager-mode .owner-only,
body.manager-mode .owner-link { display: none !important; }

/* Alerts panel */
.alerts-panel { padding: 16px 20px; margin-bottom: 16px; border-left: 4px solid #e89619; }
.alerts-panel.hidden { display: none; }
.alerts-panel .panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.alerts-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.alert-card { padding: 12px 14px; border-radius: 10px; background: #fff; border: 1px solid #e4e6ea; display: flex; flex-direction: column; gap: 6px; }
.alert-card.severity-high { border-left: 4px solid #b13a2c; background: #fef5f3; }
.alert-card.severity-medium { border-left: 4px solid #e89619; background: #fffaf2; }
.alert-card.severity-low { border-left: 4px solid #6d7c87; background: #f6f7f9; }
.alert-card .alert-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.alert-card .alert-cat { font-size: 10px; padding: 2px 8px; border-radius: 999px; background: #eef0f3; color: #54565b; }
.alert-card.severity-high .alert-cat { background: #f8d6cc; color: #8f2c20; }
.alert-card.severity-medium .alert-cat { background: #fde7c5; color: #7a4a06; }
.alert-card strong { font-size: 13px; }
.alert-card p { font-size: 12px; color: #54565b; margin: 0; line-height: 1.45; }
.alert-card a { font-size: 12px; color: #18352b; font-weight: 600; }

/* Document review */
.payment-actions button.reject { background: #b13a2c; color: #fff; }
.payment-actions button.reject:hover { background: #8f2c20; }

/* Staff CRM alerts */
.staff-crm-alerts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.staff-crm-alerts.hidden { display: none; }
.staff-crm-card { padding: 14px; }
.staff-crm-card .insight-item { padding: 8px 0; border-bottom: 1px solid #eef0f3; }
.staff-crm-card .insight-item:last-child { border-bottom: none; }
@media (max-width: 720px) {
  .staff-crm-alerts { grid-template-columns: 1fr; }
}
