@import url('/assets/fonts/inter.css');

/* KOVA interface system: local fonts, semantic colors, one responsive layout. */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-size: 15px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface2: #f0f0f4;
  --text: #24232b;
  --muted: #696775;
  --line: #e7e6ec;
  --accent: #a81750;
  --accent-dark: #88113f;
  --on-accent: #ffffff;
  --tint: #faedf2;
  --green: #237b5a;
  --green-bg: #e7f5ee;
  --danger: #b83752;
  --danger-bg: #fff0f3;
  --shadow: 0 2px 8px rgb(35 23 62 / 3%);
  --control-size: 44px;
  --input-height: 48px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --radius-control: 14px;
  --radius-input: 13px;
  --radius-surface: 20px;
  --radius: var(--radius-surface);
  --motion: 180ms;
  --sidebar-width: 248px;
  --page-gutter: 32px;
  --dialog-gap: 32px;
  color: var(--text);
  background: var(--bg);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17151a;
  --surface: #211e25;
  --surface2: #2c2830;
  --text: #f7f3f8;
  --muted: #bcb3c2;
  --line: #3b3441;
  --accent: #ff9ac0;
  --accent-dark: #ffb8d2;
  --on-accent: #3d0c22;
  --tint: #3e2433;
  --green: #90d7b6;
  --green-bg: #213d33;
  --danger: #ffabc0;
  --danger-bg: #43232f;
  --shadow: none;
}

/* Baseline and accessible controls. */
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; }
body { line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; opacity: .48; }
button, a, input, textarea, select, summary { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button, a { transition: background-color var(--motion), color var(--motion), border-color var(--motion), box-shadow var(--motion); }
button:active:not(:disabled) { filter: brightness(.96); }
a { color: var(--accent); }
svg { display: inline-block; flex: 0 0 auto; vertical-align: middle; }
button svg { pointer-events: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 700; line-height: 1.18; letter-spacing: -.75px; }
h2 { font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -.35px; }
h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }
p { line-height: 1.55; }
strong { font-weight: 600; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.label, .eyebrow, .workspace-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .65px;
  color: var(--muted);
}
.eyebrow { color: var(--accent); margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.row > div { min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.grid { display: grid; gap: var(--space-5); }
.grid > *, .card, .content, .shell-body { min-width: 0; }
.two, .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btn, .icon-btn, .text-btn, .chip {
  min-width: var(--control-size);
  min-height: var(--control-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}
.btn {
  padding: var(--space-3) 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--on-accent);
}
.btn:hover:not(:disabled) { background: var(--accent-dark); }
.btn svg, .text-btn svg { width: 20px; height: 20px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.secondary:hover:not(:disabled) { background: var(--surface2); border-color: var(--accent); }
.btn.soft { background: var(--tint); color: var(--accent); }
.btn.soft:hover:not(:disabled) { background: var(--surface2); }
.btn.ghost, .text-btn { background: transparent; color: var(--accent); }
.text-btn { padding: 8px 4px; font-size: 13px; }
.btn.danger { background: var(--danger-bg); color: var(--danger); }
.btn.danger:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--danger); background: var(--danger-bg); }
.btn.full { width: 100%; }
.icon-btn {
  width: var(--control-size);
  height: var(--control-size);
  flex: 0 0 var(--control-size);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  position: relative;
}
.icon-btn > svg { width: 22px; height: 22px; }
.icon-btn:hover, .icon-btn[aria-current="page"] { border-color: var(--accent); background: var(--tint); color: var(--accent); }
.dot { width: 7px; height: 7px; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); position: absolute; right: 8px; top: 7px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--tint);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.pill svg { width: 16px; height: 16px; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.gray { background: var(--surface2); color: var(--muted); }
.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 76px; height: 76px; flex-basis: 76px; font-size: 24px; }
.icon-btn .avatar { width: 38px; height: 38px; flex-basis: 38px; }

/* Form rhythm, including long content and mobile keyboards. */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; min-width: 0; }
.field label { color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.5; }
.input, input[type="search"], input[type="email"], input[type="password"], input[type="text"], input[type="tel"], input[type="number"], input[type="url"], input[type="date"], select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: var(--input-height);
  margin: 0;
  padding: var(--space-3) 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-size: 16px;
  line-height: 1.45;
  scroll-margin-block: 90px;
  transition: border-color var(--motion), box-shadow var(--motion);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; }
