/* BRAIZONE application styles. Every value comes from tokens.css; themes only swap tokens. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  scroll-padding-top: var(--space-6);
}
body {
  margin: 0;
  min-height: 100dvh;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  background: var(--bg);
  color: var(--text);
}
/* Discreet orbital motif: two hairline orbits behind the workspace. */
body::before, body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border: 1px solid var(--orbit);
  border-radius: 50%;
}
body::before { width: 1180px; height: 440px; top: -210px; right: -420px; transform: rotate(-16deg); }
body::after { width: 760px; height: 280px; top: -120px; right: -260px; transform: rotate(-16deg); opacity: 0.7; }
#app { position: relative; z-index: 1; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--text-2xl); line-height: var(--leading-tight); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-display); color: var(--text); }
h2 { font-size: var(--text-lg); line-height: var(--leading-snug); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); color: var(--text); }
h3 { font-size: var(--text-md); line-height: var(--leading-snug); font-weight: var(--weight-semibold); color: var(--text); }
p { color: var(--text-secondary); }
small { font-size: var(--text-xs); }
dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-small); }
.main:focus, .main:focus-visible { outline: none; box-shadow: none; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
button, a, [role="button"], summary, label:has(> input[type="radio"]), label:has(> input[type="checkbox"]) { touch-action: manipulation; }
button, [role="button"], summary, .nav a, .mobile-nav a, .chip, .badge, .status-pill { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.num, .kpi-value, .stat-value, .summary-strip strong, .report-row strong, .sold, .customer-stats dd, .product-facts dd, .stock-line strong { font-variant-numeric: tabular-nums; }
/* Amounts and counts never break mid-number. */
.summary-strip strong, .customer-stats dd, .report-row strong, .sold, .stock-line strong, .order-stats strong, .status-count strong, .product-card-price, .ai-after, .history-line strong { overflow-wrap: normal; word-break: keep-all; white-space: nowrap; }
.clamp-2, .top-product strong, .activity p, .data-table .cell-primary strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }

/* ---------- Motion primitives ---------- */
:root { --enter-distance: 6px; --sheet-from: translateY(100%); }
@keyframes enter { from { opacity: 0; transform: translateY(var(--enter-distance)); } to { opacity: 1; transform: none; } }
@keyframes enter-scale { from { opacity: 0; transform: scale(0.97) translateY(var(--enter-distance)); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes rise { from { transform: scaleY(0.04); } to { transform: none; } }
@keyframes pulse-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes orbit-spin { to { transform: rotate(360deg); } }

/* ---------- Skip link ---------- */
.skip-link { position: fixed; top: var(--space-3); left: var(--space-3); z-index: var(--z-skip); padding: var(--space-2) var(--space-4); border-radius: var(--radius-medium); background: var(--accent-strong); color: var(--accent-contrast); font-weight: var(--weight-semibold); transform: translateY(-160%); transition: transform var(--duration-base) var(--ease-out); }
.skip-link:focus { transform: none; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: var(--space-3); min-height: var(--touch); border-radius: var(--radius-medium); }
.brand strong { font-size: var(--text-md); font-weight: var(--weight-bold); letter-spacing: 0.16em; color: var(--text); }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--surface-elevated); box-shadow: inset 0 0 0 1px var(--border-strong), var(--highlight); }
.brand-mark svg { width: 26px; height: 26px; overflow: visible; }
.brand-orbit { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.brand-core { fill: var(--text); }
.brand-satellite { fill: var(--success); }
.env-badge { margin-left: auto; padding: 2px 7px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-text); font-size: 10px; font-weight: var(--weight-bold); letter-spacing: var(--tracking-label); }

/* ---------- Sidebar ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); height: 100dvh; display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-5) var(--space-3) var(--space-4); background: var(--bg-secondary); box-shadow: inset -1px 0 0 var(--border); overflow-y: auto; overscroll-behavior: contain; z-index: var(--z-sidebar); scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.sidebar-top { min-width: 0; display: grid; gap: var(--space-5); padding: 0 var(--space-2); }
.org-switcher { display: grid; gap: var(--space-2); }
.org-label { font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); padding-left: var(--space-1); }
.org-picker { position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2); border-radius: var(--radius-medium); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border), var(--highlight); transition: box-shadow var(--duration-fast) var(--ease-color); }
.org-picker:focus-within { box-shadow: var(--focus-ring); }
.org-avatar { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: 0.02em; }
.org-picker select { flex: 1 1 0; width: 0; min-width: 0; appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--text); font-weight: var(--weight-semibold); font-size: var(--text-sm); padding: var(--space-2) var(--space-5) var(--space-2) 0; cursor: pointer; text-overflow: ellipsis; }
.org-picker select:focus-visible { box-shadow: none; }
.org-caret { position: absolute; right: var(--space-3); pointer-events: none; color: var(--muted); }
.org-caret .icon { width: 14px; height: 14px; transform: rotate(90deg); }
select option { background: var(--surface-elevated); color: var(--text); }
.nav { display: grid; gap: var(--space-5); }
.nav-group { display: grid; gap: 2px; }
.nav-group-label { padding: 0 var(--space-3) var(--space-2); font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); }
.nav a { position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-medium); color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); transition: background-color var(--duration-fast) var(--ease-color), color var(--duration-fast) var(--ease-color); }
.nav-icon { display: grid; place-items: center; color: var(--muted); transition: color var(--duration-fast) var(--ease-color); }
.nav-icon .icon { width: 18px; height: 18px; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a:active { background: var(--surface-hover); }
.nav a.active { background: var(--nav-active, var(--accent-soft)); color: var(--nav-active-text, var(--text)); font-weight: var(--weight-semibold); }
.nav a.active .nav-icon { color: var(--nav-active-text, var(--accent)); }
.nav a.active .ai-tag { background: var(--nav-active-text, var(--accent-soft)); color: var(--nav-active, var(--accent-text)); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.ai-tag { padding: 1px 6px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-text); font-size: 10px; font-weight: var(--weight-bold); letter-spacing: 0.04em; }
.side-foot { margin-top: auto; display: grid; gap: var(--space-3); padding: var(--space-3) var(--space-2) 0; box-shadow: 0 -1px 0 var(--border); }
.setup-link { display: flex; align-items: center; gap: var(--space-3); min-height: 48px; padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2); border-radius: var(--radius-medium); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-semibold); transition: background-color var(--duration-fast) var(--ease-color); }
.setup-link > span:nth-child(2) { flex: 1; min-width: 0; }
.setup-link small { display: block; color: var(--muted); font-weight: var(--weight-regular); font-size: var(--text-2xs); margin-top: 1px; }
.setup-link > .icon { width: 14px; height: 14px; color: var(--muted); }
.setup-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); }
.setup-icon .icon { width: 16px; height: 16px; }
.setup-link.active { box-shadow: inset 0 0 0 1px var(--accent); }
.side-note { font-size: var(--text-xs); color: var(--muted); padding: 0 var(--space-1); }
.side-user { display: flex; align-items: center; gap: var(--space-3); min-width: 0; padding: var(--space-1); }
.avatar { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--radius-pill); background: var(--surface-elevated); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text); font-size: var(--text-xs); font-weight: var(--weight-bold); }
.side-user-copy { min-width: 0; display: grid; }
.side-user-copy strong { font-size: var(--text-sm); font-weight: var(--weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-copy small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot > .button { width: 100%; }

/* ---------- App body ---------- */
.app-body { margin-left: var(--sidebar); min-height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--space-7) var(--gutter) var(--space-8); min-width: 0; }
.main > * { min-width: 0; }
.app-footer { display: flex; justify-content: space-between; gap: var(--space-4); max-width: var(--content-max); width: 100%; margin: 0 auto; padding: var(--space-5) var(--gutter) var(--space-6); color: var(--muted); font-size: var(--text-2xs); }
.app-footer span:first-child { font-weight: var(--weight-bold); letter-spacing: 0.16em; }
.demo-banner { position: sticky; top: 0; z-index: var(--z-header); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 40px; padding: var(--space-2) var(--gutter); background: var(--material); -webkit-backdrop-filter: saturate(140%) blur(14px); backdrop-filter: saturate(140%) blur(14px); box-shadow: 0 1px 0 var(--border); color: var(--text-secondary); font-size: var(--text-xs); }
.demo-banner > span { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.demo-banner strong { color: var(--text); letter-spacing: var(--tracking-label); }
.demo-banner a { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--accent-text); font-weight: var(--weight-semibold); white-space: nowrap; min-height: 32px; }
.demo-banner .icon { width: 14px; height: 14px; }
.status-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.demo-banner .status-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mobile-header, .mobile-nav { display: none; }
.mobile-menu[hidden] { display: none; }
.sheet-scrim { display: none; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-6); }
.page-title { min-width: 0; display: grid; gap: var(--space-2); }
.page-header h1 { overflow-wrap: anywhere; }
.page-sub, .page-header .page-title > p:not(.eyebrow) { color: var(--text-secondary); font-size: var(--text-md); }
.eyebrow { display: block; font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); }
.home-header .eyebrow { text-transform: none; letter-spacing: 0; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.home-header .eyebrow::first-letter { text-transform: uppercase; }
.greeting-dot { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.compact { align-items: flex-start; }
.subhead { font-size: var(--text-sm); color: var(--text-secondary); font-weight: var(--weight-semibold); margin: var(--space-5) 0 var(--space-2); }
.helper, .integration-disclaimer { font-size: var(--text-sm); color: var(--muted); line-height: var(--leading-normal); }
.helper { padding: var(--space-2) 0; }
.muted-text { display: block; font-size: var(--text-xs); color: var(--muted); }
.page-note { margin-top: var(--space-5); }

/* ---------- Buttons ---------- */
.button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-medium); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.2; white-space: nowrap; text-align: center; transition: transform var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-color), box-shadow var(--duration-fast) var(--ease-color), color var(--duration-fast) var(--ease-color); }
.button .icon { width: 16px; height: 16px; }
.button:active:not(:disabled) { transform: scale(var(--press-scale)); }
.button.primary { background: var(--accent-strong); color: var(--accent-contrast); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 14px -4px var(--accent-glow); }
.button.secondary { background: var(--surface-elevated); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong), var(--highlight); }
.button.ghost { background: transparent; color: var(--accent-text); }
.button.block { width: 100%; }
.button:disabled { box-shadow: none; }
.icon-button { width: var(--touch); height: var(--touch); display: inline-grid; place-items: center; border: 0; border-radius: var(--radius-medium); background: transparent; color: var(--text-secondary); transition: background-color var(--duration-fast) var(--ease-color), transform var(--duration-fast) var(--ease-out); }
.icon-button:active:not(:disabled) { transform: scale(0.94); background: var(--surface-hover); }

/* ---------- Badges & pills ---------- */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 22px; padding: 0 var(--space-2); border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-text); font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: 0.02em; white-space: nowrap; flex-shrink: 0; }
.badge.muted { background: var(--surface-inset); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border); }
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 var(--space-3); border-radius: var(--radius-pill); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); color: var(--text-secondary); font-size: var(--text-xs); white-space: nowrap; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--surface-inset); color: var(--text-secondary); font-size: var(--text-2xs); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.count-pill.has-items { background: var(--warning-soft); color: var(--warning); }
.status-pill { --tone: var(--text-secondary); --tone-soft: var(--surface-inset); display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 var(--space-3) 0 var(--space-2); border-radius: var(--radius-pill); background: var(--tone-soft); color: var(--tone); font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap; flex-shrink: 0; }
.status-pill .icon { width: 15px; height: 15px; stroke-width: 1.8; }
.status-pill .status-dot { margin-left: 3px; }
.tone-success, .tone-available { --tone: var(--success); --tone-soft: var(--success-soft); }
.tone-available { --tone: var(--stock-available); --tone-soft: var(--stock-available-soft); }
.tone-warning { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.tone-low { --tone: var(--stock-low); --tone-soft: var(--stock-low-soft); }
.tone-out { --tone: var(--stock-out); --tone-soft: var(--stock-out-soft); }
.tone-danger { --tone: var(--danger); --tone-soft: var(--danger-soft); }
.tone-info { --tone: var(--info); --tone-soft: var(--info-soft); }
.tone-accent { --tone: var(--accent-text); --tone-soft: var(--accent-soft); }
.tone-neutral { --tone: var(--text-secondary); --tone-soft: var(--surface-inset); }

/* ---------- Cards ---------- */
.card { position: relative; background: var(--surface); border-radius: var(--radius-large); box-shadow: inset 0 0 0 1px var(--border), var(--highlight), var(--shadow-sm); overflow-wrap: anywhere; }
.section-card { padding: var(--space-6); }
.section-card + .section-card { margin-top: var(--space-4); }
.settings-body > .card, .settings-pair > .card, .split-main > .card, .action-row > .card { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.section-head h2 { min-width: 0; }
.section-head > a { display: inline-flex; align-items: center; gap: 2px; min-height: 32px; color: var(--accent-text); font-size: var(--text-sm); font-weight: var(--weight-semibold); white-space: nowrap; }
.section-head > a .icon { width: 15px; height: 15px; }

/* ---------- KPI ---------- */
.grid-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.kpi { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5); min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.kpi-icon { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); }
.kpi-icon .icon { width: 16px; height: 16px; }
.kpi-title { flex: 1; min-width: 0; color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.kpi-go { color: var(--muted); transition: transform var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-color); }
.kpi-go .icon { width: 16px; height: 16px; }
.kpi-value, .stat-value { display: block; margin-top: var(--space-2); font-size: 1.75rem; line-height: var(--leading-tight); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); color: var(--text); overflow-wrap: anywhere; }
.kpi-detail { color: var(--muted); font-size: var(--text-xs); }
.kpi-link { transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-color), background-color var(--duration-fast) var(--ease-color); }
.kpi-link:active { transform: scale(0.985); }

/* ---------- Home ---------- */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: var(--gap); }
.hero-sales { padding: var(--space-6); display: flex; flex-direction: column; min-width: 0; }
.hero-sales-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.hero-link { display: inline-flex; align-items: center; gap: 2px; min-height: 32px; color: var(--accent-text); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.hero-link .icon { width: 15px; height: 15px; }
.hero-sales .kpi-value { font-size: var(--text-display); letter-spacing: var(--tracking-display); font-weight: var(--weight-semibold); margin-top: var(--space-4); }
.hero-sales > .kpi-detail { margin-top: var(--space-1); }
.chart-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-6); color: var(--muted); font-size: var(--text-xs); }
.chart-summary strong { color: var(--text); font-size: var(--text-md); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
/* Sales chart: fluid SVG (non-scaling strokes) with HTML points, labels and tooltip placed by percentage. The plot keeps
   a small inset so the end points and the today marker stay inside the card at every width. */
.chart { --chart-h: 180px; --y-gutter: 52px; position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: var(--space-4) 0 0; border-radius: var(--radius-medium); outline: none; }
.chart:focus-visible { box-shadow: var(--focus-ring); }
.chart-plot { position: relative; display: grid; grid-template-columns: var(--y-gutter) minmax(0, 1fr); flex: 1 1 auto; min-height: var(--chart-h); }
.chart-y { position: relative; margin: 8px 0; color: var(--muted); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; }
.chart-y span { position: absolute; top: var(--y); left: 0; transform: translateY(-50%); white-space: nowrap; }
.chart-canvas { position: relative; margin: 8px 8px 8px 0; touch-action: pan-y; cursor: crosshair; }
.chart.is-empty .chart-canvas { cursor: default; }
.chart svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.grid-line { fill: none; stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-area { fill: url(#weekly-area-fill); }
.chart-stop-top { stop-color: var(--chart); stop-opacity: 0.22; }
.chart-stop-bottom { stop-color: var(--chart); stop-opacity: 0; }
.chart-line { fill: none; stroke: var(--chart); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw 560ms var(--ease-out) both; }
.chart-point { position: absolute; left: var(--x); top: var(--y); width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--chart); pointer-events: none; transition: transform var(--duration-fast, 140ms) var(--ease-out); }
.chart.is-dense .chart-point { width: 6px; height: 6px; margin: -3px 0 0 -3px; box-shadow: inset 0 0 0 1.5px var(--chart); }
.chart-point.is-today, .chart.is-dense .chart-point.is-today { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--chart); box-shadow: 0 0 0 3px var(--surface); }
.chart-point.is-active { transform: scale(1.5); }
.chart-marker { position: absolute; top: 0; bottom: 0; left: var(--x, 0); width: 1px; background: var(--border-strong); opacity: 0; pointer-events: none; transition: opacity var(--duration-fast, 140ms) var(--ease-out); }
.chart-tip { position: absolute; left: var(--x, 0); top: var(--y, 0); z-index: 2; padding: 6px 10px; border-radius: var(--radius-small); background: var(--surface-elevated); box-shadow: var(--shadow-md), inset 0 0 0 1px var(--border-strong); color: var(--text); font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, calc(-100% - 12px)); transition: opacity var(--duration-fast, 140ms) var(--ease-out); }
.chart-tip[data-side="start"] { transform: translate(-8px, calc(-100% - 12px)); }
.chart-tip[data-side="end"] { transform: translate(calc(-100% + 8px), calc(-100% - 12px)); }
.chart.is-inspecting .chart-tip, .chart.is-inspecting .chart-marker { opacity: 1; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--text-secondary); font-size: var(--text-sm); }
.chart-labels { position: relative; height: 1.5em; margin: 0 8px 0 var(--y-gutter); color: var(--muted); font-size: var(--text-2xs); }
.chart-labels span { position: absolute; left: var(--x); transform: translateX(-50%); white-space: nowrap; }
.chart-labels span.is-start { transform: none; }
.chart-labels span.is-end { transform: translateX(-100%); }
.chart-labels span.is-today { color: var(--text); font-weight: var(--weight-semibold); }
.hero-side { display: grid; gap: var(--gap); grid-template-rows: auto 1fr; min-width: 0; }
.hero-side .kpi-value { font-size: var(--text-3xl); letter-spacing: var(--tracking-display); }
.money-plan { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.money-plan .kpi-top .status-pill { margin-left: auto; }
.money-split { display: grid; gap: var(--space-2); }
.money-split > div { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-medium); background: var(--surface-inset); color: var(--text-secondary); font-size: var(--text-sm); }
.money-split b { width: 64px; height: 8px; border-radius: var(--radius-pill); background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 10px); flex-shrink: 0; }
.home-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: var(--gap); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: var(--gap); margin-top: var(--gap); align-items: start; }
.bottom-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--gap); margin-top: var(--gap); align-items: start; }
.bottom-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.home-grid > .section-card, .bottom-grid > .section-card { margin-top: 0; }
.home-hero > *, .home-kpis > * { animation: enter 260ms var(--ease-out) both; }
.home-hero > :nth-child(2), .home-kpis > :nth-child(1) { animation-delay: 40ms; }
.home-kpis > :nth-child(2) { animation-delay: 80ms; }
.home-kpis > :nth-child(3) { animation-delay: 120ms; }
.alert-list { display: grid; gap: var(--space-2); }
.alert { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); transition: background-color var(--duration-fast) var(--ease-color), transform var(--duration-fast) var(--ease-out); }
.alert:active { transform: scale(0.99); }
.alert > div { flex: 1; min-width: 0; }
.alert > .icon { width: 16px; height: 16px; color: var(--muted); }
.alert strong { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.alert p { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }
.alert-icon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--tone-soft); color: var(--tone); }
.alert-icon .icon { width: 18px; height: 18px; }
.ai-prompt-card { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); overflow: hidden; background: radial-gradient(120% 90% at 100% 0%, var(--accent-soft), transparent 60%), var(--surface); }
.ai-prompt-card h2 { font-size: var(--text-xl); letter-spacing: var(--tracking-display); }
.ai-prompt-card p { max-width: 34ch; }
.ai-prompt-card .button { margin-top: var(--space-3); }
.ai-prompt-card small { color: var(--muted); font-size: var(--text-xs); }
.ai-orbit { position: relative; width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: var(--space-2); color: var(--accent); }
.ai-orbit .icon { width: 26px; height: 26px; }
.ai-orbit > span { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--border-strong); }
.ai-orbit > span + span { inset: -10px; box-shadow: inset 0 0 0 1px var(--orbit); }
.ai-orbit.large { width: 72px; height: 72px; }
.ai-orbit.large .icon { width: 34px; height: 34px; }
.top-products, .activity-list { display: grid; }
.top-product { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; box-shadow: 0 -1px 0 var(--border); }
.top-product:first-child { box-shadow: none; padding-top: 0; }
.rank { width: 24px; height: 24px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--radius-pill); background: var(--surface-inset); color: var(--text-secondary); font-size: var(--text-2xs); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.top-product-copy { flex: 1; min-width: 0; display: grid; }
.top-product strong { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.top-product small { color: var(--muted); }
.sold { text-align: right; font-size: var(--text-md); font-weight: var(--weight-semibold); }
.sold small { display: block; color: var(--muted); font-weight: var(--weight-regular); }
.activity { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) 0; box-shadow: 0 -1px 0 var(--border); }
.activity:first-child { box-shadow: none; padding-top: 0; }
.activity > div { flex: 1; min-width: 0; }
.activity-dot { width: 8px; height: 8px; margin-top: 6px; flex-shrink: 0; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.activity strong { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.activity p { font-size: var(--text-xs); color: var(--muted); }
.activity time { flex-shrink: 0; color: var(--muted); font-size: var(--text-2xs); white-space: nowrap; }
.automation-preview { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; box-shadow: 0 -1px 0 var(--border); font-size: var(--text-sm); }
.automation-preview:first-of-type { box-shadow: none; padding-top: 0; }
.automation-preview + .muted-text, .section-card > .muted-text { margin-top: var(--space-3); }

/* ---------- Empty & loading ---------- */
.empty-state { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-7) var(--space-5); text-align: center; color: var(--muted); }
.empty-state h3 { font-size: var(--text-md); }
.empty-state p { max-width: 38ch; font-size: var(--text-sm); color: var(--muted); }
.empty-orbit { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent-soft) 40%, transparent); margin-bottom: var(--space-2); }
.empty-orbit .icon { width: 22px; height: 22px; }
.main > .empty-state { max-width: var(--content-narrow); margin: var(--space-8) auto var(--space-4); background: var(--surface); border-radius: var(--radius-large); box-shadow: inset 0 0 0 1px var(--border); }
.main > .empty-state + .button { display: flex; margin: 0 auto; }
.empty-business { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.empty-business .empty-orbit { width: 36px; height: 36px; margin: 0; flex-shrink: 0; box-shadow: none; }
.empty-business .empty-orbit .icon { width: 18px; height: 18px; }
.empty-business p { color: var(--text-secondary); font-size: var(--text-sm); }
.loading-state { display: flex; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-9) var(--space-5) var(--space-4); color: var(--muted); font-size: var(--text-sm); flex-wrap: wrap; }
.loading-state::after { content: ""; flex-basis: 100%; height: 180px; max-width: 920px; margin: var(--space-5) auto 0; border-radius: var(--radius-large); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-hover) 50%, var(--surface) 70%); background-size: 250% 100%; animation: shimmer 1.1s linear infinite; box-shadow: inset 0 0 0 1px var(--border); }
.loading-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse-dot 1s ease-in-out infinite; }

