/* ==========================================================================
   Ellena Admin — design system
   Palette, type and card treatment are lifted verbatim from the approved
   "Ellena Admin" design. Everything else (modals, forms, toasts, responsive
   behaviour) extends that language.
   ========================================================================== */

:root {
  --ink: #1D2320;
  --muted: #6B7268;
  --paper: #F6F2EA;
  --paper-2: #FBF9F4;
  --line: #E7E0D2;
  --line-2: #F0EADD;
  --forest: #1B3524;
  --forest-2: #24422F;
  --forest-3: #2A4A34;
  --sage: #C9D6C6;
  --sage-2: #7E9781;
  --green: #1F6E43;
  --green-bg: #E8F2EA;
  --rust: #D9481F;
  --rust-dark: #C03E18;
  --red: #B0331B;
  --gold: #B8860B;
  --indigo: #4B44C7;
  --indigo-bg: #EBEAFF;
  --sand: #EDEAE2;
  --sidebar-w: 236px;

  /* Suwannaphum ships 100/300/400/700/900 only — there is no 500, 600 or 800.
     CSS weight matching resolves 500->400, 600->700 and 800->900 onto real
     faces, so nothing is faux-bolded, but semibold and bold render alike. */
  --font-body: 'Suwannaphum', system-ui, -apple-system, 'Noto Sans Khmer', sans-serif;
  --font-display: 'Suwannaphum', system-ui, -apple-system, 'Noto Sans Khmer', sans-serif;

  --card-bg: rgba(217, 217, 217, 0.58);
  --card-shadow: 12px 17px 51px rgba(0, 0, 0, 0.22);
  --card-radius: 17px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--rust); }

button { font: inherit; color: inherit; }

@keyframes livePulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
@keyframes rotate { 0% { transform: translate(-50%, -50%) rotate(0deg) } 100% { transform: translate(-50%, -50%) rotate(360deg) } }
@keyframes rotate-reverse { 0% { transform: translate(-50%, -50%) rotate(0deg) } 100% { transform: translate(-50%, -50%) rotate(-360deg) } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
@keyframes spin { to { transform: rotate(360deg) } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D8D0BF; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.display { font-family: var(--font-display); }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.grow { flex: 1; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================== shell ============================== */

.shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--forest);
  color: var(--sage);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar__brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--forest-3);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar__mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--rust); color: #FFF;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
  flex-shrink: 0;
}
.sidebar__name {
  font-family: var(--font-display);
  font-weight: 700; font-size: 15px; color: #FFF; line-height: 1.1;
}
.sidebar__sub { font-size: 11.5px; color: var(--sage-2); margin-top: 2px; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 10px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 9px; cursor: pointer; margin-bottom: 2px;
  background: transparent; color: var(--sage);
  font-weight: 500; font-size: 13.5px;
  border: 0; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--forest-2); color: #FFF; }
