@font-face {
  font-family: Almarai;
  src: url('./assets/fonts/Almarai-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Almarai;
  src: url('./assets/fonts/Almarai-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Almarai;
  src: url('./assets/fonts/Almarai-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Lalezar;
  src: url('./assets/fonts/Lalezar-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto Mono';
  src: url('./assets/fonts/RobotoMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto Mono';
  src: url('./assets/fonts/RobotoMono-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #071b1d;
  --cream: #fdf4e6;
  --deep-teal: #05433f;
  --teal: #16c2b0;
  --bg: var(--cream);
  --bg-elev: #fffefa;
  --bg-elev-2: #f4f5ef;
  --border: #dce1d9;
  --text: var(--ink);
  --text-dim: #4c6260;
  --text-faint: #62716b;
  --accent: #ffb01f;
  --accent-2: #0a6e64;
  --accent-soft: #fff0ce;
  --green: #087365;
  --red: #b32d25;
  --amber: #9a6400;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(7, 27, 29, .16);
  --font-ui: Almarai, Arial, sans-serif;
  --font-mono: 'Roboto Mono', Almarai, monospace;
  --z-sticky: 10;
  --z-modal: 50;
  --z-toast: 100;
  font-synthesis: none;
}

* { box-sizing: border-box; }
/* Author display rules must never expose a view, dialog or conditional field. */
[hidden] { display: none !important; }
html { min-width: 320px; min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button, a, input, select, textarea, [tabindex] { touch-action: manipulation; }
button { color: inherit; }
button:not(:disabled) { cursor: pointer; }
svg { width: 19px; height: 19px; fill: currentColor; flex-shrink: 0; }
svg.icon { fill: none; }
img { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; line-height: 1.3; }
p { text-wrap: pretty; }
::selection { color: var(--ink); background: #ffdb94; }
:focus-visible { outline: 3px solid #0a6e64; outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sign-in keeps the expressive brand separate from the quiet task. */
.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100svh;
}
.login-story {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--deep-teal);
  color: var(--cream);
  padding: 76px 48px 112px;
  text-align: center;
}
.login-story .brand-logo,
.login-story > img { display: block; width: 230px; height: 230px; object-fit: contain; }
.login-headline { font: 400 48px/1.35 Lalezar, Almarai, sans-serif; margin: 18px 0 10px; color: var(--cream); }
.login-caption { max-width: 32ch; color: #c1d8ce; font-size: 15px; line-height: 1.9; margin: 0; }
.login-story-footer { position: absolute; inset-inline: 32px; bottom: 34px; color: #b9d0c8; font-size: 12px; }
.login-wordmark { position: absolute; top: 26px; inset-inline-start: 32px; display: flex; align-items: center; gap: 7px; color: var(--cream); font-size: 14px; font-weight: 800; }
.login-wordmark img { width: 54px; height: 54px; object-fit: contain; }
.login-story-content { display: flex; flex-direction: column; align-items: center; }
.login-hero-logo { width: 310px; height: 310px; object-fit: contain; }
.login-story-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.login-story-footer [lang='ar'] { color: #d0e2d5; font: 400 22px/1 Lalezar, Almarai, sans-serif; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 56px 40px; }
.login-card { display: flex; flex-direction: column; gap: 22px; width: 100%; max-width: 360px; margin: 0; }
.login-heading { margin: 0 0 8px; }
.login-heading h2 { font-size: 30px; font-weight: 800; margin: 19px 0 12px; letter-spacing: -.025em; }
.login-access { display: inline-flex; align-items: center; gap: 7px; color: #4e6a59; font-size: 12px; font-weight: 700; }
.login-access svg { width: 16px; height: 16px; }
.login-footnote { margin: 0; font-size: 11px; text-align: center; color: var(--text-faint); }
.login-intro { color: var(--text-dim); margin: 0 0 12px; font-size: 14px; line-height: 1.75; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand h1 { margin: 0; font-size: 24px; }
.login-brand span { color: var(--text-dim); font-size: 13px; }
.login-card .field { gap: 9px; }
.login-card .field input { min-height: 52px; background: #fffefa; }
.login-card .btn-primary { margin-top: 2px; min-height: 50px; }
.login-error { background: #fff0ec; border: 1px solid #e9bdb4; color: var(--red); font-size: 13px; padding: 12px; border-radius: 8px; margin: 0; }

/* Shared controls. */
.btn,
.btn-ghost {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 100ms ease, box-shadow 100ms ease;
}
.btn:active:not(:disabled), .btn-ghost:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--ink); border-color: transparent; box-shadow: 0 3px 0 var(--deep-teal); }
.btn-primary:hover:not(:disabled) { background: #ffc04b; }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--deep-teal); transform: translateY(2px); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--bg-elev); border-color: #d1dad3; color: #365550; }
.btn-ghost:hover:not(:disabled) { color: var(--ink); border-color: #8da79d; background: #f1f5ed; }
.btn-sm { padding: 8px 11px; font-size: 12px; border-radius: 7px; }
.btn-danger { background: #fff0ec; border-color: #f0d4cb; color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #ffe1d9; border-color: #d4a093; }
.btn-success { background: #e4f4ec; border-color: #c0dfd2; color: var(--green); }
.btn-success:hover:not(:disabled) { background: #d3ecdf; border-color: #8cbda8; }
button:disabled, .btn:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; }
.btn[aria-busy='true'] { opacity: .7; cursor: progress; }
.field { display: flex; flex-direction: column; gap: 8px; color: #35534e; font-size: 13px; font-weight: 700; min-width: 0; }
.field input,
.search,
.inline-field input,
.filters select,
.form-panel select,
.form-panel textarea,
.form-panel input:not([type='radio']) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #c8d3cb;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 13px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  color-scheme: light;
}
input::placeholder, textarea::placeholder { color: #67746c; opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #0a6e64;
  outline-offset: 2px;
  border-color: #0a6e64;
}
input[type='date'], input[type='time'], input[type='url'], input[type='email'], code { direction: ltr; }
input[type='radio'], input[type='checkbox'] { accent-color: #0a6e64; width: 17px; height: 17px; margin: 0; flex-shrink: 0; }
input:disabled, select:disabled, textarea:disabled { color: #68766e; background: #edf0e8; cursor: not-allowed; }

/* ───────────── Shell: navigation rail and workspace ───────────── */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.mobile-bar, .nav-scrim, .sidebar .nav-close { display: none; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  transition: background-color 150ms ease, color 150ms ease;
}
.icon-btn svg { width: 20px; height: 20px; }
.modal-head .icon-btn { background: #eff3e9; color: #365550; }
.modal-head .icon-btn:hover { background: #e3ead9; color: var(--ink); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: var(--ink);
  color: var(--cream);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #2a4743 transparent;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand-logo { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.brand-copy { flex: 1; min-width: 0; }
.brand strong { display: block; color: var(--cream); font-size: 17px; font-weight: 800; line-height: 1.3; }
.brand span { display: block; color: #9fb8b0; font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 12px 6px; color: #8faaa1; font-size: 12px; font-weight: 700; }
.nav-group-title .ar { font-size: 12px; font-weight: 400; color: #7d978f; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  padding: 9px 12px;
  background: transparent;
  color: #c9dad3;
  font-size: 13.5px;
  font-weight: 700;
  text-align: start;
  transition: background-color 150ms ease, color 150ms ease;
}
.nav-item svg { width: 18px; height: 18px; opacity: .8; }
.nav-item:hover { background: #12302d; color: var(--cream); }
.nav-item.active { background: var(--accent); color: var(--ink); }
.nav-item.active svg { opacity: 1; }
.nav-item:focus-visible, .sidebar .icon-btn:focus-visible { outline-color: var(--accent); outline-offset: 1px; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; border-top: 1px solid #22403b; margin-top: 22px; padding: 16px 6px 0; }
.account-avatar { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #1d3b36; color: #d9eadf; }
.account-avatar svg { width: 17px; height: 17px; }
.account-info { flex: 1; min-width: 0; }
.account-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--cream); }
.account-info small { display: block; color: #8faaa1; font-size: 11px; }
.sidebar-footer .icon-btn { color: #b6cec3; }
.sidebar-footer .icon-btn:hover { background: #1a3933; color: var(--cream); }

.main { min-width: 0; padding: 30px 36px 64px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading { min-width: 0; }
#view-title:focus { outline: none; }
.topbar h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.view-description { color: var(--text-dim); font-size: 13.5px; margin: 6px 0 0; max-width: 70ch; line-height: 1.6; }
.view-description:empty { display: none; }
.topbar-actions { display: flex; align-items: center; flex-shrink: 0; gap: 12px; padding-top: 2px; }
.topbar-actions .btn-ghost { background: #fffaf1; }
.view { display: block; }

/* "N online": live connections, on every view. */
.live-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 13px; border-radius: 999px; background: #e3f3ee; color: #0b5a51; font: 600 12.5px/1 var(--font-ui); white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex-shrink: 0; }
.live-dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--teal); opacity: 0; animation: live-ping 2.4s ease-out infinite; }
@keyframes live-ping { 0% { transform: scale(.6); opacity: .7; } 80%, 100% { transform: scale(1.5); opacity: 0; } }

/* ───────────── Overview ───────────── */
.live-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
  padding: 26px 30px;
  border-radius: 18px;
  background: var(--deep-teal);
  color: var(--cream);
  position: relative;
  overflow: hidden;
}
.live-band::after {
  content: 'ربع قرد';
  position: absolute;
  right: -6px;
  bottom: -34px;
  font: 400 120px/1 Lalezar, Almarai, sans-serif;
  color: #ffffff09;
  pointer-events: none;
  direction: rtl;
}
.live-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative; z-index: 1; }
.live-label { display: inline-flex; align-items: center; gap: 9px; color: #bfe3d8; font-size: 13px; font-weight: 700; }
.live-value { font: 600 64px/1.1 var(--font-mono); color: var(--accent); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.live-caption { color: #a9cbc0; font-size: 12.5px; }
.live-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; position: relative; z-index: 1; }
.live-facts > div { padding: 6px 18px; border-inline-start: 1px solid #1d6159; }
.live-facts dt { color: #a9cbc0; font-size: 12px; }
.live-facts dd { margin: 6px 0 0; font: 600 28px/1.2 var(--font-mono); color: var(--cream); font-variant-numeric: tabular-nums; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 17px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.kpi-label { color: var(--text-dim); font-size: 12.5px; font-weight: 700; }
.kpi-value { font: 600 28px/1.25 var(--font-mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi-hint { color: var(--text-faint); font-size: 11.5px; line-height: 1.5; }
.kpi-hint:empty { display: none; }
.kpi-warn .kpi-value { color: var(--red); }
.kpi-row-flat { margin: 0; gap: 0; }
.kpi-row-flat .kpi { border: 0; border-radius: 0; background: transparent; padding: 4px 18px; border-inline-start: 1px solid var(--border); }
.kpi-row-flat .kpi:first-child { border-inline-start: 0; padding-inline-start: 0; }

/* Kept for push.js's delivery stat cards. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 14px; margin-bottom: 22px; }
#po-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.label { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); }
.value { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.stat-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 18px; min-width: 0; }
.stat-card .value { font-size: 26px; margin-top: 10px; line-height: 1.35; }
.stat-sub { font-size: 11px; color: var(--text-dim); margin-top: 6px; line-height: 1.6; }
.stat-grid-sm { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-grid-sm .stat-card { padding: 14px; }
.stat-grid-sm .stat-card .value { font-size: 22px; margin-top: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green { background: var(--green); }
.dot-amber { background: #ba7a00; }
.dot-red { background: var(--red); }
.dot-accent { background: var(--accent-2); }

/* ───────────── Panels and tables ───────────── */
.panel { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.panel:last-child { margin-bottom: 0; }
.panel-head { padding: 20px 24px 16px; }
.panel-head h3 { margin: 0; font-size: 15.5px; font-weight: 800; }
.panel-head p, .panel-title-row > span { margin: 5px 0 0; color: var(--text-dim); font-size: 12.5px; line-height: 1.6; max-width: 80ch; }
.panel-head-sub { border-top: 1px solid var(--border); margin-top: 6px; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-body { padding: 0 24px 22px; }
.muted { color: var(--text-faint); font-weight: 400; }
.table-scroll { position: relative; width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.table { width: 100%; min-width: 920px; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.table th, .table td { overflow: hidden; }
.table th { background: #f4f5ee; border-top: 1px solid #e7e9e0; border-bottom: 1px solid var(--border); color: #4f6b62; padding: 11px 16px; font-size: 12px; font-weight: 700; text-align: start; white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid #eceee6; vertical-align: middle; line-height: 1.55; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8f9f2; }
.table .btn-sm { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.room-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.table .btn + .btn { margin-inline-start: 4px; }
.room-actions .btn + .btn { margin-inline-start: 0; }
.truncate { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-main { max-width: 100%; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { max-width: 100%; margin-top: 3px; color: var(--text-faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-clickable { cursor: pointer; }
.row-clickable:hover .cell-main { color: var(--accent-2); }
.row-clickable:focus-visible { outline-offset: -3px; }
.row-actions { white-space: nowrap; text-align: end; }
#view-push-history .table { min-width: 1280px; }
#view-push-scheduled .table { min-width: 950px; }
#view-reports .table { table-layout: auto; }
.table-compact { min-width: 600px; font-size: 13px; }
.table-compact th, .table-compact td { padding: 10px 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; line-height: 1.5; font-weight: 700; white-space: nowrap; background: #eaf0e7; color: #53695e; }
.badge-green { background: #dff3e9; color: #07654f; }
.badge-amber { background: #fff0cd; color: #855800; }
.badge-red { background: #fbe6df; color: #ad3128; }
.badge-gray { background: #ecf0e8; color: #53695e; }
.badge-accent { background: #dcefeb; color: #0c6258; }
.empty { padding: 52px 24px; text-align: center; color: var(--text-dim); font-size: 13px; }
.empty-icon { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 15px; border-radius: 12px; background: #edf2e8; color: #71897c; }
.empty-icon svg { width: 22px; height: 22px; }
.empty strong { display: block; color: #28473d; font-size: 14px; }
.empty p { margin: 6px auto 0; max-width: 43ch; color: var(--text-dim); font-size: 12.5px; line-height: 1.7; }

/* Filters above a view. */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.toolbar-note { margin: 0; color: var(--text-dim); font-size: 12.5px; line-height: 1.6; max-width: 72ch; }
.toolbar-note:empty { display: none; }
.tabs { display: inline-flex; gap: 2px; max-width: 100%; padding: 4px; border: 1px solid #dadfd4; border-radius: 11px; background: #f2f2e8; overflow-x: auto; }
.tab { min-height: 36px; padding: 8px 16px; border: 0; border-radius: 8px; color: #53695e; background: transparent; font-size: 12.5px; font-weight: 700; white-space: nowrap; transition: background-color 150ms ease, color 150ms ease; }
.tab:hover { background: #e6ebdf; color: var(--ink); }
.tab.active { background: var(--bg-elev); color: var(--ink); box-shadow: 0 1px 3px #071b1d1a; }
.search { width: 260px; max-width: 100%; background: var(--bg-elev); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 12.5px; font-weight: 700; }
.inline-field input { width: auto; min-width: 140px; padding: 9px 10px; }
.inline-field select { min-height: 44px; border: 1px solid #c8d3cb; border-radius: 8px; background: #fff; padding: 9px 30px 9px 12px; color: var(--text); font-size: 13px; }
.filters select { width: auto; min-width: 150px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 16px 20px; border-top: 1px solid var(--border); font-size: 12px; }

/* ───────────── Charts ───────────── */
.chart-cols { position: relative; }
.chart-empty { display: grid; place-items: center; min-height: 120px; padding: 24px; border: 1px dashed #d6dccf; border-radius: 12px; color: var(--text-dim); font-size: 12.5px; text-align: center; line-height: 1.6; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; color: var(--text-dim); font-size: 12px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i, .chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.cols { position: relative; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px; height: 150px; padding-top: 18px; border-top: 1px dashed #e1e5da; }
.chart-cols-tall .cols { height: 240px; gap: 8px; }
.cols-max { position: absolute; top: 0; inset-inline-start: 0; color: var(--text-faint); font: 400 10.5px/1 var(--font-mono); transform: translateY(-50%); background: var(--bg-elev); padding-inline-end: 6px; }
.col { display: flex; flex-direction: column; min-width: 0; height: 100%; border-radius: 6px; outline-offset: 2px; cursor: default; }
.col-track { flex: 1; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid #cfd8cb; }
.col-stack { display: flex; flex-direction: column-reverse; gap: 2px; width: 100%; max-width: 40px; min-height: 0; }
.col-seg { display: block; width: 100%; min-height: 2px; }
.col-seg:last-child { border-radius: 4px 4px 0 0; }
.col:hover .col-stack, .col:focus-visible .col-stack { filter: brightness(1.12); }
.col-label { display: flex; justify-content: center; height: 22px; padding-top: 6px; color: var(--text-faint); font-size: 10.5px; white-space: nowrap; overflow: visible; }
.col:first-of-type .col-label { justify-content: flex-start; }
.col:last-of-type .col-label { justify-content: flex-end; }
.chart-tip { position: fixed; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 4px; min-width: 140px; padding: 10px 12px; border-radius: 9px; background: var(--ink); color: var(--cream); font-size: 12px; line-height: 1.4; box-shadow: 0 8px 22px #071b1d33; pointer-events: none; }
.chart-tip strong { font-weight: 700; margin-bottom: 2px; }
.chart-tip span { display: flex; align-items: center; gap: 7px; }
.chart-tip b { margin-inline-start: auto; padding-inline-start: 12px; font: 600 12px/1 var(--font-mono); }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 1.1fr) minmax(0, 2fr) auto; align-items: center; gap: 12px; font-size: 13px; }
.hbar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.hbar-track { height: 10px; border-radius: 999px; background: #edf0e7; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 999px; background: #008c7e; }
.hbar-value { font: 600 13px/1.2 var(--font-mono); text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbar-value small { display: block; margin-top: 2px; color: var(--text-faint); font: 400 11px/1.2 var(--font-ui); }

/* ───────────── Tracking ───────────── */
.tracking-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; align-items: start; }
.tracking-grid > .panel { margin-bottom: 0; }
.tracking-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.funnel li { display: grid; gap: 8px; padding: 10px 0 12px; }
.funnel li + li { border-top: 1px solid #eef0e8; }
.funnel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.funnel-label { font-weight: 800; font-size: 13.5px; }
.funnel-label small, .funnel-num small { display: block; color: var(--text-faint); font-size: 11.5px; font-weight: 400; margin-top: 2px; font-family: var(--font-ui); }
.funnel-num { font: 600 20px/1.15 var(--font-mono); text-align: end; font-variant-numeric: tabular-nums; }
.funnel-track { display: block; height: 14px; border-radius: 6px; background: #edf0e7; overflow: hidden; }
.funnel-fill { display: block; height: 100%; border-radius: 6px; background: var(--deep-teal); }
.funnel li:first-child .funnel-fill { background: #008c7e; }
.funnel-drop { color: #8a5a00; font-size: 11.5px; }
.ret-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ret-tile { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 14px; border-radius: 12px; background: #f1f5ec; }
.ret-label { font-size: 12.5px; font-weight: 800; }
.ret-value { font: 600 26px/1.2 var(--font-mono); color: var(--deep-teal); font-variant-numeric: tabular-nums; }
.ret-hint { font-size: 11.5px; color: var(--text-dim); }
.ret-sub { font-size: 11px; color: var(--text-faint); }
.multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
.multiples h4 { margin: 0 0 12px; font-size: 13px; font-weight: 800; }
/* The legend goes under a small multiple, so all three plots line up. */
.multiples .chart-cols { display: flex; flex-direction: column-reverse; }
.multiples .chart-legend { margin: 8px 0 0; }

/* Notifications: content, audience, destination and delivery stay in order. */
.notice { padding: 14px 16px; border: 1px solid #c8dcd0; border-radius: 9px; background: #ecf4ea; color: #335947; font-size: 12px; line-height: 1.8; margin-bottom: 18px; overflow-wrap: anywhere; }
.notice-warn { background: #fff1cd; border-color: #e7cf99; color: #725014; }
.hint { margin: -9px 0 24px; color: var(--text-dim); font-size: 12px; line-height: 1.8; max-width: 78ch; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) 316px; align-items: start; gap: 24px; }
.composer-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.form-panel { display: flex; flex-direction: column; gap: 19px; margin: 0; padding: 25px; }
.form-panel h3 { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; margin: 0; }
.form-section-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 2px; }
.form-section-heading .section-description { margin: 6px 0 0; }
.section-icon { display: inline-flex; padding-top: 1px; color: var(--deep-teal); }
.section-icon svg { width: 19px; height: 19px; }
.section-description { margin: -10px 0 2px; color: var(--text-dim); font-size: 12px; line-height: 1.75; }
.form-panel .field > span { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.form-panel select { padding-inline-end: 26px; }
.form-panel textarea { resize: vertical; min-height: 104px; line-height: 1.9; }
.form-panel fieldset { padding: 0; margin: 0; border: 0; }
.form-panel legend { margin-bottom: 8px; padding: 0; color: #35534e; font-size: 13px; font-weight: 700; }
.form-panel .notice { margin-bottom: 0; }
.counter { font-family: var(--font-mono); font-size: 10px; font-weight: 400; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--red); font-weight: 600; }
.field-error { color: var(--red); font-size: 12px; line-height: 1.6; font-weight: 400; }
.field-error:empty { display: none; }
[aria-invalid='true'] { border-color: var(--red) !important; background: #fff9f6; }
.radios { display: flex; flex-wrap: wrap; gap: 5px 20px; font-size: 12px; }
.radios label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.radios-col { flex-direction: column; margin-top: 12px; gap: 8px; }
.radios-col label { padding: 10px 12px; background: #f2f5ec; border-radius: 8px; }
.schedule-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.schedule-row .muted { font-size: 11px; }
.estimate { padding: 13px 15px; border-radius: 8px; background: #edf4e8; color: #456450; font-size: 12px; line-height: 1.8; }
.estimate strong { color: var(--deep-teal); }
.search-results { list-style: none; margin: 6px 0 0; padding: 0; max-height: 276px; overflow-y: auto; border-radius: 8px; }
.search-results:not(:empty) { border: 1px solid #cbd9cd; }
.search-results li { padding: 12px 13px; min-height: 44px; border-bottom: 1px solid var(--border); background: #f5f8ef; color: var(--text); font-size: 12px; }
.search-results li:last-child { border-bottom: 0; }
.search-results li[data-i] { cursor: pointer; }
.search-results li[data-i]:hover, .search-results li[aria-selected='true'] { background: var(--accent-soft); }
.search-results li:focus-visible { outline-offset: -3px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chips:empty { margin-top: 0; }
.chip { display: inline-flex; align-items: center; max-width: 100%; gap: 6px; padding: 1px 4px 1px 12px; border-radius: 7px; background: #e5f0e4; color: #275740; font-size: 12px; overflow-wrap: anywhere; }
.chip button { min-width: 36px; min-height: 38px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: inherit; font-size: 17px; }
.chip button:hover { background: #d4e4d1; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 6px 0 5px; }
.actions .spacer { flex: 1; }

.composer-preview { position: sticky; top: 24px; min-width: 0; border-radius: 14px; padding: 24px 20px; background: #e9eee3; }
.preview-heading h3, .composer-preview > h3 { font-size: 15px; margin: 0; font-weight: 800; }
.preview-caption { margin: 8px 0 24px; color: var(--text-dim); font-size: 11px; line-height: 1.8; }
.composer-preview h3 .muted { display: block; margin-top: 7px; font-size: 11px; line-height: 1.7; }
.preview-device { margin-top: 21px; }
.phone-note { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; color: #51694e; margin: 20px 0 9px; }
.phone-note svg { width: 15px; height: 15px; }
.notif { padding: 15px; font-size: 13px; overflow: hidden; background: #fff; color: var(--ink); border-radius: 12px; }
.notif-android { border-radius: 12px; }
.notif-ios { background: #fafcf7; border-radius: 15px; }
.notif-head { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; color: #607361; font-size: 10px; }
.notif-head .when { margin-inline-start: auto; }
.app-icon { display: grid; place-items: center; flex-shrink: 0; width: 23px; height: 23px; border-radius: 6px; background: var(--deep-teal); overflow: hidden; font-size: 13px; }
.app-icon img { width: 23px; height: 23px; object-fit: contain; }
.notif-title { color: var(--ink); font-weight: 700; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.notif-body { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; color: #4b6152; font-size: 12px; line-height: 1.8; margin-top: 3px; overflow-wrap: anywhere; }
.notif-image { display: block; width: 100%; max-height: 160px; object-fit: cover; border-radius: 8px; margin-top: 11px; }
.composer-preview .hint { border-top: 1px solid #ced9c6; padding-top: 17px; margin: 23px 0 0; font-size: 11px; }

/* Dialogs keep the existing controls and confirmation flows in view. */
.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(3, 20, 22, .68); }
.modal { display: flex; flex-direction: column; width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh; overflow: hidden; border-radius: 16px; background: var(--bg-elev); box-shadow: var(--shadow); }
.modal-wide { max-width: 920px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 18px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.modal-head .btn-ghost { width: 40px; padding: 8px; background: #eff3e9; border-color: transparent; flex-shrink: 0; font-size: 15px; }
.modal-body { min-height: 0; padding: 24px; overflow-y: auto; overscroll-behavior: contain; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.modal-body > p:first-child { margin-top: 0; }
.modal-body > p:last-child { margin-bottom: 0; }
.modal-body h4 { font-size: 13px; margin: 24px 0 12px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; flex-shrink: 0; padding: 17px 24px 21px; border-top: 1px solid var(--border); background: #f6f7f0; }
.player-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.player-row:last-child { border: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px 24px; margin-bottom: 24px; }
.detail-grid > div { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; font-size: 13px; }
.detail-grid .muted { font-size: 11px; }
.detail-message { background: #f0f5e9; border-radius: 10px; padding: 17px; margin-bottom: 22px; }
code { font-family: var(--font-mono); font-size: 11px; color: #48675a; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: var(--z-toast); bottom: 24px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 14px 21px; border-radius: 10px; background: var(--ink); color: var(--cream); font-size: 13px; line-height: 1.7; box-shadow: 0 5px 12px #071b1d26; overflow-wrap: anywhere; }
.toast.error { background: #852d26; color: #fff5ed; }
.toast.success { background: var(--deep-teal); color: #e0f7e6; }


/* ---------- Store ---------- */
.store-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; display: block; background: var(--bg-elev-2); border: 1px solid var(--border); }
.store-thumb-empty { display: inline-block; }
.store-title { margin: 0; font-size: 18px; }
.store-problems { list-style: none; margin: 0 0 16px; padding: 12px 16px; border-radius: 10px; border: 1px solid rgba(179, 45, 37, .35); background: #fff4f2; color: var(--red); font-size: 12.5px; display: grid; gap: 4px; }
.store-problems .warn { color: var(--amber); }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; align-items: start; }
.store-text-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px 16px; }
.store-inline { display: flex; gap: 6px; }
.store-inline input { width: 0; flex: 1; min-width: 56px; }
.store-color { display: inline-flex; align-items: center; gap: 6px; margin-inline-end: 8px; }
.store-color input[type='color'] { width: 38px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; }
.store-color input[type='number'] { width: 62px; }
.store-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.store-slot, .store-effect { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-elev); }
.store-slot-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.store-slot-body { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.store-slot-img { max-width: 100%; max-height: 150px; object-fit: contain; border-radius: 8px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.store-slot-lottie { width: 150px; height: 150px; background: #0b1020; border-radius: 8px; }
.store-slot progress { width: 100%; }
.store-upload { align-self: flex-start; cursor: pointer; }
.store-json { font-family: var(--font-mono); font-size: 12px; direction: ltr; }
.store-json-bad { border-color: var(--red) !important; background: #fff4f2; }
.store-avatar-layout, .store-theme-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; }
.store-avatar-preview { display: flex; align-items: end; gap: 18px; padding: 18px; border-radius: 14px; background: #0e2a28; }
.store-avatar-preview figure { margin: 0; display: grid; justify-items: center; gap: 6px; }
.store-avatar-preview figcaption { color: #cfe; font-size: 11px; }
.store-avatar-disc { border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-family: Lalezar, Almarai, sans-serif; }
.store-avatar-disc img { width: 100%; height: 100%; object-fit: cover; }
.store-phone-wrap { display: grid; gap: 8px; justify-items: center; }
.store-phone { width: 300px; height: 650px; border-radius: 28px; border: 8px solid #10201f; box-shadow: var(--shadow); background: #0b1020; }
.store-entrance-preview { position: relative; overflow: hidden; }
.store-lottie { position: absolute; inset: 0; color: #cfe; display: grid; place-items: center; font-size: 13px; }
.store-overlay-mark { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; display: grid; place-items: center; background: #14254a; color: #fff4e0; border: 3px solid #fff4e0; box-shadow: 0 0 30px rgba(255, 194, 61, .45); font-family: Lalezar, Almarai, sans-serif; }
.store-overlay-name { position: absolute; transform: translate(-50%, -50%); padding: 6px 14px; border-radius: 10px; background: rgba(0, 0, 0, .6); color: #fff; white-space: nowrap; font-weight: 700; }
#se-root input[type='checkbox'], #store-create input[type='checkbox'] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--accent-2); }
#se-root .radios, #store-create .radios { display: flex; align-items: center; gap: 8px; font-size: 13px; }
#se-root .store-color input[type='color'] { width: 38px; min-width: 38px; height: 32px; padding: 2px; flex: none; }
#se-root .store-color input[type='number'] { width: 66px; min-width: 66px; flex: none; padding: 6px 8px; }
#se-root .store-color { flex-wrap: nowrap; }
#se-root .field > .store-color, #se-root .field > .store-inline { justify-content: flex-start; }
#se-root .field > .store-color + .store-color { margin-top: 6px; }
@keyframes store-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 900px) {
  .store-avatar-layout, .store-theme-layout, .store-text-grid { grid-template-columns: minmax(0, 1fr); }
  .store-phone { width: 260px; height: 563px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ── store: the item editor's tabs ── */
.store-tabs { margin: 4px 0 16px; }
.store-tab-panel > .panel + .panel { margin-top: 16px; }
.store-general { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 18px; align-items: start; margin-bottom: 14px; }
.store-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.store-facts dt { color: var(--text-dim); font-weight: 700; }
.store-facts dd { margin: 0; overflow-wrap: anywhere; }
.store-versions summary { cursor: pointer; font-size: 12px; color: var(--text-dim); }
.store-versions ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: 12px; }
.store-versions li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.store-slogan-stage { margin-top: 12px; padding: 28px 16px; border-radius: 12px; background: radial-gradient(circle at 50% 20%, #2b3a52, #0b1020 70%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.store-slogan-plate { padding: 8px 22px; border-radius: 10px; background: #071b1dd6; border: 1px solid #ffffff55; color: #fdf4e6; font-size: 20px; font-weight: 700; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-slogan-tag { color: #ffd889; font-size: 13px; font-weight: 800; letter-spacing: .2em; text-align: center; max-width: 90%; overflow-wrap: anywhere; }
.store-promo-table { margin-top: 12px; }
.store-promo-preview { margin-top: 12px; }
.store-promo-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--accent); color: var(--ink); font-weight: 800; font-size: 12px; }
.store-history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 12px; }
.store-history code { display: block; color: var(--text-faint); overflow-wrap: anywhere; }
.store-diff td { overflow-wrap: anywhere; max-width: 320px; }
@media (max-width: 720px) {
  .store-general { grid-template-columns: 1fr; }
  .store-facts { grid-template-columns: 1fr; }
}

/* ───────────── Purchases (read-only records) ───────────── */
.billing-filter { justify-content: flex-start; }
#billing-content section { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
#billing-content section > h3 { margin: 0; padding: 18px 24px 14px; font-size: 15px; font-weight: 800; }
#billing-content section > p { margin: 0; padding: 0 24px 20px; color: var(--text-dim); font-size: 12.5px; }
#billing-content .table { table-layout: auto; min-width: 960px; }
#billing-content .table td { max-width: 240px; overflow-wrap: anywhere; }
#billing-content section:nth-child(2) .table { min-width: 1500px; }

/* ───────────── App versions ───────────── */
.appcfg-root { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); align-items: start; }
.appcfg-card { margin: 0; padding: 0 24px 22px; }
.appcfg-card .panel-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 20px 0 10px; }
.appcfg-card .panel-head .muted { font-size: 12px; }
.appcfg-card > .section-description { margin: 0 0 6px; font-size: 12.5px; }
.appcfg-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin: 16px 0 18px; }
.appcfg-wide { grid-column: 1 / -1; }
.appcfg-card textarea { width: 100%; min-height: 70px; border: 1px solid #c8d3cb; border-radius: 8px; background: #fff; padding: 10px 12px; font: inherit; font-size: 14px; font-weight: 400; resize: vertical; }
.appcfg-card .field small.muted { font-size: 11.5px; font-weight: 400; }
.appcfg-card .radios { grid-column: 1 / -1; font-size: 13px; font-weight: 400; color: var(--text); }
.appcfg-card .toolbar { margin: 0; justify-content: flex-start; }
.appcfg-card input[type='checkbox'] { width: 18px; height: 18px; }

/* In-app popups */
.popups-root { display: grid; gap: 16px; margin-top: 12px; }
.popups-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.popup-card .panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.popup-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.popup-body { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.popup-picture { display: flex; flex-direction: column; gap: 8px; }
.popup-picture img, .popup-noimage { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: #f1f5ed; }
.popup-noimage { display: grid; place-items: center; }
.popup-upload { text-align: center; cursor: pointer; }
.popup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.popup-wide, .popup-action { grid-column: 1 / -1; }
.popup-action { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.popup-action:empty { display: none; }
@media (max-width: 760px) {
  .popup-body, .popup-grid, .popup-action { grid-template-columns: 1fr; }
}

/* ── «Live in the stores» (storesync.js) ── */
.store-sync h4 { margin: 18px 0 8px; font-size: 14px; }
.store-sync-form { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 4px; }
.store-sync-stores { display: flex; gap: 18px; margin: 4px 0 10px; flex-wrap: wrap; }
.store-sync-msg { min-height: 1.4em; margin: 8px 0 0; }
.store-sync-discount { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; }
.store-sync-discount.is-failed { background: #fbe4e2; }
.store-sync-discount ul { margin: 6px 0 8px; padding-inline-start: 18px; }
.ok-text { color: var(--green); }
.error-text { color: var(--red); }

/* ── Gifts (gifts.js) ── */
.gifts-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.4fr); gap: 16px; margin: 12px 0 16px; align-items: start; }
@media (max-width: 900px) { .gifts-grid { grid-template-columns: 1fr; } }
.gift-results { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; }
.gift-pick-player { width: 100%; text-align: start; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; }
.gift-pick-player:hover, .gift-pick-player:focus-visible { border-color: var(--teal); }
.gift-player-card { border: 1px solid var(--teal); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; margin-top: 8px; }
.gift-player-card .btn { justify-self: start; margin-top: 4px; }
.gift-products { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px 10px; }
.gift-group { border: 0; margin: 6px 0; padding: 0; display: grid; gap: 2px; }
.gift-group legend { font-weight: 700; padding: 6px 0 4px; }
.gift-product { display: flex; align-items: center; gap: 8px; padding: 3px 0; flex-wrap: wrap; }
.gift-product code { font-size: 11px; color: var(--text-faint); }
.gift-product.is-owned { color: var(--text-faint); }
tr.is-muted td { color: var(--text-faint); }
.gift-product input[type="checkbox"], .store-sync-stores input[type="checkbox"], #gift-notify { width: 18px; height: 18px; min-height: 0; flex: none; margin: 0; padding: 0; }
.gift-product { cursor: pointer; }

.store-slot audio { width: 100%; max-width: 100%; }

/* ───────────── Links, pager, tabs with counts ───────────── */
.link { padding: 0; border: 0; background: none; color: var(--accent-2); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; text-align: start; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-strong { color: var(--ink); }
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 18px; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 12.5px; }
.pager-text { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tabs-wrap { flex-wrap: wrap; overflow: visible; margin-bottom: 14px; }
.tab-count { display: inline-block; min-width: 22px; margin-inline-start: 6px; padding: 1px 7px; border-radius: 999px; background: #e3e8db; color: #4b6157; font: 600 11px/1.5 var(--font-mono); }
.tab.active .tab-count { background: var(--accent-soft); color: #7a5300; }
.table-auto { table-layout: auto; min-width: 980px; }
.table-auto td { max-width: 260px; overflow-wrap: anywhere; }
#billing-config { margin-bottom: 14px; }
.kv { display: grid; gap: 0; margin: 0; }
.kv-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.kv-row { display: grid; grid-template-columns: minmax(110px, 34%) minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid #eef0e8; }
.kv-row:last-child { border-bottom: 0; }
.kv-2 .kv-row { border-bottom: 0; }
.kv dt { color: var(--text-dim); font-size: 12.5px; font-weight: 700; }
.kv dd { margin: 0; min-width: 0; font-size: 13px; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ───────────── Player profile ───────────── */
.profile-head { margin-bottom: 18px; }
.profile-back { display: inline-block; margin-bottom: 12px; font-size: 13px; }
.profile-id { display: flex; align-items: center; gap: 18px; padding: 22px 24px; border-radius: 18px; background: var(--deep-teal); color: var(--cream); }
.profile-avatar { display: grid; place-items: center; flex-shrink: 0; width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--ink); font: 400 32px/1 Lalezar, Almarai, sans-serif; }
.profile-name { flex: 1; min-width: 0; }
.profile-name h3 { margin: 0; font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.profile-name p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0 0; }
.profile-name .muted { color: #a9cbc0; font-size: 12.5px; }
.profile-uid code { color: #cfe4dc; font-size: 11.5px; }
.profile-uid .btn-ghost { min-height: 30px; padding: 4px 10px; background: transparent; border-color: #2a6b62; color: #d8ece4; }
.profile-uid .btn-ghost:hover:not(:disabled) { background: #0c564f; color: var(--cream); }
.profile-actions { flex-shrink: 0; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.profile-main > .panel, .profile-side > .panel { margin-bottom: 18px; }
.day-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 4px; }
.day-cell { aspect-ratio: 1; min-height: 12px; border-radius: 4px; background: #edf0e7; }
.day-1 { background: #bfe3da; }
.day-2 { background: #3fa797; }
.day-3 { background: var(--deep-teal); }
.device-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.device-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid #eef0e8; font-size: 13px; }
.device-list li:last-child { border-bottom: 0; }
.device-name { font-weight: 700; }
.title-edit { display: flex; gap: 8px; width: 100%; }
.title-edit input { flex: 1; min-width: 0; min-height: 38px; border: 1px solid #c8d3cb; border-radius: 8px; background: #fff; padding: 7px 10px; font-size: 13px; }
@media (max-width: 1100px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .profile-id { flex-wrap: wrap; padding: 18px; gap: 14px; }
  .profile-avatar { width: 52px; height: 52px; font-size: 26px; }
  .profile-name h3 { font-size: 20px; }
  .profile-actions, .profile-actions .btn { width: 100%; }
  .kv-2 { grid-template-columns: minmax(0, 1fr); }
  .kv-row { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .day-strip { gap: 2px; }
  .day-cell { min-height: 8px; border-radius: 2px; }
  .tabs-wrap .tab { flex: 1 1 auto; }
  .title-edit input { font-size: 16px; }
}

/* ───────────── Tablet ───────────── */
@media (max-width: 1280px) {
  .tracking-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tracking-grid-3 > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 1200px) {
  .app { grid-template-columns: 232px minmax(0, 1fr); }
  .main { padding: 26px 26px 52px; }
  .composer { grid-template-columns: minmax(0, 1fr) 285px; gap: 18px; }
  .composer-preview { padding: 21px 15px; }
  .form-panel { padding: 22px; }
  .tracking-grid { grid-template-columns: minmax(0, 1fr); }
  .live-value { font-size: 54px; }
}
@media (max-width: 1060px) {
  .composer { grid-template-columns: minmax(0, 1fr); }
  .composer-preview { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; padding: 23px; }
  .preview-heading, .preview-caption, .composer-preview > h3, .composer-preview > .hint { grid-column: 1 / -1; }
  .preview-caption { margin-bottom: 0; }
  .preview-device { margin-top: 0; }
  .live-band { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .live-facts > div:first-child { border-inline-start: 0; padding-inline-start: 0; }
  .multiples { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}

/* ───────────── Phones and small tablets: the rail becomes a drawer ───────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 7px 12px 7px 6px;
    padding-top: max(7px, env(safe-area-inset-top));
    background: var(--ink);
    color: var(--cream);
  }
  .mobile-bar .icon-btn:focus-visible { outline-color: var(--accent); }
  .mobile-logo { width: 34px; height: 34px; object-fit: contain; }
  .mobile-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 800; }
  .live-pill-compact { min-height: 30px; padding: 5px 11px; background: #12302d; color: #bfe3d8; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(304px, 86vw);
    height: 100%;
    padding-top: max(18px, env(safe-area-inset-top));
    transform: translateX(-102%);
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1), visibility 0s linear 220ms;
    visibility: hidden;
    box-shadow: 12px 0 40px #00000040;
  }
  .app.nav-open .sidebar { transform: none; visibility: visible; transition: transform 220ms cubic-bezier(.2, .8, .2, 1); }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(3, 20, 22, .55); }
  .nav-scrim[hidden] { display: none; }
  .sidebar .nav-close { display: inline-grid; color: #b6cec3; }
  .nav-item { min-height: 46px; font-size: 14px; }
  body.nav-locked { overflow: hidden; }
  .main { padding: 20px 16px 48px; }
  .topbar { align-items: center; margin-bottom: 18px; }
  .topbar h2 { font-size: 22px; }
  .view-description { font-size: 12.5px; margin-top: 4px; }
  .topbar .live-pill { display: none; }
  .topbar-actions .btn { width: 44px; padding: 0; }
  .topbar-actions .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
}

/* Tables become one card per row, every cell labeled with its column. */
@media (max-width: 720px) {
  .table-scroll { overflow: visible; }
  .table, #view-push-history .table, #view-push-scheduled .table, #billing-content .table, #billing-content section:nth-child(2) .table, .table-compact {
    min-width: 0;
    table-layout: auto;
  }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table colgroup { display: none; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .table tr { padding: 14px 16px; border-bottom: 1px solid #e6e9df; }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 5px 0; border: 0; text-align: end; overflow: visible; min-width: 0; }
  .table td::before { content: attr(data-label); flex-shrink: 0; color: var(--text-faint); font-size: 12px; font-weight: 700; text-align: start; }
  .table td:not([data-label])::before, .table td[data-label='']::before { display: none; }
  .table td:not([data-label]) { justify-content: flex-start; }
  .table td:first-child { display: block; text-align: start; padding-bottom: 8px; }
  .table td:first-child::before { display: none; }
  .table td:first-child .cell-main { font-size: 14.5px; white-space: normal; }
  .table td:first-child .cell-sub { white-space: normal; }
  .table td > * { min-width: 0; }
  .table .truncate { white-space: normal; overflow-wrap: anywhere; }
  .table td:last-child:not([data-label]) { padding-top: 10px; }
  .table td:last-child:not([data-label]) .btn, .room-actions .btn { flex: 1; min-height: 44px; }
  .room-actions { width: 100%; }
  .table tbody tr:hover { background: transparent; }
  #billing-content .table td { max-width: none; }

  .live-band { padding: 20px; border-radius: 16px; }
  .live-band::after { font-size: 84px; bottom: -22px; }
  .live-value { font-size: 46px; }
  .live-facts > div { padding: 2px 12px; }
  .live-facts dd { font-size: 22px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-row > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 23px; }
  .kpi-row-flat { gap: 14px 0; }
  .kpi-row-flat .kpi { padding: 0 12px; }
  .kpi-row-flat .kpi:nth-child(odd) { border-inline-start: 0; padding-inline-start: 0; }
  .panel-head { padding: 18px 16px 14px; }
  .panel-body { padding: 0 16px 18px; }
  .panel-title-row { align-items: flex-start; flex-direction: column; gap: 4px; }
  .tracking-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .ret-grid { grid-template-columns: minmax(0, 1fr); }
  .ret-tile { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; }
  .ret-value { grid-row: 1 / 4; grid-column: 2; font-size: 24px; }
  .chart-cols-tall .cols { height: 200px; gap: 3px; }
  .hbars li { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .hbar-track { grid-column: 1 / -1; grid-row: 2; }

  .toolbar { gap: 10px; }
  .toolbar > .tabs, .tabs { width: 100%; }
  .tab { flex: 1; padding-inline: 10px; }
  .search { width: 100%; }
  .filters { width: 100%; }
  .filters .inline-field { flex: 1; min-width: 128px; flex-direction: column; align-items: stretch; gap: 5px; }
  .filters .inline-field input { width: 100%; min-width: 0; }
  .filters select { width: 100%; }
  .toolbar > .btn-primary, .billing-filter .btn { width: 100%; }
  .billing-filter .inline-field, #view-reports .inline-field { width: 100%; flex-direction: column; align-items: stretch; gap: 5px; }
  .billing-filter .inline-field input { width: 100%; }
  .stat-grid:not(.stat-grid-sm), #po-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .appcfg-root { grid-template-columns: minmax(0, 1fr); }
  .appcfg-card { padding: 0 16px 18px; }
  .appcfg-grid { grid-template-columns: minmax(0, 1fr); }

  .form-panel { padding: 20px 16px; }
  .field input, .search, .inline-field input, .inline-field select, .filters select, .form-panel select, .form-panel textarea, .form-panel input:not([type='radio']) { font-size: 16px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .actions .spacer { display: none; }
  .actions .btn-primary { grid-column: 1 / -1; min-height: 48px; }
  .composer-preview { display: block; padding: 20px 16px; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 92dvh; border-radius: 16px 16px 0 0; }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 18px 16px; }
  .modal-foot { padding: 14px 16px max(16px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 12px; }
  .empty { padding: 40px 20px; }
}
@media (max-width: 800px) {
  .login-story { padding: 50px 30px 95px; }
  .login-hero-logo { width: 250px; height: 250px; }
  .login-headline { font-size: 38px; }
  .login-caption { font-size: 13px; }
  .login-form-wrap { padding: 40px 28px; }
}
@media (max-width: 580px) {
  .login-screen { grid-template-columns: minmax(0, 1fr); }
  .login-story { padding: 24px 24px 25px; }
  .login-wordmark { position: static; align-self: flex-start; font-size: 12px; }
  .login-wordmark img { width: 34px; height: 34px; }
  .login-hero-logo { width: 132px; height: 132px; }
  .login-headline { font-size: 32px; margin: 6px 0 4px; }
  .login-caption { font-size: 12px; max-width: 38ch; line-height: 1.7; }
  .login-story-footer { position: static; margin-top: 17px; font-size: 10px; }
  .login-form-wrap { padding: 36px 24px 50px; align-items: flex-start; }
  .login-card { max-width: 400px; gap: 19px; }
  .login-heading h2 { font-size: 25px; }
  .live-facts dt { font-size: 11px; }
}
@media (min-width: 1600px) {
  .main { padding-inline: 48px; }
  .topbar, .view { max-width: 1440px; margin-inline: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