/* ---------- Forms ---------- */
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.field-grid.single { grid-template-columns: minmax(0, 1fr); }
.field-grid label, .filter-row label, .order-status-form label, .business-fields label, .tenant-invite label { display: grid; gap: 6px; min-width: 0; color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.field-grid input:not([type="radio"]):not([type="checkbox"]), .field-grid select, .filter-row input, .filter-row select, .order-status-form select, .setup-panel input:not([type="checkbox"]):not([type="radio"]), .setup-panel textarea, .mobile-menu select, .tenant-invite input, .business-fields input, .setup-form input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%; min-width: 0; min-height: var(--touch); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-medium); background: var(--surface-inset); color: var(--text); font-size: var(--text-base); box-shadow: inset 0 0 0 1px var(--border-strong); transition: box-shadow var(--duration-fast) var(--ease-color), background-color var(--duration-fast) var(--ease-color);
}
.setup-panel textarea { padding: var(--space-3); line-height: var(--leading-relaxed); resize: vertical; }
select { cursor: pointer; }
.field-grid select, .filter-row select, .order-status-form select, .mobile-menu select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
input[readonly] { color: var(--text-secondary); background: var(--surface-subtle); }
input:disabled, select:disabled { opacity: 0.55; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); border-radius: var(--radius-medium); }
input[type="date"] { color-scheme: inherit; }
input, select, textarea { accent-color: var(--accent); }
.form-error, .inline-error { color: var(--danger); font-size: var(--text-sm); }
.form-error:empty, .inline-error:empty { display: none; }
.form-error { margin-top: var(--space-3); overflow-wrap: anywhere; }
.inline-error { margin-top: var(--space-2); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-5); }
.business-form { padding: var(--space-6); }
.form-head { display: grid; gap: var(--space-1); margin-bottom: var(--space-5); }
.form-head p { font-size: var(--text-sm); }
.business-feedback:empty { display: none; }
.business-feedback:not(:empty) { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-medium); background: var(--success-soft); color: var(--text); font-size: var(--text-sm); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success) 30%, transparent); animation: enter 220ms var(--ease-out) both; }
.business-feedback:not(:empty)::before { content: ""; width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--success); }
.sale-preview { margin-top: var(--space-3); padding: var(--space-4); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); color: var(--text-secondary); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.filter-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); margin-bottom: var(--space-5); }
.input-icon { position: relative; display: block; }
.input-icon .icon { position: absolute; left: var(--space-3); top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filter-row .input-icon input { padding-left: 40px; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Disclosure panels for secondary create flows */
.action-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--gap); margin-bottom: var(--gap); align-items: start; }
.action-panel { border-radius: var(--radius-large); }
.action-panel > summary { display: flex; align-items: center; gap: var(--space-3); min-height: 64px; padding: var(--space-3) var(--space-4); list-style: none; cursor: pointer; border-radius: var(--radius-large); transition: background-color var(--duration-fast) var(--ease-color); }
.action-panel > summary::-webkit-details-marker { display: none; }
.action-panel-icon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.action-panel-icon .icon { width: 18px; height: 18px; }
.action-panel-copy { flex: 1; min-width: 0; display: grid; }
.action-panel-copy strong { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.action-panel-copy small { color: var(--muted); }
.action-panel-toggle { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-pill); background: var(--surface-inset); color: var(--text-secondary); transition: transform var(--duration-base) var(--ease-out); }
.action-panel-toggle .icon { width: 16px; height: 16px; }
.action-panel[open] .action-panel-toggle { transform: rotate(45deg); }
.action-panel[open] { grid-column: 1 / -1; }
.action-panel-body { padding: 0 var(--space-5) var(--space-5); animation: enter 220ms var(--ease-out) both; }
.action-panel-body .field-grid { padding-top: var(--space-4); box-shadow: 0 -1px 0 var(--border); }

/* ---------- Split layout & summary ---------- */
.split-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: var(--gap); align-items: start; }
.split-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.split-side { position: sticky; top: var(--space-5); min-width: 0; }
.split-side .field-grid { grid-template-columns: 1fr 1fr; }
.split-side .field-grid label:first-child { grid-column: 1 / -1; }
.split-side .form-actions .button { width: 100%; }
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 1px; overflow: hidden; border-radius: var(--radius-large); background: var(--border); box-shadow: inset 0 0 0 1px var(--border); margin-bottom: var(--gap); }
.split-main .summary-strip { margin-bottom: 0; }
.summary-strip > div { display: grid; gap: 2px; padding: var(--space-4) var(--space-5); background: var(--surface); min-width: 0; }
.summary-strip span { color: var(--muted); font-size: var(--text-xs); }
.summary-strip strong { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); color: var(--text); overflow-wrap: anywhere; }
.summary-strip .tone-low strong { color: var(--stock-low); }
.summary-strip .tone-out strong { color: var(--stock-out); }
.summary-strip.compact { margin: var(--space-4) 0; }
.summary-strip.compact > div { background: var(--surface-subtle); padding: var(--space-3) var(--space-4); }
.summary-strip.compact strong { font-size: var(--text-md); }

/* ---------- Data table (cards on narrow screens) ---------- */
.table-scroll { max-width: 100%; overflow-x: auto; border-radius: var(--radius-medium); box-shadow: inset 0 0 0 1px var(--border); overscroll-behavior-x: contain; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: var(--text-sm); }
.data-table th { position: sticky; top: 0; padding: var(--space-3) var(--space-4); background: var(--surface-subtle); color: var(--muted); font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-label); text-transform: uppercase; white-space: nowrap; box-shadow: inset 0 -1px 0 var(--border); }
.data-table td { padding: var(--space-3) var(--space-4); box-shadow: inset 0 -1px 0 var(--border); vertical-align: middle; }
.data-table tr:last-child td { box-shadow: none; }
.data-table td small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--text-xs); }
.data-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table th:nth-child(n+2):not(:last-child) { text-align: right; }
.compact-table th:last-child { text-align: right; }
.data-table .muted-num { color: var(--text-secondary); }
.cell-primary strong { font-weight: var(--weight-semibold); }
.data-table .cell-primary { min-width: 220px; max-width: 320px; }
.data-table td:last-child { min-width: 170px; }
.person-chip { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; color: var(--text); font-weight: var(--weight-medium); }
.person-chip > span:last-child { min-width: 0; }
.person-chip small { display: block; color: var(--muted); font-weight: var(--weight-regular); }
.mini-avatar { width: 24px; height: 24px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 10px; font-weight: var(--weight-bold); }
.walk-in { display: inline-flex; align-items: center; color: var(--muted); font-style: italic; }

/* ---------- Inventory ---------- */
.inventory-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--space-3); }
.inventory-item { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-large); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); min-width: 0; }
.inventory-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.inventory-title { min-width: 0; display: grid; gap: 2px; }
.inventory-title h3 { font-size: var(--text-md); }
.inventory-title p { display: flex; flex-wrap: wrap; gap: 0 6px; color: var(--muted); font-size: var(--text-xs); }
.sku { font-family: var(--font-mono); font-size: 0.95em; color: var(--text-secondary); overflow-wrap: anywhere; }
.stock-badge { background: var(--tone-soft); color: var(--tone); box-shadow: none; }
.stock-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stock-line { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.stock-line strong { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); color: var(--tone); }
.stock-line span { color: var(--muted); font-size: var(--text-xs); }
.stock-meter { position: relative; height: 4px; border-radius: var(--radius-pill); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); }
.stock-meter span { display: block; height: 100%; border-radius: inherit; background: var(--tone); }
.stock-meter i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--border-strong); }
.product-facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-4); font-size: var(--text-sm); }
.product-facts > div { min-width: 0; }
.product-facts dt { color: var(--muted); font-size: var(--text-xs); }
.product-facts dd { margin-top: 2px; color: var(--text); overflow-wrap: anywhere; }
.lots { margin-top: auto; padding-top: var(--space-3); box-shadow: 0 -1px 0 var(--border); }
.lots > summary, .inline-details > summary { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 32px; cursor: pointer; color: var(--accent-text); font-size: var(--text-sm); font-weight: var(--weight-semibold); list-style: none; }
.lots > summary::-webkit-details-marker, .inline-details > summary::-webkit-details-marker { display: none; }
.lots > summary::after, .inline-details > summary::after { content: ""; width: 7px; height: 7px; margin-left: 2px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform var(--duration-base) var(--ease-out); }
.lots[open] > summary::after, .inline-details[open] > summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.lot-list { display: grid; gap: var(--space-1); margin-top: var(--space-2); }
.lot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-small); background: var(--surface-inset); font-size: var(--text-xs); }
.lot-code { font-family: var(--font-mono); color: var(--text); overflow-wrap: anywhere; }
.lot-qty { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.lot-expiry { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.lot-expiry .icon { width: 13px; height: 13px; }
.lot.is-expired .lot-expiry { color: var(--danger); }

/* ---------- Orders ---------- */
.status-overview { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); margin-bottom: var(--gap); }
.status-count { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px var(--space-2); padding: var(--space-3) var(--space-4); border-radius: var(--radius-large); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); color: var(--tone); }
.status-count .icon { width: 18px; height: 18px; grid-row: span 2; }
.status-count span { color: var(--text-secondary); font-size: var(--text-xs); }
.status-count strong { color: var(--text); font-size: var(--text-lg); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.order-list { display: grid; gap: var(--space-3); margin-top: var(--space-2); }
.order-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); padding: var(--space-5); border-radius: var(--radius-large); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.order-main { min-width: 0; display: grid; gap: var(--space-2); }
.order-main h3 { font-size: var(--text-md); }
.order-main > p { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.order-date { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
.order-date .icon { width: 14px; height: 14px; }
.order-lanes { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin-top: var(--space-1); }
.lane { display: flex; align-items: center; gap: var(--space-2); }
.lane-label { min-width: 46px; color: var(--muted); font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.lane-empty { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--text-xs); }
.lane-empty .icon { width: 15px; height: 15px; }
.order-status-form { display: flex; align-items: flex-end; gap: var(--space-2); flex-wrap: wrap; flex-shrink: 0; }
.order-status-form select { min-width: 160px; }
.order-status-form .form-error { flex-basis: 100%; margin-top: 0; }
.order-closed { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
.order-closed .icon { width: 16px; height: 16px; color: var(--success); }

/* ---------- Customers (constellation) ---------- */
.customer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--space-3); }
.customer-star, .customer-add > summary { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-2); padding: var(--space-6) var(--space-4) var(--space-5); border-radius: var(--radius-large); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); min-width: 0; }
.customer-star.is-selected { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-soft); }
.star-avatar { position: relative; width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: var(--space-2); }
.star-avatar::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--orbit); }
.star-avatar::after { content: ""; position: absolute; top: -4px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface-subtle); }
.star-avatar > span { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--surface-elevated), var(--surface-inset)); box-shadow: inset 0 0 0 1px var(--border-strong), var(--highlight); color: var(--text); font-size: var(--text-md); font-weight: var(--weight-bold); letter-spacing: 0.02em; }
.star-avatar.large { width: 72px; height: 72px; margin: 0; flex-shrink: 0; }
.customer-star h3 { font-size: var(--text-md); max-width: 100%; }
.customer-contact { display: grid; gap: 2px; color: var(--muted); font-size: var(--text-xs); max-width: 100%; }
.customer-contact span { overflow-wrap: anywhere; }
.customer-stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; width: 100%; margin-top: var(--space-2); border-radius: var(--radius-medium); overflow: hidden; background: var(--border); }
.customer-stats > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3); background: var(--surface); min-width: 0; }
.customer-stats dt { color: var(--muted); font-size: var(--text-2xs); }
.customer-stats dd { font-size: var(--text-sm); font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.customer-last { color: var(--muted); font-size: var(--text-xs); }
.customer-star .button { margin-top: var(--space-2); width: 100%; }
.customer-add > summary { justify-content: center; min-height: 100%; list-style: none; cursor: pointer; box-shadow: none; background: transparent; border: 1.5px dashed var(--border-strong); transition: background-color var(--duration-fast) var(--ease-color); }
.customer-add > summary::-webkit-details-marker { display: none; }
.customer-add > summary strong { font-size: var(--text-md); }
.customer-add > summary small { color: var(--muted); }
.add-orbit { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: var(--space-2); border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent-soft) 45%, transparent); transition: transform var(--duration-fast) var(--ease-out); }
.add-orbit .icon { width: 24px; height: 24px; }
.customer-add > summary:active .add-orbit { transform: scale(0.94); }
.customer-add[open] { grid-column: 1 / -1; }
.customer-add[open] > summary { border-style: solid; flex-direction: row; justify-content: flex-start; text-align: left; min-height: 0; padding: var(--space-3) var(--space-4); }
.customer-add[open] .add-orbit { width: 36px; height: 36px; margin: 0; transform: rotate(45deg); box-shadow: none; }
.customer-add[open] > summary small { display: none; }
.customer-add-body { padding: var(--space-4) var(--space-4) var(--space-2); animation: enter 220ms var(--ease-out) both; }
.customer-profile { margin-top: var(--gap); animation: enter 240ms var(--ease-out) both; }
.profile-head { display: flex; align-items: center; gap: var(--space-5); }
.profile-head > div { min-width: 0; display: grid; gap: var(--space-1); }
.history-list { display: grid; }
.history-line { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: var(--space-4); padding: var(--space-3) 0; box-shadow: 0 -1px 0 var(--border); font-size: var(--text-sm); }
.history-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-product small { display: block; color: var(--muted); }
.history-line strong { font-variant-numeric: tabular-nums; }

/* ---------- BRAIZONE AI ---------- */
.app-body:has(.ai-page) { height: 100dvh; min-height: 0; }
.main:has(.ai-page) { display: flex; flex-direction: column; min-height: 0; padding-bottom: var(--space-5); }
.ai-page { flex: 1; min-height: 420px; width: 100%; display: flex; flex-direction: column; max-width: 980px; margin: 0 auto; }
.ai-header { margin-bottom: var(--space-4); }
.app-body:has(.ai-page) .app-footer { display: none; }
.chat-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-6) var(--space-6) var(--space-4); display: flex; flex-direction: column; gap: var(--space-5); scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.chat-welcome { margin: auto; display: grid; justify-items: center; gap: var(--space-3); max-width: 560px; padding: var(--space-6) 0; text-align: center; }
.chat-welcome h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-display); }
.chat-welcome > p { font-size: var(--text-md); color: var(--text-secondary); line-height: var(--leading-relaxed); }
.chat-welcome .quick-actions { justify-content: center; margin-top: var(--space-3); }
.quick-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.quick-action { min-height: 38px; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-pill); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-secondary); font-size: var(--text-sm); text-align: left; transition: background-color var(--duration-fast) var(--ease-color), color var(--duration-fast) var(--ease-color), transform var(--duration-fast) var(--ease-out); }
.quick-action:active { transform: scale(var(--press-scale)); }
.chat-compose { padding: var(--space-3) var(--space-5) var(--space-5); box-shadow: 0 -1px 0 var(--border); background: var(--surface); }
.quick-actions-more { margin-bottom: var(--space-3); }
.quick-actions-more > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-pill); color: var(--muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); cursor: pointer; list-style: none; transition: color var(--duration-fast) var(--ease-color), background-color var(--duration-fast) var(--ease-color); }
.quick-actions-more > summary::-webkit-details-marker { display: none; }
.quick-actions-more > summary .icon { width: 15px; height: 15px; }
.quick-actions-more[open] > summary { color: var(--text); background: var(--surface-inset); }
.quick-actions-more .quick-actions { margin-top: var(--space-2); animation: enter 200ms var(--ease-out) both; }
.chat-form { padding: var(--space-3) var(--space-3) var(--space-2) var(--space-4); border-radius: var(--radius-large); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border-strong); transition: box-shadow var(--duration-fast) var(--ease-color); }
.chat-form:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
.chat-form textarea { display: block; width: 100%; min-height: 26px; max-height: 180px; padding: var(--space-1) 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font-size: var(--text-md); line-height: var(--leading-normal); }
.chat-form textarea:focus-visible { box-shadow: none; }
.compose-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-2); }
.compose-footer > span { color: var(--muted); font-size: var(--text-xs); }
.compose-buttons { display: flex; align-items: center; gap: var(--space-1); }
.compose-buttons .icon-button { width: 36px; height: 36px; }
.send-button { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: var(--radius-pill); background: var(--accent-strong); color: var(--accent-contrast); box-shadow: 0 4px 12px -4px var(--accent-glow); transition: transform var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-color), opacity var(--duration-fast) var(--ease-color); }
.send-button .icon { width: 18px; height: 18px; stroke-width: 2; }
.send-button:active:not(:disabled) { transform: scale(0.92); }
.send-button[aria-busy="true"] { opacity: 0.6; }
.voice-status { color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.voice-status:empty { display: none; }
.compose-footer:has(.voice-status:not(:empty)) .compose-notice { display: none; }
.voice-button .icon + .icon { display: none; }
.chat-form[data-voice="listening"] .voice-button .icon:first-child { display: none; }
.chat-form[data-voice="listening"] .voice-button .icon + .icon { display: block; }
.chat-form[data-voice="listening"] .voice-button { background: var(--danger-soft); color: var(--danger); box-shadow: 0 0 0 0 var(--danger-soft); animation: voice-ring 1.6s var(--ease-out, ease-out) infinite; }
.chat-form[data-voice="listening"] .voice-status { color: var(--danger); }
.chat-form[data-voice="listening"] .voice-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: var(--space-2); border-radius: 50%; background: var(--danger); vertical-align: 1px; animation: pulse-dot 1.4s ease-in-out infinite; }
.chat-form[data-voice="transcribing"] .voice-status, .chat-form[data-voice="starting"] .voice-status { color: var(--accent-text); }
.chat-form[data-voice="transcribing"] .voice-button { color: var(--accent-text); animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes voice-ring { 0% { box-shadow: 0 0 0 0 var(--danger-soft); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.user-message { align-self: flex-end; max-width: min(78%, 620px); padding: var(--space-3) var(--space-4); border-radius: var(--radius-large) var(--radius-large) 6px var(--radius-large); background: var(--accent-strong); color: var(--accent-contrast); box-shadow: var(--shadow-sm); }
.user-message p { color: inherit; font-size: var(--text-md); white-space: pre-wrap; overflow-wrap: anywhere; }
.user-message.is-pending { animation: enter 200ms var(--ease-out) both; }
.ai-message { align-self: stretch; max-width: 100%; display: grid; gap: var(--space-2); }
.ai-message.is-latest, .ai-message.is-thinking { animation: enter 240ms var(--ease-out) both; }
.message-label { display: flex; align-items: center; gap: var(--space-2); color: var(--muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: 0.02em; }
.message-avatar { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.message-avatar .icon { width: 16px; height: 16px; }
.assistant-response { display: grid; gap: var(--space-3); padding-left: 32px; min-width: 0; }
.assistant-response > p { color: var(--text); font-size: var(--text-md); line-height: var(--leading-relaxed); white-space: pre-wrap; overflow-wrap: anywhere; }
.response-kpi { font-size: var(--text-3xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-display); color: var(--text); font-variant-numeric: tabular-nums; }
.response-products { display: grid; gap: var(--space-2); }
.product-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); min-width: 0; }
.product-art { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--surface-inset); color: var(--text-secondary); }
.product-art .icon { width: 18px; height: 18px; }
.product-card-main { flex: 1; min-width: 0; display: grid; }
.product-card strong { font-size: var(--text-sm); }
.product-card small { color: var(--muted); }
.stock-label { color: var(--tone); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.product-card-price { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.thinking { display: inline-flex; gap: 5px; padding: var(--space-3) var(--space-4); margin-left: 32px; width: max-content; border-radius: var(--radius-pill); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse-dot 1s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: 150ms; }
.thinking i:nth-child(3) { animation-delay: 300ms; }

/* WRITE confirmation card */
.ai-action { display: grid; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-large); background: var(--surface-elevated); box-shadow: inset 0 0 0 1px var(--border-strong), var(--highlight), var(--shadow-md); animation: enter-scale 260ms var(--ease-out) both; }
.ai-action-head { display: flex; align-items: flex-start; gap: var(--space-3); }
.ai-action-icon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.ai-action-icon .icon { width: 18px; height: 18px; }
.ai-action-head > div { min-width: 0; display: grid; gap: 2px; }
.ai-action-kicker { color: var(--accent-text); font-size: var(--text-2xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.ai-action-summary { color: var(--text); font-size: var(--text-md); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.ai-action-changes { display: grid; border-radius: var(--radius-medium); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.ai-action-legend, .ai-change { display: grid; grid-template-columns: minmax(110px, 0.9fr) minmax(0, 2.2fr); gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); }
.ai-action-legend { grid-template-columns: minmax(110px, 0.9fr) minmax(0, 1fr) 20px minmax(0, 1fr); color: var(--muted); font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-label); text-transform: uppercase; padding-block: var(--space-2); box-shadow: inset 0 -1px 0 var(--border); }
.ai-change + .ai-change { box-shadow: inset 0 1px 0 var(--border); }
.ai-change dt { color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.ai-change dd { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); align-items: center; gap: var(--space-3); min-width: 0; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.ai-before { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent); overflow-wrap: anywhere; }
.ai-before.is-empty { text-decoration: none; }
.assistant-response > p strong { font-weight: var(--weight-semibold); color: var(--text); }
.ai-change b { display: grid; place-items: center; color: var(--muted); }
.ai-change b .icon { width: 16px; height: 16px; }
.ai-after { color: var(--text); font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.ai-action-note { color: var(--muted); font-size: var(--text-xs); }
.ai-action-buttons { display: flex; justify-content: flex-end; gap: var(--space-2); }
.ai-action-buttons .button { min-height: var(--touch); padding: 0 var(--space-5); }
.ai-action .ai-action-changes:not(:has(.ai-change)) { display: none; }

/* ---------- Dialog ---------- */
dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: var(--space-6); border: 0; border-radius: var(--radius-xl); background: var(--surface-elevated); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-lg); overflow-wrap: anywhere; }
dialog[open] { animation: enter-scale 200ms var(--ease-out) both; }
dialog::backdrop { background: var(--overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade 200ms var(--ease-out) both; }
dialog h2 { margin: var(--space-3) 0 var(--space-2); font-size: var(--text-xl); letter-spacing: var(--tracking-display); }
dialog p { font-size: var(--text-md); }
dialog .badge { margin-left: var(--space-2); vertical-align: middle; }
.dialog-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); vertical-align: middle; }
dialog .setup-buttons { justify-content: flex-end; margin-top: var(--space-6); }

/* ---------- Management ---------- */
.automation-list { display: grid; gap: var(--space-3); }
.automation-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-4); padding: var(--space-5); }
.automation-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-inset); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border); }
.automation-card.is-active .automation-icon { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }
.automation-copy { min-width: 0; display: grid; gap: var(--space-1); }
.automation-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
.automation-title h2 { font-size: var(--text-md); }
.automation-copy > p:not(.helper) { font-size: var(--text-sm); }
.automation-copy .helper { padding: 0; font-size: var(--text-xs); }
.automation-toggle { min-width: 120px; }
.report-filter-card { padding: var(--space-4) var(--space-5); margin-bottom: var(--gap); }
.report-filter { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; margin: 0; }
.report-filter .button { min-height: var(--touch); }
.report-filter-card .form-error { margin-top: var(--space-2); }
.report-kpis { margin-bottom: 0; }
.report-chart { margin-top: var(--space-2); }
.report-bars { display: flex; align-items: flex-end; gap: 3px; height: 132px; padding: 0 var(--space-1); box-shadow: inset 0 -1px 0 var(--border-strong); }
.report-bar-wrap { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.report-bar { display: block; width: 72%; max-width: 40px; border-radius: 4px 4px 1px 1px; background: var(--chart); transform-origin: bottom; animation: rise 300ms var(--ease-out) both; }
.report-chart > p { display: flex; justify-content: space-between; margin-top: var(--space-2); color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.inline-details { margin-top: var(--space-4); }
.inline-details .table-scroll { margin-top: var(--space-2); }
.report-stats { display: grid; gap: var(--space-2); }
.order-stats > div { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; box-shadow: 0 -1px 0 var(--border); }
.order-stats > div:first-child { box-shadow: none; }
.order-stats strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.report-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; box-shadow: 0 -1px 0 var(--border); font-size: var(--text-sm); }
.report-row:first-child, .subhead + .report-row, .section-head + .report-row, .helper + .report-row { box-shadow: none; }
.report-row > span { min-width: 0; }
.report-row small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--text-xs); }
.report-row strong { flex-shrink: 0; font-weight: var(--weight-semibold); }
.rank-list { display: grid; }
.rank-row { justify-content: flex-start; }
.rank-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rank-bar { display: block; height: 3px; margin-top: var(--space-1); border-radius: var(--radius-pill); background: var(--surface-inset); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: inherit; background: var(--chart); }
.report-expenses { margin-top: var(--gap); }
.connection-note { display: flex; align-items: flex-start; gap: var(--space-4); padding: var(--space-5); margin-bottom: var(--gap); }
.connection-note h2 { font-size: var(--text-md); }
.connection-note p { margin-top: var(--space-1); font-size: var(--text-sm); }
.connection-icon { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.integration-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--gap); }
.integration-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); }
.integration-head { display: flex; align-items: center; gap: var(--space-3); }
.integration-head > div { min-width: 0; display: grid; justify-items: start; gap: 6px; }
.integration-head h2 { font-size: var(--text-md); }
.integration-logo { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); color: var(--text); font-weight: var(--weight-bold); font-size: var(--text-sm); }
.integration-card.tone-success .integration-logo { box-shadow: inset 0 0 0 1.5px var(--success); }
.integration-card.tone-danger .integration-logo { box-shadow: inset 0 0 0 1.5px var(--danger); }
.integration-card > p:not(.helper) { font-size: var(--text-sm); }
.integration-card .helper { padding: 0; }
.integration-card .inline-details { margin-top: auto; }
.legend-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }

