/* Masa admin + platform admin — prototype CSS. Tokens: platform base theme "Petrol" (theme-platform.css),
   never the tenant theme (R42). Components imitate @gkberk/ui (shadcn/Radix) so the spec's component map is
   visible; production uses the package components, not this file. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--background); color: var(--foreground); font: var(--font-weight-body) var(--text-sm)/var(--leading-body) var(--font-body); -webkit-font-smoothing: antialiased; }
:root { --s: var(--gk-spacing-unit); --ctl: 36px; }
@media (pointer: coarse), (max-width: 767px) { :root { --ctl: 44px; } }
h1, h2, h3 { font-family: var(--font-heading); font-weight: var(--font-weight-heading); line-height: var(--leading-heading); margin: 0; }
p { margin: 0; } ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-lg { width: 20px; height: 20px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted-foreground); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- App shell: ui-kit Sidebar ---------- */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-foreground); border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 12px; gap: 4px; }
.tenant-switch { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); text-decoration: none; margin-bottom: 8px; min-height: 52px; }
.tenant-switch:hover { background: var(--sidebar-accent); }
.tenant-switch img { width: 32px; height: 32px; border-radius: var(--radius-md); }
.tenant-switch b { display: block; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-switch small { display: block; color: var(--muted-foreground); font-size: var(--text-xs); }
.tenant-switch > span { flex: 1; min-width: 0; }
.nav-label { font-size: var(--text-xs); font-weight: 600; color: var(--muted-foreground); padding: 12px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: var(--ctl); padding: 0 10px; border-radius: var(--radius-md); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--sidebar-accent); }
.nav a[aria-current="page"] { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); font-weight: 600; }
.nav a .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--sidebar-border); padding-top: 8px; }
.user { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-foreground); display: grid; place-items: center; font-weight: 700; font-size: var(--text-xs); flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; background: var(--background); border-bottom: 1px solid var(--border); padding: 6px 12px; min-height: 56px; }
  .topbar b { flex: 1; font: 600 var(--text-base)/1.2 var(--font-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.content { padding: 24px 32px 96px; max-width: 1180px; width: 100%; }
@media (max-width: 767px) { .content { padding: 16px 16px 112px; } }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { font-size: var(--text-2xl); }
.page-head p { color: var(--muted-foreground); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-foreground); text-decoration: none; font-weight: 500; margin-bottom: 8px; min-height: 32px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--ctl); padding: 0 14px; border-radius: var(--radius-md); border: 1px solid transparent; font: 600 var(--text-sm)/1 var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap; background: var(--primary); color: var(--primary-foreground); }
.btn-outline { background: var(--card); color: var(--foreground); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-outline:hover, .btn-ghost:hover { background: var(--muted); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); }
.btn-destructive-outline { background: var(--card); color: var(--destructive); border-color: var(--border); }
.btn-icon { width: var(--ctl); padding: 0; }
.btn-sm { min-height: 32px; padding: 0 10px; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font: 600 var(--text-xs)/1.5 var(--font-body); white-space: nowrap; border: 1px solid transparent; }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-outline { border-color: var(--border); color: var(--foreground); }
.badge-info { background: var(--accent); color: var(--accent-foreground); }
.badge-warning { background: var(--warning); color: var(--warning-foreground); }
.badge-success { background: var(--success); color: var(--success-foreground); }
.badge-destructive { background: var(--destructive); color: var(--destructive-foreground); }
.badge-primary { background: var(--primary); color: var(--primary-foreground); }