.nav-item.is-active { background: var(--forest-3); color: #FFF; font-weight: 700; }
.nav-item svg { flex-shrink: 0; }
.nav-item__label { flex: 1; }
.nav-item__badge {
  background: var(--rust); color: #FFF; font-size: 10.5px; font-weight: 700;
  border-radius: 99px; padding: 1px 7px;
}

.sidebar__user {
  padding: 14px 16px; border-top: 1px solid var(--forest-3);
  display: flex; align-items: center; gap: 10px;
}
.sidebar__avatar {
  width: 32px; height: 32px; border-radius: 99px; background: var(--gold); color: #FFF;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.sidebar__uname { font-size: 13px; color: #FFF; font-weight: 600; }
.sidebar__urole { font-size: 11px; color: var(--sage-2); }
.sidebar__signout {
  background: none; border: 0; color: var(--sage-2); cursor: pointer; padding: 4px;
  border-radius: 6px; display: flex;
}
.sidebar__signout:hover { color: #FFF; background: var(--forest-2); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 62px; flex-shrink: 0; background: #FFF;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  z-index: 20;
}
.topbar__title { font-family: var(--font-display); font-weight: 700; font-size: 19px; }

.branch-switch {
  display: flex; gap: 6px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 99px; padding: 4px;
}
.branch-switch button {
  padding: 5px 13px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; background: transparent; color: var(--muted); border: 0;
  transition: background .15s, color .15s;
}
.branch-switch button:hover { color: var(--ink); }
.branch-switch button.is-active { background: var(--forest); color: #FFF; }

.branch-pin {
  font-size: 12.5px; font-weight: 600; background: var(--paper);
  border: 1px solid var(--line); border-radius: 99px; padding: 8px 15px;
}

.icon-btn {
  position: relative; width: 36px; height: 36px; border: 1px solid var(--line);
  border-radius: 99px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: #FFF; flex-shrink: 0;
}
.icon-btn:hover { background: var(--paper); }
.icon-btn__dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 99px; background: var(--rust);
}

.menu-toggle { display: none; }

/* Animated aurora canvas behind the content — straight from the design. */
.content {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px; position: relative;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.1)),
    linear-gradient(135deg, #ffe8f3, #d9f3ff);
  isolation: isolate;
}
.content::before,
.content::after {
  content: ''; position: absolute; top: 50%; left: 50%; z-index: -1;
  pointer-events: none;
  background: conic-gradient(from 0deg, #ff9aa2, #ffb7b2, #ffdac1, #e2f0cb, #a2e4ff, #c9afff, #ffb7b2, #ff9aa2);
  filter: blur(50px);
}
.content::before { width: 200%; height: 200%; animation: rotate 8s linear infinite; opacity: .8; }
.content::after { width: 180%; height: 180%; animation: rotate-reverse 10s linear infinite; opacity: .6; }

.screen { animation: fadeUp .28s ease both; }

@media (prefers-reduced-motion: reduce) {
  .content::before, .content::after { animation: none; }
  .screen { animation: none; }
  .live-dot, .pulse { animation: none !important; }
}

/* ============================== cards ============================== */

.card {
  box-sizing: border-box;
  background: var(--card-bg);
  border: 1px solid #FFF;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: var(--card-radius);
  transition: all .5s;
  padding: 18px 20px;
}
/* Compact cards keep the design's playful scale-on-hover. */
.card--tap { cursor: pointer; }
.card--tap:hover { border: 1px solid #000; transform: scale(1.05); }
.card--tap:active { transform: scale(0.95) rotateZ(1.7deg); }

/* Wide panels (tables, boards) lift instead of scaling — scaling a full-width
   table pushes it past the viewport and makes rows unclickable. */
.card--panel { padding: 0; overflow: hidden; }
.card--panel:hover { border-color: rgba(0, 0, 0, .55); }
.card--flush { padding: 0; }

.card__head {
  padding: 15px 20px; font-weight: 700; font-size: 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card__title { font-weight: 700; font-size: 15px; }
.card__sub { font-size: 12px; color: var(--muted); }

.section-title { font-weight: 700; font-size: 15px; margin: 0 0 12px; }

/* ============================== grid ============================== */

.grid { display: grid; gap: 14px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid--side { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); }
.grid--loyalty { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.grid--ai { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.mb-20 { margin-bottom: 20px; }
.mb-16 { margin-bottom: 16px; }
.mb-26 { margin-bottom: 26px; }

/* ============================== KPIs ============================== */

.kpi__label {
  font-size: 12px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
}
.kpi__value {
  font-family: var(--font-display); font-weight: 800; font-size: 30px;
  margin: 8px 0 4px; font-variant-numeric: tabular-nums; line-height: 1.05;
}
.kpi__value--sm { font-size: 26px; }
.kpi__trend { font-size: 12.5px; font-weight: 600; }
.kpi__trend span { color: var(--muted); font-weight: 400; }

.stat { font-size: 12px; color: var(--muted); }
.stat__value {
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.stat-row { display: flex; gap: 22px; flex-wrap: wrap; }

/* ============================== chart ============================== */

.chart { display: flex; align-items: flex-end; gap: 14px; height: 150px; }
.chart__col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  justify-content: flex-end; height: 100%;
}
.chart__val { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart__bar { width: 100%; border-radius: 6px 6px 3px 3px; background: var(--forest); transition: height .4s ease; }
.chart__bar--peak { background: var(--rust); }
.chart__day { font-size: 11.5px; color: var(--muted); font-weight: 600; }

.progress { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress__fill { height: 6px; border-radius: 99px; background: var(--green); transition: width .4s ease; }

/* ============================== tables ============================== */

.tbl { width: 100%; }
.tbl__scroll { overflow-x: auto; }
.tbl__head, .tbl__row { display: grid; gap: 10px; align-items: center; }
.tbl__head {
  padding: 12px 20px; font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--line);
}
.tbl__row {
  padding: 13px 20px; font-size: 13px; border-bottom: 1px solid var(--line-2);
}
.tbl__row:last-child { border-bottom: 0; }
.tbl__row:hover { background: rgba(251, 249, 244, .6); }
.tbl__row--total { font-weight: 700; }
.tbl__empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ============================== pills ============================== */

.pill {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  border-radius: 99px; padding: 3px 10px; white-space: nowrap;
}
.tag {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  border-radius: 6px; padding: 3px 8px; white-space: nowrap;
}
.pill--live {
  font-size: 11px; font-weight: 700; color: var(--green);
  background: var(--green-bg); border-radius: 99px; padding: 3px 9px;
}

.chip-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.chip {
  padding: 7px 15px; border-radius: 99px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--line); background: #FFF; color: var(--ink);
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: var(--forest); }
.chip.is-active { background: var(--forest); color: #FFF; border-color: var(--forest); }

/* ============================== buttons ============================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; font-weight: 600; border-radius: 9px; padding: 9px 16px;
  cursor: pointer; border: 1px solid transparent; background: var(--forest); color: #FFF;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--forest-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--ghost { background: #FFF; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { background: var(--paper); }
.btn--rust { background: var(--rust); }
.btn--rust:hover { background: var(--rust-dark); }
.btn--danger { background: var(--red); }
.btn--danger:hover { background: #8f2915; }
.btn--sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn--block { width: 100%; }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--green); font-size: 12.5px; font-weight: 600;
}
.link-btn:hover { color: var(--rust); text-decoration: underline; }
.link-btn--danger { color: var(--red); }

.row-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ============================== alerts ============================== */

.alert {
  display: flex; align-items: center; gap: 10px;
  background: #FBEFE5; border: 1px solid #EDD3BC; border-radius: 10px;
  padding: 11px 16px; margin-bottom: 18px; font-size: 13px;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 99px; background: var(--rust);
  animation: livePulse 1.6s infinite; flex-shrink: 0;
}

/* ============================== forms ============================== */

.field { margin-bottom: 14px; }
.field__label {
  display: block; font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; font-size: 13.5px; font-family: inherit; color: var(--ink);
  background: #FFF; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px rgba(27, 53, 36, .1);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field__hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.field__error { font-size: 12px; color: var(--red); margin-top: 5px; font-weight: 600; }

.switch { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--forest); cursor: pointer; }

/* ============================== modal ============================== */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(17, 24, 20, .48);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeUp .18s ease both;
}
.modal {
  background: var(--paper-2); border-radius: 16px; width: 100%; max-width: 540px;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
  overflow: hidden;
}
.modal--wide { max-width: 760px; }
.modal__head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #FFF;
}
.modal__title { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.modal__close {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 20px; line-height: 1;
}
.modal__close:hover { background: var(--paper); color: var(--ink); }
.modal__body { padding: 20px 22px; overflow-y: auto; }
.modal__foot {
  padding: 14px 22px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-end; background: #FFF;
}

/* ============================== toast ============================== */

.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
  background: var(--forest); color: #FFF; border-radius: 11px;
  padding: 12px 16px; font-size: 13px; font-weight: 500;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
  animation: fadeUp .2s ease both; display: flex; gap: 10px; align-items: flex-start;
}
.toast--error { background: var(--red); }
.toast--ok { background: var(--green); }

/* ============================== login ============================== */

.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.1)),
    linear-gradient(135deg, #ffe8f3, #d9f3ff);
}
.login::before, .login::after {
  content: ''; position: absolute; top: 50%; left: 50%; z-index: 0; pointer-events: none;
  background: conic-gradient(from 0deg, #ff9aa2, #ffb7b2, #ffdac1, #e2f0cb, #a2e4ff, #c9afff, #ffb7b2, #ff9aa2);
  filter: blur(50px);
}
.login::before { width: 140%; height: 140%; animation: rotate 8s linear infinite; opacity: .75; }
.login::after { width: 120%; height: 120%; animation: rotate-reverse 10s linear infinite; opacity: .55; }

.login__card {
  position: relative; z-index: 1; width: 100%; max-width: 400px;
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(10px);
  border: 1px solid #FFF; border-radius: 20px; padding: 32px;
  box-shadow: var(--card-shadow);
}
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login__title {
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  margin: 0 0 4px;
}
.login__hint {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); line-height: 1.7;
}
.login__hint code {
  background: var(--paper); padding: 1px 6px; border-radius: 5px;
  font-size: 11.5px; color: var(--ink);
}
.login__demo {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}
.login__demo button {
  border: 1px solid var(--line); background: #FFF; border-radius: 99px;
  padding: 4px 11px; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.login__demo button:hover { border-color: var(--forest); background: var(--paper); }

/* ============================== misc ============================== */

/* ==========================================================================
   Clean surface — the calmer, flat treatment used by the Dashboard.
   Opts out of the animated aurora so figures read clearly.
   ========================================================================== */

.content:has(> .screen--clean) {
  background: #F5F7F4;
}
.content:has(> .screen--clean)::before,
.content:has(> .screen--clean)::after { display: none; }

/* Fallback for engines without :has() — set by app.js as well. */
.content.is-clean { background: #F5F7F4; }
.content.is-clean::before, .content.is-clean::after { display: none; }

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.page-head__title {
  font-family: var(--font-display);
  font-weight: 800; font-size: 21px; line-height: 1.2;
  display: flex; align-items: center; gap: 9px;
}
.page-head__meta {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--muted); margin-top: 7px; flex-wrap: wrap;
}
.page-head__chip {
  background: #E9EDE7; color: #4A554A; border-radius: 7px;
  padding: 3px 9px; font-size: 11.5px; font-weight: 600;
}

/* Segmented period control */
.seg {
  display: inline-flex; gap: 6px; background: transparent;
  padding: 0; border-radius: 12px; flex-wrap: wrap;
}
.seg button {
  border: 0; cursor: pointer; border-radius: 10px;
  padding: 9px 18px; font-size: 13px; font-weight: 600;
  background: #EDF0EB; color: #56604F;
  transition: background .15s, color .15s;
}
.seg button:hover { background: #E2E8DF; }
.seg button.is-active { background: var(--forest); color: #FFF; }

/* Flat KPI tiles */
.tile {
  background: #FFF; border: 1px solid #ECEFE9; border-radius: 16px;
  padding: 20px 22px; display: flex; align-items: flex-start; gap: 14px;
  box-shadow: 0 1px 2px rgba(20, 30, 20, .04);
}
.tile__body { flex: 1; min-width: 0; }
.tile__label {
  font-size: 12.5px; color: #6E786C; font-weight: 600; letter-spacing: .1px;
}
.tile__value {
  font-family: var(--font-display); font-weight: 800;
  font-size: 30px; line-height: 1.15; margin-top: 8px;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.tile__trend { font-size: 12.5px; font-weight: 600; margin-top: 6px; }
.tile__trend span { color: #6E786C; font-weight: 400; }
.tile__icon {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #EEF3EC; color: var(--green);
}
/* The lead tile is filled, as in the reference */
.tile--accent { background: var(--forest); border-color: var(--forest); }
.tile--accent .tile__label { color: #9FB69E; }
.tile--accent .tile__value { color: #FFF; }
.tile--accent .tile__trend { color: #BFE0C4; }
.tile--accent .tile__trend span { color: #8FA98E; }
.tile--accent .tile__icon { background: #2A4A34; color: #CFE6D2; }

/* Panel used by the chart and rails on the clean surface */
.panel {
  background: #FFF; border: 1px solid #ECEFE9; border-radius: 18px;
  box-shadow: 0 1px 2px rgba(20, 30, 20, .04);
}
.panel__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding: 22px 24px 6px;
}
.panel__title { font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.panel__sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.panel__body { padding: 10px 18px 20px; }
.panel__pill {
  background: var(--forest); color: #FFF; border-radius: 99px;
  padding: 7px 15px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}

/* Line + area chart */
.linechart { width: 100%; display: block; overflow: visible; }
.linechart .grid { stroke: #EAEEE7; stroke-width: 1; }
.linechart .area { fill: url(#ellenaArea); }
.linechart .line { fill: none; stroke: #2F6B3F; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.linechart .dot { fill: #FFF; stroke: #2F6B3F; stroke-width: 2.5; }
.linechart .dot--peak { fill: #58C070; stroke: #2F6B3F; }
.linechart .ylab { fill: #98A296; font-size: 11.5px; }
.linechart .xlab { fill: #7E887C; font-size: 11.5px; }
.linechart .xlab--peak { fill: var(--ink); font-weight: 700; }
.linechart .hit { fill: transparent; cursor: pointer; }
.linechart .hit:hover + .dot { r: 7; }

/* ==========================================================================
   Menu view modes
   ========================================================================== */

.viewtoggle { display: inline-flex; gap: 4px; background: #EDF0EB; border-radius: 10px; padding: 4px; }
.viewtoggle button {
  border: 0; background: transparent; cursor: pointer; border-radius: 8px;
  padding: 6px 10px; display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: #56604F;
}
.viewtoggle button.is-active { background: #FFF; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ==========================================================================
   Point of sale — catalogue on the left, running order on the right.
   ========================================================================== */

.pos { display: flex; gap: 18px; align-items: flex-start; }
.pos__left { flex: 1; min-width: 0; }
.pos__right {
  width: 372px; flex-shrink: 0;
  background: #FFF; border: 1px solid #ECEFE9; border-radius: 18px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; max-height: calc(100vh - 110px);
  box-shadow: 0 1px 3px rgba(20, 30, 20, .06);
}

.pos__hello { font-family: var(--font-display); font-weight: 800; font-size: 21px; }
/* Compound selector on purpose: the generic .search rule (max-width 280px)
   is declared later in this file, so a single .pos-search class would lose. */
.search.pos-search { max-width: none; width: 100%; margin-bottom: 16px; display: block; }
.search.pos-search .input { padding-left: 36px; height: 42px; border-radius: 11px; }
.pos__date { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* Category carousel — one row that scrolls sideways, with paging arrows. */
.pos-rail { position: relative; margin: 18px 0 14px; }
.pos-rail__track {
  display: flex; gap: 12px; overflow-x: auto; scroll-behavior: smooth;
  scroll-snap-type: x proximity; padding: 2px 0 6px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.pos-rail__track::-webkit-scrollbar { display: none; }
.pos-rail__btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 34px; height: 34px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: #FFF; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(20, 30, 20, .16);
  transition: opacity .15s, visibility .15s;
}
.pos-rail__btn:hover { border-color: var(--rust); color: var(--rust); }
.pos-rail__btn--prev { left: -6px; }
.pos-rail__btn--next { right: -6px; }
.pos-rail__btn[hidden] { display: none; }

.pos-cat {
  flex: 0 0 176px; scroll-snap-align: start;
  background: #FFF; border: 1.5px solid #ECEFE9; border-radius: 13px;
  padding: 13px 15px; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.pos-cat:hover { border-color: #D9DFD6; }
.pos-cat.is-active { border-color: var(--rust); }
.pos-cat__icon { color: var(--muted); }
.pos-cat.is-active .pos-cat__icon, .pos-cat.is-active .pos-cat__name { color: var(--rust); }
.pos-cat__name { font-weight: 600; font-size: 13.5px; margin-top: 9px; }
.pos-cat__count { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Sellable products */
.pos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 14px;
}
.pos-item {
  background: #FFF; border: 1.5px solid transparent; border-radius: 14px;
  padding: 8px 8px 4px; cursor: pointer; position: relative;
  box-shadow: 0 1px 3px rgba(20, 30, 20, .07);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pos-item:hover { box-shadow: 0 6px 16px rgba(20, 30, 20, .12); transform: translateY(-2px); }
.pos-item:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
.pos-item.is-picked { border-color: var(--rust); }
.pos-item__media {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, var(--sand), var(--line-2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 28px; color: var(--muted);
  -webkit-user-select: none; user-select: none;
}
/* contain, not cover: show the whole product rather than a crop of it. The
   frame keeps its aspect so the grid stays even, and the image letterboxes
   inside it. */
.pos-item__media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 9px; box-sizing: border-box;
}
/* A near-white mat behind a photo; the sand gradient is for the monogram
   fallback only, and would read as a coloured border around a contained image. */
.pos-item__media:has(img) { background: #FAFAF8; }
.pos-item__qty {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px;
  background: var(--rust); color: #FFF; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; box-shadow: 0 0 0 2px #FFF;
}
.pos-item__name {
  font-weight: 600; font-size: 13.5px; margin: 10px 4px 2px; line-height: 1.3;
  overflow-wrap: anywhere;
}
.pos-item__price { font-size: 13px; color: var(--muted); margin: 0 4px 8px; font-variant-numeric: tabular-nums; }

/* Order panel */
.pos-order__head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line-2); }
.pos-order__body { flex: 1; overflow-y: auto; padding: 14px 20px; min-height: 0; }
.pos-order__foot { padding: 14px 20px 18px; border-top: 1px solid var(--line-2); }
.pos-order__name { font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.pos-order__ref { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

.pos-toggle { display: flex; gap: 8px; }
.pos-toggle button, .pos-choice {
  flex: 1; border: 1.5px solid var(--line); background: #FFF; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: border-color .15s, color .15s;
}
.pos-toggle button:hover, .pos-choice:hover { border-color: #CBD3C7; }
.pos-toggle button.is-active, .pos-choice.is-active { border-color: var(--rust); color: var(--rust); }

.pos-label { font-size: 12.5px; color: var(--muted); margin: 16px 0 8px; }

.pos-line { display: flex; gap: 11px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.pos-line:last-child { border-bottom: 0; }
.pos-line__media {
  width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0; overflow: hidden; position: relative;
  background: linear-gradient(135deg, var(--sand), var(--line-2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--muted);
}
.pos-line__media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 3px; box-sizing: border-box;
}
.pos-line__media:has(img) { background: #FAFAF8; }
.pos-line__name { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.pos-line__price { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-line__del {
  border: 0; background: none; cursor: pointer; color: var(--red); padding: 2px; border-radius: 6px;
  display: flex; flex-shrink: 0;
}
.pos-line__del:hover { background: #FBE5E0; }

.pos-step { display: inline-flex; align-items: center; gap: 4px; margin-top: 7px; }
.pos-step button {
  width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--line);
  background: #FFF; cursor: pointer; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.pos-step button:hover { border-color: var(--rust); color: var(--rust); }
.pos-step__n {
  min-width: 26px; text-align: center; font-weight: 700; font-size: 13.5px;
  color: var(--rust); font-variant-numeric: tabular-nums;
}

.pos-total { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; color: var(--muted); }
.pos-total--grand {
  font-size: 15.5px; font-weight: 800; color: var(--ink);
  border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 11px;
}
.pos-total span:last-child { font-variant-numeric: tabular-nums; }

.pos-pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.pos-pay button {
  border: 1.5px solid var(--line); background: #FFF; border-radius: 11px; cursor: pointer;
  padding: 11px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.pos-pay button:hover { border-color: #CBD3C7; }
.pos-pay button.is-active { border-color: var(--rust); color: var(--rust); }

.pos-submit {
  width: 100%; margin-top: 14px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--rust); color: #FFF; font-size: 15px; font-weight: 700; padding: 14px;
  transition: background .15s, opacity .15s;
}
.pos-submit:hover { background: var(--rust-dark); }
.pos-submit:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 1080px) {
  .pos { flex-direction: column; }
  .pos__right { width: 100%; position: static; max-height: none; }
}
@media (max-width: 620px) {
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 10px; }
  .pos-cat { flex-basis: 148px; }
  .pos-rail__btn { display: none; }
}

/* Photo picker inside the menu item editor */
.imgpick { display: flex; gap: 14px; align-items: flex-start; }
.imgpick__preview {
  width: 92px; height: 92px; flex-shrink: 0; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, var(--sand), var(--line-2));
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 900; font-size: 30px; color: var(--muted);
}
.imgpick__preview img { width: 100%; height: 100%; object-fit: contain; padding: 5px; box-sizing: border-box; background: #FAFAF8; }
.imgpick__actions { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.imgpick__actions .field__hint { margin-top: 0; }

/* --------------------------- product cards --------------------------- */

/* Auto-fill rather than a fixed column count: the catalogue runs to 200+
   items and should use whatever width is going. */
.pgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(226px, 1fr));
  gap: 16px;
}

.pcard {
  position: relative;
  background: #FFF;
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 10px 10px 4px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(20, 30, 20, .07);
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.pcard:hover { box-shadow: 0 6px 18px rgba(20, 30, 20, .12); transform: translateY(-2px); }
.pcard:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
/* The best seller in the current view, mirroring the reference's active card. */
.pcard--top { border-color: var(--forest); }

.pcard__badge {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  min-width: 26px; height: 26px; padding: 0 7px;
  border-radius: 99px; background: var(--forest); color: #FFF;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px #FFF;
}

.pcard__media {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 11px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--sand), var(--line-2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 34px; color: var(--muted);
  -webkit-user-select: none; user-select: none;
}
.pcard__media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 11px; box-sizing: border-box; display: block;
}
.pcard__media:has(img) { background: #FAFAF8; }

.pcard__body { padding: 12px 4px 10px; }
.pcard__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.pcard__name {
  font-weight: 700; font-size: 15.5px; line-height: 1.25;
  overflow-wrap: anywhere; min-width: 0;
}
.pcard__price {
  font-family: var(--font-display);
  font-weight: 800; font-size: 16.5px; color: var(--green);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pcard__cat {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); margin-top: 8px;
}
.pcard__cat svg { flex-shrink: 0; opacity: .75; }
.pcard__meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.pcard--hidden { opacity: .62; }

@media (max-width: 620px) {
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .pcard__name { font-size: 14px; }
  .pcard__price { font-size: 15px; }
}

.menu-list { display: grid; grid-template-columns: 1fr; }

/* Two columns once there is genuinely room for them. Below this the rows are
   full width, which is what a phone or a narrow window wants anyway. */
@media (min-width: 1200px) {
  .menu-list { grid-template-columns: 1fr 1fr; }
  .menu-cell:nth-child(odd) { border-right: 1px solid var(--line-2); }
  /* Second cell starts the right-hand column, so it has no row above it. */
  .menu-cell:nth-child(2) { border-top: 0; }
}

/* Each cell is a query container: in two-column mode a row is roughly half the
   viewport, so it must lay itself out against its own width. Viewport media
   queries would leave the row cramped at exactly the sizes that matter. */
.menu-cell {
  container-type: inline-size;
  border-top: 1px solid var(--line-2);
  min-width: 0;
}
.menu-cell:first-child { border-top: 0; }

.menu-row {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: 58px minmax(0, 2.2fr) minmax(0, 1fr) 96px 88px 92px 78px;
  padding: 11px 18px; cursor: pointer;
}
.menu-row:hover { background: rgba(251, 249, 244, .75); }
.menu-row__name { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.menu-row__desc { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

/* Drop the softest columns first as the row narrows: category and margin,
   then weekly sales — name, photo and price always survive. */
@container (max-width: 720px) {
  .menu-row { grid-template-columns: 52px minmax(0, 1fr) 96px 84px 76px; gap: 12px; }
  .menu-row__hide-md { display: none; }
}
@container (max-width: 430px) {
  .menu-row { grid-template-columns: 44px minmax(0, 1fr) 88px; gap: 10px; }
  .menu-row__hide-sm { display: none; }
}

/* Fallback for engines without container queries. */
@supports not (container-type: inline-size) {
  @media (max-width: 1100px) {
    .menu-row { grid-template-columns: 48px minmax(0, 2fr) 88px 82px; }
    .menu-row__hide-md { display: none; }
  }
  @media (max-width: 620px) {
    .menu-row { grid-template-columns: 44px minmax(0, 1fr) 84px; }
    .menu-row__hide-sm { display: none; }
  }
}

@media (max-width: 620px) {
  .page-head { gap: 12px; }
  .tile__value { font-size: 25px; }
  .tile__icon { width: 40px; height: 40px; border-radius: 12px; }
}

/* Product photography mirrored from Square.
   The fallback initial sits *behind* the image, so an item with no photo — or
   a URL that 404s — degrades to a tasteful monogram with no JavaScript. */
.thumb {
  position: relative;
  flex-shrink: 0;
  width: 58px;
  height: 58px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--sand), var(--line-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--muted);
  -webkit-user-select: none;
  user-select: none;
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
  box-sizing: border-box;
  display: block;
}
.thumb:has(img) { background: #FAFAF8; }
.thumb--lg { width: 100%; height: 190px; border-radius: 13px; font-size: 40px; }
.thumb--sm { width: 34px; height: 34px; border-radius: 8px; font-size: 13px; }

.board-col { background: var(--line-2); border-radius: 14px; padding: 14px; }
.board-col__head {
  font-weight: 700; font-size: 13px; margin: 2px 4px 12px;
  display: flex; justify-content: space-between;
}
.board-col__cards { display: flex; flex-direction: column; gap: 10px; }

.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #FFF; border-radius: 99px; animation: spin .7s linear infinite;
}
.loading-pane {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 60px; color: var(--muted); font-size: 13px;
}
.loading-pane .spinner { border-color: rgba(0, 0, 0, .15); border-top-color: var(--forest); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; font-size: 12.5px; color: var(--muted); }
.pager__btns { display: flex; gap: 8px; }

.search {
  position: relative; flex: 1; max-width: 280px;
}
.search .input { padding-left: 34px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; }

.kv { display: flex; gap: 12px; font-size: 13px; }
.kv__k { width: 58px; flex-shrink: 0; font-weight: 700; }
.kv__v { color: var(--muted); line-height: 1.5; }

.note-box {
  font-size: 12.5px; color: var(--muted); background: var(--paper-2);
  border-radius: 9px; padding: 10px 14px;
}

/* ============================== responsive ============================== */

@media (max-width: 1180px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--main, .grid--side, .grid--loyalty, .grid--ai { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px;
    background: #FFF; cursor: pointer; flex-shrink: 0;
  }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: 0 0 60px rgba(0, 0, 0, .4);
  }
  .sidebar.is-open { transform: none; }
  .scrim {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 39;
  }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar__title { font-size: 16px; }
  .content { padding: 16px; }
  .branch-switch { padding: 3px; }
  .branch-switch button { padding: 5px 10px; font-size: 12px; }
}

@media (max-width: 640px) {
  .grid--4, .grid--3, .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .card--tap:hover { transform: none; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .field-row { grid-template-columns: 1fr; }
  .kpi__value { font-size: 26px; }
  .toasts { left: 16px; right: 16px; max-width: none; }
}

/* ------------------- POS: item options (sizes and extras) ------------------ */

/* Corner marker so staff can see which tiles will ask a question. */
.pos-item__opts {
  position: absolute; top: 6px; right: 8px; z-index: 2;
  font-size: 15px; line-height: 1; color: var(--rust); opacity: .75;
}
.pos-line__opts { font-size: 11.5px; font-weight: 700; color: var(--green); margin-top: 2px; overflow-wrap: anywhere; }

.pos-modal {
  position: fixed; inset: 0; z-index: 300; background: rgba(16, 24, 18, .5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.pos-modal__card {
  background: #FFF; border-radius: 16px; width: min(620px, 100%);
  max-height: min(88vh, 900px); display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(10, 20, 12, .35);
}
.pos-modal__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.pos-modal__name { font-size: 17px; font-weight: 900; }
.pos-modal__sub { font-size: 20px; font-weight: 900; color: var(--rust); margin-top: 2px; font-variant-numeric: tabular-nums; }
.pos-modal__x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.pos-modal__body { overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.pos-modal__foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }

.pos-optg { border: 0; margin: 0; padding: 0; min-width: 0; }
.pos-optg legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 900; padding: 0 0 8px; }
.pos-optg__rule { font-size: 11px; font-weight: 700; color: var(--muted); }
.pos-optg__req {
  font-size: 10px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase;
  color: var(--rust); background: #FCEBE5; border-radius: 99px; padding: 2px 7px;
}
.pos-optg__grid { display: flex; flex-wrap: wrap; gap: 7px; }
.pos-optp {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 10px; background: #FFF;
  padding: 9px 12px; font-size: 13px; font-weight: 700;
}
.pos-optp input { position: absolute; opacity: 0; width: 0; height: 0; }
.pos-optp b { color: var(--muted); font-variant-numeric: tabular-nums; }
.pos-optp:has(input:checked) { border-color: var(--green); background: #EAF3EC; color: var(--green); }
.pos-optp:has(input:checked) b { color: var(--green); }
.pos-optp:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
.pos-optg.is-missing legend { color: var(--rust); }
.pos-optg.is-missing .pos-optg__grid { outline: 2px dashed #EFB49F; outline-offset: 5px; border-radius: 8px; }

.pos-qty { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.pos-qty button { width: 32px; height: 32px; border: 0; background: none; cursor: pointer; font-size: 17px; border-radius: 7px; }
.pos-qty button:hover { background: var(--line); }
.pos-qty span { min-width: 26px; text-align: center; font-weight: 900; font-variant-numeric: tabular-nums; }

@media (max-width: 620px) {
  .pos-modal { padding: 0; align-items: flex-end; }
  .pos-modal__card { border-radius: 16px 16px 0 0; max-height: 92vh; }
}

/* Sizes and option groups mirrored from Square, on the Menu screen. */
.pcard__opts, .menu-row__opts {
  font-size: 11.5px; font-weight: 700; color: var(--green); margin-top: 3px;
}

/* --------------- Menu panel: sizes and option groups --------------- */

.choices { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.choices__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }

/* One editable row: name, price, remove. Also used for a new group's options. */
.crow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.crow__name { flex: 1 1 auto; min-width: 0; }
.crow__price { flex: 0 0 108px; }
.crow__tag {
  flex: 0 0 auto; font-size: 10px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--sand); border-radius: 99px; padding: 3px 7px;
}
.crow__x {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #FFF; color: var(--muted); font-size: 18px; line-height: 1;
}
.crow__x:hover { border-color: var(--rust); color: var(--rust); }

.mgroup {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 11px; background: #FFF;
  padding: 10px 12px; margin-bottom: 8px;
}
.mgroup.is-on { border-color: var(--green); background: #F3F8F4; }
.mgroup__body { flex: 1; min-width: 0; }
.mgroup__name { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13.5px; font-weight: 800; }
.mgroup__rule { font-size: 11px; font-weight: 700; color: var(--muted); }
.mgroup__opts {
  display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mgroup__req {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; color: var(--muted);
}
.mgroup__req input:disabled { opacity: .4; }

.ngroup { border: 1.5px dashed var(--line); border-radius: 11px; padding: 12px; margin-bottom: 10px; }
.ngroup__head { display: flex; gap: 8px; margin-bottom: 10px; }
.ngroup__head .input { flex: 1; min-width: 0; }
.ngroup__head .select { flex: 0 0 130px; }

@media (max-width: 560px) {
  .crow__price { flex-basis: 84px; }
  .mgroup { flex-wrap: wrap; }
}

/* The library runs to ~50 groups; keep it a browsable box, not a long page. */
.mgroups { max-height: 320px; overflow-y: auto; padding-right: 4px; }
.mgroups .mgroup[hidden] { display: none; }

/* ========================== Stripe payments card ========================== */

.sp-card { padding: 0; overflow: hidden; }

/* Header carries the environment: green when real cards are being charged,
   amber while rehearsing. The difference should be visible from across a room. */
.sp-card__head {
  display: flex; align-items: center; gap: 13px; padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.sp-card__head.is-live { background: linear-gradient(100deg, #EAF4EE 0%, #F6FBF7 70%); }
.sp-card__head.is-test { background: linear-gradient(100deg, #FDF4E0 0%, #FEFAF1 70%); }
.sp-card__logo {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #635BFF; color: #FFF;              /* Stripe's own violet */
  box-shadow: 0 4px 12px rgba(99, 91, 255, .34);
}
.sp-card__name { font-weight: 800; font-size: 15.5px; line-height: 1.25; }
.sp-card__meta {
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-mode {
  flex-shrink: 0; font-size: 10.5px; font-weight: 900; letter-spacing: .05em;
  text-transform: uppercase; border-radius: 99px; padding: 5px 11px;
}
.sp-mode--live { background: var(--green); color: #FFF; }
.sp-mode--test { background: #F5E2B8; color: #7A5B08; }

.sp-card__body { padding: 18px 20px; }

/* Three figures across the top of the body. */
.sp-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.sp-stat { background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 13px; padding: 13px 15px; }
.sp-stat__n { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.sp-stat__l { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* What is working, and what it costs when it is not. */
.sp-healths { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.sp-health {
  display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; line-height: 1.5;
  border-radius: 10px; padding: 9px 12px;
}
.sp-health.is-ok { background: var(--green-bg); color: #1B5233; }
.sp-health.is-off { background: #FDECE6; color: #7E2E13; }
.sp-health__dot { width: 8px; height: 8px; border-radius: 99px; margin-top: 6px; flex-shrink: 0; }
.sp-health.is-ok .sp-health__dot { background: var(--green); }
.sp-health.is-off .sp-health__dot { background: var(--rust); }
.sp-health__t span { opacity: .82; }

.sp-note {
  font-size: 12.5px; line-height: 1.65; color: var(--muted);
  background: var(--paper-2); border: 1px solid var(--line-2);
  border-radius: 11px; padding: 11px 14px; margin-bottom: 14px;
}
.sp-note--warn { background: #FFF6E3; border-color: #F0DCAE; color: #6B5310; }
.sp-note b { color: var(--ink); }
.sp-note--warn b { color: #4A3908; }

.sp-sec__t {
  font-size: 11px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.sp-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sp-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px;
  border-bottom: 1px solid var(--line-2); font-size: 12.5px;
}
.sp-row:last-child { border-bottom: 0; }
.sp-row:nth-child(odd) { background: var(--paper-2); }
.sp-row__code { font-weight: 700; }
.sp-row__amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.sp-tag {
  font-size: 10.5px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase;
  border-radius: 99px; padding: 3px 9px; min-width: 62px; text-align: center;
}
.sp-tag--paid { background: var(--green-bg); color: var(--green); }
.sp-tag--unpaid { background: var(--sand); color: #5B6259; }
.sp-tag--refunded { background: #FDECE6; color: var(--rust); }

.sp-empty { font-size: 12.5px; color: var(--muted); padding: 6px 0 2px; }

.sp-card__foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 13px 20px; border-top: 1px solid var(--line); background: var(--paper-2);
}

/* Shared with the not-connected state. */
.steps-list { margin: 0 0 16px; padding-left: 20px; font-size: 13px; line-height: 1.75; color: var(--muted); }
.steps-list b { color: var(--ink); }
.steps-list a { color: var(--green); font-weight: 700; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  background: var(--sand); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere;
}

@media (max-width: 620px) {
  .sp-stats { grid-template-columns: 1fr 1fr; }
  .sp-stats > :last-child { grid-column: 1 / -1; }
  .sp-card__head { flex-wrap: wrap; }
}

/* ============================== Notifications ============================== */

.nt-card { padding: 0; overflow: hidden; }

.nt-tabs { display: flex; gap: 4px; padding: 12px 16px 0; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.nt-tab {
  border: 0; background: none; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 700;
  color: var(--muted); padding: 10px 16px; border-radius: 10px 10px 0 0; position: relative; bottom: -1px;
}
.nt-tab:hover { color: var(--ink); }
.nt-tab.is-active {
  color: var(--ink); background: var(--card-bg);
  border: 1px solid var(--line); border-bottom-color: transparent;
}

.nt-pane { padding: 20px; }
.nt-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.nt-head__t { font-size: 15.5px; font-weight: 800; }
.nt-head__s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* Says whether anything is actually going out, not just whether it is filled in. */
.nt-state {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase;
  border-radius: 99px; padding: 5px 12px;
}
.nt-state i { width: 7px; height: 7px; border-radius: 99px; }
.nt-state.is-on { background: var(--green-bg); color: var(--green); }
.nt-state.is-on i { background: var(--green); }
.nt-state.is-off { background: var(--sand); color: #5B6259; }
.nt-state.is-off i { background: #9AA096; }

.nt-form { max-width: 640px; }
.nt-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.nt-guide {
  margin-top: 22px; padding: 16px 18px; border-radius: 13px;
  background: var(--paper-2); border: 1px solid var(--line-2);
}
.nt-guide__t { font-size: 12.5px; font-weight: 900; margin-bottom: 8px; }
.nt-guide ol { margin: 0; padding-left: 20px; font-size: 12.5px; line-height: 1.85; color: var(--muted); }
.nt-guide ol b { color: var(--ink); }
.nt-guide__n { font-size: 12px; color: var(--muted); margin-top: 10px; font-style: italic; }

@media (max-width: 620px) {
  .nt-tabs { padding: 10px 10px 0; }
  .nt-tab { padding: 9px 12px; font-size: 13px; }
  .nt-pane { padding: 16px; }
}