/* ---------- Settings ---------- */
.settings-nav { position: sticky; top: 0; z-index: 5; display: flex; gap: var(--space-1); margin: 0 calc(var(--space-2) * -1) var(--space-5); padding: var(--space-2); overflow-x: auto; scrollbar-width: none; background: var(--material); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-radius: var(--radius-large); box-shadow: inset 0 0 0 1px var(--border); }
.settings-nav::-webkit-scrollbar { display: none; }
.settings-nav a { flex-shrink: 0; display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-3); border-radius: var(--radius-pill); color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap; transition: background-color var(--duration-fast) var(--ease-color), color var(--duration-fast) var(--ease-color); }
.settings-nav a:active { background: var(--surface-hover); }
.settings-stack { display: grid; gap: var(--space-7); }
.settings-section { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: var(--space-6); scroll-margin-top: 72px; }
.settings-head { display: flex; align-items: flex-start; gap: var(--space-3); }
.settings-head > div { min-width: 0; display: grid; gap: var(--space-1); }
.settings-head h2 { font-size: var(--text-md); }
.settings-head p { font-size: var(--text-sm); color: var(--muted); }
.settings-icon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--surface-inset); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border); }
.settings-icon .icon { width: 18px; height: 18px; }
.settings-body { display: grid; gap: var(--gap); min-width: 0; }
.settings-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.settings-body .subhead:first-child { margin-top: 0; }
.permission-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.people-list { display: grid; }
.person-row:first-child { box-shadow: none; }
.ai-settings { display: grid; gap: var(--space-4); justify-items: start; }
.ai-settings-row { display: flex; align-items: flex-start; gap: var(--space-3); }
.ai-settings-row .icon { color: var(--accent-text); margin-top: 1px; }
.ai-settings-row p { font-size: var(--text-sm); }
.settings-link { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.settings-link .helper { padding: 0; flex: 1 1 260px; }
.theme-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin: 0; padding: 0; border: 0; min-width: 0; }
.theme-option { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-large); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); cursor: pointer; transition: box-shadow var(--duration-fast) var(--ease-color), transform var(--duration-fast) var(--ease-out); }
.theme-option:active { transform: scale(0.985); }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-option:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-soft); }
.theme-option:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.theme-preview { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; width: 52px; height: 52px; overflow: hidden; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border-strong); }
.theme-preview i { display: block; }
.theme-copy { min-width: 0; display: grid; }
.theme-copy strong { font-size: var(--text-sm); }
.theme-copy small { color: var(--muted); }
.theme-check { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--border-strong); transition: box-shadow var(--duration-fast) var(--ease-color), background-color var(--duration-fast) var(--ease-color); }
.theme-option:has(input:checked) .theme-check { background: var(--accent); box-shadow: inset 0 0 0 5px var(--accent), inset 0 0 0 10px var(--accent-contrast); }

/* ---------- Pending / onboarding / tenant ---------- */
.large-spark { width: 56px; height: 56px; display: inline-grid; place-items: center; border-radius: 16px; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--space-3); }
.large-spark .icon { width: 28px; height: 28px; }
.pending-panel { max-width: var(--content-narrow); margin: var(--space-6) auto; padding: var(--space-8) var(--space-6); text-align: center; display: grid; justify-items: center; gap: var(--space-3); }
.pending-panel h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-display); }
.pending-panel p { max-width: 50ch; }
.integration-list { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); width: 100%; text-align: left; margin: var(--space-3) 0; font-size: var(--text-sm); }
.integration-list > span { padding: var(--space-3); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.setup-layout { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: var(--space-8); max-width: 1040px; margin: var(--space-6) auto; }
.setup-intro { display: grid; align-content: start; gap: var(--space-3); }
.setup-intro h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-display); line-height: var(--leading-tight); }
.setup-intro > p { line-height: var(--leading-relaxed); }
.setup-intro > small { color: var(--muted); }
.setup-steps { display: grid; gap: var(--space-3); margin: var(--space-4) 0; }
.setup-steps li { display: flex; align-items: center; gap: var(--space-3); color: var(--muted); font-size: var(--text-sm); }
.setup-steps li > span { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--border-strong); font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.setup-steps li.current { color: var(--text); font-weight: var(--weight-semibold); }
.setup-steps li.current > span { background: var(--accent-strong); color: var(--accent-contrast); box-shadow: none; }
.setup-note { display: flex; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.setup-note p { font-size: var(--text-sm); }
.setup-panel { padding: var(--space-7); display: grid; gap: var(--space-3); align-content: start; }
.setup-panel h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-display); }
.setup-panel label { display: grid; gap: 6px; color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.setup-panel form { display: grid; gap: var(--space-3); }
.guide-reply { padding: var(--space-4); border-radius: var(--radius-medium); background: var(--accent-soft); }
.guide-reply > span { display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-1); color: var(--accent-text); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.guide-reply .icon { width: 15px; height: 15px; }
.guide-reply p { color: var(--text); }
.business-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.stretch { width: 100%; }
.data-options, .plan-options { display: grid; gap: var(--space-2); }
.plan-options { grid-template-columns: 1fr 1fr; }
.data-option, .plan-option { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); cursor: pointer; }
.data-option.selected, .plan-option.selected { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 3px var(--accent-soft); }
.data-option strong, .plan-option strong, .module-options strong { display: block; color: var(--text); font-size: var(--text-sm); }
.data-option small, .plan-option small, .module-options small { display: block; color: var(--muted); }
.data-option .icon { color: var(--accent-text); }
.module-options { display: grid; margin: 0; padding: 0; border: 0; }
.module-options label { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; box-shadow: 0 -1px 0 var(--border); }
.setup-panel .future-channel, .future-channel { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); padding-top: var(--space-3); box-shadow: 0 -1px 0 var(--border); }
.setup-buttons { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.setup-complete { max-width: 640px; margin: var(--space-8) auto; padding: var(--space-8) var(--space-6); text-align: center; display: grid; justify-items: center; gap: var(--space-3); }
.setup-summary { display: grid; gap: var(--space-1); width: 100%; padding: var(--space-5); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.setup-summary strong { font-size: var(--text-lg); }
.tenant-onboarding { max-width: 780px; margin: 0 auto; }
.tenant-onboarding fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.tenant-optional { margin: var(--space-5) 0; }
.tenant-optional summary { min-height: var(--touch); display: flex; align-items: center; cursor: pointer; font-weight: var(--weight-semibold); color: var(--accent-text); }
.tenant-optional .field-grid { margin-top: var(--space-3); }
.tenant-list { display: grid; gap: var(--space-3); }
.tenant-card { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); }
.tenant-card > div:first-child { min-width: 0; display: grid; gap: var(--space-1); justify-items: start; }
.tenant-actions { display: flex; flex-direction: column; gap: var(--space-2); flex-shrink: 0; }
.tenant-invite { display: grid; gap: var(--space-3); margin: var(--space-5) 0; padding: var(--space-5); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.activation-panel { margin: var(--space-8) auto; }

/* ---------- Auth ---------- */
.auth-screen { position: relative; display: grid; place-items: center; min-height: 100dvh; padding: var(--space-6) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom, 0px)); overflow: hidden; }
.auth-orbit { position: absolute; inset: 0; pointer-events: none; }
.auth-orbit span { position: absolute; left: 50%; top: 50%; width: 980px; height: 360px; margin: -180px 0 0 -490px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--orbit); transform: rotate(-18deg); }
.auth-orbit span + span { width: 640px; height: 230px; margin: -115px 0 0 -320px; }
.auth-card { position: relative; width: 100%; max-width: 420px; padding: var(--space-7); display: grid; gap: var(--space-2); box-shadow: inset 0 0 0 1px var(--border-strong), var(--highlight), var(--shadow-lg); animation: enter-scale 280ms var(--ease-out) both; }
.auth-brand { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.auth-brand strong { font-weight: var(--weight-bold); letter-spacing: 0.16em; }
.auth-card h1 { font-size: var(--text-2xl); }
.auth-card form { margin-top: var(--space-4); display: grid; gap: var(--space-4); }
.auth-card .form-error { margin: 0; }
.auth-card .helper { margin-top: var(--space-2); }

/* ---------- Mobile sheet (Más) ---------- */
.mobile-menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet); max-height: min(86dvh, 680px); overflow-y: auto; overscroll-behavior: contain; padding: var(--space-2) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom, 0px)); border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: var(--surface-elevated); box-shadow: inset 0 1px 0 var(--border-strong), var(--shadow-lg); transition: transform var(--duration-slow) var(--ease-drawer); }
@starting-style { .mobile-menu:not([hidden]) { transform: var(--sheet-from); } }
.sheet-handle { display: block; width: 36px; height: 5px; margin: 0 auto var(--space-3); border-radius: var(--radius-pill); background: var(--border-strong); }
.menu-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.menu-heading strong { font-size: var(--text-md); }
.mobile-menu > label { display: block; margin-bottom: 6px; color: var(--muted); font-size: var(--text-xs); }
.mobile-menu select { margin-bottom: var(--space-4); }
.menu-links { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-1); }
.mobile-menu a { display: flex; align-items: center; gap: var(--space-3); min-height: 48px; padding: 0 var(--space-3); border-radius: var(--radius-medium); color: var(--text-secondary); font-size: var(--text-sm); font-weight: var(--weight-medium); transition: background-color var(--duration-fast) var(--ease-color); }
.mobile-menu a .icon { width: 18px; height: 18px; color: var(--muted); }
.mobile-menu a:active { background: var(--surface-hover); }
.mobile-menu a.active { background: var(--accent-soft); color: var(--text); }
.mobile-menu a.active .icon { color: var(--accent); }
.mobile-menu > .button { width: 100%; margin-top: var(--space-4); }
.mobile-menu:not([hidden]) + .sheet-scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-sheet) - 1); background: var(--overlay); transition: opacity var(--duration-slow) var(--ease-out); }
@starting-style { .mobile-menu:not([hidden]) + .sheet-scrim { opacity: 0; } }

/* ---------- Hover (precise pointers only) ---------- */
@media (hover: hover) and (pointer: fine) {
  .nav a:hover { background: var(--surface-hover); color: var(--text); }
  .nav a:hover .nav-icon { color: var(--text-secondary); }
  .nav a.active:hover { background: var(--accent-soft); }
  .nav a.active:hover .nav-icon { color: var(--accent); }
  .setup-link:hover { background: var(--surface-hover); }
  .button.primary:hover:not(:disabled) { background: var(--accent-hover); }
  [data-theme="blue"] .button.primary:hover:not(:disabled), [data-theme="purple"] .button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent-strong) 88%, white); }
  .button.secondary:hover:not(:disabled) { background: var(--surface-hover); }
  .button.ghost:hover { background: var(--accent-soft); }
  .icon-button:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
  .kpi-link:hover { box-shadow: inset 0 0 0 1px var(--border-strong), var(--highlight), var(--shadow-md); }
  .kpi-link:hover .kpi-go { color: var(--accent-text); transform: translateX(2px); }
  .hero-link:hover, .section-head > a:hover, .demo-banner a:hover { color: var(--accent-hover); }
  .alert:hover { background: var(--surface-hover); }
  .quick-action:hover { background: var(--surface-hover); color: var(--text); }
  .quick-actions-more > summary:hover { color: var(--text); }
  .action-panel > summary:hover { background: var(--surface-hover); }
  .customer-add > summary:hover { background: var(--surface-hover); }
  .settings-nav a:hover { background: var(--surface-hover); color: var(--text); }
  .theme-option:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
  .mobile-menu a:hover { background: var(--surface-hover); }
  .data-table tbody tr:hover td { background: var(--surface-subtle); }
  .lots > summary:hover, .inline-details > summary:hover { color: var(--accent-hover); }
  select:hover, input:not([readonly]):not(:disabled):hover { box-shadow: inset 0 0 0 1px var(--muted); }
}