/* ---------- Surfaces ---------- */
.panel { background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: var(--text-base); }
.panel-body { padding: 16px; }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1023px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.grid-2 > *, .stack > * { min-width: 0; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); }
.alert .i { margin-top: 2px; }
.alert b { display: block; font-weight: 600; }
.alert p { color: var(--muted-foreground); }
.alert-info { background: var(--accent); color: var(--accent-foreground); border-color: transparent; }
.alert-info p { color: var(--accent-foreground); }
.alert-warning { border-color: var(--warning); }
.alert-destructive { border-color: var(--destructive); }
.alert-destructive .i, .alert-destructive b { color: var(--destructive); }
.alert .btn { margin-left: auto; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.field + .field { margin-top: 16px; }
.row > .field + .field { margin-top: 0; }
.label { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.label .muted { font-weight: 400; }
.input, .textarea, .select { width: 100%; min-height: var(--ctl); padding: 0 12px; border: 1px solid var(--input); border-radius: var(--radius-md); background: var(--background); color: var(--foreground); font: inherit; }
.textarea { padding: 8px 12px; min-height: 84px; resize: vertical; line-height: 1.5; }
.select { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--destructive); box-shadow: 0 0 0 1px var(--destructive); }
.help { color: var(--muted-foreground); font-size: var(--text-xs); }
.err { color: var(--destructive); font-size: var(--text-xs); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.affix { display: flex; align-items: stretch; }
.affix .input { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.affix span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--input); border-left: 0; border-radius: 0 var(--radius-md) var(--radius-md) 0; background: var(--muted); color: var(--muted-foreground); white-space: nowrap; }
.row { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .cols-2 { grid-template-columns: 1fr; } }
.checkbox, .radio { display: flex; align-items: flex-start; gap: 10px; min-height: 36px; padding-top: 8px; cursor: pointer; }
.checkbox .box, .radio .box { width: 18px; height: 18px; border: 1.5px solid var(--input); border-radius: var(--radius-sm); flex: none; display: grid; place-items: center; background: var(--background); margin-top: 1px; }
.radio .box { border-radius: 50%; }
.checkbox.on .box { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.radio.on .box { border-color: var(--primary); }
.radio.on .box::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.radio small { display: block; color: var(--muted-foreground); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: var(--ctl); }
.switch .track { width: 36px; height: 20px; border-radius: 10px; background: var(--input); position: relative; flex: none; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--background); box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch.on .track { background: var(--primary); }
.switch.on .track::after { transform: translateX(16px); }
.toggle-group { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; min-height: var(--ctl); padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); font-weight: 500; }
.toggle[aria-pressed="true"] { background: var(--accent); color: var(--accent-foreground); border-color: var(--primary); font-weight: 600; }
.segmented { display: inline-flex; background: var(--muted); padding: 3px; border-radius: var(--radius-md); }
.segmented a { min-height: calc(var(--ctl) - 6px); padding: 0 12px; display: grid; place-items: center; border-radius: calc(var(--radius-md) - 2px); text-decoration: none; font-weight: 600; color: var(--muted-foreground); }
.segmented a[aria-current="true"] { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }
.counter { font-size: var(--text-xs); color: var(--muted-foreground); font-weight: 400; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: var(--text-xs); font-weight: 600; color: var(--muted-foreground); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--muted); position: sticky; top: 0; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tr.sel td { background: var(--accent); }

/* ---------- Menu editor rows ---------- */
.draft-bar { position: sticky; top: 0; z-index: 25; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 12px 10px 16px; margin: 0 0 20px; border-radius: var(--radius-lg); background: var(--foreground); color: var(--background); box-shadow: var(--shadow-md); }
.draft-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); flex: none; }
.draft-bar .txt { flex: 1; min-width: 200px; }
.draft-bar .txt b { font-weight: 700; }
.draft-bar .txt span { opacity: .8; }
.draft-bar .btn-ghost { color: var(--background); }
.draft-bar .btn-ghost:hover { background: rgb(255 255 255 / .12); }
.draft-bar .btn-on-dark { background: var(--background); color: var(--foreground); }
@media (max-width: 767px) { .draft-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; margin: 0; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.toolbar .search { flex: 1; min-width: 220px; position: relative; }
.toolbar .search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); }
.toolbar .search .input { padding-left: 36px; }
.cat-block { margin-bottom: 16px; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 4px; border-bottom: 1px solid var(--border); }
.cat-row h2 { font-size: var(--text-base); }
.cat-row .count { color: var(--muted-foreground); font-size: var(--text-xs); }
.cat-row .spacer { flex: 1; }
.handle { width: 28px; height: 36px; display: grid; place-items: center; color: var(--muted-foreground); border-radius: var(--radius-sm); cursor: grab; flex: none; background: none; border: 0; }
.prow { display: grid; grid-template-columns: 28px 44px minmax(0, 1fr) 190px 150px 36px; gap: 12px; align-items: center; padding: 8px 8px 8px 4px; border-bottom: 1px solid var(--border); }
.prow:hover { background: var(--muted); }
.prow .thumb { width: 44px; height: 44px; border-radius: var(--radius-md); object-fit: cover; background: var(--muted); display: grid; place-items: center; color: var(--muted-foreground); }
.prow .name a { font-weight: 600; text-decoration: none; }
.prow .name a:hover { text-decoration: underline; }
.prow .name .sub { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 3px; align-items: center; }
.prow .price { text-align: right; }
.prow .price small { display: block; color: var(--muted-foreground); font-size: var(--text-xs); }
.prow.is-out .name a { color: var(--muted-foreground); }
.prow .avail { justify-self: end; }
@media (max-width: 767px) {
  .prow { grid-template-columns: 24px 44px minmax(0, 1fr) auto 44px; grid-template-areas: "h t n n m" "h t p a a"; row-gap: 4px; }
  .prow .handle { grid-area: h; } .prow .thumb { grid-area: t; align-self: start; } .prow .name { grid-area: n; } .prow .price { grid-area: p; text-align: left; } .prow .avail { grid-area: a; justify-self: end; } .prow .more { grid-area: m; }
  .prow .price small { display: block; margin: 0; }
  .prow .price .num { white-space: normal; }
}
.setup { margin-bottom: 20px; }
.setup ol { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; counter-reset: s; }
@media (max-width: 1023px) { .setup ol { grid-template-columns: 1fr; } }
.setup li { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--radius-md); background: var(--muted); }
.setup li.done { background: transparent; color: var(--muted-foreground); }
.setup li .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1.5px solid var(--input); font-size: var(--text-xs); font-weight: 700; }
.setup li.done .mark { background: var(--success); border-color: var(--success); color: var(--success-foreground); }
.setup li a { font-weight: 600; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: none; }
.overlay:target, .overlay.is-open { display: block; }
.scrim { position: absolute; inset: 0; background: rgb(0 0 0 / .5); }
.dialog { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: var(--popover); color: var(--popover-foreground); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 24px; }
.dialog-lg { width: min(980px, calc(100vw - 32px)); }
.dialog h2 { font-size: var(--text-xl); padding-right: 40px; }
.dialog .desc { color: var(--muted-foreground); margin-top: 6px; }
.dialog .foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.dialog .x { position: absolute; top: 14px; right: 14px; }
.sheet-r { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--popover); box-shadow: var(--shadow-lg); padding: 24px; overflow: auto; }
.sheet-r h2 { font-size: var(--text-xl); }
@media (max-width: 767px) { .dialog { top: auto; bottom: 0; transform: translateX(-50%); width: 100vw; border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92vh; } .dialog .foot { flex-direction: column-reverse; } .dialog .foot .btn { width: 100%; } }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 70; display: flex; align-items: center; gap: 12px; min-width: 320px; max-width: calc(100vw - 32px); padding: 12px 14px; border-radius: var(--radius-lg); background: var(--popover); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.toast b { display: block; } .toast p { color: var(--muted-foreground); font-size: var(--text-xs); }
@media (max-width: 767px) { .toast { left: 16px; right: 16px; bottom: 88px; min-width: 0; } }

