/* Stage 12: operational hierarchy, touch-first navigation and safe-area spacing. */
:root { --admin-stage-nav-height: 72px; --admin-stage-gap: 12px; }
.admin-header.admin-header-compact { min-height: 60px; background: #101316f7; }
.admin-header-compact .header-actions { gap: 4px; }
.admin-header.admin-header-compact .header-actions .admin-header-link { display:flex; box-sizing:border-box; flex:0 0 44px; width:44px; height:44px; min-width:44px; min-height:44px; padding:0; }
.admin-header-compact .admin-header-brand { color: var(--admin-ink); font-weight: 750; }
.admin-context-strip { padding-block: 5px 0; }
.admin-context-strip .admin-mode-banner summary { font-size: 12px; }
.sidebar-header { min-height: 76px; padding: 14px 18px; }
.sidebar-navigation { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px; gap: 4px; }
.sidebar-navigation .nav-item { min-height: 48px; padding: 10px 13px; border-radius: 11px; }
.sidebar-navigation .admin-command-trigger { display: flex; justify-content: space-between; align-items: center; min-height: 44px; width: 100%; margin-block-start: 8px; }
.sidebar-footer { flex: 0 0 auto; padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
.admin-bottom-nav { display: none; }
.admin-overview { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:var(--admin-stage-gap); margin-block: 0 14px; }
.admin-overview .panel { min-width:0; margin:0; display:flex; flex-direction:column; gap:8px; justify-content:flex-start; }
.admin-overview h2 { font-size: 15px; font-weight: 700; margin:0; }
.admin-overview p { margin:0; color: var(--admin-ink-soft); font-size: 13px; overflow-wrap:anywhere; }
.admin-overview .stat-value,.overview-unavailable { font-size: 26px; font-weight: 700; color: var(--admin-accent-bright); line-height:1.2; font-variant-numeric: tabular-nums; }
.admin-overview button { min-height: 44px; }
#overview-rating-actions:not([hidden]) { display:flex; flex-wrap:wrap; gap:6px; }
.admin-welcome-strip { padding: 12px 16px; margin-block-end: 14px; }
.admin-welcome-strip::after { display:none; }
.page-heading { margin-block-end: 16px; }
.page-heading h1 { font-size: clamp(24px, 3vw, 34px); }
.page-heading p { font-size: 14px; line-height: 1.6; }
.stats-grid .stat-card { min-height: 96px; padding: 14px; }
.admin-product-card,.admin-category-card { border-radius: 12px; box-shadow: none; background: var(--admin-surface); }
.admin-product-card .admin-product-name,.category-admin-name { white-space: normal; overflow-wrap:anywhere; }
.admin-product-info,.category-admin-copy { min-width:0; }
.admin-product-actions .icon-button,.admin-category-actions .icon-button { min-height:44px; min-width:44px; }
.admin-category-card { gap:10px; }
.loyalty-notice { margin-block-end: 14px; color:var(--admin-ink-soft); font-size:14px; }
.loyalty-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.loyalty-card { display:flex; flex-direction:column; gap:8px; margin:0; min-width:0; }
.loyalty-card p,.loyalty-card h2 { margin:0; overflow-wrap:anywhere; }
.loyalty-card p { color:var(--admin-ink-soft); font-size:14px; }
.loyalty-card-heading { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:6px; }
.loyalty-card-heading h2 { font-size:17px; }
.loyalty-badge { font-size:12px; color:var(--admin-accent-bright); }
.loyalty-preview { white-space:pre-wrap; background:var(--admin-surface-raised); border:1px solid var(--admin-line); padding:10px; border-radius:9px; }
.loyalty-actions { display:flex; flex-wrap:wrap; gap:6px; margin-block-start:auto; }
.loyalty-actions button { min-height:44px; flex:1 1 auto; }
#loyalty-form:not([hidden]) { margin-block-end:14px; }
#loyalty-form h2 { margin-block:0 16px; }
#loyalty-form [hidden], #loyalty-form[hidden], #loyalty-add[hidden], #loyalty-connected[hidden],#overview-rating-actions[hidden] { display:none!important; }
#loyalty-status { color:var(--admin-ink-soft); font-size:13px; }
#restaurant-settings-form .form-field input,#restaurant-settings-form .form-field textarea { min-width:0; }
@media (max-width:999px) {
  html { scroll-padding-block-end:calc(var(--admin-stage-nav-height) + env(safe-area-inset-bottom) + 20px); }
  .admin-main { padding-block-end:calc(var(--admin-stage-nav-height) + env(safe-area-inset-bottom) + 18px); }
  .admin-header-compact .mobile-menu-button { display:flex; }
  .admin-bottom-nav { position:fixed; left:max(8px, env(safe-area-inset-left)); right:max(8px, env(safe-area-inset-right)); inset-block-end: max(8px, env(safe-area-inset-bottom)); z-index: 700; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); direction:ltr; gap:3px; padding:5px; min-height:var(--admin-stage-nav-height); background:#17191df7; border:1px solid var(--admin-line-strong); border-radius:20px; box-shadow:0 8px 32px #0008; }
  .admin-bottom-nav button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; min-width:0; min-height:60px; border:0; border-radius:14px; background:transparent; color:var(--admin-ink-soft); padding:4px 1px; font-family:inherit; transition: background .18s ease,color .18s ease,transform .15s ease; cursor:pointer; }
  .admin-bottom-nav button:active { transform:scale(.96); }
  .admin-bottom-nav button.is-active { background:#382f22; color:#f0ce93; }
  .admin-bottom-nav button span { font-size:11px; line-height:1.25; text-align:center; overflow-wrap:anywhere; }
  .admin-bottom-nav svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }
  .admin-overview { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .overview-revenue { grid-column:1/-1; }
  .admin-content { padding-block-end:22px; }
  .admin-footer { padding-block-end:16px; }
  body:has(.admin-modal.is-open) .admin-bottom-nav { visibility:hidden; }
}
@media(max-width:600px) {
  .loyalty-list { grid-template-columns:minmax(0,1fr); }
  .admin-overview .panel { padding:12px; }
  .admin-product-card { padding:10px; gap:8px; }
  .admin-product-actions { grid-column:1/-1; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); width:100%; gap:5px; }
  .admin-product-actions .icon-button { min-width:0; width:100%; }
  .admin-category-card { flex-wrap:wrap; }
  .category-admin-info { flex:1 1 140px; }
  .admin-category-actions { flex:0 0 auto; }
  .admin-bottom-nav button span { font-size:11px; }
}
@media(prefers-reduced-motion:reduce) { .admin-bottom-nav button { transition:none; } }

.admin-category-actions { flex-wrap:wrap; }
.admin-category-actions button:disabled { opacity:.4; cursor:not-allowed; }

/* Advanced admin forms: grouped fields, visible validation, inert preview. */
.settings-group { min-inline-size:0; margin:0 0 20px; padding:16px; border:1px solid var(--admin-line); border-radius:12px; }
.settings-group legend { font-size:15px; font-weight:700; padding-inline:6px; color:var(--admin-ink); }
.settings-validation { margin:0; color:#ffb5a8; font-size:14px; overflow-wrap:anywhere; }
.settings-validation:empty { display:none; }
#restaurant-settings-form [aria-invalid="true"] { outline:2px solid #ffb5a8; outline-offset:2px; }
#settings-reset { min-height:44px; }
.review-comment { white-space:pre-wrap; overflow-wrap:anywhere; border-inline-start:2px solid var(--admin-accent-bright); padding-inline-start:10px; }
.sms-preview-panel { padding:12px; background:var(--admin-surface-raised); border-radius:10px; }
.sms-preview-panel h3,.sms-preview-panel p { margin:0; overflow-wrap:anywhere; }
.sms-preview-panel small { color:var(--admin-ink-soft); font-variant-numeric:tabular-nums; }
.loyalty-actions button:disabled,#loyalty-add:disabled { opacity:.5; cursor:not-allowed; }
@media(max-width:600px){.settings-group { padding:10px; } #restaurant-settings-form .form-actions { flex-wrap:wrap; } #restaurant-settings-form .form-actions button { flex:1 1 100%; }}

.overview-order-breakdown { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0; }
.overview-order-breakdown[hidden],.review-comment[hidden] { display:none!important; }
.overview-order-breakdown div { min-width:0; padding:8px; background:var(--admin-surface-raised); border-radius:8px; }
.overview-order-breakdown dt { color:var(--admin-ink-soft); font-size:12px; overflow-wrap:anywhere; }
.overview-order-breakdown dd { margin:0; font-size:18px; font-weight:650; }
.sms-preview-text { white-space:pre-wrap; background:var(--admin-surface); border:1px solid var(--admin-line); padding:10px; border-radius:9px; }
.loyalty-sms-readiness { margin-block-end:14px; }
.loyalty-sms-readiness h2 { font-size:16px; }
.loyalty-sms-readiness p { font-size:14px; color:var(--admin-ink-soft); overflow-wrap:anywhere; }
#product-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
#product-form > .form-field:first-of-type,#product-form > .form-field.full,#product-form > .checkbox-row,#product-form > .form-actions { grid-column:1/-1; }
#product-form .form-field > span { font-size:13px; }
#product-form .form-field { margin:0; min-inline-size:0; }
#product-form .checkbox-row,#product-form .form-actions { margin-block-start:4px; }
@media(max-width:440px){ #product-form { grid-template-columns:minmax(0,1fr); gap:12px; } #product-form .image-upload-control { min-height:100px; padding:10px; } }

/* R12 — sample revenue, accessible data table and responsive native controls. */
.admin-overview {grid-template-columns:repeat(2,minmax(0,1fr));}
.admin-overview .overview-revenue {grid-column:1/-1;gap:14px;}
.revenue-heading,.revenue-filters {display:flex;align-items:flex-end;justify-content:space-between;flex-wrap:wrap;gap:10px;}
.revenue-heading>div {min-width:0;flex:1 1 220px;}
.revenue-filters label,.revenue-detail-label {display:grid;gap:6px;min-width:0;font-size:13px;}
.revenue-filters label {flex:1 1 130px;}
.overview-revenue select {min-height:44px;width:100%;min-width:0;font:inherit;font-size:16px;color:var(--admin-ink);background:var(--admin-surface-raised);border:1px solid var(--admin-line-strong);border-radius:10px;padding:8px;}
.overview-revenue [hidden] {display:none!important;}
#revenue-content {display:grid;grid-template-columns:minmax(0,1fr);gap:12px;min-width:0;}
.revenue-kpis {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:0;}
.revenue-kpis>div {min-width:0;padding:12px;background:var(--admin-surface-raised);border:1px solid var(--admin-line);border-radius:12px;}
.revenue-kpis dt {font-size:12px;color:var(--admin-ink-soft);overflow-wrap:anywhere;}
.revenue-kpis dd {margin:6px 0 0;font-weight:700;font-size:clamp(15px,2vw,23px);font-variant-numeric:tabular-nums;overflow-wrap:anywhere;}
#revenue-previous {font-size:12px;font-weight:400;color:var(--admin-ink-soft);}
.revenue-chart {min-width:0;border:1px solid var(--admin-line);background:var(--admin-surface-raised);border-radius:14px;padding:12px;display:grid;gap:8px;}
#revenue-axis-max,.revenue-axis {font-size:12px;color:var(--admin-ink-soft);overflow-wrap:anywhere;}
#revenue-bars {display:flex;align-items:flex-end;height:clamp(110px,18vw,190px);gap:clamp(2px,.6vw,7px);border-bottom:1px solid var(--admin-line-strong);background:repeating-linear-gradient(to top,transparent 0,transparent calc(25% - 1px),var(--admin-line) calc(25% - 1px),var(--admin-line) 25%);}
.revenue-bar {flex:1;min-width:0;height:var(--bar-height);background:#b98d53;border-radius:5px 5px 0 0;}
.revenue-bar.is-selected {background:#f1d39a;}
.revenue-axis {display:flex;justify-content:space-between;gap:8px;}
.revenue-axis span:last-child {text-align:right;}
.revenue-table {min-inline-size:0;}
.revenue-table summary {cursor:pointer;min-height:44px;padding:10px 0;font-size:13px;font-weight:650;}
.revenue-table-scroll {overflow-x:auto;max-width:100%;}
.revenue-table table {width:100%;border-collapse:collapse;font-size:13px;text-align:start;}
.revenue-table th,.revenue-table td {padding:8px;border-block-end:1px solid var(--admin-line);text-align:start;white-space:nowrap;}
.overview-revenue :is(select,summary,button,[tabindex]):focus-visible {outline:2px solid var(--admin-accent-bright);outline-offset:2px;}
@media(max-width:650px){.revenue-kpis {grid-template-columns:repeat(2,minmax(0,1fr));}.revenue-kpis>div{padding:9px;}.revenue-heading button{flex:1 1 auto;}}

/* R13 — clearer workspace hierarchy and a legible, presentation-ready revenue panel. */
.admin-main {background:radial-gradient(circle at 50% 0,#be8d4420,transparent 30%),#090a0b;}
.admin-content {width:min(100%,1500px);margin-inline:auto;}
.sidebar {border-inline-start:1px solid #d6ae7028;box-shadow:0 0 36px #0005;}
.sidebar-navigation .nav-item {border:1px solid transparent;}
.sidebar-navigation .nav-item:hover {border-color:#d6ae7030;background:#d6ae700a;}
.sidebar-navigation .nav-item.active {border-color:#d6ae7050;background:linear-gradient(100deg,#d6ae7026,#d6ae700b);box-shadow:inset 3px 0 0 #d6ae70;}
html[dir="rtl"] .sidebar-navigation .nav-item.active {box-shadow:inset -3px 0 0 #d6ae70;}
.panel,.stat-card,.admin-welcome-strip {border-color:#d6ae7029;background:linear-gradient(145deg,#15191d,#101316);box-shadow:0 12px 30px #0002;}
.admin-overview .overview-revenue {padding:clamp(16px,2vw,24px);border-color:#d6ae7040;background:linear-gradient(150deg,#1b1a17,#111519 55%);}
.revenue-heading {align-items:center;padding-block-end:12px;border-block-end:1px solid var(--admin-line);}
.revenue-heading h2 {font-size:clamp(19px,2.1vw,25px);}
.revenue-heading p {max-width:64ch;line-height:1.65;}
.revenue-filters {padding:12px;border:1px solid var(--admin-line);border-radius:14px;background:#0b0e11;}
.revenue-kpis {gap:10px;}
.revenue-kpis>div {position:relative;overflow:hidden;padding:14px 15px;border-radius:15px;background:linear-gradient(145deg,#1b2025,#12161a);}
.revenue-kpis>div::before {content:"";position:absolute;inset-block:0;inset-inline-start:0;width:3px;background:#d6ae70;opacity:.72;}
.revenue-kpis dt {line-height:1.5;}
.revenue-kpis dd {color:#f4d296;line-height:1.25;}
.revenue-chart {padding:18px 16px 12px;border-radius:18px;background:linear-gradient(180deg,#11161a,#0c0f12);box-shadow:inset 0 1px 0 #fff1;}
#revenue-bars {height:clamp(170px,22vw,260px);gap:clamp(4px,.75vw,10px);border-bottom-color:#d6ae7060;background:repeating-linear-gradient(to top,transparent 0,transparent calc(25% - 1px),#ffffff0d calc(25% - 1px),#ffffff0d 25%);}
.revenue-bar {min-width:3px;background:linear-gradient(180deg,#d4a963,#93652f);border-radius:8px 8px 2px 2px;box-shadow:0 -4px 12px #d6ae7020;transition:filter .18s ease,transform .18s ease;}
.revenue-bar.is-selected {background:linear-gradient(180deg,#ffe0a7,#c18a45);filter:drop-shadow(0 0 7px #d6ae7060);}
.revenue-detail-label {padding:12px;border-radius:13px;background:#ffffff05;}
#revenue-detail,#revenue-excluded {margin:0;color:var(--admin-ink-soft);line-height:1.6;}
.revenue-table {border-block-start:1px solid var(--admin-line);}
.revenue-table summary {color:var(--admin-accent-bright);}
.admin-app :is(input,select,textarea,button):focus-visible {outline:2px solid var(--admin-accent-bright);outline-offset:3px;}
@media(max-width:700px) {
  .admin-content {padding-inline:12px;}
  .admin-overview .overview-revenue {padding:14px;}
  .revenue-chart {padding-inline:10px;}
  #revenue-bars {height:180px;gap:3px;}
}
@media(max-width:390px) {.revenue-kpis{grid-template-columns:minmax(0,1fr)}.revenue-heading>button{width:100%}}
@media(prefers-reduced-motion:reduce) {.revenue-bar{transition:none}}