/* ---------- Responsive ---------- */
@media (min-width: 1600px) {
  :root { --content-max: 1480px; --gutter: var(--space-8); }
  .hero-sales .kpi-value { font-size: 3.25rem; }
  .chart { --chart-h: 200px; }
}
@media (max-width: 1280px) {
  .bottom-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bottom-grid.three > :last-child { grid-column: 1 / -1; }
  .settings-section { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
}
@media (max-width: 1180px) {
  :root { --sidebar: 224px; --gutter: var(--space-6); }
  .home-hero { grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout { grid-template-columns: minmax(0, 1fr); }
  .split-side { position: static; order: -1; }
  .split-side .field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split-side .field-grid label:first-child { grid-column: auto; }
  .split-side .form-actions .button { width: auto; }
  .status-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .automation-card { grid-template-columns: auto minmax(0, 1fr); }
  .automation-toggle { grid-column: 2; justify-self: start; }
}
@media (max-width: 960px) {
  .home-hero, .home-grid, .bottom-grid, .bottom-grid.three { grid-template-columns: minmax(0, 1fr); }
  .bottom-grid.three > :last-child { grid-column: auto; }
  .hero-side { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-header { flex-wrap: wrap; align-items: flex-start; }
  .theme-picker, .settings-pair { grid-template-columns: minmax(0, 1fr); }
  .setup-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .setup-intro > .large-spark, .setup-intro > h2, .setup-intro > p, .setup-intro > small, .setup-note { display: none; }
  .setup-steps { display: flex; justify-content: space-between; margin: 0; }
  .report-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-filter .button { grid-column: 1 / -1; }
}

/* Phone: the app becomes a native-feeling shell with a top bar, tab bar and bottom sheet. */
@media (max-width: 860px) {
  :root { --sidebar: 0px; --gutter: var(--space-4); --gap: var(--space-3); }
  .sidebar { display: none; }
  .app-body { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .mobile-header { position: sticky; top: 0; z-index: var(--z-header); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) max(var(--space-2), env(safe-area-inset-right, 0px)) 0 max(var(--space-4), env(safe-area-inset-left, 0px)); background: var(--material); -webkit-backdrop-filter: saturate(140%) blur(16px); backdrop-filter: saturate(140%) blur(16px); box-shadow: 0 1px 0 var(--border); }
  .mobile-header .brand { min-width: 0; gap: var(--space-2); }
  .mobile-header .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .mobile-header .brand-mark svg { width: 22px; height: 22px; }
  .mobile-brand-copy { min-width: 0; display: grid; line-height: 1.2; }
  .mobile-brand-copy strong { font-size: var(--text-sm); letter-spacing: 0.14em; }
  .mobile-brand-copy small { color: var(--muted); font-size: var(--text-2xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .demo-banner { position: static; padding: var(--space-2) var(--gutter); font-size: var(--text-2xs); }
  .demo-banner a { display: none; }
  .main { padding: var(--space-5) var(--gutter) var(--space-6); padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
  .app-footer { display: none; }
  .mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); min-height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding: var(--space-1) max(var(--space-2), env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(var(--space-2), env(safe-area-inset-left, 0px)); background: var(--material); -webkit-backdrop-filter: saturate(140%) blur(16px); backdrop-filter: saturate(140%) blur(16px); box-shadow: 0 -1px 0 var(--border); }
  .mobile-nav a, .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: var(--weight-semibold); letter-spacing: 0.01em; }
  .tab-icon { width: 44px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-pill); transition: background-color var(--duration-fast) var(--ease-color), transform var(--duration-instant) var(--ease-out); }
  .tab-icon .icon { width: 21px; height: 21px; }
  .mobile-nav a:active .tab-icon, .mobile-nav button:active .tab-icon { transform: scale(0.92); }
  .mobile-nav a.active { color: var(--text); }
  .mobile-nav a.active .tab-icon { background: var(--accent-soft); color: var(--accent); }
  .mobile-nav .tab-ai .tab-icon { color: var(--accent); }
  .page-header { margin-bottom: var(--space-5); gap: var(--space-3); }
  h1, .page-header h1 { font-size: 1.625rem; }
  .page-sub { font-size: var(--text-sm); }
  .header-actions { width: 100%; }
  .header-actions .button { flex: 1; }
  .section-card, .business-form { padding: var(--space-5) var(--space-4); }
  .card { border-radius: var(--radius-large); }
  .hero-sales { padding: var(--space-5) var(--space-4); }
  .hero-sales .kpi-value { font-size: 2.375rem; }
  .hero-side .kpi-value { font-size: var(--text-2xl); }
  .chart { --chart-h: 150px; --y-gutter: 44px; }
  .grid-kpi, .home-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-kpis > :last-child { grid-column: 1 / -1; }
  .kpi { padding: var(--space-4); }
  .kpi-value, .stat-value { font-size: var(--text-xl); }
  .field-grid, .split-side .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-side .field-grid label:first-child, .filter-row label:first-child { grid-column: 1 / -1; }
  .filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-overview > :first-child { grid-column: 1 / -1; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-strip > div { padding: var(--space-3) var(--space-4); }
  .summary-strip strong { font-size: var(--text-md); }
  .summary-strip > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .order-item { flex-direction: column; align-items: stretch; padding: var(--space-4); }
  .order-status-form { width: 100%; }
  .order-status-form label { flex: 1; }
  .order-status-form select { min-width: 0; }
  .customer-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: var(--space-2); }
  .customer-star, .customer-add > summary { padding: var(--space-5) var(--space-3) var(--space-4); }
  .star-avatar { width: 52px; height: 52px; }
  .add-orbit { width: 52px; height: 52px; }
  .profile-head { gap: var(--space-4); }
  .star-avatar.large { width: 56px; height: 56px; }
  .history-line { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); }
  .history-date { grid-column: 1 / -1; font-size: var(--text-xs); }
  .automation-card { grid-template-columns: auto minmax(0, 1fr); padding: var(--space-4); gap: var(--space-3); }
  .automation-toggle { grid-column: 1 / -1; width: 100%; }
  .report-filter { grid-template-columns: 1fr 1fr; }
  .report-filter label:first-child { grid-column: 1 / -1; }
  .settings-nav { margin-left: 0; margin-right: 0; top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); }
  .settings-section { scroll-margin-top: calc(var(--header-h) + 72px); }
  .tenant-card { flex-direction: column; align-items: stretch; }
  .tenant-actions { width: 100%; }
  .integration-list { grid-template-columns: minmax(0, 1fr); }
  .setup-panel { padding: var(--space-5) var(--space-4); }
  .setup-complete, .pending-panel { padding: var(--space-6) var(--space-4); margin: var(--space-4) auto; }
  dialog { padding: var(--space-5); }
  dialog .setup-buttons { flex-direction: column-reverse; }
  dialog .setup-buttons .button { width: 100%; }

  /* Tables become stacked rows with inline labels. */
  .table-scroll { box-shadow: none; overflow: visible; }
  .data-table:not(.compact-table) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .data-table:not(.compact-table), .data-table:not(.compact-table) tbody, .data-table:not(.compact-table) tr, .data-table:not(.compact-table) td { display: block; width: 100%; }
  .data-table:not(.compact-table) tr { padding: var(--space-3) var(--space-4); margin-bottom: var(--space-2); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
  .data-table:not(.compact-table) td { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding: var(--space-1) 0; box-shadow: none; text-align: right; }
  .data-table:not(.compact-table) td::before { content: attr(data-label); flex-shrink: 0; color: var(--muted); font-size: var(--text-xs); text-align: left; }
  .data-table:not(.compact-table) td.cell-primary { display: block; padding-bottom: var(--space-2); margin-bottom: var(--space-1); text-align: left; box-shadow: inset 0 -1px 0 var(--border); }
  .data-table:not(.compact-table) td.cell-primary::before { content: none; }
  .data-table td > small { display: block; }
  .data-table:not(.compact-table) td:last-child { flex-wrap: wrap; }
  .data-table:not(.compact-table) td:last-child small { flex-basis: 100%; }

  /* Chat fills the space between the top bar and the tab bar. */
  .ai-page { min-height: 340px; }
  .main:has(.ai-page) { padding-top: var(--space-4); padding-bottom: var(--space-3); }
  .ai-header { margin-bottom: var(--space-3); }
  .ai-header .page-sub { display: none; }
  .chat-messages { padding: var(--space-4) var(--space-3) var(--space-3); gap: var(--space-4); }
  .chat-welcome h2 { font-size: var(--text-xl); }
  .chat-welcome > p { font-size: var(--text-sm); }
  .chat-compose { padding: var(--space-2) var(--space-3) var(--space-3); }
  .compose-footer > span { font-size: var(--text-2xs); }
  .user-message { max-width: 88%; }
  .assistant-response { padding-left: 0; }
  .thinking { margin-left: 0; }
  .ai-action { padding: var(--space-4); }
  .ai-action-legend { display: none; }
  .ai-change { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
  .ai-action-buttons { flex-direction: column-reverse; }
  .ai-action-buttons .button { width: 100%; }
}
@media (max-width: 600px) {
  .hero-side { grid-template-columns: minmax(0, 1fr); }
  .field-grid, .split-side .field-grid, .filter-row, .business-fields, .plan-options { grid-template-columns: minmax(0, 1fr); }
  .split-side .field-grid label:first-child, .filter-row label:first-child { grid-column: auto; }
  .form-actions .button, .split-side .form-actions .button { width: 100%; }
  .customer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .report-filter { grid-template-columns: minmax(0, 1fr); }
  .grid-kpi, .home-kpis { grid-template-columns: minmax(0, 1fr); }
  .home-kpis > :last-child { grid-column: auto; }
  .customer-grid { grid-template-columns: minmax(0, 1fr); }
  .menu-links { grid-template-columns: minmax(0, 1fr); }
  .header-actions { flex-wrap: wrap; }
  .hero-sales .kpi-value { font-size: 2rem; }
}

@media (max-width: 860px) and (max-height: 760px) {
  .chat-welcome .ai-orbit { display: none; }
  .chat-welcome { padding: var(--space-2) 0; gap: var(--space-2); }
}

/* Very short viewports (landscape phones, 200% zoom): let the page scroll instead of squeezing the chat. */
@media (max-height: 560px) {
  .app-body:has(.ai-page) { height: auto; min-height: 100dvh; }
  .ai-page { flex: none; min-height: 0; }
  .chat-card { flex: none; }
  .chat-messages { flex: none; min-height: 220px; max-height: 70dvh; }
}

/* Touch devices: inputs at 16px never zoom the page. */
@media (pointer: coarse) {
  input, select, textarea, .chat-form textarea { font-size: 16px; }
  .quick-action { min-height: var(--touch); }
}

/* Reduced motion: keep opacity and color, remove movement. */
@media (prefers-reduced-motion: reduce) {
  .chat-form[data-voice] .voice-button, .chat-form[data-voice] .voice-status::before { animation: none; }
  :root { --enter-distance: 0px; --press-scale: 1; --sheet-from: translateY(0); }
  .chart-line, .report-bar { animation: none; }
  .chart-point, .chart-tip, .chart-marker { transition: none; }
  .loading-dot, .thinking i { animation-duration: 2s; }
  .loading-state::after { animation: none; }
  .ai-action, dialog[open], .auth-card { animation-name: fade; }
  .button:active:not(:disabled), .icon-button:active, .alert:active, .kpi-link:active, .theme-option:active, .quick-action:active, .send-button:active:not(:disabled) { transform: none; }
  .action-panel-toggle, .kpi-go, .lots > summary::after, .inline-details > summary::after { transition: none; }
  .chat-messages { scroll-behavior: auto; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 240ms; animation-timing-function: var(--ease-out); }

/* ===== Adaptive business v1: privacy, scanner, variants, services, loans, profile ===== */
.privacy-toggle:not(.icon-button) { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 36px; margin: 0 0 var(--space-3); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-medium); background: transparent; color: var(--text-secondary); font: inherit; font-size: var(--text-xs); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-color), color var(--duration-fast) var(--ease-color); }
.privacy-toggle .icon { width: 18px; height: 18px; flex-shrink: 0; }
.privacy-toggle[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-soft); }
.privacy-toggle:focus-visible { box-shadow: var(--focus-ring); outline: 0; }
@media (hover: hover) { .privacy-toggle:not(.icon-button):hover { background: var(--surface-hover); color: var(--text); } }
.mobile-header { gap: var(--space-2); }
.mobile-header .privacy-toggle { margin-left: auto; }
.mobile-header .privacy-toggle + #mobile-menu-button { margin-left: 0; }
:root[data-privacy="on"] .sensitive { letter-spacing: 0.04em; }

.input-with-action { display: flex; align-items: stretch; gap: var(--space-2); min-width: 0; }
.input-with-action > input, .input-with-action > select { flex: 1; min-width: 0; }
.input-with-action .scan-icon { width: 44px; height: auto; min-height: 44px; flex-shrink: 0; background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--accent-text); }
.field-hint { color: var(--muted); font-size: var(--text-2xs); font-weight: var(--weight-regular); }
.field-hint:empty { display: none; }
.field-wide { grid-column: 1 / -1; }
.scan-button { align-self: end; min-height: 44px; white-space: nowrap; }
.scan-button .icon { width: 18px; height: 18px; }
.filter-row:has(.scan-button) { grid-template-columns: minmax(0, 2fr) auto minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
.scan-result { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: calc(var(--space-2) * -1) 0 var(--space-4); color: var(--text-secondary); font-size: var(--text-sm); }
.scan-result:empty { display: none; }
.scan-found strong { color: var(--text); }
.is-scanned { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-soft) !important; }

.scanner-dialog { width: min(480px, calc(100% - 32px)); }
.scanner-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.scanner-head h2 { margin: 0; }
.scanner-view { position: relative; margin-top: var(--space-4); overflow: hidden; border-radius: var(--radius-large); background: #000; aspect-ratio: 4 / 3; }
.scanner-view video { display: block; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; inset: 22% 12%; border-radius: var(--radius-medium); box-shadow: 0 0 0 2px var(--accent), 0 0 0 999px rgba(0, 0, 0, 0.35); pointer-events: none; }
.scanner-status { margin-top: var(--space-3); color: var(--text-secondary); font-size: var(--text-sm); }
.scanner-manual { display: grid; gap: 6px; margin-top: var(--space-4); padding-top: var(--space-4); box-shadow: 0 -1px 0 var(--border); color: var(--text-secondary); font-size: var(--text-xs); }
.scanner-manual-row { display: flex; gap: var(--space-2); }
.scanner-manual-row input { flex: 1; min-width: 0; min-height: 44px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-medium); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text); font: inherit; font-size: 16px; }
.scanner-manual-row input:focus-visible { outline: 0; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }

.product-facts.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.variant-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.variant-row { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-medium); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.variant-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.variant-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-pill); background: var(--surface-inset); color: var(--text); font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap; }
.variant-chip.color { background: var(--accent-soft); color: var(--accent-text); }
.variant-codes { display: grid; min-width: 0; font-size: var(--text-xs); }
.variant-codes .sku, .variant-codes small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.variant-codes small { color: var(--muted); }
.variant-stock { display: grid; justify-items: end; font-variant-numeric: tabular-nums; }
.variant-stock small { color: var(--tone); font-size: var(--text-2xs); }

.service-grid, .loan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.service-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); padding: var(--space-4); background: var(--surface-subtle); }
.service-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.service-copy h3 { font-size: var(--text-md); overflow-wrap: anywhere; }
.service-copy p { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--text-xs); }
.service-copy .icon { width: 14px; height: 14px; }
.service-price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.service-line { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: var(--text-sm); }
.service-line .icon { width: 16px; height: 16px; color: var(--accent-text); }
.action-link { display: flex; align-items: center; gap: var(--space-3); min-height: 64px; padding: var(--space-3) var(--space-4); color: inherit; text-decoration: none; }

.loan-card { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); background: var(--surface-subtle); }
.loan-card.tone-danger { box-shadow: inset 0 0 0 1px var(--danger-soft), inset 3px 0 0 var(--danger), var(--shadow-sm); }
.loan-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-width: 0; }
.loan-customer { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loan-balance { display: grid; gap: 2px; }
.loan-balance span { color: var(--muted); font-size: var(--text-xs); }
.loan-balance strong { font-size: var(--text-2xl, 1.75rem); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.loan-progress { display: grid; gap: var(--space-2); color: var(--text-secondary); font-size: var(--text-xs); }
.loan-progress .stock-meter { --tone: var(--accent); }
.loan-current { margin: 0; color: var(--text-secondary); font-size: var(--text-xs); overflow-wrap: anywhere; }
.loan-current strong { color: var(--text); font-variant-numeric: tabular-nums; }
.loan-payment-form { display: grid; gap: var(--space-3); padding-top: var(--space-3); box-shadow: 0 -1px 0 var(--border); }
.field-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.center-actions { display: flex; justify-content: center; margin-top: var(--space-4); }

.profile-card { display: grid; gap: var(--space-5); }
.profile-current { display: flex; gap: var(--space-4); align-items: flex-start; }
.profile-current h3 { font-size: var(--text-xl); letter-spacing: var(--tracking-tight); }
.capability-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.capability-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-pill); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); color: var(--text); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.capability-chip .icon { width: 14px; height: 14px; color: var(--accent-text); }
.planned-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.profile-form { display: grid; gap: var(--space-4); }
.type-picker, .capability-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: var(--space-3); margin: 0; padding: 0; border: 0; min-width: 0; }
.type-picker legend, .capability-picker legend { grid-column: 1 / -1; margin-bottom: var(--space-2); color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.type-picker > .helper { grid-column: 1 / -1; margin-top: calc(var(--space-2) * -1); }
.type-option, .capability-toggle { position: relative; display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-large); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); cursor: pointer; min-width: 0; }
.type-option input, .capability-toggle input { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; width: 18px; height: 18px; }
.type-option span, .capability-toggle span { display: grid; gap: 2px; min-width: 0; }
.type-option strong, .capability-toggle strong { color: var(--text); font-size: var(--text-sm); }
.type-option small, .capability-toggle small { color: var(--muted); font-size: var(--text-xs); }
.type-option:has(input:checked), .capability-toggle:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-soft); }
.type-option:has(input:focus-visible), .capability-toggle:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.type-option:has(input:disabled), .capability-toggle:has(input:disabled) { cursor: default; opacity: 0.75; }
.tenant-types { margin-top: var(--space-5); }

.home-kpis:has(> :nth-child(4)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.home-kpis.is-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .home-kpis:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); } .home-kpis:has(> :nth-child(4)) > :last-child { grid-column: auto; } }
@media (max-width: 860px) { .filter-row:has(.scan-button) { grid-template-columns: minmax(0, 1fr) auto; } .filter-row:has(.scan-button) label:first-child { grid-column: auto; } .filter-row:has(.scan-button) label:not(:first-child) { grid-column: span 1; } }
@media (max-width: 600px) { .filter-row:has(.scan-button) { grid-template-columns: minmax(0, 1fr) auto; } .filter-row:has(.scan-button) > label:not(:first-child) { grid-column: 1 / -1; } .field-grid.compact { grid-template-columns: minmax(0, 1fr); } .variant-row { grid-template-columns: minmax(0, 1fr) auto; } .variant-codes { grid-column: 1 / -1; grid-row: 2; } .home-kpis.is-compact { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 380px) { .home-kpis:has(> :nth-child(4)) { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .privacy-toggle { transition: none; } }
.field-grid label { align-content: start; }
.product-facts dd .icon, .lot-expiry .icon { display: inline-block; width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }

/* Mis negocios: one card per business; actions wrap below the name on narrow screens. */
.workspace-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.workspace-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--space-3); padding: var(--space-4); background: var(--surface-subtle); }
.workspace-card.is-current { box-shadow: inset 0 0 0 2px var(--accent); }
.workspace-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--text-sm); font-weight: var(--weight-bold); }
.workspace-copy { min-width: 0; }
.workspace-copy h3 { font-size: var(--text-md); overflow-wrap: anywhere; }
.workspace-copy p { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--text-xs); }
.workspace-copy .icon { width: 14px; height: 14px; }
.workspace-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.workspace-actions .button { min-height: 44px; }
.workspace-archived { display: grid; gap: var(--space-2); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
.workspace-archived li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); overflow-wrap: anywhere; }

/* Editing: the same Editar / Guardar pattern everywhere; touch targets stay at least 44px. */
.item-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.item-actions .button { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.item-actions .icon, .icon-button .icon { width: 16px; height: 16px; }
.variant-row .icon-button, .service-card .icon-button { min-width: 44px; min-height: 44px; }
.service-card { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.edit-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 0; border-radius: var(--radius-lg, 16px); padding: var(--space-5); background: var(--surface); color: var(--text); }
.edit-dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.edit-form { display: grid; gap: var(--space-3); }
.edit-check { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; grid-column: 1 / -1; }

/* Organization AI usage (owners/admins) */
.ai-usage-card { margin-top: var(--space-4); }
.ai-usage-title { font-size: var(--text-sm); margin-top: var(--space-3); }
.ai-usage-list { display: grid; gap: var(--space-2); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.ai-usage-list li { display: flex; justify-content: space-between; gap: var(--space-2); overflow-wrap: anywhere; font-size: var(--text-sm); }

/* BRAIZONE AI suggestions: up to 4 main suggestions in a grid (2 columns, 1 on very narrow screens), never a horizontal
   swipe; the rest under "Más sugerencias". Labels wrap instead of overflowing, also with zoom or the keyboard open. */
.quick-actions.primary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); width: 100%; max-width: 520px; margin-inline: auto; }
.quick-actions.primary .quick-action, .quick-actions-more .quick-action { white-space: normal; text-align: center; min-height: var(--touch, 44px); display: inline-flex; align-items: center; justify-content: center; overflow-wrap: anywhere; text-decoration: none; color: inherit; }
.chat-welcome .quick-actions-more { margin-top: var(--space-2); text-align: center; }
.quick-actions-more.in-chat .quick-actions.primary { margin-top: var(--space-2); }
@media (max-width: 340px) { .quick-actions.primary { grid-template-columns: minmax(0, 1fr); } }

/* Loading screen: styles/boot.css (loaded first, so it paints before the rest of the app's styles). */

/* First run: setup wizard, short guide and start-here empty states. Single column on phones, no horizontal scroll. */
.first-run { max-width: 760px; margin-inline: auto; }
.setup-form { display: grid; gap: var(--space-4); }
.setup-steps { display: grid; gap: var(--space-5); margin: 0; padding: 0; list-style: none; }
.type-option.is-disabled { opacity: 0.6; cursor: not-allowed; }
.tutorial-card { margin-bottom: var(--space-4); }
.tutorial-steps { display: grid; gap: var(--space-2); margin: var(--space-3) 0; padding: 0; list-style: none; }
.tutorial-step { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; overflow-wrap: anywhere; }
.tutorial-step.is-done > span:not(.tutorial-mark) { color: var(--muted); text-decoration: line-through; }
.tutorial-mark { display: grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--border); color: var(--accent-text); }
.tutorial-step.is-done .tutorial-mark { background: var(--accent-soft); box-shadow: none; }
.tutorial-mark .icon { width: 14px; height: 14px; }
.empty-start { text-align: center; }
.empty-start .button { min-height: 44px; margin-top: var(--space-3); }

/* Home hierarchy: where am I (business as title), what is going on (pulse from real data), what can I do (quick actions). */
.home-header h1 { font-size: var(--text-3xl); letter-spacing: var(--tracking-display); overflow-wrap: anywhere; }
.home-pulse { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
.pulse-item { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--surface-subtle); color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-medium); box-shadow: inset 0 0 0 1px var(--border); }
.pulse-item .icon { width: 16px; height: 16px; flex-shrink: 0; }
.pulse-item.tone-ok .icon { color: var(--success); }
.pulse-item.tone-idle .icon { color: var(--muted); }
.pulse-item.tone-attention { background: var(--warning-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 40%, transparent); }
.pulse-item.tone-attention .icon { color: var(--warning); }
.home-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-3); margin-bottom: var(--gap); }
.home-action { display: flex; align-items: center; gap: var(--space-3); min-height: 64px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-large); background: var(--surface); color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-semibold); text-decoration: none; box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm); transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-color), background-color var(--duration-fast) var(--ease-color); }
.home-action:hover { background: var(--surface-hover); box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-md); }
.home-action:active { transform: scale(var(--press-scale)); }
.home-action:focus-visible { box-shadow: var(--focus-ring); }
.home-action-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--radius-medium); background: var(--accent-soft); color: var(--accent-text); }
.home-action-icon .icon { width: 20px; height: 20px; }
.home-action.is-ai .home-action-icon { background: var(--accent-strong); color: var(--accent-contrast); }
.empty-action { display: flex; justify-content: center; margin-top: var(--space-4); }
@media (max-width: 600px) {
  .home-header h1 { font-size: var(--text-2xl); }
  .home-header .header-actions { display: none; }
  .home-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .home-action { flex-direction: column; align-items: flex-start; justify-content: center; gap: var(--space-2); min-height: 92px; padding: var(--space-3); }
  .home-action-label { line-height: var(--leading-snug); }
}

/* Forms: the few fields everyone needs first; the rest under "Más opciones" with safe defaults. */
.field-grid > .more-options { grid-column: 1 / -1; }
.more-options { border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.more-options > summary { position: relative; display: grid; gap: 2px; min-height: var(--touch); align-content: center; padding: var(--space-3) calc(var(--space-4) + 24px) var(--space-3) var(--space-4); border-radius: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold); cursor: pointer; list-style: none; }
.more-options > summary::-webkit-details-marker { display: none; }
.more-options > summary::after { content: "+"; position: absolute; right: var(--space-4); top: 50%; transform: translateY(-50%); color: var(--accent-text); font-size: var(--text-lg); font-weight: var(--weight-regular); }
.more-options[open] > summary::after { content: "−"; }
.more-options > summary small { color: var(--muted); font-size: var(--text-xs); font-weight: var(--weight-regular); }
.more-options[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-medium) var(--radius-medium) 0 0; }
.more-options > .field-grid { padding: var(--space-4); }

/* Success feedback: short, specific, dismissible; above the tab bar on phones; never blocks the page. */
.toast-region { position: fixed; z-index: calc(var(--z-sheet) + 1); left: 50%; bottom: calc(var(--space-6) + env(safe-area-inset-bottom)); display: grid; gap: var(--space-2); width: min(440px, calc(100vw - 2 * var(--space-4))); transform: translateX(-50%); pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); border-radius: var(--radius-large); background: var(--surface-elevated); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-lg); pointer-events: auto; animation: toast-in 220ms var(--ease-out) both; }
.toast.is-leaving { opacity: 0; transform: translateY(4px); transition: opacity 180ms var(--ease-in-out), transform 180ms var(--ease-in-out); }
.toast-icon { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--success-soft); color: var(--success); }
.toast.tone-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-icon .icon { width: 18px; height: 18px; }
.toast-copy { display: grid; flex: 1; gap: 2px; min-width: 0; padding: var(--space-1) 0; }
.toast-copy strong { font-size: var(--text-sm); }
.toast-copy small { color: var(--text-secondary); font-size: var(--text-xs); overflow-wrap: anywhere; }
.toast-close { display: grid; flex-shrink: 0; place-items: center; width: var(--touch); height: var(--touch); border: 0; border-radius: var(--radius-medium); background: transparent; color: var(--text-secondary); }
.toast-close:hover { background: var(--surface-hover); }
.toast-close .icon { width: 16px; height: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 860px) { .toast-region { bottom: calc(var(--tabbar-h) + var(--space-3) + env(safe-area-inset-bottom)); } }
@media (prefers-reduced-motion: reduce) { .toast { animation-name: fade; } .toast.is-leaving { transform: none; } .home-action:active { transform: none; } }

