:root {
  --mist: #EDF1EE;        /* page background */
  --paper: #FBFCFA;       /* panels */
  --line: #D3DCD6;
  --ink: #17261F;
  --ink-soft: #55665E;
  --eucalyptus: #2F6B5A;  /* primary action */
  --eucalyptus-deep: #214D41;
  --stone: #A67B5B;       /* money / accent */
  --danger: #B54A3F;
  --ok: #2F6B5A;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23,38,31,.06);
  font-family: 'Manrope', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--mist); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 500; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 2rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.1rem; }
p { margin: 0; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.money { font-variant-numeric: tabular-nums; color: var(--stone); font-weight: 600; }
.right { text-align: right; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(60% 50% at 20% 0%, #DCE8E1 0, var(--mist) 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--paper); padding: 36px 32px;
  border-radius: 18px; border: 1px solid var(--line); }
.login-card .brand { text-align: center; margin-bottom: 24px; }
.login-card .brand p { color: var(--ink-soft); }
.brand-mark { display: inline-block; width: 34px; height: 34px; border-radius: 50% 50% 50% 0;
  background: var(--eucalyptus); transform: rotate(-45deg); margin-bottom: 10px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--eucalyptus-deep); color: #E9F0EC; padding: 22px 16px;
  display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; }
.sidebar .brand-mark { width: 26px; height: 26px; background: #9CC7B4; margin: 0; }
.sidebar .brand strong { display: block; font-family: 'Fraunces', serif; font-size: 1.15rem; }
.role-pill { font-size: .72rem; background: rgba(255,255,255,.14); padding: 1px 8px; border-radius: 999px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { text-decoration: none; padding: 9px 12px; border-radius: 8px; color: #CFE0D7; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); }
.sidebar nav a.active { background: rgba(255,255,255,.16); color: #fff; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.sidebar-foot .btn { color: #CFE0D7; border-color: rgba(255,255,255,.25); }
.menu-toggle { display: none; }
main { padding: 32px 36px; max-width: 1200px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--ink-soft); margin-top: 4px; }

/* ---------- Panels & stats ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel + .panel, .grid + .panel, .panel + .grid { margin-top: 18px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--paper); border-left: 4px solid var(--eucalyptus); border-radius: 6px; padding: 14px 16px; }
.stat.stone { border-color: var(--stone); }
.stat.danger { border-color: var(--danger); }
.stat .label { color: var(--ink-soft); font-size: .85rem; }
.stat .value { font-family: 'Fraunces', serif; font-size: 1.7rem; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-soft); font-weight: 600; font-size: .82rem; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; background: #E2EBE6; color: var(--eucalyptus-deep); }
.tag.cancelled, .tag.no_show { background: #F3DEDB; color: var(--danger); }
.tag.booked, .tag.in_progress { background: #F0E6DC; color: var(--stone); }
.empty { padding: 36px; text-align: center; color: var(--ink-soft); }

/* ---------- Forms ---------- */
form { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-row.c3 { grid-template-columns: repeat(3, 1fr); }

.label-text { font-size: .88rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
label { display: grid; gap: 4px; font-size: .88rem; font-weight: 600; color: var(--ink-soft); }
label span.req::after, .label-text.req::after { content: ' *'; color: var(--danger); }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--eucalyptus); outline-offset: 1px; }
input.invalid, select.invalid { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .8rem; font-weight: 500; min-height: 1em; }
.form-error { color: var(--danger); font-size: .88rem; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline label { flex: 1; min-width: 140px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.checks label { flex-direction: row; display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink);
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.checks input { width: auto; }
.totals { display: grid; gap: 6px; max-width: 320px; margin-left: auto; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-family: 'Fraunces', serif; font-size: 1.3rem; border-top: 1px solid var(--line); padding-top: 6px; }

/* ---------- Buttons ---------- */
.btn { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  background: #E2EBE6; color: var(--eucalyptus-deep); cursor: pointer; }
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--eucalyptus); color: #fff; }
.btn.danger { background: #F3DEDB; color: var(--danger); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Modal & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(23,38,31,.45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-card { background: var(--paper); border-radius: 14px; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px; z-index: 60; font-size: .9rem; }
.toast.error { background: var(--danger); }

/* ---------- Chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; background: var(--eucalyptus); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .bar span { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: .7rem; color: var(--ink-soft); }
.bars .bar:hover::after { content: attr(data-v); position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: .7rem; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 240px; transition: left .2s; z-index: 40; }
  .sidebar.open { left: 0; }
  .menu-toggle { display: block; position: fixed; top: 12px; left: 12px; z-index: 45; font-size: 1.2rem;
    background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
  main { padding: 64px 16px 32px; }
  .grid.c2, .grid.c3, .grid.c4, .form-row, .form-row.c3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---- added with the offers / memberships / analytics pages ---- */
.sidebar-foot #user-name { color: #CFE0D7; text-decoration: none; border-bottom: 1px dotted rgba(255,255,255,.3); align-self: flex-start; }
.sidebar-foot #user-name:hover { color: #fff; }

/* Month and hour bars carry more labels than the 14-day chart, so let them
   shrink and stay readable rather than overflowing the panel. */
.bars .bar { min-width: 6px; }
.bars .bar span { font-size: .65rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Coupon status line under the code field */
#coupon-status { display: block; line-height: 1.3; }

/* Stat cards used as offer tiles keep their value line from wrapping oddly */
.stat .value .tag { font-size: .8rem; vertical-align: middle; }

@media (max-width: 900px) {
  .grid.c3 .panel, .grid.c2 .panel { min-width: 0; }
  .table-wrap { overflow-x: auto; }
}