input[type="checkbox"] { accent-color: var(--accent); width: 20px; height: 20px; flex: 0 0 20px; margin: 0; }
input[type="file"] { width: 100%; max-width: 100%; min-height: 44px; font-size: 13px; color: var(--muted); }
input[type="file"]::file-selector-button { min-height: 44px; margin-right: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface2); color: var(--text); font: inherit; }
textarea { resize: vertical; min-height: 104px; }
.input-icon { position: relative; min-width: 0; }
.input-icon > svg { position: absolute; left: 15px; top: 14px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 45px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid > * { min-width: 0; }
.form-section { border-top: 1px solid var(--line); padding-top: 22px; margin: 0 0 24px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -4px 0 16px; }
.checkboxes { display: flex; flex-direction: column; gap: 3px; margin: 9px 0 18px; }
.checkboxes label, .confirm-check { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 0; font-size: 14px; line-height: 1.45; }
.confirm-check { margin-bottom: 20px; align-items: flex-start; }
.confirm-check input { margin-top: 2px; }
.error-box, .note, .version-warning { padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.error-box { margin-bottom: 18px; background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.note { background: var(--surface2); color: var(--muted); }
.version-warning { margin-bottom: 22px; background: var(--tint); color: var(--text); border-color: transparent; }
.version-warning p { margin-top: 8px; color: var(--muted); }
.lookup-row { display: flex; align-items: stretch; gap: 10px; }
.lookup-row input { width: 0; flex: 1; }
.lookup-row .btn { flex: 0 0 auto; }
.lookup-found { display: flex; align-items: center; gap: 10px; padding: 13px; background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; }
.lookup-found > svg { width: 20px; height: 20px; color: var(--green); }
.lookup-found > div { min-width: 0; flex: 1; }
.lookup-found strong { font-size: 14px; }
.lookup-found p { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.lookup-found .pill { flex-shrink: 0; }

/* Shared app chrome. */
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 24px; font-weight: 700; letter-spacing: 1px; line-height: 1; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 38px; width: 38px; height: 38px; padding-right: 3px; border-radius: 12px; background: var(--accent); color: #ffffff; font-size: 32px; font-weight: 700; letter-spacing: -3px; }
.brand small { display: block; margin-top: 6px; font-size: 12px; font-weight: 500; letter-spacing: 1px; color: var(--muted); }
.boot { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 100dvh; color: var(--muted); }
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column; gap: 20px; padding: 32px 18px 24px; overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--line); background: var(--surface); z-index: 20; }
.sidebar > .brand { margin: 0 12px 12px; }
.workspace-label { padding: 0 12px; }
.side-nav { display: flex; flex-direction: column; gap: 7px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 46px; width: 100%; padding: 12px 14px; border-radius: 13px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; text-align: left; }
.nav-item svg { width: 22px; height: 22px; }
.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active { color: var(--on-accent); background: var(--accent); font-weight: 600; box-shadow: 0 4px 12px rgb(168 23 80 / 12%); }
.sidebar-foot { display: flex; flex-direction: column; gap: 16px; margin-top: auto; padding-top: 20px; }
.context-picker { width: 100%; max-width: 100%; min-height: 44px; padding: 11px; font-size: 13px; background: var(--surface2); text-overflow: ellipsis; }
.side-user { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 20px; }
.side-user .user-copy { min-width: 0; flex: 1; }
.side-user strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.side-user small { display: block; color: var(--muted); font-size: 12px; }
.side-user .text-btn { flex: 0 0 44px; }
.shell-body { grid-column: 2; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 88px; padding: 18px var(--page-gutter); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-title { min-width: 0; color: var(--text); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.topbar-title span { margin-left: 8px; color: var(--muted); font-weight: 400; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.admin-mobile-top { display: none; }
.content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 32px var(--page-gutter) 48px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-heading p { margin-top: 9px; color: var(--muted); font-size: 14px; }
.date-pill { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 12px; }
.date-pill svg { width: 18px; height: 18px; }
.mobile-nav, .mobile-menu, .mobile-context { display: none; }

/* Surface hierarchy and real dashboard data. */
.card { padding: var(--space-6); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-head, .section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-title { margin-top: 4px; }
.card-head > svg { width: 22px; height: 22px; color: var(--muted); }
.card-head h2, .section-title h2 { min-width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-grid.stat-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 20px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.stat-icon, .activity-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; background: var(--tint); color: var(--accent); }
.stat-icon svg, .activity-icon svg { width: 21px; height: 21px; }
.stat-value { font-size: 32px; font-weight: 700; line-height: 1.2; letter-spacing: -.75px; margin: 15px 0 8px; }
.stat-note { font-size: 12px; color: var(--muted); line-height: 1.45; }
.activity-list { display: flex; flex-direction: column; gap: 20px; }
.activity-item { display: flex; align-items: flex-start; gap: 13px; }
.activity-item > div { min-width: 0; }
.activity-item p { font-size: 14px; overflow-wrap: anywhere; }
.activity-item time { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.staff-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; margin-bottom: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.staff-toolbar > div { min-width: 0; }
.staff-toolbar strong { font-size: 15px; }
.staff-toolbar p { margin-top: 6px; }
.staff-toolbar .btn { flex-shrink: 0; }
.table-wrap { max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; text-align: left; font-size: 14px; }
th { padding: 13px 14px; background: var(--surface2); color: var(--muted); font-size: 12px; font-weight: 600; }
th:first-child { border-radius: 10px 0 0 10px; }
th:last-child { border-radius: 0 10px 10px 0; }
td { padding: 16px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
.name-cell { display: flex; align-items: center; gap: 11px; }
.name-cell .avatar { width: 36px; height: 36px; flex-basis: 36px; }
.empty { padding: 30px 18px; color: var(--muted); text-align: center; font-size: 14px; line-height: 1.6; }
.empty > svg { display: block; margin: 0 auto 14px; width: 28px; height: 28px; color: var(--accent); }

/* Client and employee compact application shell. */
.consumer { max-width: 1180px; margin: 0 auto; }
.consumer .topbar { min-height: 94px; padding: 22px var(--page-gutter); border: 0; background: transparent; }
.consumer .content { padding-top: 12px; padding-bottom: 128px; }
.consumer .mobile-context { margin-bottom: 20px; }
.consumer-nav { display: flex; gap: 6px; position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 7px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 8px 32px rgb(31 20 48 / 9%); z-index: 30; }
.consumer-nav button { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; min-width: 44px; padding: 12px 22px; border-radius: 14px; background: transparent; color: var(--muted); font-size: 14px; white-space: nowrap; }
.consumer-nav button svg { width: 22px; height: 22px; }
.consumer-nav button.active { background: var(--tint); color: var(--accent); font-weight: 600; }
.search-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.search-row .input-icon { flex: 1; }
.search-row input { box-shadow: var(--shadow); }
.categories, .management-tabs { display: flex; align-items: stretch; gap: 9px; overflow-x: auto; max-width: 100%; padding: 2px 2px 8px; margin: -2px -2px 20px; scrollbar-width: thin; overscroll-behavior-inline: contain; }
.chip { flex: 0 0 auto; padding: 11px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--muted); font-size: 13px; white-space: nowrap; }
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.place-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.place { padding: 0; overflow: hidden; color: var(--text); text-align: left; transition: border-color var(--motion), box-shadow var(--motion); }
.place:hover { border-color: var(--accent); box-shadow: 0 5px 20px rgb(85 53 148 / 8%); }
.place-cover, .manage-cover { height: 150px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; background: var(--surface2); color: var(--muted); }
.place-photo, .manage-cover > img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { display: flex; flex-direction: column; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.cover-placeholder > svg { width: 28px; height: 28px; opacity: .7; }
.category-label { position: absolute; left: 12px; top: 12px; max-width: calc(100% - 24px); padding: 5px 9px; border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.place-details { padding: 16px; }
.place-details h3 { margin-bottom: 5px; font-size: 16px; overflow-wrap: anywhere; }
.place-details .row { align-items: flex-start; gap: 10px; }
.place-address { color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.place-reward { display: flex; align-items: flex-start; gap: 7px; min-height: 48px; padding-top: 12px; margin-top: 13px; border-top: 1px solid var(--line); color: var(--accent); font-size: 13px; line-height: 1.45; }
.place-reward svg { width: 18px; height: 18px; margin-top: 1px; }
.business-icon, .business-logo { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 42px; width: 42px; height: 42px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); color: var(--muted); }
.business-icon img, .business-logo { object-fit: contain; }
.business-icon img { width: 100%; height: 100%; }
.business-icon svg { width: 22px; height: 22px; }

/* Full client business page; contact controls share the management views. */
.business-page { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.place-back { align-self: flex-start; padding-inline: 0; gap: 8px; }
.place-summary { padding: 0; overflow: hidden; }
.place-banner { width: 100%; height: 120px; object-fit: cover; background: var(--surface2); }
.place-summary-body { padding: var(--space-6); }
.place-title-row { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.place-title-row > div { min-width: 0; }
.place-title-row h1 { overflow-wrap: anywhere; }
.place-title-row p { margin-top: 6px; font-size: 13px; }
.place-detail-logo { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; object-fit: contain; border: 1px solid var(--line); background: var(--surface); }
.client-branch-list { display: flex; flex-direction: column; gap: var(--space-3); }
.client-branch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); min-height: 76px; width: 100%; text-align: left; color: var(--text); }
.client-branch-row > span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.client-branch-row strong, .client-branch-row .small { overflow-wrap: anywhere; }
.client-branch-row > svg { color: var(--muted); }
.client-branch-row:hover { border-color: var(--accent); }
.branch-detail-page { max-width: 820px; margin-inline: auto; }
.branch-detail-photo { width: 100%; height: clamp(180px, 36vw, 360px); object-fit: cover; background: var(--surface2); }
.branch-business-name { margin-bottom: var(--space-2); }
.place-branch-address { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 14px; }
.place-branch-address svg { margin-top: 2px; }
.place-branch-address > span { min-width: 0; overflow-wrap: anywhere; }
.branch-contacts { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.branch-contact { gap: 7px; padding: 10px 12px; font-size: 13px; max-width: 100%; }
.branch-contact-hint { margin-bottom: var(--space-4); }
.place-summary-body > .branch-contacts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 480px; }
.place-summary-body > .branch-contacts .branch-contact { flex-direction: column; gap: 4px; padding: 10px 4px; min-width: 0; font-size: 13px; }
.live-refresh-status:empty { display: none; }
.live-refresh-status:not(:empty) { margin-top: var(--space-3); }
.loyalty-status { margin-top: var(--space-3); }
.loyalty-card > .loyalty-status:first-child { margin-top: 0; }
.loyalty-gifts { display: flex; align-items: center; gap: 8px; margin: var(--space-4) 0 var(--space-2); color: var(--accent); font-size: 14px; }
.loyalty-note, .loyalty-data-warning { margin-top: var(--space-3); }

/* Compact business view and native disclosures. */
.compact-business-page { gap: var(--space-3); max-width: 820px; margin-inline: auto; }
.compact-business-page .place-summary-body { padding: var(--space-4); }
.compact-business-page .place-title-row { gap: var(--space-3); }
.compact-business-page .place-title-row h1 { font-size: 24px; }
.compact-business-page .place-title-row p { margin-top: 3px; }
.compact-business-page .branch-contacts { margin-top: var(--space-2); max-width: none; }
.compact-business-page .place-summary-body > .branch-contacts .branch-contact { flex-direction: row; min-height: 44px; gap: 4px; padding: 8px 4px; }
.compact-business-page .branch-contact svg { width: 18px; height: 18px; }
.compact-disclosure { min-width: 0; }
.compact-disclosure > summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--accent); font-size: 13px; }
.compact-disclosure > summary::-webkit-details-marker { display: none; }
.compact-disclosure > summary > svg { transition: transform var(--motion); }
.compact-disclosure[open] > summary > svg { transform: rotate(90deg); }
.disclosure-body { font-size: 13px; line-height: 1.6; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; padding-bottom: var(--space-3); }
.disclosure-body p + p { margin-top: 8px; }
.business-about { margin-top: var(--space-3); }
#client-loyalty-content:empty { display: none; }
#client-loyalty-content:not(:empty) { margin-top: var(--space-3); }
.compact-loyalty-list { display: flex; flex-direction: column; gap: var(--space-3); }
.compact-loyalty-row { min-width: 0; }
.compact-loyalty-row + .compact-loyalty-row { border-top: 1px solid var(--line); padding-top: var(--space-2); }
.program-disclosure > .compact-loyalty-heading { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: var(--space-3); color: var(--text); }
.compact-loyalty-name { min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.compact-loyalty-count { flex: 0 0 auto; font-size: 14px; font-weight: 600; color: var(--accent); }
.compact-loyalty-footer { display: flex; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.compact-loyalty-footer .compact-gifts-ready { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 5px 9px; border-radius: 10px; background: var(--tint); color: var(--accent); font-size: 13px; font-weight: 600; }
.program-disclosure .program-conditions { margin-top: 8px; }
.business-news { padding: 0; overflow: hidden; }
.business-news-image { width: 100%; height: 150px; object-fit: cover; background: var(--surface2); }
.business-news-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; min-height: 44px; }
.business-news-title h3 { min-width: 0; font-size: 15px; color: var(--text); }
.business-news > summary { display: block; }
.business-news-title > svg { flex-shrink: 0; color: var(--accent); transition: transform var(--motion); }
.business-news[open] .business-news-title > svg { transform: rotate(90deg); }
.business-news-text { padding: 0 16px 16px; }
.business-branches { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.branches-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px; padding: 12px 16px; background: transparent; color: var(--text); text-align: left; font-size: 15px; font-weight: 600; }
.branches-toggle > svg { transition: transform var(--motion); }
.business-branches.is-expanded .branches-toggle > svg { transform: rotate(90deg); }
.branches-panel { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows var(--motion), visibility var(--motion); }
.branches-panel-inner { min-height: 0; overflow: hidden; }
.business-branches.is-expanded .branches-panel { grid-template-rows: 1fr; visibility: visible; }
.business-branches .client-branch-list { gap: 0; }
.business-branches .client-branch-row { min-height: 64px; padding: 12px 16px; background: transparent; border-top: 1px solid var(--line); border-radius: 0; }
.business-branches .client-branch-row strong { font-size: 14px; }
.business-branches .client-branch-row:hover { background: var(--surface2); }

/* One managed news item per business. */
.settings-sections { display: flex; flex-direction: column; gap: var(--space-4); }
.news-management .section-title { align-items: center; }
.news-preview { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.news-preview > img { width: 100%; height: 120px; object-fit: cover; border-radius: 12px; }
.news-preview > div { min-width: 0; }
.news-preview-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.news-readonly, .news-form-note { margin-top: var(--space-3); }
.news-form-note { margin-bottom: var(--space-4); }

/* One mark per cell; long programs scroll inside the row, never the page. */
.segmented-progress { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; padding-block: 2px; scrollbar-width: thin; }
.segmented-progress:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.segmented-track { display: flex; gap: 4px; width: max-content; min-width: 100%; }
.progress-segment { display: block; width: 10px; height: 8px; flex: 1 0 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface2); }
.progress-segment.is-filled { background: var(--accent); border-color: var(--accent); }
.compact-loyalty-row .segmented-progress { margin-top: 0; }
.my-places-list { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.place-loyalty-row { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.place-loyalty-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.place-loyalty-logo { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; object-fit: contain; background: var(--surface2); color: var(--muted); }
.place-loyalty-copy { flex: 1; min-width: 0; }
.place-loyalty-copy h3 { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.place-loyalty-copy p { margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.place-loyalty-count { flex: 0 0 auto; font-size: 13px; color: var(--accent); }
.place-loyalty-row .segmented-progress { margin-top: 8px; }
.place-loyalty-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; }
.place-loyalty-meta .small { font-size: 12px; }
.place-loyalty-gift { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 3px 7px; border-radius: 8px; color: var(--accent); background: var(--tint); font-size: 12px; font-weight: 600; }

/* Loyalty cards, QR and scan workflow. */
.program-card .reward-title { font-size: 18px; margin: 18px 0 9px; letter-spacing: -.2px; }
.program-conditions { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 10px; line-height: 1.55; }
.progress-track { height: 8px; border-radius: 8px; background: var(--surface2); overflow: hidden; }
.progress-track span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width var(--motion); }
.program-card .progress-track { margin: 19px 0 11px; }
.program-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.qr-container { max-width: 430px; margin: 4px auto 0; text-align: center; }
.qr-container h1 { margin: 16px 0 10px; }
.qr-container > .muted { font-size: 14px; }
.qr-panel { padding: 28px; margin-top: 24px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); }
.qr-picture { max-width: 260px; width: 100%; aspect-ratio: 1; margin: 0 auto; padding: 10px; background: #ffffff; border-radius: 14px; }
.qr-picture svg { width: 100%; height: auto; display: block; }
.qr-timer { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 21px 0; font-size: 12px; color: var(--muted); }
.qr-timer svg { width: 16px; height: 16px; }
.qr-panel summary { display: flex; align-items: center; min-height: 44px; font-size: 13px; }
.code-text { padding: 12px; margin: 10px 0; border-radius: 11px; background: var(--surface2); color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; text-align: left; }
.scan-area { padding: 24px; margin: 21px 0; border: 1px dashed var(--accent); border-radius: 18px; background: var(--tint); text-align: center; }
.scan-area > svg { width: 40px; height: 40px; color: var(--accent); margin-bottom: 12px; }
.scan-area p { margin-bottom: 18px; color: var(--muted); font-size: 13px; }
.scan-area video { width: 100%; max-height: 300px; margin: 14px 0; border-radius: 12px; background: #17131e; }
.scan-program { padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.scan-program .row { margin-top: 15px; }

/* Management, profile and uploaded media. */
.business-manage-card { padding: 0; overflow: hidden; }
.manage-cover > .pill { position: absolute; top: 12px; right: 12px; }
.manage-card-body { padding: 19px; }
.manage-card-body h3 { overflow-wrap: anywhere; }
.manage-card-body .row { align-items: flex-start; }
.management-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.management-actions .btn { padding: 11px 14px; font-size: 13px; }
.media-preview { display: flex; align-items: center; justify-content: center; height: 150px; overflow: hidden; border: 1px dashed var(--line); border-radius: 13px; background: var(--surface2); color: var(--muted); }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-preview.logo { width: 112px; height: 112px; }
.media-preview.logo img { object-fit: contain; }
.media-preview > span > svg { width: 26px; height: 26px; }
.branch-list { display: flex; flex-direction: column; gap: 16px; }
.branch-list h3, .branch-list p { overflow-wrap: anywhere; }
.branch-list .row.between { align-items: flex-start; }
.branch-list .row.between > .pill { flex-shrink: 0; max-width: 150px; }
.profile-grid { display: grid; gap: 22px; max-width: 980px; }
.profile-summary { display: flex; align-items: center; gap: 20px; margin-bottom: 26px; }
.profile-summary > div { min-width: 0; }
.profile-summary p { font-size: 13px; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.role-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.notification { padding: 19px 0; border-bottom: 1px solid var(--line); }
.notification:first-child { padding-top: 0; }
.notification:last-child { border-bottom: 0; }
.notification h3 { font-size: 15px; margin-bottom: 7px; }
.notification p { font-size: 14px; color: var(--muted); }
.notification time { display: block; margin-top: 9px; font-size: 12px; color: var(--muted); }
.notification.unread h3::before { display: inline-block; content: ""; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--accent); }

/* Authentication and transient surfaces. */
.auth-layout { min-height: 100dvh; }
.auth-main { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 88px 24px 48px; position: relative; }
.auth-tools { position: absolute; top: max(24px, env(safe-area-inset-top)); right: max(24px, env(safe-area-inset-right)); }
.auth-form { width: 100%; max-width: 410px; }
.auth-form > .brand { margin-bottom: 32px; }
.auth-form > .label { margin-bottom: 10px; color: var(--accent); }
.auth-form h1 { margin-bottom: 12px; }
.auth-form > .muted { font-size: 15px; margin-bottom: 30px; }
.demo-panel { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.demo-accounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 15px; }
.demo-account { min-height: 68px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; text-align: left; }
.demo-account:hover { border-color: var(--accent); background: var(--tint); }
.demo-account span { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 5px; overflow-wrap: anywhere; }
.success-code { margin: 16px 0; padding: 16px; background: var(--tint); border-radius: 13px; color: var(--accent); font-size: 27px; font-weight: 700; letter-spacing: 5px; text-align: center; }
.subtle-footer { margin-top: 30px; font-size: 12px; color: var(--muted); text-align: center; }
.loading { min-height: 200px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 14px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(108px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(8px); width: max-content; max-width: min(440px, calc(100% - 32px)); padding: 14px 18px; border: 1px solid rgb(255 255 255 / 10%); border-radius: 14px; background: #292333; color: #ffffff; box-shadow: 0 6px 25px rgb(20 12 32 / 16%); font-size: 13px; line-height: 1.5; opacity: 0; pointer-events: none; z-index: 100; transition: opacity var(--motion), transform var(--motion); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
dialog { position: fixed; inset: var(--viewport-top, 0px) 0 auto; width: min(540px, calc(100% - 32px)); max-height: calc(var(--visible-height, 100dvh) - max(var(--dialog-gap), env(safe-area-inset-top)) - max(var(--dialog-gap), env(safe-area-inset-bottom))); margin: max(var(--dialog-gap), env(safe-area-inset-top)) auto max(var(--dialog-gap), env(safe-area-inset-bottom)); padding: var(--space-6); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgb(18 12 29 / 20%); overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 86px 24px; scrollbar-gutter: stable; }
dialog[open] { animation: dialog-in var(--motion) ease-out; }
dialog::backdrop { background: rgb(24 17 36 / 35%); backdrop-filter: blur(6px); }
dialog:has([data-manage-form="business"]) { width: min(760px, calc(100% - 32px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 3; margin: -24px -24px 24px; padding: 20px 24px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.modal-head h2 { min-width: 0; font-size: 20px; overflow-wrap: anywhere; }
.modal-head .icon-btn { flex-shrink: 0; }
/* Compact branch overlay uses the same dialog and never stacks another modal. */
dialog.branch-card-dialog { width: min(440px, calc(100% - 32px)); max-height: min(85dvh, calc(var(--visible-height, 100dvh) - max(var(--dialog-gap), env(safe-area-inset-top)) - max(var(--dialog-gap), env(safe-area-inset-bottom)))); padding: 16px; scroll-padding-block: 64px 16px; }
.branch-card-dialog .modal-head { margin: -16px -16px 12px; padding: 8px 16px; gap: 12px; }
.branch-card-dialog .modal-head h2 { font-size: 16px; }
.branch-card { min-width: 0; }
.branch-card-photo { width: 100%; height: 170px; object-fit: cover; border-radius: 12px; margin-bottom: 14px; }
.branch-card-name { font-size: 22px; overflow-wrap: anywhere; }
.branch-card-description { margin-top: 12px; font-size: 14px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.branch-card .branch-contacts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.branch-card .branch-contact { min-width: 0; min-height: 44px; padding: 8px 4px; gap: 4px; font-size: 13px; }
.branch-card .branch-contact svg { width: 18px; height: 18px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Shared image forms and real tenant overview. */
.profile-context { margin-bottom: 20px; max-width: 980px; }
.profile-context h2 { margin-bottom: 8px; }
.profile-context .context-picker { max-width: 520px; margin-top: 15px; }
.profile-demo-label { margin: 0 0 20px; }
.image-field { min-width: 0; }
.image-field-error { color: var(--danger); background: var(--danger-bg); border-radius: 10px; padding: 11px 13px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.image-field[aria-busy="true"] .media-preview { border-color: var(--accent); }
.media-preview.image-preview-avatar, .media-preview.image-preview-logo { width: 112px; height: 112px; }
.image-preview-avatar { border-radius: 50%; }
.image-preview-avatar img { object-fit: cover; }
.image-preview-logo img { object-fit: contain; }
.image-preview-branch, .image-preview-cover { max-width: 100%; height: 165px; }
.branch-photo { width: 58px; height: 58px; flex: 0 0 58px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }
.branch-identity, .employee-identity { min-width: 0; align-items: flex-start; }
.branch-identity > div, .employee-identity > div { min-width: 0; }
.overview-filters { display: grid; grid-template-columns: minmax(0,.7fr) minmax(0,1fr) auto; align-items: end; gap: 14px 16px; margin-bottom: 23px; }
.overview-filters .field { margin-bottom: 0; }
.overview-filters > .btn { min-height: 48px; }
.overview-date-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; grid-column: 1 / -1; }
.overview-date-fields input { max-width: 100%; }
.overview-timezone { grid-column: 1 / -1; }
.overview-filter-error { grid-column: 1 / -1; margin: 0; }
.overview-chart-card, .overview-breakdowns, .staff-chart { margin-bottom: 22px; }
.overview-stats .stat-top { align-items: flex-start; }
.overview-stats .stat-note { overflow-wrap: anywhere; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-bottom: 22px; font-size: 13px; color: var(--muted); }
.chart-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend i { display: inline-block; width: 22px; height: 3px; border-radius: 2px; }
.legend-marks { background: var(--accent); }
.chart-legend .legend-rewards { height: 0; background: transparent; border-top: 3px dashed var(--green); }
.overview-plot { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 7px; }
.overview-y-axis { position: relative; height: 180px; font-size: 12px; color: var(--muted); }
.overview-y-axis span { position: absolute; right: 2px; transform: translateY(-50%); }
.overview-chart-main { min-width: 0; }
.overview-chart-main > svg { display: block; width: 100%; height: 180px; overflow: visible; }
.chart-gridline { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-marks { stroke: var(--accent); }
.chart-rewards { stroke: var(--green); stroke-dasharray: 6 5; }
.chart-point-marks { fill: var(--accent); }
.chart-point-rewards { fill: var(--green); }
.overview-x-axis { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.overview-x-axis span { min-width: 0; }
.overview-x-axis span:last-child { text-align: right; }
.overview-operations .card-head { flex-wrap: wrap; }
.overview-breakdowns table, .overview-operations table { font-size: 13px; }
.overview-breakdowns .name-cell strong { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

/* Tablet layout keeps content inside the page and tables inside their container. */
@media (max-width: 1100px) {
  :root { --sidebar-width: 224px; --page-gutter: 24px; }
  .sidebar { padding-inline: 14px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .place-grid, .three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-title span { display: none; }
  .date-pill { display: none; }
  .stat-grid.stat-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .two, .profile-grid { grid-template-columns: 1fr; }
  .stat-grid.stat-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-three .stat:last-child { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .consumer .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phone: compact cards, 44px controls and separate safe-area allowances. */
@media (max-width: 700px) {
  :root { --page-gutter: 18px; --dialog-gap: 16px; --radius: 18px; }
  h1 { font-size: 26px; letter-spacing: -.6px; }
  h2 { font-size: 19px; }
  .shell { display: block; }
  .sidebar { display: none; }
  .shell-body { width: 100%; }
  .topbar, .consumer .topbar {
    min-height: calc(68px + env(safe-area-inset-top));
    padding: calc(12px + env(safe-area-inset-top)) max(var(--page-gutter), env(safe-area-inset-right)) 12px max(var(--page-gutter), env(safe-area-inset-left));
    border: 0;
    background: var(--bg);
    gap: 10px;
  }
  .topbar-title { display: none; }
  .admin-mobile-top { display: flex; align-items: center; gap: 9px; font-size: 23px; font-weight: 700; letter-spacing: .7px; }
  .brand { font-size: 23px; gap: 9px; }
  .brand small { font-size: 12px; letter-spacing: .8px; }
  .brand-mark { flex-basis: 35px; width: 35px; height: 35px; border-radius: 11px; font-size: 30px; }
  .topbar-actions { gap: 8px; }
  .content, .consumer .content {
    padding: 14px max(var(--page-gutter), env(safe-area-inset-right)) calc(114px + env(safe-area-inset-bottom)) max(var(--page-gutter), env(safe-area-inset-left));
  }
  .mobile-context { display: block; margin-bottom: 16px; }
  .consumer .mobile-context { margin-bottom: 16px; }
  .context-picker { min-height: 46px; padding-block: 10px; font-size: 16px; background: var(--surface); }
  .page-heading { margin-bottom: 16px; align-items: flex-start; gap: 14px; }
  .page-heading p { margin-top: 8px; font-size: 13px; }
  .card { padding: 16px; }
  .business-page { gap: var(--space-4); }
  .place-banner { height: 100px; }
  .place-summary-body { padding: var(--space-4); }
  .place-title-row { gap: var(--space-3); }
  .place-title-row h1 { font-size: 24px; }
  .place-summary { padding: 0; }
  .client-branch-row { padding: var(--space-4); }
  .compact-business-page .place-title-row h1 { font-size: 22px; }
  .business-news { padding: 0; }
  .business-news-image { height: 130px; }
  .news-preview { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .news-preview > img { max-width: 320px; height: 140px; }

  .card-head, .section-title { gap: 12px; margin-bottom: 16px; }
  .section-title { flex-wrap: wrap; align-items: center; }
  .section-title .btn { font-size: 13px; padding: 11px 14px; }
  .grid { gap: 16px; }
  .three, .two, .profile-grid, .consumer .form-grid { grid-template-columns: 1fr; }
  .stat-grid, .stat-grid.stat-three { gap: 12px; margin-bottom: 16px; }
  .stat { padding: 16px; }
  .stat-top { align-items: flex-start; font-size: 12px; gap: 8px; }
  .stat-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
  .stat-value { font-size: 29px; margin: 14px 0 7px; }
  .stat-note { font-size: 12px; }
  .stat-three .stat:last-child { display: grid; grid-template-columns: 1fr auto; gap: 4px 15px; }
  .stat-three .stat:last-child .stat-top { grid-row: 1; align-items: center; }
  .stat-three .stat:last-child .stat-top .stat-icon { display: none; }
  .stat-three .stat:last-child .stat-value { grid-column: 2; grid-row: 1 / 3; margin: 0; align-self: center; }
  .stat-three .stat:last-child .stat-note { grid-column: 1; }
  .staff-toolbar { padding: 16px; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
  .staff-toolbar strong { font-size: 14px; }
  .staff-toolbar .btn { width: 100%; }
  .activity-item p { font-size: 14px; }
  .activity-list { gap: 16px; }
  .mobile-nav, .consumer-nav {
    display: flex;
    justify-content: space-around;
    gap: 5px;
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    transform: none;
    padding: 9px max(10px, env(safe-area-inset-right)) calc(9px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    box-shadow: 0 -3px 18px rgb(25 16 45 / 3%);
    z-index: 30;
  }
  .mobile-nav button, .consumer-nav button {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    max-width: 170px;
    min-height: 59px;
    padding: 7px 4px;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
  }
  .mobile-nav button svg, .consumer-nav button svg { width: 23px; height: 23px; }
  .mobile-nav button.active, .consumer-nav button.active { color: var(--accent); background: var(--tint); font-weight: 700; }
  .mobile-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .mobile-menu .nav-item { min-height: 70px; padding: 15px 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
  .mobile-menu .nav-item.active { background: var(--accent); }
  .categories, .management-tabs { gap: 8px; margin-bottom: 16px; }
  .chip { padding: 11px 14px; }
  .place-grid { gap: 13px; }
  .place { padding: 0; border-radius: 17px; }
  .place-cover { height: 116px; }
  .category-label { left: 9px; top: 9px; max-width: calc(100% - 18px); padding: 4px 7px; font-size: 12px; }
  .cover-placeholder { gap: 7px; font-size: 12px; }
  .cover-placeholder > svg { width: 24px; height: 24px; }
  .place-details { padding: 13px; }
  .place-details h3 { font-size: 14px; line-height: 1.35; }
  .place-details .row { display: block; }
  .place-details .business-logo { width: 30px; height: 30px; margin-bottom: 9px; border-radius: 9px; }
  .place-address { font-size: 12px; }
  .place-reward { font-size: 12px; gap: 6px; margin-top: 12px; padding-top: 11px; min-height: 48px; }
  .place-reward svg { width: 17px; height: 17px; }
  .manage-business-grid { grid-template-columns: 1fr; }
  .business-manage-card { padding: 0; }
  .manage-cover { height: 150px; }
  .manage-card-body { padding: 16px; }
  .manage-card-body .row { align-items: center; }
  .management-actions .btn { flex: 1 1 auto; }
  .branch-list .row.between > .pill { max-width: 115px; font-size: 12px; }
  .branch-list h3 { font-size: 15px; }
  .qr-container { margin-top: 0; }
  .qr-panel { padding: 16px; margin-top: 16px; border-radius: 21px; }
  .qr-picture { max-width: 250px; }
  .qr-container > .muted { font-size: 13px; }
  .scan-area { padding: 16px; margin: 16px 0; }
  .scan-program .row .btn { flex: 1 1 auto; }
  .profile-summary { gap: 16px; align-items: flex-start; }
  .profile-summary h2 { font-size: 20px; }
  .profile-summary .avatar.big { width: 64px; height: 64px; flex-basis: 64px; font-size: 22px; }
  .role-list { gap: 6px; }
  .profile-grid { gap: 16px; }
  .lookup-row { gap: 8px; }
  .lookup-row .btn { padding-inline: 13px; }
  .lookup-found { flex-wrap: wrap; }
  .lookup-found .pill { margin-left: 30px; }
  .form-grid { grid-template-columns: 1fr; }
  .field { margin-bottom: 16px; }
  .media-preview { height: 140px; }
  .auth-main { padding: calc(86px + env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom)); align-items: flex-start; }
  .auth-form { margin: auto; }
  .auth-form > .brand { margin-bottom: 16px; }
  .auth-form > .muted { font-size: 14px; }
  .auth-tools { right: 22px; }
  .demo-account { font-size: 13px; }
  .demo-account span { font-size: 12px; }
  .form-footer { gap: 4px 10px; }
  .form-footer .text-btn { font-size: 13px; }
  .toast { bottom: calc(102px + env(safe-area-inset-bottom)); }
  dialog { padding: 20px; border-radius: 21px; }
  .modal-head { top: 0; margin: -20px -20px 22px; padding: 17px 20px; }
  .modal-head h2 { font-size: 19px; }
  th, td { padding-inline: 12px; }
  .subtle-footer { font-size: 12px; margin-top: 16px; }
  .profile-summary, .profile-context, .profile-demo-label { margin-bottom: 16px; }
  .management-actions { margin-top: 16px; }
  .program-card .reward-title { margin-top: 16px; }
  .program-card .progress-track { margin-top: 16px; }
  .scan-program { margin-top: 16px; padding-top: 16px; }
  .scan-area p { margin-bottom: 16px; }
  .auth-form > .muted { margin-bottom: 16px; }
  .demo-panel { margin-top: 16px; padding-top: 16px; }
  .overview-filters { margin-bottom: 16px; }
}
@media (max-width: 700px) {
  .profile-context .context-picker { font-size: 16px; }
  .branch-identity { flex-direction: column; gap: 10px; }
  .branch-photo { width: 54px; height: 54px; flex-basis: 54px; }
  .employee-identity { gap: 10px; }
  .employee-identity h3 { font-size: 14px; }
  .overview-filters { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 13px; }
  .overview-filters > .btn { grid-column: 1 / -1; }
  .overview-date-fields { gap: 13px; }
  .overview-filters label { font-size: 13px; }
  .overview-chart-card, .overview-breakdowns, .staff-chart { margin-bottom: 16px; }
  .overview-stats .stat-top { flex-direction: column-reverse; align-items: flex-start; }
  .overview-stats .stat-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .overview-stats .stat-value { font-size: 27px; }
  .overview-stats .stat-note { font-size: 12px; }
  .overview-plot { grid-template-columns: 27px minmax(0,1fr); gap: 5px; }
  .chart-legend { gap: 10px 15px; font-size: 12px; margin-bottom: 16px; }
  .overview-x-axis { font-size: 12px; gap: 6px; }
  .overview-x-axis span { max-width: 67px; }
  .overview-breakdowns .card { padding: 16px; }
  .overview-operations .card-head h2 { font-size: 18px; }
}
@media (max-width: 380px) {
  :root { --page-gutter: 16px; }
  .brand small { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar, .consumer .topbar { gap: 8px; }
  .place-grid { gap: 12px; }
  .place-details { padding: 12px; }
  .place-cover { height: 108px; }
  .stat-top { flex-wrap: wrap; }
  .stat-top .stat-icon { order: -1; }
  .stat-three .stat:last-child .stat-top { display: block; }
  .demo-accounts { gap: 8px; }
  .demo-account { padding: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Berry management and authentication: same tokens, practical working density. */
html { scrollbar-gutter: stable; scroll-padding-block: 88px 120px; }
body { min-height: 100dvh; }
.brand-mark { background: var(--accent); color: var(--on-accent); }
.shell-body, .content, .card, .form-grid > *, .grid > * { min-width: 0; }
.sidebar { background: var(--surface); }
.nav-item.active { box-shadow: none; }
.shell .topbar { min-height: 76px; }
.shell .card, .staff-toolbar { box-shadow: var(--shadow); }
.shell .stat { border-top: 3px solid var(--tint); }
.shell .stat-value { letter-spacing: -.04em; }
.shell .table-wrap { border-radius: 12px; }
.shell td .btn { min-height: 44px; }
.shell .staff-toolbar { border-radius: 20px; }
.auth-main { background: radial-gradient(ellipse at 50% 0%, var(--tint), transparent 65%); }
.auth-form { padding: 28px; max-width: 460px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.auth-form h1 { font-size: 28px; }
.auth-form .demo-account { border-color: var(--line); }
input, textarea, select { scroll-margin-block: 100px 160px; }
textarea { resize: vertical; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
.profile-action > span { min-width: 0; }
.profile-action > span > svg { flex-shrink: 0; }
img { color: var(--muted); }
@media (max-width: 700px) {
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; }
  .shell .topbar { min-height: calc(64px + env(safe-area-inset-top)); }
  .shell .topbar-actions { gap: 2px; }
  .shell .topbar-actions .icon-btn { width: 44px; min-width: 44px; height: 44px; background: transparent; }
  .shell .topbar-actions .ui-icon { width: 19px; height: 19px; }
  .auth-main { padding-inline: 18px; }
  .auth-form { padding: 22px 18px; }
  .page-heading { flex-wrap: wrap; }
  .page-heading > .btn { max-width: 100%; }
  .mobile-nav { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