/* Sales lifecycle: cancelled/corrected sales stay readable in history but visibly out of the totals. */
.button.small { min-height: var(--touch); padding: 0 var(--space-3); font-size: var(--text-xs); }
.button.ghost.tone-danger { color: var(--danger); }
.button.ghost.tone-danger:hover { background: var(--danger-soft); }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.data-table .cell-primary .status-pill { margin-top: var(--space-1); }
.data-table tr.is-cancelled td { color: var(--muted); }
.data-table tr.is-cancelled .cell-primary strong, .data-table tr.is-cancelled td.num strong { text-decoration: line-through; text-decoration-color: var(--border-strong); }
.sale-reason { overflow-wrap: anywhere; }

/* Commercial orders: product lines, estimated total, separation state and next actions. */
.field-grid > .order-lines, .field-grid > .order-reserve { grid-column: 1 / -1; }
.order-lines { display: grid; gap: var(--space-2); margin: 0; padding: var(--space-3); border: 0; border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.order-lines legend { padding: 0 var(--space-1); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.order-line { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: var(--space-2); }
.order-lines .button { justify-self: start; }
.order-lines-list { display: grid; gap: var(--space-1); margin: var(--space-2) 0 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.order-lines-list li { display: flex; justify-content: space-between; gap: var(--space-3); }
.order-lines-list small { color: var(--muted); white-space: nowrap; }
.order-total { margin: var(--space-2) 0 0; color: var(--text-secondary); font-size: var(--text-sm); }
.order-total strong { color: var(--text); }
.order-source, .order-notes { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-1) 0 0; color: var(--text-secondary); font-size: var(--text-xs); }
.order-source .icon { width: 14px; height: 14px; }
.order-notes { font-style: italic; overflow-wrap: anywhere; }
.order-actions { margin-top: var(--space-3); }
@media (max-width: 600px) { .order-line { grid-template-columns: minmax(0, 1fr) 84px; } .order-actions .button { flex: 1; } }

/* Día a día: notes, notification center (Pendientes) and agenda. */
.note-composer form { display: grid; gap: var(--space-3); }
.note-composer label[for="note-text"] { font-weight: var(--weight-semibold); }
.note-composer textarea { width: 100%; min-height: 72px; resize: vertical; }
.note-composer .form-actions { justify-content: flex-end; }
.note-list { display: grid; gap: var(--space-3); }
.note-card { display: grid; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.note-card.is-archived { opacity: 0.75; }
.note-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--muted); font-size: var(--text-xs); }
.archived-notes > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--touch); cursor: pointer; list-style: none; }
.archived-notes > summary h2 { margin: 0; }
.notification-list, .agenda-day { display: grid; gap: var(--space-2); }
.notification, .agenda-event { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-3); border-radius: var(--radius-medium); color: var(--text); text-decoration: none; box-shadow: inset 0 0 0 1px var(--border); }
.notification:hover, .agenda-event:hover { background: var(--surface-hover); }
.notification.is-unread { background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border-strong), inset 3px 0 0 var(--accent); }
.notification-icon, .agenda-icon { display: grid; flex-shrink: 0; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-medium); background: var(--tone-soft, var(--surface-inset)); color: var(--tone, var(--text-secondary)); }
.notification-icon .icon, .agenda-icon .icon { width: 18px; height: 18px; }
.notification-copy, .agenda-copy { display: grid; flex: 1; gap: 2px; min-width: 0; }
.notification-copy small, .agenda-copy small { color: var(--text-secondary); font-size: var(--text-xs); overflow-wrap: anywhere; }
.notification-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-1); color: var(--muted); font-size: var(--text-2xs); }
.unread-mark { font-weight: var(--weight-semibold); color: var(--accent-text); }
.agenda-day + .agenda-day { margin-top: var(--space-5); }
.agenda-day h2 { margin: 0 0 var(--space-1); font-size: var(--text-sm); color: var(--text-secondary); }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--gap); }
.chip-row .chip { min-height: var(--touch); padding: 0 var(--space-4); border: 0; cursor: pointer; }
.chip.is-active { background: var(--accent-strong); color: var(--accent-contrast); }
.notification-bell { position: relative; }
.bell-count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--danger); color: #fff; font-size: 11px; font-weight: var(--weight-bold); line-height: 18px; text-align: center; }
.attention-more { margin-top: var(--space-3); }

/* BRAIZONE AI card: what BRAIZONE understood, what changes, and what will happen (sentence), then the named action. */
.ai-action-effect { display: flex; align-items: flex-start; gap: var(--space-2); margin: var(--space-3) 0 0; padding: var(--space-3); border-radius: var(--radius-medium); background: var(--info-soft); color: var(--text); font-size: var(--text-sm); line-height: var(--leading-snug); }
.ai-action-effect .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--info); }

/* Public catalog settings. */
.catalog-settings h2 { display: flex; align-items: center; gap: var(--space-2); }
.catalog-link-row { display: flex; align-items: center; gap: var(--space-2); overflow-wrap: anywhere; font-size: var(--text-sm); }
.input-prefix { display: flex; align-items: center; gap: var(--space-1); }
.input-prefix > span { color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
.input-prefix input { flex: 1; min-width: 0; }
.catalog-warning::before { background: var(--warning) !important; }

/* Finanzas: available money with its formula in plain lines. */
.finance-cash h2, .finance-cash .section-head h2 { display: flex; align-items: center; gap: var(--space-2); }
.finance-amount { display: block; margin: var(--space-2) 0 var(--space-3); font-size: var(--text-display, var(--text-3xl)); letter-spacing: var(--tracking-display); }
.finance-formula { display: grid; gap: var(--space-1); margin: var(--space-3) 0; }
.finance-formula > div { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-1) 0; font-size: var(--text-sm); }
.finance-formula dt { color: var(--text-secondary); }
.finance-formula dd { margin: 0; font-variant-numeric: tabular-nums; }
.finance-formula .finance-total { padding-top: var(--space-2); border-top: 1px solid var(--border); font-weight: var(--weight-semibold); }
.finance-formula .finance-total dt { color: var(--text); }
.finance-period { margin-top: var(--gap); }
.finance-entries { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.finance-entries li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-medium); box-shadow: inset 0 0 0 1px var(--border); }
.finance-entries li > div { display: grid; flex: 1; gap: 2px; min-width: 0; }
.finance-entries small { color: var(--muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.finance-entries li.is-cancelled strong, .finance-entries li.is-cancelled .finance-entry-amount { color: var(--muted); text-decoration: line-through; }
.finance-entry-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-card .stat-value { font-size: var(--text-lg); }

/* Touch targets: on phones and touch screens every control is at least 44 px (WCAG 2.5.5 target size). */
@media (max-width: 860px), (pointer: coarse) {
  .button, .icon-button, .chip-row .chip, details.lots > summary, details.advanced-type > summary { min-height: var(--touch); }
  details.lots > summary, details.advanced-type > summary { display: flex; align-items: center; gap: var(--space-2); }
}

/* Phones: order states as a compact 3-column summary so the orders themselves are visible on the first screen. */
@media (max-width: 600px) {
  .status-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-1); }
  .status-count { grid-template-columns: minmax(0, 1fr); gap: 0; padding: var(--space-2) var(--space-3); }
  .status-overview > :first-child { grid-column: auto; }
  .status-count .icon { display: none; }
  .status-count span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .status-count strong { font-size: var(--text-md); }
}

/* Platform products (BraiZone Business / BraiZone Citas) */
.platform-products { margin-top: var(--space-6); }
.product-rows { display: grid; gap: var(--space-3); }
.product-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-top: 1px solid var(--line, rgba(127,127,127,.18)); }
.product-row h3 { font-size: 1rem; margin: 0; }
.product-toggles { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: flex-end; }
.product-toggles .edit-check { min-height: 44px; }
@media (max-width: 720px) { .product-row { flex-direction: column; align-items: stretch; } .product-toggles { justify-content: flex-start; } }

/* Public sign-up */
.auth-signup { display: grid; gap: var(--space-2); margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line, rgba(127,127,127,.18)); text-align: center; }
.password-field { position: relative; display: block; }
.password-field input { width: 100%; padding-right: 92px; }
.password-toggle { position: absolute; top: 0; right: 0; bottom: 0; min-width: 84px; padding: 0 var(--space-3); border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: var(--weight-semibold); cursor: pointer; border-radius: 0 var(--radius-medium) var(--radius-medium) 0; }
.password-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.auth-demo { margin: var(--space-3) 0 0; text-align: center; font-size: var(--text-sm); }
.auth-demo a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-secondary); text-decoration: underline; text-underline-offset: 3px; }
/* Citas: Agenda empty state and the switch between appointments and dated items (Business+Citas). */
.agenda-empty { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-7) var(--space-4); text-align: center; }
.agenda-empty h2 { font-size: var(--text-lg); }
.agenda-date { margin: var(--space-2) 0; font-size: var(--text-md, 1rem); }
.agenda-switch { margin-top: var(--space-4); text-align: center; }
.agenda-switch a { display: inline-flex; align-items: center; min-height: 44px; }
.product-upgrade { margin-top: var(--space-4); }
.signup-card { max-width: 520px; }
.signup-step { display: grid; gap: var(--space-3); }
.signup-step h2 { font-size: var(--text-xl, 1.25rem); margin: 0; }
.signup-types[data-citas] { display: none; }
.signup-requests { margin-bottom: var(--space-6); }

/* BRAIZONE Citas (owner) */
.citas-tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-5); }
.citas-tabs .chip { min-height: 44px; }
.staff-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); margin-top: var(--space-4); }
.staff-card form { display: grid; gap: var(--space-3); }
.staff-card.is-muted { opacity: .7; }
.staff-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.staff-services { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; padding: 0; }
.hours-editor { border: 0; padding: 0; display: grid; gap: var(--space-2); }
.hours-row { display: grid; grid-template-columns: minmax(110px, 1.2fr) repeat(4, minmax(0, 1fr)); gap: var(--space-2); align-items: center; }
.hours-row input[type=time] { min-height: 44px; min-width: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end; }
.bookable-row { display: grid; gap: var(--space-3); margin-top: var(--space-3); }
.block-list { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.block-list li { display: flex; justify-content: space-between; gap: var(--space-3); align-items: center; }
@media (max-width: 560px) { .hours-row { grid-template-columns: 1fr 1fr; } .hours-row .edit-check { grid-column: 1 / -1; } }

.agenda-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.agenda-toolbar .segmented { display: flex; gap: var(--space-2); }
.agenda-nav { display: flex; gap: var(--space-2); align-items: center; }
.agenda-nav input[type=date] { min-height: 44px; }
.agenda-day { margin-bottom: var(--space-4); }
.appointment-card { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-4); align-items: center; margin-top: var(--space-3); padding: var(--space-4); }
.appointment-time { display: grid; text-align: center; min-width: 64px; }
.appointment-time strong { font-size: 1.15rem; }
.appointment-body h3 { margin: 0; font-size: 1rem; }
.appointment-body p { margin: 2px 0; }
.appointment-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; align-items: center; }
.appointment-card.status-cancelled { opacity: .65; }
@media (max-width: 640px) { .appointment-card { grid-template-columns: auto 1fr; } .appointment-actions { grid-column: 1 / -1; justify-content: flex-start; } }

.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: flex; align-items: center; padding: 0 var(--space-2); color: var(--text-secondary); }
.input-prefix input { flex: 1; min-width: 0; }
.palette-picker { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; padding: 0; margin: var(--space-3) 0; }
.palette-option { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-3); border-radius: 999px; box-shadow: inset 0 0 0 1px var(--border); cursor: pointer; }
.palette-option:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); }
.palette-swatch { width: 20px; height: 20px; border-radius: 50%; }

/* Citas — polish: controls follow the BRAIZONE form style; tabs use chip-row; cards keep their padding. */
.citas-page input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), .citas-page select, .citas-page textarea {
  width: 100%; min-width: 0; min-height: var(--touch); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-medium); background: var(--surface-inset); color: var(--text); font-size: var(--text-base); box-shadow: inset 0 0 0 1px var(--border-strong);
}
.citas-page textarea { padding: var(--space-3); min-height: 88px; line-height: var(--leading-relaxed); resize: vertical; }
.citas-page select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.citas-page input:disabled, .citas-page select:disabled, .citas-page textarea:disabled { opacity: .6; cursor: not-allowed; }
.citas-page label { display: grid; gap: var(--space-1); }
.citas-page label.edit-check { display: flex; }
.citas-tabs { margin-bottom: var(--space-5); }
.citas-tabs .chip, .agenda-toolbar .chip, .new-appointment-times .chip { min-height: var(--touch); padding: 0 var(--space-4); border: 0; cursor: pointer; }
.chip:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft), inset 0 0 0 1px var(--accent); outline: none; }
.staff-card { padding: var(--space-5); }
.staff-card .staff-head h3 { margin: 0; }
.bookable-row { padding: var(--space-5); }
.hours-row .edit-check { min-height: var(--touch); align-items: center; }
.inline-form label { flex: 1 1 220px; }
.media-controls { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); margin-bottom: var(--space-5); }
.media-slot { display: flex; gap: var(--space-4); align-items: center; padding: var(--space-4); border-radius: var(--radius-large); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); }
.media-preview { flex-shrink: 0; display: grid; place-items: center; overflow: hidden; background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.media-logo .media-preview { width: 72px; height: 72px; border-radius: 18px; }
.media-cover .media-preview { height: 72px; aspect-ratio: 16 / 9; border-radius: var(--radius-medium); }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-preview[aria-busy="true"] { opacity: .6; }
.media-copy { display: grid; gap: var(--space-1); min-width: 0; }
.media-copy small { color: var(--text-secondary); }
.media-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.media-actions .button { min-height: var(--touch); }
.new-appointment { margin-bottom: var(--space-4); }
@media (max-width: 560px) { .agenda-toolbar { align-items: stretch; } .agenda-toolbar > .button { width: 100%; justify-content: center; } }
/* Citas — weekly schedule as explicit intervals ("Horario 1 · Desde · Hasta"). A day off shows no time fields. */
.day-hours { display: grid; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.day-hours .day-toggle { min-height: var(--touch); align-items: center; font-weight: var(--weight-semibold); }
.day-off { color: var(--text-secondary); font-size: var(--text-sm); }
.day-intervals { display: grid; gap: var(--space-2); }
.interval { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--space-2) var(--space-3); align-items: end; padding: var(--space-3); border-radius: var(--radius-medium); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.interval-title { grid-column: 1 / -1; margin: 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-secondary); }
.interval label { display: grid; gap: var(--space-1); font-size: var(--text-sm); }
.interval input[type=time] { min-height: var(--touch); width: 100%; min-width: 0; font-size: var(--text-md); }
.interval .field-error, .day-intervals > .field-error { grid-column: 1 / -1; margin: 0; }
.field-error { color: var(--danger); font-size: var(--text-sm); }
.field-error:empty { display: none; }
.field-hint { color: var(--text-secondary); font-size: var(--text-sm); font-weight: normal; }
.is-invalid { box-shadow: 0 0 0 2px var(--danger) !important; }
.add-interval { justify-self: start; }
.copy-hours { padding-top: var(--space-2); }
@media (max-width: 560px) { .interval { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .interval [data-remove-interval] { grid-column: 1 / -1; justify-self: start; } }
/* Página de reservas: grouped settings, an obvious publication state and what is missing. */
.booking-settings form { display: grid; gap: var(--space-4); }
.settings-group { display: grid; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.settings-group:first-child { border-top: 0; padding-top: 0; }
.settings-group h3 { margin: 0; font-size: var(--text-xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-secondary); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .field-grid.three { grid-template-columns: 1fr; } }
.publish-state { display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-pill); background: var(--surface-inset); color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-label); }
.publish-state.is-live { background: var(--success-soft); color: var(--success); }
.publish-line { margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.readiness { padding: var(--space-3) var(--space-4); border-radius: var(--radius-medium); background: var(--warning-soft); }
.readiness p { margin: 0 0 var(--space-1); }
.readiness ul { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-1); }
.readiness a { display: inline-flex; min-height: 32px; align-items: center; }
.url-preview { margin: 0; color: var(--text-secondary); font-size: var(--text-sm); overflow-wrap: anywhere; }
.url-preview strong { color: var(--text); }
.service-facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-1) 0 0; color: var(--text-secondary); }
/* A checkbox inside a field grid stays a checkbox (the grid's input sizing is for text fields). */
.field-grid label.edit-check { display: flex; align-items: center; color: var(--text); font-size: var(--text-sm); }
.field-grid .edit-check input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; padding: 0; flex: none; box-shadow: none; }
/* Citas Agenda — Lista / Calendario. Month grid: six weeks, Monday first; chips per day, counts on small screens. */
.display-switch .chip { display: inline-flex; align-items: center; gap: 6px; }
.display-switch .icon { width: 16px; height: 16px; }
.cal-title { min-width: 9.5rem; text-align: center; font-size: var(--text-md); }
.agenda-calendar { padding: var(--space-3); }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-weekdays span { padding: var(--space-1) 0 var(--space-2); text-align: center; color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.cal-cell { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-height: 108px; min-width: 0; padding: 8px; border: 0; border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: box-shadow .15s, background .15s, transform .15s; }
.cal-cell:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell.is-outside { opacity: .45; }
.cal-cell.is-today .cal-num { background: var(--accent); color: #fff; }
.cal-cell.is-selected { box-shadow: inset 0 0 0 2px var(--accent); background: var(--surface); }
.cal-num { align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.cal-count { display: none; }
.cal-items { display: grid; gap: 3px; min-width: 0; }
.cal-chip { display: block; overflow: hidden; padding: 2px 6px; border-radius: 6px; font-size: 11px; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; background: var(--surface-inset); color: var(--text); border-left: 3px solid var(--text-secondary); }
.cal-chip.status-pending { background: var(--warning-soft); border-left-color: var(--warning); }
.cal-chip.status-confirmed, .cal-chip.status-completed { background: var(--success-soft); border-left-color: var(--success); }
.cal-more { color: var(--text-secondary); font-size: 11px; font-weight: var(--weight-semibold); }
.cal-legend { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0 0; }
.cal-legend .cal-chip { display: inline-block; font-size: var(--text-xs); }
@media (max-width: 760px) {
  .agenda-calendar { padding: var(--space-2); }
  .cal-weekdays, .cal-grid { gap: 4px; }
  .cal-cell { min-height: 56px; padding: 6px 4px; align-items: center; justify-content: flex-start; }
  .cal-num { align-self: center; min-width: 28px; height: 28px; }
  .cal-items { display: none; }
  .cal-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: var(--weight-bold); }
  .cal-title { min-width: 0; }
}
/* Citas C5 — service image, categories, Mi página tabs, portfolio, reviews, review invitation. */
.bookable-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.service-media { display: grid; gap: var(--space-2); justify-items: start; }
.service-thumb { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius-medium); overflow: hidden; display: grid; place-items: center; background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); color: var(--text-secondary); font-weight: var(--weight-bold); font-size: var(--text-lg); }
.service-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.service-thumb[aria-busy="true"] { opacity: .6; }
@media (max-width: 640px) { .bookable-row { grid-template-columns: minmax(0, 1fr); } .service-media { grid-template-columns: 6.5rem minmax(0, 1fr); align-items: center; } .service-media .form-error { grid-column: 1 / -1; } }
.category-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.category-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.category-name { font-weight: var(--weight-semibold); flex: 1; min-width: 8rem; }
.category-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.page-tabs { margin: 0 0 var(--space-4); overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
.page-tabs .chip { white-space: nowrap; }
.page-facts { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-3) 0; padding: 0; }
.page-facts li { padding: var(--space-3) var(--space-4); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); color: var(--text-secondary); }
.page-facts strong { color: var(--text); font-size: var(--text-lg); margin-right: 4px; }
.sticky-actions { position: sticky; bottom: calc(var(--space-3) + env(safe-area-inset-bottom)); z-index: 2; padding: var(--space-3); margin: 0 calc(-1 * var(--space-3)); border-radius: var(--radius-medium); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); }
@media (max-width: 760px) { .sticky-actions { bottom: calc(76px + env(safe-area-inset-bottom)); } }
.portfolio-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); margin: var(--space-3) 0; }
.portfolio-add > label:first-child { display: grid; gap: 6px; flex: 1; min-width: 12rem; color: var(--text-secondary); font-size: var(--text-xs); }
.portfolio-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.portfolio-item { position: relative; margin: 0; border-radius: var(--radius-medium); overflow: hidden; background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.portfolio-item img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.portfolio-item.is-hidden img { opacity: .45; }
.portfolio-hidden { position: absolute; top: 8px; left: 8px; }
.portfolio-item figcaption { display: grid; gap: var(--space-2); padding: var(--space-2); }
.portfolio-item figcaption input { width: 100%; min-height: var(--touch); }
.portfolio-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.portfolio-actions .edit-check { min-height: var(--touch); margin-right: auto; }
.stars { color: #f5a623; letter-spacing: 2px; }
.stars-off { color: var(--border-strong); }
.review-score { font-weight: var(--weight-semibold); }
.review-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-3); }
.review-list li { padding: var(--space-3) var(--space-4); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.review-list p { margin: var(--space-1) 0; }
.review-list small { color: var(--text-secondary); }
.review-invite { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); padding: var(--space-3); border-radius: var(--radius-medium); background: var(--success-soft); }
.review-invite p { flex-basis: 100%; margin: 0; }
.review-invite input { flex: 1; min-width: 12rem; min-height: var(--touch); }
/* Hidden Mi página groups, panels and forms stay hidden even where a display rule applies. */
.citas-page [hidden] { display: none !important; }