/* ---------- Misc ---------- */
.diff li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.diff li:last-child { border-bottom: 0; }
.diff .old { color: var(--muted-foreground); text-decoration: line-through; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; font-weight: 500; }
.empty-state { text-align: center; padding: 48px 16px; }
.empty-state > .i { width: 32px; height: 32px; color: var(--muted-foreground); margin: 0 auto 12px; }
.empty-state h2 { font-size: var(--text-lg); }
.empty-state p { color: var(--muted-foreground); margin: 6px auto 16px; max-width: 46ch; }
.dropzone { border: 1.5px dashed var(--input); border-radius: var(--radius-lg); padding: 20px; text-align: center; background: var(--muted); }
.dropzone .i { width: 24px; height: 24px; margin: 0 auto 8px; color: var(--muted-foreground); }
.progress { height: 6px; border-radius: 3px; background: var(--secondary); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary); }
.phone { width: 100%; border-radius: 18px; border: 6px solid var(--foreground); overflow: hidden; background: var(--foreground); aspect-ratio: 300 / 600; }
.phone img { width: 100%; }
.tpl-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .tpl-cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .tpl-cards { grid-template-columns: 1fr; } }
.tpl-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.tpl-card h3 { font-size: var(--text-base); }
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding: 8px 0 0; border-bottom: 1px solid var(--border); }
.bar-chart span { flex: 1; background: var(--chart-1); border-radius: 2px 2px 0 0; min-height: 2px; }
.bar-chart span.partial { background: repeating-linear-gradient(135deg, var(--chart-1) 0 4px, var(--accent) 4px 8px); }
.hbar { height: 8px; border-radius: 4px; background: var(--secondary); overflow: hidden; min-width: 80px; }
.hbar span { display: block; height: 100%; background: var(--chart-1); }
.stat-strip { display: flex; flex-wrap: wrap; gap: 8px 40px; margin-bottom: 20px; }
.stat-strip dt { color: var(--muted-foreground); font-size: var(--text-xs); font-weight: 600; }
.stat-strip dd { margin: 2px 0 0; font: 700 var(--text-3xl)/1.1 var(--font-heading); }
.stat-strip dd small { font: 500 var(--text-sm)/1 var(--font-body); color: var(--muted-foreground); margin-left: 6px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); vertical-align: -2px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--muted); }
.auth-card { width: min(420px, 100%); padding: 28px; }
.auth-brand { font: 700 var(--text-lg)/1 var(--font-heading); margin-bottom: 24px; display: flex; align-items: center; gap: 8px; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .92em; }