/* Citas — compact service list and the "Editar servicio" dialog (a sheet on phones). */
.service-list { display: grid; gap: var(--space-3); margin-top: var(--space-3); }
.service-row { display: grid; grid-template-columns: 7rem minmax(0, 1fr) auto; gap: var(--space-4); align-items: center; padding: var(--space-4); }
.service-row .service-thumb { width: 7rem; }
.service-row-body { min-width: 0; display: grid; gap: 4px; }
.service-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.service-row-title h3 { margin: 0; font-size: var(--text-md); }
.service-row .helper { margin: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.service-content-state { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; color: var(--text-secondary); font-size: var(--text-xs); }
.service-content-state span::before { content: "✓ "; color: var(--success); }
@media (max-width: 640px) { .service-row { grid-template-columns: 5.5rem minmax(0, 1fr); } .service-row .service-thumb { width: 5.5rem; } .service-row > .button { grid-column: 1 / -1; justify-self: stretch; } }
.service-editor { width: min(760px, calc(100vw - 2 * var(--space-4))); max-height: calc(100dvh - 2 * var(--space-5)); padding: 0; border: 0; border-radius: var(--radius-large); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.45); overflow: hidden; }
.service-editor::backdrop { background: rgba(4, 8, 16, .62); backdrop-filter: blur(3px); }
.service-editor form { display: flex; flex-direction: column; max-height: calc(100dvh - 2 * var(--space-5)); }
.service-editor-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.service-editor-head h2 { margin: 2px 0 0; font-size: var(--text-lg); overflow-wrap: anywhere; }
.service-editor-head .eyebrow { margin: 0; }
.service-editor-body { overflow-y: auto; padding: var(--space-4) var(--space-5); display: grid; gap: var(--space-5); overscroll-behavior: contain; }
.service-editor-body .settings-group { gap: var(--space-3); }
.service-editor-body > .settings-group > label { display: grid; gap: 6px; color: var(--text-secondary); font-size: var(--text-xs); }
.service-editor-body textarea, .service-editor-body > .settings-group > label > input { width: 100%; min-height: var(--touch); }
.service-editor-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5) calc(var(--space-3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.service-editor-foot .form-error { margin: 0 auto 0 0; }
.editor-label { margin: 0 0 var(--space-2); color: var(--text-secondary); font-size: var(--text-xs); }
.editor-image .service-media { grid-template-columns: 9rem minmax(0, 1fr); align-items: center; }
.list-editor { border: 0; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.list-editor legend { margin-bottom: 6px; color: var(--text-secondary); font-size: var(--text-xs); }
.list-items { display: grid; gap: var(--space-2); }
.list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; }
.list-item input { width: 100%; min-height: var(--touch); }
.list-editor [data-add-item] { justify-self: start; }
.gallery-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: var(--space-3); }
.gallery-item { margin: 0; border-radius: var(--radius-medium); overflow: hidden; background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.gallery-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery-item figcaption { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; }
.gallery-add { display: grid; place-items: center; align-content: center; gap: 4px; min-height: 8rem; border-radius: var(--radius-medium); border: 1.5px dashed var(--border-strong); color: var(--text-secondary); cursor: pointer; text-align: center; }
.gallery-add:hover, .gallery-add:focus-within { border-color: var(--accent); color: var(--text); }
.gallery-admin .form-error { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) {
  .service-editor { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: var(--radius-large) var(--radius-large) 0 0; }
  .service-editor form { max-height: 94dvh; }
  .service-editor-body { padding: var(--space-4); }
  .editor-image .service-media { grid-template-columns: 6.5rem minmax(0, 1fr); }
}

/* BRAIZONE Web — Mi web (#/mi-web). Built on the Mi página layout (.citas-page): tabs, settings cards, the media
   slots, the palette picker and the editor dialog are shared; only the product list, the publish checklist and the
   web orders are new. Touch targets stay at 44px. */
.web-page .media-grid { display: grid; gap: var(--space-3); margin-top: var(--space-4); }
@media (min-width: 47.5rem) { .web-page .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.web-page .media-slot { flex-wrap: wrap; }
.web-page .media-slot .editor-label { flex-basis: 100%; margin: 0; font-weight: var(--weight-semibold); }
.web-page .media-slot .field-hint { flex: 1; min-width: 10rem; }
.web-page .media-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.web-search { position: relative; display: flex !important; align-items: center; margin: var(--space-3) 0; }
.web-search .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.citas-page.web-page .web-search input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]) { padding-left: 40px; }
.web-products { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.web-product { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: var(--space-3); align-items: center; padding: var(--space-3); border-radius: var(--radius-large); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); }
.web-product.is-shown { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success) 45%, var(--border)); }
.web-thumb { width: 56px; height: 56px; border-radius: var(--radius-medium); overflow: hidden; display: grid; place-items: center; background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.web-thumb img { width: 100%; height: 100%; object-fit: cover; }
.web-product-copy { display: grid; gap: 2px; min-width: 0; }
.web-product-copy strong { overflow-wrap: anywhere; }
.web-product-facts { display: flex; flex-wrap: wrap; gap: 4px var(--space-3); color: var(--text-secondary); font-size: var(--text-xs); }
.web-product-facts .is-ok { color: var(--success); font-weight: var(--weight-semibold); }
.web-product-facts .is-out { color: var(--danger); font-weight: var(--weight-semibold); }
.web-product-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
@media (min-width: 47.5rem) { .web-product { grid-template-columns: 56px minmax(0, 1fr) auto; } .web-product-actions { grid-column: auto; justify-content: flex-end; } }
.web-page label.switch { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; cursor: pointer; font-weight: var(--weight-medium); }
.web-page label.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
.web-page label.switch.is-large { font-size: var(--text-md); }
.web-checklist { list-style: none; margin: var(--space-4) 0; padding: 0; display: grid; gap: var(--space-2); }
.web-checklist li { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-medium); background: var(--surface-inset); }
.web-checklist li.is-ok .icon { color: var(--success); }
.web-checklist li.is-missing .icon { color: var(--warning); }
.web-checklist li .button { margin-left: auto; }
.link-button { padding: 0; border: 0; background: none; color: var(--accent-text); font: inherit; text-decoration: underline; cursor: pointer; min-height: 44px; }
.web-orders { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.web-order { display: grid; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-large); background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); }
.web-order-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.web-order-who { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
.web-order-who .order-date { margin-left: auto; }
.order-source-tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 var(--space-2); border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--text-2xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-label); }
.web-editor .service-thumb.is-large { max-width: 16rem; aspect-ratio: 1 / 1; }

/* ---------- BraiZone Restaurantes: stations (Mesas, Cocina, Caja), administration and Avisos ---------- */
.live-status { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 var(--space-3); border-radius: var(--radius-pill); background: var(--surface-inset); color: var(--text-secondary); font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap; }
.live-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.live-status[data-state="on"] { color: var(--success); background: var(--success-soft); }
.live-status[data-state="on"]::before { background: var(--success); }
.live-status[data-state="off"] { color: var(--warning); background: var(--warning-soft); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.button.big { min-height: 52px; padding-inline: var(--space-5); font-size: var(--text-md); }
.span-2 { grid-column: 1 / -1; }
.inline-pair { display: grid; grid-template-columns: minmax(0, 1fr) 88px; gap: var(--space-2); margin-top: var(--space-1); }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.plain-list > li + li { border-top: 1px solid var(--border); }
.list-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-3) 0; color: inherit; text-decoration: none; }
.list-row > span:first-child { flex: 1 1 240px; min-width: 0; display: grid; gap: 2px; }
.list-row small { color: var(--text-secondary); }
.list-row.is-archived { opacity: .6; }
.plain-list.compact .list-row { padding: var(--space-2) 0; }
.add-panel > summary { cursor: pointer; list-style: none; }
.add-panel > summary h2 { display: inline-flex; align-items: center; gap: var(--space-2); }
.callout { margin-top: var(--space-4); padding: var(--space-4); border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); }
.callout p { margin: var(--space-2) 0 0; color: var(--text-secondary); }
.business-feedback.is-warning { color: var(--warning); }
.edit-dialog.is-wide { width: min(760px, calc(100vw - 32px)); }
.option-list { grid-column: 1 / -1; display: grid; gap: var(--space-2); margin: 0; padding: 0; border: 0; }
.option-list legend { font-weight: var(--weight-semibold); margin-bottom: var(--space-2); }
.payment-methods { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

/* Mesas */
.station-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: var(--gap); align-items: start; }
.station-side { position: sticky; top: var(--space-4); }
.floor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.table-card { display: grid; gap: var(--space-2); justify-items: start; min-height: 112px; padding: var(--space-4); border: 0; border-radius: var(--radius-large); background: var(--card); box-shadow: inset 0 0 0 1px var(--border), var(--shadow-1); color: var(--text); text-align: left; cursor: pointer; transition: box-shadow var(--duration-fast) var(--ease); }
.table-card .table-name { font-size: var(--text-md); font-weight: var(--weight-bold); }
.table-card .table-meta { color: var(--text-secondary); font-size: var(--text-xs); }
.table-card.state-preparing { box-shadow: inset 0 0 0 2px var(--warning), var(--shadow-1); }
.table-card.state-ready { box-shadow: inset 0 0 0 2px var(--success), var(--shadow-1); }
.table-card.state-bill { box-shadow: inset 0 0 0 2px var(--danger), var(--shadow-1); }
.table-card.is-selected { outline: 3px solid var(--accent); outline-offset: 2px; }
.counter-orders { margin-top: var(--gap); display: grid; gap: var(--space-2); }
.counter-orders h2 { font-size: var(--text-md); margin: 0; }
.counter-order { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); width: 100%; min-height: 56px; padding: var(--space-3) var(--space-4); border: 0; border-radius: var(--radius-medium); background: var(--card); box-shadow: inset 0 0 0 1px var(--border); color: var(--text); text-align: left; cursor: pointer; }
.counter-order span:first-child { display: grid; gap: 2px; }
.counter-order small { color: var(--text-secondary); }
.counter-order.is-selected { outline: 3px solid var(--accent); outline-offset: 2px; }
.order-panel .order-lines { list-style: none; margin: var(--space-3) 0; }
.order-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-1) var(--space-3); align-items: center; }
.order-line + .order-line { padding-top: var(--space-2); border-top: 1px solid var(--border); }
.order-line .row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.order-line .row-actions:empty { display: none; }
.order-line.status-cancelled .line-copy, .order-line.status-wasted .line-copy { text-decoration: line-through; color: var(--text-secondary); }
.line-copy { display: grid; gap: 2px; font-weight: var(--weight-medium); }
.line-options, .line-notes { color: var(--text-secondary); font-weight: normal; }
.line-notes { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); }
.line-notes .icon { width: 14px; height: 14px; }
.line-price { font-variant-numeric: tabular-nums; }
.order-total { display: flex; justify-content: space-between; align-items: baseline; margin: var(--space-3) 0; font-size: var(--text-md); }
.order-actions { flex-wrap: wrap; }
.menu-picker { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); display: grid; gap: var(--space-3); }
.menu-picker-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.menu-picker-head h3 { margin: 0; }
.menu-search { flex: 1 1 160px; min-height: var(--touch); padding: 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-medium); background: var(--surface-subtle); color: var(--text); font: inherit; }
.order-line .status-pill { justify-self: start; }
.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); gap: var(--space-2); }
.dish-tile { display: grid; gap: 4px; align-content: start; justify-items: start; min-height: 84px; padding: var(--space-3); border: 0; border-radius: var(--radius-medium); background: var(--surface-subtle); box-shadow: inset 0 0 0 1px var(--border); color: var(--text); text-align: left; cursor: pointer; }
.dish-tile:hover:not(:disabled) { background: var(--surface-hover); }
.dish-tile.is-off { opacity: .55; cursor: not-allowed; }
.dish-price { font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.dish-flag { font-size: var(--text-2xs); font-weight: var(--weight-semibold); color: var(--accent-text); }
.dish-note { color: var(--warning); font-size: var(--text-xs); }

/* Cocina */
.kds-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.kds-column { display: grid; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-large); background: var(--surface-subtle); min-height: 160px; align-content: start; }
.kds-column h2 { margin: 0; font-size: var(--text-md); display: flex; align-items: center; gap: var(--space-2); }
.kds-ticket { display: grid; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-medium); background: var(--card); box-shadow: inset 0 0 0 1px var(--border), var(--shadow-1); }
.kds-ticket.is-late { box-shadow: inset 0 0 0 2px var(--danger), var(--shadow-1); }
.kds-ticket header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.kds-ticket header strong { font-size: var(--text-md); }
.kds-meta, .kds-time { color: var(--text-secondary); font-size: var(--text-xs); }
.kds-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.kds-ticket ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.kds-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border); }
.kds-line .line-copy { flex: 1 1 140px; font-size: var(--text-md); }
.kds-line .button.big { min-width: 7.5rem; }
.kds-availability { margin-top: var(--gap); }
.kds-availability > summary, .movements > summary, .needs > summary { cursor: pointer; }
.toggle-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.toggle-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.toggle-list small { color: var(--text-secondary); }

/* Caja */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: var(--gap); }
.check-card .order-lines { list-style: none; }

/* Inicio del restaurante */
.ingredient-alert { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); color: inherit; text-decoration: none; margin-bottom: var(--gap); }
.ingredient-alert > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.ingredient-alert small { color: var(--text-secondary); }
.station-links { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Menú, insumos, catering */
.dish-list { list-style: none; margin: 0; padding: 0; }
.dish-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; }
.dish-row + .dish-row { border-top: 1px solid var(--border); }
.dish-thumb { flex: 0 0 56px; width: 56px; height: 56px; display: grid; place-items: center; border-radius: var(--radius-medium); background: var(--surface-inset); overflow: hidden; color: var(--text-secondary); }
.dish-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dish-copy { flex: 1 1 220px; min-width: 0; display: grid; gap: 4px; }
.dish-copy small { color: var(--text-secondary); }
.dish-flags { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.file-button { position: relative; cursor: pointer; }
.recipe-rows { display: grid; gap: var(--space-2); }
.add-row { justify-self: start; }
.recipe-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(70px, 1fr) 80px minmax(70px, auto) 44px; gap: var(--space-2); align-items: center; }
.recipe-cost { color: var(--text-secondary); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.recipe-total { font-weight: var(--weight-semibold); margin: 0; }
.results .section-head { flex-wrap: wrap; gap: var(--space-3); }
.results-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-top: var(--space-4); }
.results-columns h3 { margin: 0 0 var(--space-2); font-size: var(--text-md); }
.movements { margin-top: var(--space-4); }
.needs ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); }
.needs .is-short { color: var(--danger); font-weight: var(--weight-semibold); }

/* Equipo y Avisos */
.password-once { box-shadow: inset 0 0 0 2px var(--accent); }
.password-once h2 { display: flex; align-items: center; gap: var(--space-2); }
.temp-password { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.temp-password code { padding: var(--space-2) var(--space-3); border-radius: var(--radius-medium); background: var(--surface-inset); font-size: var(--text-md); letter-spacing: .04em; user-select: all; }
.prefs-table { width: 100%; border-collapse: collapse; }
.prefs-table th, .prefs-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); text-align: center; }
.prefs-table th[scope="row"], .prefs-table thead th:first-child { text-align: left; font-weight: var(--weight-medium); }
.check-cell { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.check-cell input { width: 20px; height: 20px; }

@media (max-width: 1100px) { .station-layout { grid-template-columns: 1fr; } .station-side { position: static; } .station-layout.has-selection .station-side { order: -1; } }
.setup-link[hidden], .mobile-menu a[hidden] { display: none; }
.section-card h2 > .icon, .password-once h2 > .icon { display: inline-block; width: 20px; height: 20px; margin-right: var(--space-2); vertical-align: -3px; }
@media (max-width: 900px) { .kds-board { grid-template-columns: 1fr; } .results-columns { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .recipe-row { grid-template-columns: minmax(0, 1fr) 80px 72px 44px; }
  .recipe-row .recipe-cost { grid-column: 1 / -1; }
  .table-card { min-height: 96px; padding: var(--space-3); }
  .header-actions { flex-wrap: wrap; }
}

/* Choice controls must never inherit full-width text-input geometry. The entire row is tappable. */
.field-grid .edit-check:has(> input[type="radio"]),
.field-grid .edit-check:has(> input[type="checkbox"]) {
  display: flex; align-items: center; gap: var(--space-3); min-width: 0;
}
.field-grid input[type="radio"], .field-grid input[type="checkbox"] {
  width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0;
  flex: 0 0 20px; box-shadow: none; accent-color: var(--accent);
}
.payment-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.payment-methods .edit-check {
  grid-column: auto;
  min-height: 52px; padding: var(--space-3); border: 1px solid var(--border-strong);
  border-radius: var(--radius-medium); background: var(--surface-inset); cursor: pointer;
}
.payment-methods .edit-check > span { min-width: 0; overflow-wrap: normal; word-break: normal; color: var(--text); }
.payment-methods .edit-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.payment-methods .edit-check:has(input:focus-visible) { box-shadow: var(--focus-ring); }
@media(max-width: 380px) { .payment-methods { grid-template-columns: minmax(0, 1fr); } }

/* Design layer (restored from d7e528a): solid readable surfaces with a quiet edge reflection. No layout changes. */
.card { background: var(--panel-fill, var(--surface)); }
.hero-sales { background: linear-gradient(135deg, var(--hero-tint, var(--surface)), var(--surface)); }
.sidebar { background: linear-gradient(165deg, var(--surface-elevated), var(--bg-secondary) 65%); }
.hero-side .kpi:nth-child(2) { background: linear-gradient(140deg, var(--surface-elevated), var(--surface)); }
.nav a.active { box-shadow: var(--highlight), var(--shadow-sm); }
.theme-preview { box-shadow: inset 0 0 0 1px var(--border-strong); }
/* Category lighting (restored from d7e528a): each section keeps its own icon colour. */
:root {
  --module-teal: #63e7dc;
  --module-blue: #9abfff;
  --module-violet: #c5adff;
  --module-emerald: #76e6bc;
  --module-coral: #ffac9d;
  --module-gold: #f3c77d;
}
.nav a, .home-action, .kpi, .hero-sales { --module-color: var(--accent); }
:is(.nav a, .home-action, .kpi):has([data-icon="inventory"]),
.home-action:has([data-icon="plus"]) { --module-color: var(--module-teal); }
:is(.nav a, .home-action, .kpi):has([data-icon="customers"]) { --module-color: var(--module-blue); }
:is(.nav a, .home-action, .kpi):has([data-icon="ai"]) { --module-color: var(--module-violet); }
:is(.nav a, .home-action, .kpi):has([data-icon="wallet"]) { --module-color: var(--module-emerald); }
:is(.nav a, .home-action, .kpi):has([data-icon="orders"]) { --module-color: var(--module-coral); }
:is(.nav a, .home-action, .kpi):has([data-icon="reports"]) { --module-color: var(--module-violet); }
.nav-icon { color: var(--module-color, var(--muted)); }
.nav-icon .icon { filter: drop-shadow(0 0 4px color-mix(in srgb, currentColor 28%, transparent)); }
.nav a.active .nav-icon .icon { filter: none; }
.kpi-icon, .home-action-icon {
  color: var(--module-color);
  background: linear-gradient(145deg, color-mix(in srgb, var(--module-color) 22%, var(--surface)), color-mix(in srgb, var(--module-color) 7%, var(--surface-inset)));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--module-color) 30%, transparent), 0 3px 9px #0002;
}
.kpi-icon .icon, .home-action-icon .icon {
  stroke-width: 1.9;
  filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--module-color) 35%, transparent));
}
.home-action.is-ai .home-action-icon { background: color-mix(in srgb, var(--module-violet) 20%, var(--surface)); color: var(--module-violet); }
.home-action:has([data-icon="sales"]) { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 26%, var(--surface)), var(--surface)); }
.home-action:has([data-icon="inventory"]), .home-action:has([data-icon="plus"]), .home-action:has([data-icon="customers"]) {
  background: linear-gradient(135deg, color-mix(in srgb, var(--module-color) 12%, var(--surface)), var(--surface-inset));
}
.home-hero .kpi, .home-kpis > .kpi {
  background: linear-gradient(145deg, color-mix(in srgb, var(--module-color) 9%, var(--surface-elevated)), var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--module-color) 23%, var(--border)), var(--highlight), var(--shadow-sm);
}
.hero-sales {
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 10%, var(--hero-tint, var(--surface))), transparent 65%), var(--panel-fill, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, var(--border)), var(--highlight), var(--shadow-sm);
}
.sidebar { box-shadow: inset -1px 0 0 color-mix(in srgb, var(--accent) 25%, var(--border)); }