/* Mobile refinements */
.show-sm { display: none; }
@media (max-width: 767px) {
  .hide-sm { display: none; }
  .show-sm { display: inline-flex; }
  .cat-row h2 { flex: 1; min-width: 0; }
  .cat-row .spacer { display: none; }
  .cat-row .lbl { display: none; }
  .page-head .actions { width: 100%; }
}
.alert { flex-wrap: wrap; }
.alert > div { flex: 1; min-width: 200px; }

/* Layout helpers that collapse on phones (no fixed-width inline grids) */
.split { display: grid; grid-template-columns: var(--split, 240px) minmax(0, 1fr); gap: 24px; }
.split-r { grid-template-columns: minmax(0, 1fr) var(--split, 240px); }
.price-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 160px var(--ctl); }
.bulk-row { grid-template-columns: minmax(0, 1fr) 160px auto; }
.hours-row { display: grid; grid-template-columns: 110px 120px minmax(0, 1fr); gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
@media (max-width: 767px) {
  .split, .split-r { grid-template-columns: minmax(0, 1fr); }
  .split .phone { max-width: 220px; margin: 0 auto; }
  .price-row { grid-template-columns: minmax(0, 1fr) 120px var(--ctl); grid-template-areas: "l p d" "e e e"; }
  .price-row > :nth-child(1) { grid-area: l; } .price-row > :nth-child(2) { grid-area: e; } .price-row > :nth-child(3) { grid-area: p; } .price-row > :nth-child(4) { grid-area: d; }
  .bulk-row { grid-template-columns: minmax(0, 1fr) 110px; }
  .bulk-row > .btn { grid-column: 1 / -1; }
  .hours-row { grid-template-columns: minmax(0, 1fr) auto; }
  .hours-row > :last-child { grid-column: 1 / -1; }
  .row.cols-2 { grid-template-columns: minmax(0, 1fr); }
}

/* Tables scroll inside their panel on narrow screens instead of widening the page */
.panel:has(> .tbl) { overflow-x: auto; }

/* ---------- Round 2 ---------- */
.tenant-switch > span.avatar { flex: none; }
.show-sm-inline, .show-sm-flex { display: none; }
@media (max-width: 767px) {
  .show-sm-inline { display: inline; }
  .show-sm-flex { display: flex; }
  .alert-compact { padding: 8px 10px; align-items: center; }
  .alert-compact > div { min-width: 0; }
  .alert-compact .btn { margin-left: 0; }
  .toolbar { flex-wrap: nowrap; }
  .toolbar .search { min-width: 0; }
  .toolbar-filter { width: auto; max-width: 132px; }
  .draft-bar { padding: 8px 8px 8px 14px; gap: 8px; }
  .draft-bar .txt { min-width: 0; }
}
.toolbar-filter { width: auto; min-width: 220px; }
@media (max-width: 767px) { .toolbar-filter { min-width: 0; } }
/* Hours: intervals never split; copy button per open day */
.hours-row { grid-template-columns: 110px 120px minmax(0, 1fr) var(--ctl); }
.ivs { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.iv { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 6px; white-space: nowrap; }
@media (max-width: 767px) { .hours-row { grid-template-columns: minmax(0, 1fr) auto var(--ctl); } .hours-row > :last-child { grid-column: auto; } .hours-row > .ivs { grid-column: 1 / -1; grid-row: 2; } }
/* ---------- Theme editor (@gkberk/ui ThemeEditor layout, Masa wrapper) ---------- */
.content-full { min-width: 0; }
.ed { display: flex; flex-direction: column; min-height: 100vh; }
.ed-top { padding: 12px 20px 0; border-bottom: 1px solid var(--border); background: var(--card); }
.ed-top .crumb { margin-bottom: 2px; }
.ed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ed-title h1 { font-size: var(--text-xl); }
.ed-title p { font-size: var(--text-xs); }
.ed-chip { border: 0; cursor: pointer; }
.ed-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.ed-save { display: inline-flex; gap: 8px; margin-left: 8px; }
.ed-reason { display: flex; align-items: center; gap: 6px; justify-content: flex-end; color: var(--foreground); font-size: var(--text-xs); font-weight: 600; margin-top: 6px; }
.ed-note { padding: 8px 0 10px; }
.ed-block { margin: 0 0 12px; }
.ed-body { display: grid; grid-template-columns: 96px 400px minmax(0, 1fr); flex: 1; min-height: 0; }
.ed-rail { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-right: 1px solid var(--border); background: var(--card); }
.ed-rail a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: var(--radius-md); text-decoration: none; font-size: var(--text-xs); font-weight: 600; color: var(--muted-foreground); }
.ed-rail a[aria-selected="true"] { background: var(--accent); color: var(--accent-foreground); }
.ed-count { position: absolute; top: 4px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--destructive); color: var(--destructive-foreground); font-size: 11px; line-height: 18px; text-align: center; }
.ed-dot { position: absolute; top: 8px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 2px var(--card); }
.ed-panel { padding: 20px; border-right: 1px solid var(--border); background: var(--card); min-width: 0; }
.ed-panel h2 { font-size: var(--text-lg); }
.ed-sub { font-size: var(--text-sm); font-weight: 700; margin: 20px 0 6px; color: var(--muted-foreground); }
.swatch-lg { width: 36px; height: 36px; border-radius: var(--radius-md); border: 1px solid var(--border); flex: none; }
.roles .role { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 44px; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.roles .role.is-fail { background: color-mix(in srgb, var(--destructive) 6%, transparent); box-shadow: inset 3px 0 0 var(--destructive); padding-left: 8px; }
.role-name { font-weight: 600; min-width: 0; }
.sw { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); font-size: var(--text-xs); cursor: pointer; }
.sw i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgb(0 0 0 / .2); }
.ratio { justify-self: end; font-size: var(--text-xs); font-weight: 700; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--muted); font-variant-numeric: tabular-nums; }
.ratio.fail { background: var(--destructive); color: var(--destructive-foreground); }
.role-extra { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--foreground); }
.ed-preview { display: flex; flex-direction: column; background: var(--muted); min-width: 0; }
.ed-ptools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--card); }
.ed-frame { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 20px; overflow: hidden; }
.ed-frame img { width: 375px; border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.ed-taskbar { position: sticky; bottom: 0; z-index: 20; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: var(--card); border-top: 1px solid var(--border); }
.ed-taskbar p { flex: 1 1 100%; }
@media (max-width: 1023px) {
  .ed-body { grid-template-columns: minmax(0, 1fr); }
  .ed-rail { flex-direction: row; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-right: 0; border-bottom: 1px solid var(--border); }
  .ed-preview { display: none; }
  .ed-top { padding: 10px 16px 0; }
  .ed-taskbar.show-sm-flex { display: flex; }
}
@media (min-width: 1024px) { .ed-taskbar.show-sm-flex { display: none; } }
.alert-destructive .btn .i { color: inherit; }
.alert .actions .btn { margin-left: 0; }
@media (max-width: 1023px) { .ed-save, .ed-top .ed-reason { display: none; } }

/* Round 2 reflow fixes found by the element-level check (spec §11.9) */
.affix { min-width: 0; }
.affix .input { min-width: 0; width: 100%; }
.toolbar-wrap { flex-wrap: wrap !important; }
.toolbar-wrap .select { flex: 1 1 160px; min-width: 0; width: auto; }
@media (max-width: 767px) {
  .draft-bar .txt { flex: 1 1 150px; min-width: 150px; }
  .iv { flex-wrap: wrap; }
  .iv .select { width: 92px !important; }
  .price-row { grid-template-columns: minmax(0, 1fr) 128px var(--ctl); }
}