/* BraiZone blue (reference screenshots): soft navy depth, light-blue active item and primary quick action. */
[data-theme="blue"] body { background: linear-gradient(105deg, var(--bg) 0%, #0b1527 55%, #102033 100%) fixed; }
[data-theme="blue"] .nav a.active { background: linear-gradient(90deg, #d8f2ff, #b4e1ff); }
[data-theme="blue"] .home-action:has([data-icon="sales"]) { background: linear-gradient(90deg, #a3dbff, #5fbbff); color: var(--nav-active-text); box-shadow: 0 6px 22px -8px rgba(95, 187, 255, .55), var(--highlight); }
[data-theme="blue"] .home-action:has([data-icon="sales"]) .home-action-icon { background: rgba(255, 255, 255, .38); color: var(--nav-active-text); box-shadow: none; }
[data-theme="blue"] .home-action:has([data-icon="sales"]) .home-action-label { color: var(--nav-active-text); }
/* Ventas: registrar a la izquierda (≈41 %) y, a la derecha (≈59 %), Caja, «Por resolver», resumen e historial.
   En una columna (tableta y celular) el orden del documento ya es el pedido: registrar, caja, historial. */
.sales-layout { display: grid; grid-template-columns: minmax(380px, 41fr) minmax(0, 59fr); gap: var(--gap); align-items: start; }
.sales-layout:not(:has(> .sales-entry-wrap)) { grid-template-columns: minmax(0, 1fr); }
.sales-layout > .sales-entry-wrap { position: static; min-width: 0; }
.sales-records { display: grid; gap: var(--gap); min-width: 0; container: sales-records / inline-size; }
.sales-records > * { margin: 0; min-width: 0; }
.sales-entry + .sale-preview { display: none; }
.sales-entry[open] + .sale-preview { display: block; }
@media (max-width: 1180px) {
  .sales-layout { grid-template-columns: minmax(0, 1fr); }
  .sales-entry > summary { color: var(--accent-text); }
  .sales-entry:not([open]) { box-shadow: inset 0 0 0 1px var(--border-strong), var(--highlight); }
}

/* Historial de ventas: una fila compacta por venta en todo ancho, sin desplazamiento lateral. Arriba: producto (con su
   fecha), estado y total; abajo: cantidad × precio, cliente, canal y pago, y la utilidad cuando se puede ver. Las acciones
   ocupan las dos líneas a la derecha. En el celular el estado y las acciones bajan a una tercera línea. */
.sales-records .table-scroll:has(.sales-table) { overflow: visible; box-shadow: none; border: 0; }
.sales-records .sales-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sales-records .sales-table, .sales-records .sales-table tbody { display: block; width: 100%; min-width: 0; }
.sales-records .sales-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(88px, auto) auto; grid-template-areas: "product state total actions" "detail detail profit actions"; align-items: center; column-gap: var(--space-3); row-gap: 2px; padding: var(--space-2) 0; margin: 0; border-radius: 0; background: none; box-shadow: inset 0 -1px 0 var(--border); }
.sales-records .sales-table tr:last-child { box-shadow: none; }
.sales-records .sales-table tr[hidden] { display: none; }
.sales-records .sales-table td { display: block; width: auto; min-width: 0; max-width: none; padding: 0; border: 0; box-shadow: none; text-align: left; white-space: normal; }
.sales-records .sales-table td::before { content: none; }
.sales-records .sales-table td.cell-primary { grid-area: product; display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; padding: 0; margin: 0; box-shadow: none; }
.sales-records .sales-table td.cell-primary strong { flex: 0 0 auto; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-records .sales-table td.cell-primary small { flex: 1 1 0; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--text-xs); }
.sales-records .sales-table td.cell-detail { grid-area: detail; color: var(--text-secondary); font-size: var(--text-sm); }
.sales-records .sale-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2); min-width: 0; }
.sales-records .sale-detail .sep { color: var(--muted); }
.sales-records .sale-detail .person-chip { display: inline-flex; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-records .sale-detail .mini-avatar { width: 20px; height: 20px; font-size: var(--text-2xs); }
.sales-records .sales-table td.cell-state { grid-area: state; justify-self: end; text-align: right; }
.sales-records .sale-states { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-1); }
.sales-records .sale-states .status-pill { margin: 0; }
.sales-records .sales-table td.cell-state .sale-reason { display: block; max-width: 28ch; margin-top: 2px; color: var(--muted); font-size: var(--text-xs); }
.sales-records .sales-table td.cell-total { grid-area: total; text-align: right; font-size: var(--text-md); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-records .sales-table td.cell-profit { grid-area: profit; text-align: right; color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-records .sales-table td.cell-actions { grid-area: actions; justify-self: end; }
.sales-records .sales-table td.cell-actions:empty { display: none; }
.sales-records .sales-table .row-actions { flex-wrap: nowrap; justify-content: flex-end; gap: var(--space-2); }
.sales-records .sales-table tr.is-cancelled .cell-primary strong, .sales-records .sales-table tr.is-cancelled td.num strong { text-decoration: line-through; text-decoration-color: var(--border-strong); }
/* Con mouse, los botones de la fila miden 36 px (cada fila queda en ≈56 px); con dedo conservan 44 px. */
@media (pointer: fine) { .sales-records .sales-table .row-actions .button.small { min-height: 36px; } }
.history-more { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding-top: var(--space-3); box-shadow: inset 0 1px 0 var(--border); }
@container sales-records (max-width: 520px) {
  .sales-records .sales-table tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "product total" "detail profit" "state actions"; row-gap: var(--space-1); padding: var(--space-3) 0; }
  .sales-records .sales-table td.cell-state { justify-self: start; text-align: left; }
  .sales-records .sale-states { justify-content: flex-start; }
  .sales-records .sales-table td.cell-state .sale-reason { max-width: none; }
  .sales-records .sales-table td.cell-primary { flex-wrap: wrap; row-gap: 0; }
  .sales-records .sales-table .sale-op { display: none; }
}
/* Menú «Acciones» (popover del navegador, dashboard/components/row-menu.js). Sin soporte, los botones se ven en línea. */
/* Cerrado, el navegador lo oculta ([popover]); no se le da display propio fuera de :popover-open. */
.row-menu:not(:popover-open) { display: none; }
@supports not selector(:popover-open) { .row-menu { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: 0; margin: 0; border: 0; background: none; color: inherit; } }
.row-menu:popover-open { position: fixed; inset: auto; margin: 0; color: inherit; display: grid; gap: 2px; min-width: 13rem; max-width: calc(100vw - 16px); padding: var(--space-1); border: 1px solid var(--border-strong); border-radius: var(--radius-medium); background: var(--surface-elevated); box-shadow: var(--shadow-lg); }
.row-menu-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: var(--touch); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-small); background: transparent; color: inherit; font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; }
.row-menu-item .icon { width: 18px; height: 18px; flex: none; }
.row-menu-item:hover { background: var(--surface-hover); }
.row-menu-item:focus-visible { outline: none; background: var(--surface-hover); box-shadow: var(--focus-ring); }
.row-menu-item.tone-danger { color: var(--danger); }
@media (pointer: fine) { .row-menu-item { min-height: 40px; } }
.row-menu-toggle[aria-expanded="true"] { background: var(--surface-hover); }
@media (prefers-reduced-motion: no-preference) {
  .row-menu:popover-open { animation: row-menu-in 120ms var(--ease-out, ease-out); }
  @keyframes row-menu-in { from { opacity: 0; transform: translateY(-4px); } }
}

/* ---------- Brand: the official owl (transparent extraction of PR #35), no tile behind it ----------
   Dark themes show the owl alone. Light themes would lose its white outline, so it sits on a night-blue circular lens
   (the BraiZone blue, not a picture's square; DESIGN.md records this). */
.brand-mark, .brand-mark:where(*) { width: 40px; height: 40px; display: grid; place-items: center; background: transparent; box-shadow: none; border-radius: 0; }
.brand-logo { display: block; width: 36px; height: 36px; object-fit: contain; }
.mobile-header .brand-mark { width: 36px; height: 36px; }
.mobile-header .brand-logo { width: 32px; height: 32px; }
:is([data-theme="pink"], [data-theme="organic"], [data-theme="light"]) .brand-mark {
  border-radius: 50%; background: radial-gradient(circle at 50% 38%, #15305a, #09111f 78%); box-shadow: inset 0 0 0 1px rgba(124, 196, 255, .28), 0 2px 8px rgba(9, 17, 31, .18); }
:is([data-theme="pink"], [data-theme="organic"], [data-theme="light"]) .brand-logo { width: 30px; height: 30px; }
:is([data-theme="pink"], [data-theme="organic"], [data-theme="light"]) .mobile-header .brand-logo { width: 27px; height: 27px; }
/* The orbital logo is shown on its own (reference design): no ring, tile or glow box behind it. */
.nav-icon .brand-logo-icon { width: 24px; height: 24px; }
.ai-orbit:has(.brand-logo-icon) > span { display: none; }
.ai-orbit:has(.brand-logo-icon) .icon { width: 52px; height: 52px; }
.ai-orbit.large:has(.brand-logo-icon) { width: 84px; height: 84px; }
.ai-orbit.large:has(.brand-logo-icon) .icon { width: 84px; height: 84px; }
.home-action .home-action-icon:has(.brand-logo-icon) { background: transparent; box-shadow: none; }
.home-action-icon .brand-logo-icon { width: 38px; height: 38px; filter: none; }
.empty-orbit:has(.brand-logo-icon) { background: transparent; box-shadow: none; }
.empty-orbit .brand-logo-icon { width: 40px; height: 40px; }
img.icon.brand-logo-icon { object-fit: contain; stroke: none; }

/* ---------- Private Business: support banner, privacy card, business administration ---------- */
.support-banner { position: sticky; top: 0; z-index: calc(var(--z-header) + 1); display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-2) var(--gutter); background: var(--warning-soft); color: var(--text); box-shadow: inset 0 -1px 0 var(--border); font-size: var(--text-sm); }
.support-banner > .icon { color: var(--warning); }
.support-banner > span { flex: 1 1 260px; }
.privacy-card .support-grant small { display: block; }
.support-log { margin-top: var(--space-4); }
.support-log > summary, .time-saved-detail > summary { cursor: pointer; font-weight: var(--weight-semibold); }
.tenant-admin { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
.danger-text { color: var(--danger); }
.section-card h2 > .icon, .notification-settings h2 > .icon { display: inline-block; width: 20px; height: 20px; margin-right: var(--space-2); vertical-align: -3px; }

/* ---------- Tiempo ahorrado con BraiZone ---------- */
.time-saved { margin-top: var(--gap); }
.time-saved-value { display: block; font-size: var(--text-2xl); letter-spacing: var(--tracking-display); }
.time-saved-sub { display: block; color: var(--text-secondary); margin-top: var(--space-1); }
.time-saved-detail { margin-top: var(--space-4); }

/* ---------- Phones in landscape: a slim side rail instead of the bottom bar, and the full width for content ---------- */
@media (max-width: 1000px) and (max-height: 520px) and (orientation: landscape) {
  :root { --rail: 76px; --gutter: var(--space-4); }
  .app-body { margin-left: calc(var(--rail) + env(safe-area-inset-left, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .demo-banner { min-height: 0; padding-block: 2px; font-size: var(--text-2xs); }
  .demo-banner a { display: none; }
  .mobile-header { min-height: 46px; padding-block: 0; }
  .mobile-brand-copy small { display: none; }
  .mobile-nav { top: 0; bottom: 0; right: auto; width: calc(var(--rail) + env(safe-area-inset-left, 0px)); min-height: 0; grid-template-columns: 1fr; grid-auto-rows: minmax(52px, auto); align-content: center; gap: var(--space-1); padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); box-shadow: 1px 0 0 var(--border); }
  .mobile-nav a, .mobile-nav button { min-height: 52px; font-size: 10px; }
  .main { padding-top: var(--space-4); }
  .page-header { margin-bottom: var(--space-3); }
  .page-header h1 { font-size: var(--text-xl); }
  .page-sub { display: none; }
  .toast-region { bottom: calc(var(--space-3) + env(safe-area-inset-bottom)); left: calc(50% + var(--rail) / 2); }
  .mobile-menu { left: var(--rail); }
  /* Operation screens use the width: floor next to the order, three kitchen columns. */
  .station-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 44%); }
  .station-layout.has-selection .station-side { order: 0; }
  .station-side { position: sticky; top: 52px; max-height: calc(100dvh - 64px); overflow-y: auto; }
  .kds-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .floor-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 132px), 1fr)); }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
  /* The assistant fills the screen height so the message box is always visible. */
  .app-body:has(.ai-page) { height: 100dvh; min-height: 0; }
  .main:has(.ai-page) { padding-top: var(--space-2); padding-bottom: var(--space-2); }
  .ai-page { flex: 1; min-height: 0; }
  .ai-header { display: none; }
  .chat-welcome { padding: var(--space-2) 0; gap: var(--space-2); }
  .chat-welcome .ai-orbit, .chat-welcome > p { display: none; }
  .chat-compose { padding: var(--space-2) var(--space-3) var(--space-3); }
  .chat-card, .chat-messages { flex: 1 1 0; min-height: 0; }
}
/* Tablets in landscape: a little more room for the operation screens. */
.startup-guide { margin-bottom: 1rem; }
.startup-guide > summary { padding: 1rem 1.25rem; cursor: pointer; font-weight: 650; min-height: 48px; }
.startup-guide > summary:focus-visible, .startup-plan a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.startup-guide-body { padding: 0 1.25rem 1.25rem; }
.startup-guide form { display: grid; gap: 1rem; margin: 1rem 0; }
.startup-guide label:not(.edit-check) { display: grid; gap: .4rem; }
.startup-guide select, .startup-guide input:not([type="checkbox"]), .startup-guide textarea { width: 100%; min-height: 44px; max-width: 100%; }
.startup-guide textarea { background: var(--surface-inset); border: 1px solid var(--border-strong); border-radius: var(--radius-sm, 10px); padding: .75rem; resize: vertical; line-height: 1.5; }
.startup-guide .edit-check { min-height: 44px; align-items: center; }
.startup-plan { border-top: 1px solid var(--border, #30445e); padding-top: 1rem; overflow-wrap: anywhere; }
.startup-plan-steps { display: grid; gap: 1rem; padding-left: 1.5rem; }
.startup-plan h3 { margin: .6rem 0; }
.startup-plan ul { padding-left: 1.2rem; }
.startup-plan li { margin-bottom: .5rem; }
.startup-plan .button { margin: .5rem .3rem 0 0; }
.guide-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.guide-reference { padding: .75rem 0; border-top: 1px solid var(--border, #30445e); }
@media (max-width: 600px) { .startup-guide-body { padding: 0 1rem 1rem; } .startup-guide .field-grid { grid-template-columns: 1fr; } }
@media (width >= 1001px) and (width <= 1280px) and (orientation: landscape) {
  .station-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); }
  .floor-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
}

/* ---------- Dirección (BraiZone HQ, solo fundador) ---------- */
.hq-views { margin-bottom: var(--space-4); }
.hq-strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-4); font-size: var(--text-sm); color: var(--text-secondary); }
.hq-strip > span { display: inline-flex; align-items: center; gap: var(--space-1); }
.hq-notice { padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); font-size: var(--text-sm); }
.hq-panel { padding: var(--space-4); display: grid; gap: var(--space-3); align-content: start; margin-bottom: var(--space-4); }
.hq-panel > header, .hq-list-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.hq-panel h2 { font-size: var(--text-lg); }
.hq-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.hq-grid .hq-panel { margin-bottom: 0; }
.hq-grid + .hq-panel { margin-top: var(--space-4); }
.hq-live { margin-bottom: var(--space-4); }
.hq-live .hq-meta dd .hq-sources { margin-top: var(--space-1); }
.hq-mini, .hq-sources, .hq-attention ol { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.hq-mini li { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.hq-mini li > span:not(.badge):not(.status-pill) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hq-attention li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); padding: var(--space-3);
  border-radius: var(--radius-medium); background: var(--surface-inset); border-left: 4px solid var(--border-strong); }
.hq-attention li > span:first-child { display: grid; gap: 2px; min-width: 0; }
.hq-attention li small, .hq-sources small { color: var(--text-secondary); }
.hq-attention .hq-rank-0, .hq-attention .hq-rank-1 { border-left-color: var(--danger); }
.hq-attention .hq-rank-2 { border-left-color: var(--warning); }
.hq-attention .hq-rank-3 { border-left-color: var(--info); }
.hq-sources li { display: flex; align-items: flex-start; gap: var(--space-3); }
.hq-sources li > span:last-child { display: grid; gap: 2px; min-width: 0; }
.hq-badges { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
/* Origen: Manual sólido; Prueba rayado con borde discontinuo (no depende solo del color). */
.hq-origin-prueba { background: repeating-linear-gradient(135deg, var(--warning-soft) 0 6px, transparent 6px 12px); color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning); text-transform: uppercase; }
.hq-origin-integracion { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-secondary); }
.hq-records { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.hq-record { padding: var(--space-4); display: grid; gap: var(--space-3); align-content: start; }
.hq-record.is-test { outline: 1px dashed var(--warning); outline-offset: -1px; }
.hq-record > header { display: grid; gap: var(--space-2); }
.hq-record h3 { font-size: var(--text-md); }
.hq-meta { margin: 0; display: grid; gap: var(--space-2); }
.hq-meta div { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: var(--space-2); }
.hq-meta dt { color: var(--muted); font-size: var(--text-sm); }
.hq-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.hq-meta ul { margin: 0; padding-left: var(--space-4); }
.hq-meta code, .hq-provenance code { font-size: var(--text-xs); word-break: break-all; }
/* HQ → Prospectos y Sitio web (pages/hq-site.js). */
.hq-meta .hq-wide { grid-template-columns: 1fr; }
.hq-meta .hq-wide dd { white-space: pre-line; }
.hq-upload { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; margin-bottom: var(--space-3); }
.hq-upload label { display: grid; gap: var(--space-1); font-size: var(--text-sm); color: var(--muted); }
.hq-history ul { margin: var(--space-2) 0 0; padding-left: var(--space-4); font-size: var(--text-xs); color: var(--muted); }
.hq-provenance { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border); color: var(--muted); font-size: var(--text-xs); }
.hq-provenance .button { margin-left: auto; }
.hq-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-left: auto; }
.hq-actions .button { margin-left: 0; }
.hq-rectify { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-2) var(--space-3); grid-column: 1 / -1; }
.hq-rectify summary { grid-column: 1 / -1; cursor: pointer; font-size: var(--text-sm); color: var(--muted); }
.hq-history { grid-column: 1 / -1; }
@media (max-width: 600px) { .hq-meta div { grid-template-columns: 1fr; gap: 0; } }
.hq-textarea { width: 100%; min-width: 0; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-medium); background: var(--surface-inset); color: var(--text);
  font-size: var(--text-base); line-height: var(--leading-relaxed); box-shadow: inset 0 0 0 1px var(--border-strong); resize: vertical; }

/* Inicio compacto (prueba de uso real de un dueño): período de ventas, pedidos web con disponibilidad e indicadores de
   dos en dos en el celular. Cada tarjeta es un solo enlace (sin controles anidados) y mantiene el foco visible. */
.sales-periods { display: inline-flex; gap: 4px; padding: 3px; margin: var(--space-3) 0 var(--space-2); border-radius: 999px; background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); }
.sales-periods .segment { min-height: 36px; padding: 0 var(--space-3); border: 0; border-radius: 999px; background: transparent; color: var(--text-secondary); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; transition: background-color 160ms ease, color 160ms ease, transform 160ms ease-out; }
.sales-periods .segment:active { transform: scale(0.97); }
.sales-periods .segment.is-active { background: var(--accent); color: var(--accent-contrast); }
.sales-periods .segment:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hero-sales-main { display: grid; gap: 6px; color: inherit; text-decoration: none; border-radius: 12px; }
.hero-sales-main:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.chart-loading { display: grid; gap: var(--space-3); margin-top: var(--space-4); color: var(--text-secondary); font-size: var(--text-sm); }
.chart-skeleton { display: block; height: 180px; border-radius: var(--radius-medium); background: var(--surface-subtle); }
.stock-chip { display: inline-flex; align-items: center; gap: 4px; margin-left: var(--space-2); padding: 2px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; }
.stock-chip.is-ok { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.stock-chip.is-short, .stock-chip.is-out { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.stock-chip.is-unknown { background: var(--surface-inset); color: var(--text-secondary); }
.web-orders { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.web-order { display: grid; gap: 6px; padding: var(--space-3); border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border); color: inherit; text-decoration: none; }
.web-order:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.web-order-head { display: flex; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.web-order-head small { color: var(--text-secondary); }
.web-order-lines { display: grid; gap: 4px; }
.web-order-line { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap; font-size: var(--text-sm); }
.time-saved-inline { margin-top: 6px; font-size: var(--text-sm); color: var(--text-secondary); }
.time-saved-inline summary { cursor: pointer; display: inline-flex; gap: 6px; align-items: center; min-height: 32px; }
.time-saved-inline summary strong { color: var(--text); }
.time-saved-inline[open] { padding: var(--space-3); border-radius: 12px; background: var(--surface-inset); }
@media (max-width: 600px) {
  .home-hero .hero-side, .home-kpis, .home-kpis.is-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; gap: var(--space-2); }
  .home-hero .hero-side .kpi, .home-kpis .kpi { min-width: 0; padding: var(--space-3); }
  .home-hero .hero-side .kpi-value, .home-hero .hero-side .stat-value, .home-kpis .kpi-value, .home-kpis .stat-value { font-size: clamp(1.05rem, 5.2vw, 1.5rem); overflow-wrap: anywhere; line-height: 1.15; }
  .home-hero .hero-side .kpi-title, .home-kpis .kpi-title { font-size: var(--text-xs); }
  .home-hero .hero-side .kpi-detail, .home-kpis .kpi-detail { font-size: var(--text-2xs, 11px); }
  .sales-periods { display: flex; width: 100%; } .sales-periods .segment { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .sales-periods .segment { transition: none; } }

/* BraiZone AI: espacio para conversar. El logo no compite con las respuestas; al escribir en el celular las sugerencias
   iniciales se ocultan para dejar sitio al teclado; «Ir al último mensaje» aparece solo si el dueño subió a leer. */
.chat-card { position: relative; }
.chat-welcome .ai-orbit.large { width: 48px; height: 48px; }
.chat-welcome .ai-orbit.large .icon { width: 24px; height: 24px; }
.chat-jump { position: absolute; left: 50%; bottom: 132px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--space-4); border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-contrast); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); box-shadow: 0 8px 20px -10px rgba(0,0,0,.6); cursor: pointer; z-index: 3; }
.chat-jump .icon { transform: rotate(90deg); }
.chat-jump[hidden] { display: none; }
.chat-jump:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
@media (max-width: 860px) {
  .chat-card:has(#chat-input:focus) .chat-welcome .quick-actions, .chat-card:has(#chat-input:focus) .chat-welcome .quick-actions-more, .chat-card:has(#chat-input:focus) .chat-welcome .ai-orbit, .chat-card:has(#chat-input:focus) .quick-actions-more.in-chat { display: none; }
  .ai-header .page-sub { display: none; }
}

/* Clientes compactos en el celular: 4–6 por pantalla sin achicar áreas táctiles; tocar la tarjeta abre la ficha. */
.customer-star { cursor: pointer; }
@media (max-width: 600px) {
  .customer-star { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "avatar name stats" "avatar contact stats" "actions actions actions"; align-items: center; column-gap: var(--space-3); row-gap: 2px; padding: var(--space-3); text-align: left; min-height: 0; }
  .customer-star .star-avatar { grid-area: avatar; width: 40px; height: 40px; margin: 0; }
  .customer-star h3 { grid-area: name; margin: 0; font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .customer-star .customer-contact { grid-area: contact; margin: 0; font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .customer-star .customer-contact span + span::before { content: " · "; }
  .customer-star .customer-stats { grid-area: stats; margin: 0; display: grid; gap: 0; text-align: right; }
  .customer-star .customer-stats div:not(:first-child) { display: none; }
  .customer-star .customer-stats dt { font-size: var(--text-2xs, 11px); }
  .customer-star .customer-stats dd { margin: 0; font-size: var(--text-sm); }
  .customer-star .customer-last { display: none; }
  .customer-star .item-actions { grid-area: actions; display: flex; gap: var(--space-2); margin-top: var(--space-2); }
  .customer-star .item-actions .button { min-height: 40px; flex: 1; }
  .customer-add summary { padding: var(--space-3); min-height: 48px; }
}

/* Estado de conexión junto a la marca (dashboard/lib/connection-status.js): texto + punto; el color nunca va solo. */
.connection-status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: var(--text-2xs, 11px); font-weight: var(--weight-medium); color: var(--text-secondary); background: var(--surface-inset); white-space: nowrap; max-width: 100%; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-secondary); flex: 0 0 8px; }
.connection-status.is-online .connection-dot { background: var(--success); }
.connection-status.is-offline, .connection-status.is-service { color: var(--danger); }
.connection-status.is-offline .connection-dot, .connection-status.is-service .connection-dot { background: var(--danger); }
.sidebar-top .connection-status { margin: 6px 0 0 4px; }
.mobile-header .connection-status.is-online .connection-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mobile-header .connection-status.is-online { padding: 6px; background: transparent; }
@media (max-width: 600px) {
  .customer-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .customer-star .star-avatar { padding: 0; box-shadow: none; }
  .customer-star .star-avatar::after, .customer-star .star-avatar::before { display: none; }
  .customer-star .customer-stats { padding: 0; background: transparent; }
  .customer-star .item-actions { flex-wrap: nowrap; }
  .customer-star .item-actions .button { min-height: 40px; padding: 0 var(--space-2); font-size: var(--text-sm); }
  .customer-add { min-height: 0; }
  .customer-add summary { flex-direction: row; justify-content: flex-start; gap: var(--space-3); text-align: left; }
  .customer-add .add-orbit { width: 36px; height: 36px; }
}
@media (max-width: 600px) {
  /* Sin tarjetas huérfanas: la última de un grupo impar ocupa la fila completa. */
  .home-hero .hero-side > :last-child:nth-child(odd), .home-kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* HQ → Prospectos y Sitio web (pages/hq-site.js). */
.hq-meta .hq-wide { grid-template-columns: 1fr; }
.hq-meta .hq-wide dd { white-space: pre-line; }
.hq-upload { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; margin-bottom: var(--space-3); }
.hq-upload label { display: grid; gap: var(--space-1); font-size: var(--text-sm); color: var(--muted); }
.hq-history ul { margin: var(--space-2) 0 0; padding-left: var(--space-4); font-size: var(--text-xs); color: var(--muted); }
.hq-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-left: auto; }
.hq-actions .button { margin-left: 0; }
.hq-rectify { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-2) var(--space-3); grid-column: 1 / -1; }
.hq-rectify summary { grid-column: 1 / -1; cursor: pointer; font-size: var(--text-sm); color: var(--muted); }
.hq-history { grid-column: 1 / -1; }
dialog .hq-version { display: flex; grid-column: 1 / -1; gap: var(--space-3); align-items: flex-start; padding: var(--space-2) 0; cursor: pointer; }
dialog .hq-version input { width: 18px; height: 18px; min-height: 0; flex: 0 0 auto; margin: 2px 0 0; padding: 0; }
.hq-version span { display: grid; gap: 2px; font-size: var(--text-sm); }
.hq-version small { color: var(--muted); }

/* Versión nueva publicada mientras la pestaña estaba abierta (dashboard/lib/version-guard.js). */
.version-banner { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: var(--space-3); max-width: calc(100vw - 32px); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface-elevated); box-shadow: var(--shadow-lg); color: var(--text); font-size: var(--text-sm); }
@media (max-width: 860px) { .version-banner { bottom: calc(var(--tabbar-h) + var(--space-3) + env(safe-area-inset-bottom, 0px)); } }

/* ---------- Progressive loading: skeleton of the screen that is coming (components/skeleton.js) ----------
   It uses the real layout classes, so blocks sit where the content will land. Invisible for the first 120 ms (a quick
   answer never flashes it), then a slow opacity breath on ONE layer: no repainting shimmer. */
.skeleton-screen { animation: sk-in 200ms var(--ease-out) 120ms both; }
.skeleton-screen > [aria-hidden] { animation: sk-breathe 1.6s cubic-bezier(.45, 0, .55, 1) 320ms infinite alternate; }
.skeleton-screen .home-hero > *, .skeleton-screen .home-kpis > * { animation: none; }
.sk-card { display: grid; gap: var(--space-3); align-content: start; padding: var(--space-5); min-height: 0; }
.sk-block { display: block; border-radius: 8px; background: color-mix(in srgb, var(--text) 9%, var(--surface)); }
.sk-eyebrow { width: min(180px, 60%); height: 12px; margin-bottom: var(--space-2); }
.sk-title { width: min(320px, 70%); height: 30px; }
.sk-detail { margin-top: var(--space-2); }
.sk-pulse { display: flex; }
.sk-pill.sk-pulse-pill { height: 32px; max-width: 100%; }
.skeleton-screen .home-actions { margin-bottom: var(--gap); }
.sk-button { width: min(132px, 40vw); height: 40px; border-radius: var(--radius-medium); }
.sk-line { height: 14px; }
.sk-small { height: 11px; }
.sk-figure { width: 46%; height: 32px; margin: var(--space-1) 0; }
.sk-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.sk-card-head .sk-line { flex: 0 1 auto; }
.sk-segment { width: min(168px, 45%); height: 32px; border-radius: 999px; }
.sk-chart { height: 200px; border-radius: var(--radius-medium); background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 7%, var(--surface))); }
.sk-chart-card { min-height: 280px; }
.sk-kpi { min-height: 132px; }
.sk-split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: var(--gap); margin-top: var(--gap); }
.sk-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); min-height: 52px; box-shadow: inset 0 -1px 0 var(--border); }
.sk-row:last-child { box-shadow: none; }
.sk-row-text { display: grid; gap: 6px; }
.sk-avatar { width: 36px; height: 36px; border-radius: 50%; }
.sk-pill { width: 72px; height: 22px; border-radius: 999px; }
.sk-field { height: 44px; border-radius: var(--radius-medium); }
.sk-chips { height: 40px; border-radius: 999px; width: 82%; }
.sk-total { height: 52px; border-radius: var(--radius-medium); }
.sk-cta { height: 48px; border-radius: var(--radius-medium); background: color-mix(in srgb, var(--accent) 26%, var(--surface)); }
.sk-toolbar { display: flex; gap: var(--space-3); margin-bottom: var(--space-2); }
.sk-search { flex: 1; }
.sk-composer { margin-top: var(--space-4); height: 52px; }
.skeleton-screen .page-header { margin-bottom: var(--space-6); }
@keyframes sk-in { from { opacity: 0; } }
@keyframes sk-breathe { to { opacity: .55; } }
@media (max-width: 860px) {
  .sk-split { grid-template-columns: minmax(0, 1fr); }
  .sk-header .header-actions { display: none; }
  .sk-chart { height: 160px; }
  .sk-segment { width: min(120px, 40%); }
}
@media (prefers-reduced-motion: reduce) { .skeleton-screen, .skeleton-screen > [aria-hidden] { animation: none; } }
html[data-motion="reduced"] :is(.skeleton-screen, .skeleton-screen > [aria-hidden]) { animation: none; }

/* ---------- Alta asistida: entrada, prueba, navegación reducida y bandeja de HQ ---------- */
.trial-banner { display: flex; align-items: center; gap: var(--space-3); min-height: 40px; padding: var(--space-2) var(--gutter); background: var(--accent-soft); border-bottom: 1px solid var(--border); color: var(--text); font-size: var(--text-sm); }
.trial-banner.is-ended { background: var(--warning-soft); }
.trial-banner strong { font-weight: var(--weight-semibold); }
.access-steps { margin: var(--space-3) 0 var(--space-4); padding-left: var(--space-5); display: grid; gap: var(--space-2); color: var(--muted); font-size: var(--text-sm); }
.access-steps li::marker { color: var(--accent-text); font-weight: var(--weight-semibold); }
.auth-forgot { margin: calc(var(--space-2) * -1) 0 var(--space-3); text-align: right; font-size: var(--text-sm); }
.auth-forgot a { display: inline-flex; align-items: center; min-height: var(--touch); color: var(--accent-text); }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(255, 111, 129, 0.18); }
.nav-more { margin-top: var(--space-2); }
.nav-more > summary { display: flex; align-items: center; gap: var(--space-3); min-height: var(--touch); padding: 0 var(--space-3); border-radius: var(--radius-small); color: var(--muted); cursor: pointer; list-style: none; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover, .nav-more > summary:focus-visible { background: var(--surface-hover); color: var(--text); }
.menu-more-label { margin: var(--space-4) 0 var(--space-2); color: var(--muted); font-size: var(--text-xs); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.hq-request { width: 100%; text-align: left; display: grid; gap: var(--space-1); cursor: pointer; }
.hq-record-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.hq-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-4); }
.hq-facts dt { color: var(--muted); font-size: var(--text-xs); }
.hq-facts dd { margin: 0; overflow-wrap: anywhere; }
.hq-charges { list-style: none; margin: var(--space-3) 0; padding: 0; display: grid; gap: var(--space-2); }
.hq-charges li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
@media (prefers-reduced-motion: reduce) { .nav-more > summary { transition: none; } }
/* Un campo condicional del formulario (presupuesto de IA solo en planes con IA) se oculta de verdad. */
.edit-form [data-ai-field][hidden] { display: none; }

/* Venta de mostrador (042): productos con cantidad dentro del diálogo de cobro compartido. */
.counter-search, .counter-list { grid-column: 1 / -1; }
.counter-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); max-height: 42vh; overflow-y: auto; }
.counter-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-medium); }
.counter-row[hidden] { display: none; }
.counter-row .line-copy { display: grid; min-width: 0; }
.counter-row small { color: var(--text-secondary); }
.counter-qty { display: inline-flex; align-items: center; gap: var(--space-2); flex: none; }
.counter-qty .icon-button { border: 1px solid var(--border); color: var(--text); font-size: var(--text-md); }
.counter-qty output { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
/* Inicio del restaurante: seis indicadores del servicio en dos filas de tres; el resultado del día se lee como una cuenta. */
.home-kpis.is-service:has(> :nth-child(4)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1180px) { .home-kpis.is-service:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 380px) { .home-kpis.is-service:has(> :nth-child(4)) { grid-template-columns: minmax(0, 1fr); } }
.home-kpis.is-service > :nth-child(n+4) { animation-delay: 160ms; }
.result-card .report-row.is-total { font-weight: var(--weight-semibold); color: var(--text); }
.result-card .report-row.is-total strong { font-size: var(--text-md); }
.result-card .report-row:last-of-type strong { font-size: var(--text-lg); letter-spacing: var(--tracking-tight); }
.result-note { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--text-secondary); }
/* Pago del pedido por la web y su marca de demostración. */
.web-payment-note .demo-mark { font-weight: var(--weight-semibold); }
/* Gráficos financieros dentro del chat (components/chat-chart.js): datos del Core, dibujados con el sistema visual. */
.chat-chart { margin: 0; padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-large); background: var(--surface-subtle); display: grid; gap: var(--space-3); min-width: 0; max-width: 640px; }
.chat-chart figcaption { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-3); row-gap: 2px; align-items: baseline; }
.chat-chart-title { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text); }
.chat-chart-period { grid-column: 1; font-size: var(--text-xs); color: var(--muted); }
.chat-chart-total { grid-column: 2; grid-row: 1; justify-self: end; font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-chart-measure { grid-column: 2; grid-row: 2; justify-self: end; font-size: var(--text-xs); color: var(--muted); }
.chat-chart-columns { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--space-2); block-size: 180px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.chat-chart-columns.is-dense { gap: 2px; }
.chat-chart-column { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; justify-items: center; align-items: end; min-width: 0; position: relative; padding-bottom: 22px; }
.chat-chart-value { font-size: var(--text-2xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; min-block-size: 1.2em; padding-bottom: 4px; }
.chat-chart-column .chat-chart-bar { inline-size: min(100%, 44px); align-self: end; border-radius: var(--radius-small) var(--radius-small) 0 0; background: var(--accent-strong); opacity: 0.6; }
.chat-chart-columns.is-dense .chat-chart-bar { border-radius: 3px 3px 0 0; }
.chat-chart-column.is-latest .chat-chart-bar { background: var(--accent); opacity: 1; }
.chat-chart-column.is-zero .chat-chart-bar { block-size: 2px !important; background: var(--muted); opacity: 0.45; border-radius: 1px; }
.chat-chart-axis { position: absolute; inset-block-end: 2px; inset-inline: -8px; text-align: center; font-size: var(--text-2xs); color: var(--muted); white-space: nowrap; }
.chat-chart-column.is-latest .chat-chart-axis { color: var(--text); font-weight: var(--weight-semibold); }
.chat-chart-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.chat-chart-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-3); row-gap: 6px; align-items: baseline; }
.chat-chart-label { font-size: var(--text-sm); color: var(--text-secondary); overflow-wrap: anywhere; }
.chat-chart-amount { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-chart-track { grid-column: 1 / -1; block-size: 10px; border-radius: var(--radius-pill); background: var(--surface-inset); overflow: hidden; }
.chat-chart-fill { display: block; block-size: 100%; border-radius: var(--radius-pill); background: var(--accent); }
.chat-chart-bars .is-collected .chat-chart-fill { background: var(--success); }
.chat-chart-bars .is-pending .chat-chart-fill { background: var(--warning); }
.chat-chart-note { margin: 0; display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-xs); color: var(--text-secondary); }
.chat-chart-note strong { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-chart-definition, .chat-chart-empty { margin: 0; font-size: var(--text-xs); line-height: var(--leading-normal); color: var(--muted); }
.chat-chart-empty { padding: var(--space-4) 0; font-size: var(--text-sm); color: var(--text-secondary); }
@media (prefers-reduced-motion: no-preference) { .ai-message.is-latest .chat-chart-fill { animation: chat-chart-grow var(--duration-slow) var(--ease-out) both; transform-origin: left center; } .ai-message.is-latest .chat-chart-column .chat-chart-bar { animation: chat-chart-rise var(--duration-slow) var(--ease-out) both; transform-origin: center bottom; } }
@keyframes chat-chart-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes chat-chart-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
/* Acceso a la demostración desde el inicio de sesión de la aplicación principal. */
.auth-demo-entry { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); display: grid; gap: var(--space-2); }
.auth-demo-kicker { margin: 0; font-size: var(--text-xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); }
/* BraiZone HQ como centro de control (dashboard/pages/hq-*.js). Mismos tokens y componentes que el Inicio de la app. */
.hq-hero .hq-hero-rows { margin: var(--space-5) 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.hq-hero-rows div { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-medium); background: var(--surface-inset); min-width: 0; }
.hq-hero-rows dt { display: grid; gap: 2px; color: var(--text-secondary); font-size: var(--text-sm); min-width: 0; }
.hq-hero-rows dt small { color: var(--muted); font-size: var(--text-xs); }
.hq-hero-rows dd { margin: 0; font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--text); font-variant-numeric: tabular-nums; }
.hq-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.hq-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px var(--space-3); align-items: baseline; }
.hq-bars-label { color: var(--text-secondary); font-size: var(--text-sm); overflow-wrap: anywhere; }
.hq-bars strong { font-variant-numeric: tabular-nums; }
.hq-bars-track { grid-column: 1 / -1; display: block; block-size: 8px; border-radius: var(--radius-pill); background: var(--surface-inset); overflow: hidden; }
.hq-bars-track > span { display: block; block-size: 100%; min-inline-size: 3px; border-radius: inherit; background: var(--accent); }
.hq-bars-track > span.is-near { background: var(--warning); }
.hq-bars-track > span.is-over { background: var(--danger); }
.hq-footnote { margin-top: var(--space-4); }
.hq-search { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-4); padding: 0 var(--space-3); min-height: var(--touch); border: 1px solid var(--border); border-radius: var(--radius-medium); background: var(--surface-inset); color: var(--muted); }
.hq-search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; min-height: 42px; }
.hq-search input:focus { outline: none; }
.hq-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hq-search .icon { width: 16px; height: 16px; }
.hq-client-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.hq-client-card { display: grid; gap: var(--space-2); margin: 0; color: inherit; text-decoration: none; transition: border-color var(--duration-fast) var(--ease-color), transform var(--duration-fast) var(--ease-out); }
.hq-client-card:active { transform: scale(var(--press-scale)); }
.hq-client-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hq-client-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.hq-client-head strong { font-size: var(--text-md); margin-right: auto; }
.hq-client-facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); color: var(--text-secondary); font-size: var(--text-sm); }
.hq-client-facts > span { display: inline-flex; align-items: center; gap: 6px; }
.hq-client-facts .icon { width: 14px; height: 14px; color: var(--muted); }
.hq-client-plan { color: var(--muted); font-size: var(--text-xs); }
.hq-back { display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); color: var(--accent-text); font-weight: var(--weight-semibold); text-decoration: none; }
.hq-back .icon { transform: rotate(180deg); width: 14px; height: 14px; }
.hq-client-title { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin: var(--space-2) 0 var(--space-4); }
.hq-client-title h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-tight); }
.hq-client-actions { justify-content: flex-start; margin: 0 0 var(--space-4); }
.hq-detail-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.hq-detail-grid > .section-card { margin: 0; }
.hq-section-title { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-6) 0 var(--space-3); font-size: var(--text-lg); }
.hq-section-title .icon { width: 18px; height: 18px; color: var(--muted); }
.hq-team { list-style: none; margin: 0; padding: 0; display: grid; }
.hq-team > li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) 0; box-shadow: 0 -1px 0 var(--border); }
.hq-team > li:first-child { box-shadow: none; }
.hq-team-who { display: grid; gap: 2px; min-width: 0; flex: 1 1 200px; }
.hq-team-who small { color: var(--muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.hq-team-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.hq-messages > li p { flex-basis: 100%; margin: 0; color: var(--text-secondary); white-space: pre-line; }
.hq-ai { display: grid; gap: var(--space-2); margin-top: var(--space-2); }
.hq-ai-head { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); color: var(--text-secondary); }
.hq-ai-head strong { color: var(--text); font-variant-numeric: tabular-nums; }
.hq-position { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-text); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.hq-need { color: var(--text-secondary); font-size: var(--text-sm); line-height: var(--leading-normal); }
.hq-need-block { margin: 0 0 var(--space-4); padding: var(--space-4); border-radius: var(--radius-medium); background: var(--surface-inset); }
.hq-need-block h3 { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--muted); font-weight: var(--weight-medium); }
.hq-need-block p { margin: 0; white-space: pre-line; }
.hq-request-actions { flex-wrap: wrap; justify-content: flex-start; }
.hq-request-detail h3 { font-size: var(--text-md); margin: var(--space-4) 0 var(--space-2); }
/* Reserva de cupo («Crear cuenta»): pasos, código y posición en la lista de espera. */
.reserve-steps { list-style: none; margin: var(--space-4) 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.reserve-steps li { display: grid; justify-items: center; gap: 6px; text-align: center; font-size: var(--text-xs); color: var(--muted); }
.reserve-steps span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-inset); color: var(--muted); font-weight: var(--weight-semibold); }
.reserve-steps .is-current { color: var(--text); font-weight: var(--weight-semibold); }
.reserve-steps .is-current span { background: var(--accent); color: var(--accent-contrast); }
.reserve-steps .is-done span { background: var(--success-soft); color: var(--success); }
.code-input { font-size: var(--text-xl); letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.waitlist-position { display: flex; align-items: center; gap: var(--space-4); margin: var(--space-4) 0; padding: var(--space-4); border-radius: var(--radius-large); background: var(--accent-soft); }
.waitlist-number { font-size: var(--text-display); line-height: 1; font-weight: var(--weight-bold); letter-spacing: var(--tracking-display); color: var(--accent-text); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .hq-detail-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .hq-hero .hq-hero-rows { grid-template-columns: minmax(0, 1fr); } .hq-team-actions { flex-basis: 100%; } }
@media (prefers-reduced-motion: reduce) { .hq-client-card { transition: none; } .hq-client-card:active { transform: none; } }
.hq-facts .status-pill { white-space: normal; text-align: left; max-width: 100%; }
/* Campos de texto largos con el mismo aspecto que los demás campos (reserva de cupo, diálogos de HQ). */
.field-grid textarea { width: 100%; min-width: 0; min-height: 96px; padding: var(--space-3); border: 0; border-radius: var(--radius-medium); background: var(--surface-inset); color: var(--text); font: inherit; font-size: var(--text-base); line-height: var(--leading-normal); box-shadow: inset 0 0 0 1px var(--border-strong); resize: vertical; }
.field-grid textarea:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.field-grid textarea::placeholder { color: var(--muted); }
