/* Drevic Studio · Hub layout and component rules. */

.hidden { display: none !important; }

/* ---------- Canvas ---------- */
html { background: var(--wall); }
body.studio {
  font-size: var(--fs);
  font-family: var(--font-text);
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--label);
  background: transparent;
  font-optical-sizing: auto;
}
body.studio ::placeholder { color: var(--label-3); }
.studio :is(button, a, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 3.5px solid var(--focus);
  outline-offset: 3px;
}
.studio :is(.toolbar-title, .section-title, .sheet-title, .lead-name, .panel-title, .stat-value, .lock-name) {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  line-height: 1.15;
}
.studio :is(.eyebrow, .chip, .side-label, .sync, .count, .stat-note, .t-sub) { letter-spacing: .015em; }
.studio :is(.stat-value, .tnum, .table, time) { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Desktop controls are compact; touch keeps the 44px targets from drevic.css */
@media (pointer: fine) {
  body.studio button, body.studio a.btn { min-height: 0; }
}

/* ---------- Icons ---------- */
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 13px; height: 13px; }
.ico-lg { width: 20px; height: 20px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 1.6px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- App frame ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  width: var(--side-w); flex: none;
  display: flex; flex-direction: column;
  padding: 14px 10px 12px;
  background: var(--glass-sidebar);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-right: 1px solid var(--hair-strong);
  box-shadow: var(--rim-sidebar);
  z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.sidebar-brand .logo { height: 18px; }
.sidebar-brand .tag { font-size: 11px; color: var(--label-3); font-weight: 500; padding-left: 10px; border-left: 0.5px solid var(--hair-strong); }
.side-group { margin-bottom: 14px; }
.side-label { font-size: 11px; font-weight: 600; color: var(--label-3); padding: 0 10px 5px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 10px; border-radius: 7px;
  color: var(--label); font-size: 13px; font-weight: 500; text-align: left;
  background: transparent; border: 0; cursor: default; text-decoration: none;
  transition: background var(--motion-press) var(--ease);
}
.nav-item .ico { color: var(--accent-2); }
.nav-item:hover { background: var(--glass-hover); }
.nav-item.is-active { background: var(--fill-hover); box-shadow: var(--rim); }
.nav-item.is-active .ico { color: var(--accent-text); }
.nav-item .count { margin-left: auto; font-size: 11px; color: var(--label-3); font-variant-numeric: tabular-nums; font-weight: 500; }
.nav-item .ext { margin-left: auto; color: var(--label-3); width: 11px; height: 11px; }
.nav-label-short { display: none; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 0; border-top: 0.5px solid var(--hair); }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--label-3); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--label-3); flex: none; }
.dot.live { background: var(--green); box-shadow: 0 0 0 3px rgba(50, 215, 75, .14); }
.dot.busy { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.dot.off { background: var(--orange); }
@keyframes pulse { 50% { opacity: .35; } }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.toolbar-sentinel { height: 1px; margin-bottom: -1px; flex: none; pointer-events: none; }
.toolbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--bar-h); flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px;
  background: var(--toolbar-bg);
  -webkit-backdrop-filter: var(--blur-toolbar); backdrop-filter: var(--blur-toolbar);
  border-bottom: 1px solid transparent;
  transition: background-color var(--motion-state) var(--ease), border-color var(--motion-state) var(--ease), box-shadow var(--motion-state) var(--ease);
}
.toolbar.is-scrolled { background-color: var(--toolbar-deep); border-bottom-color: var(--hair-strong); box-shadow: var(--lift-toolbar); }
.toolbar-title { font-size: var(--type-control); font-weight: 600; letter-spacing: -0.015em; }
.toolbar-sub { font-size: 12px; color: var(--label-3); }
.toolbar-logo { display: none; height: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 22px 22px 60px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Buttons ---------- */
.btn {
  --button-hover: var(--fill-hover);
  --button-press: var(--glass-press);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 var(--gap-3); border-radius: var(--r-pill);
  font: 500 var(--type-control)/1 var(--font-text); letter-spacing: -0.005em; white-space: nowrap;
  color: var(--label); background: var(--fill);
  border: 0; box-shadow: var(--rim);
  text-decoration: none; cursor: pointer; user-select: none;
}
.btn-primary {
  --button-hover: var(--primary-hover);
  --button-press: var(--primary-active);
  background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 1px 2px rgba(0,0,0,.3); font-weight: 600;
}
.btn-success {
  --button-hover: color-mix(in srgb, var(--green-ink) 18%, transparent);
  --button-press: color-mix(in srgb, var(--green-ink) 23%, transparent);
  background: var(--green-wash); color: var(--green-ink); box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--green-ink) 30%, transparent);
}
.btn-danger {
  --button-hover: color-mix(in srgb, var(--red-ink) 17%, transparent);
  --button-press: color-mix(in srgb, var(--red-ink) 22%, transparent);
  background: var(--red-wash); color: var(--red-ink); box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--red-ink) 30%, transparent);
}
.btn-plain { --button-hover: var(--glass-hover); background: transparent; box-shadow: none; color: var(--label-2); }
.btn-lg { height: 40px; padding: 0 var(--gap-4); }
.btn-block { width: 100%; }
.btn-sm { height: 28px; padding: 0 var(--gap-2); font-size: var(--type-meta); }
.btn-icon { width: 32px; padding: 0; flex: none; }
.icon-close { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--label-2); background: var(--fill); border: 0; cursor: pointer; flex: none; }
.studio :is(.btn, .icon-close, .seg, .hub-quick-theme-option) {
  transition: background-color var(--motion-press) var(--ease), color var(--motion-press) var(--ease), transform var(--motion-press) var(--ease), opacity var(--motion-press) var(--ease);
}
.studio :is(.btn, .icon-close, .seg, .hub-quick-theme-option):is(:disabled, [aria-disabled="true"]) { opacity: .55; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .studio :is(.btn, .icon-close, .seg, .hub-quick-theme-option):hover:not(:disabled, [aria-disabled="true"]) {
    background-color: var(--button-hover, var(--fill-hover));
  }
  .studio :is(.btn-plain, .icon-close, .seg):hover:not(:disabled, [aria-disabled="true"]) { color: var(--label); }
}
.studio :is(.btn, .icon-close, .seg, .hub-quick-theme-option):active:not(:disabled, [aria-disabled="true"]) {
  background-color: var(--button-press, var(--glass-press));
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  :root:is([data-motion="full"], [data-motion="subtle"]) .studio
    :is(.btn, .icon-close, .seg, .hub-quick-theme-option):active:not(:disabled, [aria-disabled="true"]) { transform: scale(.97); }
}

/* ---------- Surfaces ---------- */
.panel {
  position: relative;
  background: var(--glass);
  border-radius: var(--r-card);
  box-shadow: var(--rim), var(--lift);
}
.panel:not(.lead) { -webkit-backdrop-filter: var(--blur-panel); backdrop-filter: var(--blur-panel); }
.panel-pad { padding: var(--gap-3); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 0.5px solid var(--hair); }
.panel-title { font-size: var(--type-control); font-weight: 600; letter-spacing: -0.01em; }
.panel-sub { font-size: 12px; color: var(--label-2); margin-top: 1px; }
.panel-body { padding: 16px 18px; }
.well { background: var(--well); border-radius: var(--r-group); box-shadow: inset 0 0 0 1px var(--hair); padding: var(--gap-3); }
.eyebrow { font-size: 11px; font-weight: 600; color: var(--label-3); margin-bottom: 4px; }
.muted { color: var(--label-2); }
.faint { color: var(--label-3); }
.tnum { font-variant-numeric: tabular-nums; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-title { font-size: var(--type-title); font-weight: 600; letter-spacing: -.025em; }
.section-sub { font-size: 13px; color: var(--label-2); margin-top: 2px; }
.section-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { padding: 14px 18px; position: relative; }
.stat + .stat::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 0.5px; background: var(--hair-strong); }
.stat-label { font-size: 12px; color: var(--label-2); font-weight: 500; }
.studio .stat-value { font-size: var(--type-display); line-height: 1.15; font-weight: 600; letter-spacing: -.035em; margin-top: 3px; }
.stat-unit { font-size: 13px; color: var(--label-3); font-weight: 500; letter-spacing: 0; margin-left: 1px; }
.stat-note { font-size: 11px; color: var(--label-3); margin-top: 2px; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span, .field-label { font-size: 12px; font-weight: 500; color: var(--label-2); }
.input, .select, .textarea {
  width: 100%; min-height: 32px;
  background: var(--input-bg); color: var(--label);
  border: 1px solid var(--hair-strong) !important; border-radius: var(--r-ctl) !important;
  padding: 6px 10px; font: inherit; font-size: var(--type-body);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.25);
  transition: box-shadow var(--motion-press) var(--ease), border-color var(--motion-press) var(--ease);
}
.textarea { line-height: 1.5; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus) !important; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' fill='none' stroke='%23c7c7cc' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select option, .select optgroup { background: var(--menu-bg); color: var(--label); }
.select-pill { width: auto; border-radius: 980px !important; min-height: 30px; padding-left: 12px; background-color: var(--fill); box-shadow: var(--rim); border-color: transparent !important; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace !important; font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- Segmented control ---------- */
.segmented { position: relative; display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r-group); background: var(--seg-bg); box-shadow: inset 0 0 0 1px var(--hair-strong); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.seg { position: relative; flex: none; height: 28px; padding: 0 var(--gap-3); border-radius: var(--r-ctl); border: 0; background: transparent; color: var(--label-2); font: 500 var(--type-meta)/1 var(--font-text); white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg.is-active { color: var(--label); }
.seg.is-active, .hub-quick-theme-option[aria-pressed="true"] {
  --button-hover: color-mix(in srgb, var(--accent-wash), var(--accent-text) 6%);
  --button-press: color-mix(in srgb, var(--accent-wash), var(--accent-text) 11%);
}
.studio .seg:focus-visible { outline-offset: -4px; }
.segmented:not(.has-thumb) .seg.is-active, .seg-thumb { background: var(--fill-active); box-shadow: var(--rim-window), 0 1px 3px rgb(0 0 0 / .17); }
.seg-thumb { position: absolute; top: 2px; bottom: 2px; left: 0; border-radius: var(--r-ctl); pointer-events: none; }
.segmented.has-thumb .seg-thumb { transition: transform var(--motion-state) var(--ease), width var(--motion-state) var(--ease); }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 980px; font-size: 11px; font-weight: 500; color: var(--label-2); background: var(--fill); white-space: nowrap; }
.chip-green { color: var(--green-ink); background: var(--green-wash); }
.chip-orange { color: var(--orange-ink); background: var(--orange-wash); }
.chip-red { color: var(--red-ink); background: var(--red-wash); }
.chip-accent { color: var(--accent-text); background: var(--accent-wash); }
.chip .dot { width: 6px; height: 6px; }

/* Status popup on lead cards */
.status-pop { position: relative; display: inline-flex; align-items: center; flex: none; }
.status-pop::before { content: ""; position: absolute; left: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--label-3); pointer-events: none; }
.status-pop[data-status="Owner Not In"]::before { background: var(--orange); }
.status-pop[data-status="Demo Shown"]::before { background: var(--blue); }
.status-pop[data-status="Follow-Up"]::before { background: var(--accent); }
.status-pop[data-status="Closed"]::before, .status-pop[data-status="Closed Deal"]::before, .status-pop[data-status="Deposit paid"]::before { background: var(--green); }
.status-pop .select { padding-left: 24px; font-size: 12px; font-weight: 500; min-height: 26px; height: 26px; width: auto; padding-top: 0; padding-bottom: 0; }

/* ---------- Grouped list (inset form rows) ---------- */
.group { background: var(--well); border-radius: var(--r-group); box-shadow: inset 0 0 0 1px var(--hair); }
.row { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 12px; }
.row + .row { border-top: 0.5px solid var(--hair); }
.row-label { width: 88px; flex: none; font-size: 12px; color: var(--label-2); }
.row-input { flex: 1; min-width: 0; background: transparent !important; border: 0 !important; color: var(--label); font: inherit; font-size: 13px; padding: 4px 0; outline: none; box-shadow: none !important; }
.row-input:focus { box-shadow: none !important; }
.row-input::-webkit-calendar-picker-indicator { filter: invert(.8); opacity: .6; }

/* ---------- Lead cards ---------- */
.lead-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.lead { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.lead-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lead-cat { font-size: 11px; color: var(--accent-2); font-weight: 500; }
.lead-name { font-size: var(--type-lead); font-weight: 600; letter-spacing: -0.018em; margin-top: 2px; }
.lead-addr { font-size: 12px; color: var(--label-2); display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.lead-actions { display: flex; gap: 6px; }
.lead-actions .btn { flex: 1; }
.lead-more { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 0.5px solid var(--hair); }
.lead-more .btn { flex: 1 1 auto; }
.lead-sign { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.empty { padding: 48px 20px; text-align: center; color: var(--label-3); font-size: 13px; grid-column: 1 / -1; }
.empty .ico { width: 28px; height: 28px; margin: 0 auto 10px; color: var(--label-3); stroke-width: 1.3; }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--label-3); padding: 10px 16px; border-bottom: 0.5px solid var(--hair-strong); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 0.5px solid var(--hair); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--row-hover); }
.t-strong { font-weight: 600; }
.t-sub { font-size: 11px; color: var(--label-3); margin-top: 1px; }

/* ---------- Drafts / list cards ---------- */
.card-grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.squircle { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--fill); color: var(--accent-text); box-shadow: var(--rim); }
.squircle.green { color: var(--green-ink); background: var(--green-wash); }
.squircle.orange { color: var(--orange-ink); background: var(--orange-wash); }
.squircle.blue { color: var(--blue-ink); background: var(--blue-wash); }
.text-body { font-size: 13px; line-height: 1.55; color: var(--label); opacity: .9; white-space: pre-wrap; overflow-y: auto; max-height: 240px; user-select: text; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hstack { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }

pre.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; line-height: 1.5; color: var(--label-2); background: var(--well); border-radius: 8px; padding: 10px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

details.disclosure > summary { list-style: none; cursor: default; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--label-2); padding: 8px 0; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; margin: 0 3px; }
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure > summary:hover { color: var(--label); }

/* ---------- Sheets (modals) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: calc(60 + var(--hub-overlay-depth, 0)); display: flex; align-items: center; justify-content: center; padding: var(--gap-6); background: var(--scrim); animation: fade var(--motion-state) var(--ease); }
.sheet {
  position: relative; width: 100%; max-width: 520px; max-height: min(88vh, 860px); max-height: min(88dvh, 860px);
  display: flex; flex-direction: column;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur-sheet); backdrop-filter: var(--blur-sheet);
  border-radius: var(--r-win);
  box-shadow: var(--rim-window), var(--shadow-sheet);
  animation: rise var(--motion-sheet) var(--ease);
}
.sheet > form { display: flex; flex-direction: column; min-height: 0; }
.sheet-wide { max-width: 760px; }
.sheet-head { display: flex; flex: none; align-items: center; gap: var(--gap-3); padding: var(--gap-4); border-bottom: 1px solid var(--hair); }
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-title { font-size: var(--type-title); font-weight: 600; letter-spacing: -.025em; }
.sheet-sub { font-size: 12px; color: var(--label-2); margin-top: 1px; }
.sheet-body { min-height: 0; padding: var(--gap-4); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: var(--gap-3); }
.sheet-body > * { flex-shrink: 0; }
.sheet-foot { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: var(--gap-2); padding: var(--gap-3) var(--gap-4); border-top: 1px solid var(--hair); }
.sheet-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.sheet-backdrop.hidden { display: none !important; }

.status-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--accent-wash); color: var(--accent-text); font-size: 12px; }
.notice { padding: 10px 12px; border-radius: 10px; font-size: 12px; }

dialog.sheet { position: fixed; inset: 0; padding: 0; border: 0; color: var(--label); margin: auto; width: min(92vw, 540px); }
dialog.sheet::backdrop { background: var(--scrim); animation: fade var(--motion-state) var(--ease); }
/* Lock scrolling on the viewport only. `hidden` on body would turn it into its own scroll box, and the
   sticky toolbar and sidebar would jump back to the top of the page (off screen once you have scrolled),
   taking toolbar-anchored popovers such as the theme picker with them. `clip` does not do that. */
html.hub-overlay-open { overflow: hidden; overscroll-behavior: none; }
html.hub-overlay-open body { overflow: clip; overscroll-behavior: none; }
html { scrollbar-gutter: stable; }
#audit-result { display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 1.5; }
#audit-result strong.block { font-size: 44px; font-weight: 600; letter-spacing: -0.04em; color: var(--accent-text); }
#audit-result a { color: var(--accent-text); text-decoration: none; }
#audit-result a:hover { text-decoration: underline; }
#audit-result label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--label-2); }
#audit-result input:not([type=checkbox]), #audit-result select { background: var(--input-bg) !important; border: 0.5px solid var(--hair-strong) !important; border-radius: 8px !important; color: var(--label); padding: 6px 10px; min-height: 34px; }
#audit-result label:has(input[type=checkbox]) { flex-direction: row; align-items: center; color: var(--label); }
#audit-result button:not(.btn) { align-self: flex-start; display: inline-flex; align-items: center; height: 32px; min-height: 32px; padding: 0 16px; border-radius: var(--r-pill) !important; background: var(--accent) !important; color: var(--accent-ink) !important; font-weight: 600; border: 0; }
#audit-result svg { background: #fff; border-radius: 10px; padding: 6px; }

/* ---------- Shared glass chrome ---------- */
.hub-menu {
  position: relative;
  color: var(--label); background: var(--glass-menu);
  -webkit-backdrop-filter: var(--blur-menu); backdrop-filter: var(--blur-menu);
  border-radius: var(--r-card); box-shadow: var(--rim-window), var(--lift-menu);
}
.hub-menu-enter { transform-origin: var(--hub-menu-origin, top center); animation: menu-in var(--motion-state) var(--ease); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-2px) scale(.97); } }
:is(.sidebar, .toolbar, .panel:not(.lead), .sheet, .hub-menu)::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background-image: var(--grain); opacity: var(--grain-opacity); pointer-events: none;
}
.hub-glint {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none;
  contain: paint; opacity: 0; transition: opacity var(--motion-state) var(--ease);
}
.hub-glint.is-visible { opacity: 1; }
.hub-glint::before {
  content: ""; position: absolute; inset: -4px;
  background: radial-gradient(180px 80px at var(--glint-x, 50%) var(--glint-y, 0%), var(--glint-color), transparent 85%);
  transform: translate(var(--glint-dx, 0px), var(--glint-dy, 0px));
}

/* ---------- Switch, loading and feedback ---------- */
.studio input[type="checkbox"]:is(.check, .switch) {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; cursor: pointer;
  width: 36px; height: 22px; margin: 0; padding: 0;
  background: var(--fill-hover); border-radius: var(--r-pill); border: 1px solid var(--hair-strong);
  transition: background-color var(--motion-state) var(--ease);
}
.studio input[type="checkbox"]:is(.check, .switch)::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--label); box-shadow: 0 1px 3px rgb(0 0 0 / .22);
  transition: transform var(--motion-state) var(--ease), background-color var(--motion-state) var(--ease);
}
.studio input[type="checkbox"]:is(.check, .switch):checked { background: var(--accent); }
.studio input[type="checkbox"]:is(.check, .switch):checked::before { background: var(--accent-ink); transform: translateX(14px); }
.studio input[type="checkbox"]:is(.check, .switch):disabled { opacity: .55; cursor: default; }
.skeleton {
  position: relative; display: block; min-height: .65em; overflow: hidden;
  background: var(--fill); border-radius: var(--r-ctl);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent 15%, var(--fill-hover) 48%, transparent 81%);
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { from { transform: translateX(-105%); } to { transform: translateX(105%); } }
.hub-tab-enter { animation: fade var(--motion-state) var(--ease); }

.hub-toast-stack {
  position: fixed; inset: auto max(var(--gap-4), env(safe-area-inset-right)) max(var(--gap-4), env(safe-area-inset-bottom)) auto;
  z-index: 90; margin: 0; padding: 0; border: 0; background: transparent;
  display: flex; flex-direction: column; gap: var(--gap-2); width: min(370px, calc(100vw - 32px)); pointer-events: none;
}
.hub-toast-stack:empty, .hub-toast-stack[hidden] { display: none; }
.hub-toast-stack[popover]:not(:popover-open) { display: none; }
dialog .hub-toast-stack:not([popover]) { position: absolute; inset: auto var(--gap-3) var(--gap-3) auto; max-width: calc(100% - 24px); }
.hub-toast {
  display: flex; align-items: flex-start; gap: var(--gap-2); padding: var(--gap-3); border-radius: var(--r-group);
  pointer-events: auto; animation: rise var(--motion-state) var(--ease);
}
.hub-toast-message { flex: 1; align-self: center; overflow-wrap: anywhere; white-space: pre-line; }
.hub-toast[data-tone="success"] .hub-toast-message { color: var(--green-ink); }
.hub-toast[data-tone="warning"] .hub-toast-message { color: var(--orange-ink); }
.hub-toast[data-tone="error"] .hub-toast-message { color: var(--red-ink); }
.hub-dialog-message { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.hub-confirm [hidden] { display: none !important; }
.hub-tooltip {
  position: fixed; z-index: 95; margin: 0; border: 0; pointer-events: none;
  padding: var(--gap-1) var(--gap-2); max-width: min(240px, calc(100vw - 16px));
  font-size: var(--type-meta); border-radius: var(--r-ctl);
}
dialog .hub-tooltip:not([popover]) { position: absolute; }

/* ---------- Lock screen ---------- */
.lock {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px;
  background: var(--lock-veil);
}
.lock-mark { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--rim), 0 20px 50px -15px rgba(0,0,0,.7); }
.lock-mark img { height: 18px; }
.lock-name { font-size: var(--type-title); font-weight: 600; letter-spacing: -.025em; text-align: center; }
.lock-hint { font-size: 12px; color: var(--label-2); text-align: center; margin-top: 2px; }
.lock-form { position: relative; width: min(240px, 100%); }
.lock-input {
  width: 100%; height: 36px; border-radius: 980px !important; padding: 0 42px 0 16px;
  background: rgba(255,255,255,.12) !important; border: 0 !important; color: #fff; font-size: var(--type-control) !important;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--rim);
}
.lock-input:focus { outline: none; box-shadow: var(--rim), 0 0 0 3.5px var(--focus) !important; }
.lock-input.border-red-500 { box-shadow: 0 0 0 1px var(--red) !important; animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.lock-go { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; min-height: 28px !important; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255,255,255,.16); color: #fff; }
.lock-go:hover { background: rgba(255,255,255,.26); }
.lock-error { font-size: 12px; color: #ff8a82; text-align: center; }
.lock-foot { position: absolute; bottom: 28px; font-size: 11px; color: var(--label-3); display: flex; align-items: center; gap: 6px; }

/* ---------- Responsive: tablet ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(4)::before { display: none; }
  .stat:nth-child(n+4) { border-top: 0.5px solid var(--hair); }
}

/* ---------- Responsive: phone (sidebar becomes a tab bar) ---------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; width: auto;
    flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--hair-strong);
    background: var(--tabbar-bg);
  }
  .sidebar-brand, .side-label, .side-group.resources, .sidebar-foot { display: none; }
  .side-group { margin: 0; flex: 1; }
  .nav { flex-direction: row; justify-content: space-around; gap: 0; }
  .nav-item { flex: 1; flex-direction: column; gap: 3px; padding: 6px 2px 4px; font-size: 10px; font-weight: 500; text-align: center; border-radius: 10px; color: var(--label-3); min-height: 48px; justify-content: center; }
  .nav-item .ico { width: 22px; height: 22px; color: inherit; stroke-width: 1.6; }
  .nav-item .count { display: none; }
  .nav-item.is-active { background: transparent; box-shadow: none; color: var(--accent-text); }
  .nav-item.is-active .ico { color: var(--accent-text); }
  .nav-label-long { display: none; }
  .nav-label-short { display: inline; }

  .toolbar { padding: 0 14px; padding-top: env(safe-area-inset-top); height: calc(var(--bar-h) + env(safe-area-inset-top)); }
  .toolbar-logo { display: block; }
  .toolbar-title { font-size: var(--type-lead); }
  .toolbar-sub, .hide-phone { display: none !important; }
  .content { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); gap: 14px; }
  .stats { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .stats::-webkit-scrollbar { display: none; }
  .stat { flex: 0 0 40%; scroll-snap-align: start; border: 0 !important; }
  .stat + .stat::before { display: block !important; }
  .icon-close { width: 32px; height: 32px; min-height: 32px !important; }
  .lead-grid, .card-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .main, .content, .panel { min-width: 0; }
  .section-tools .select-pill { min-width: 0; }
  .section-tools { flex-wrap: nowrap; }
  .btn { height: 40px; font-size: 15px; padding: 0 16px; }
  .btn-sm { height: 34px; font-size: 13px; }
  .btn-icon { width: 40px; padding: 0; }
  .seg { height: 32px; font-size: 13px; }
  .input, .select, .textarea { min-height: 40px; font-size: var(--type-lead); }
  .status-pop .select { height: 32px; min-height: 32px; font-size: 13px; }
  .row { min-height: 46px; }
  .row-input { font-size: var(--type-lead); }
  .row-label { font-size: 13px; width: 78px; }
  .row .btn-sm { padding: 0 12px; }
  .stat-note { display: none; }
  .stat { padding: 12px 14px; }
  .section-tools { width: 100%; }
  .section-tools .select-pill { flex: 1; }

  /* Sheets become bottom sheets */
  .sheet-backdrop { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; max-height: 92vh; max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top))); border-radius: var(--r-win) var(--r-win) 0 0; padding-bottom: env(safe-area-inset-bottom); animation: up var(--motion-sheet) var(--ease); }
  dialog.sheet { inset: auto 0 0; width: 100%; margin: 0; padding-bottom: env(safe-area-inset-bottom); }
  @keyframes up { from { transform: translateY(40px); opacity: 0; } }
  .sheet-foot { flex-wrap: wrap; }
  .sheet-foot .btn { flex: 1; }
  .sheet-foot .left { flex-basis: 100%; margin: 0; }

  /* Orders table → stacked rows */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 16px; border-bottom: 0.5px solid var(--hair); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { padding: 3px 0; border: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .table td[data-label]::before { content: attr(data-label); font-size: 13px; color: var(--label-3); }
  .table td.t-lead { display: block; padding-bottom: 6px; }
  .table td.t-actions { justify-content: flex-end; padding-top: 8px; }

  .hub-toast-stack { inset: calc(var(--gap-2) + env(safe-area-inset-top)) max(var(--gap-3), env(safe-area-inset-right)) auto auto; width: min(370px, calc(100vw - 24px)); }
  dialog .hub-toast-stack:not([popover]) { inset: var(--gap-3) var(--gap-3) auto auto; }
  .lock-input { font-size: var(--type-lead) !important; }
}

@media (pointer: coarse), (hover: none) {
  .studio :is(.btn, .icon-close, .seg, .select, .input, .row-input, #audit-result button, #audit-result select) { min-height: 44px !important; min-width: 44px; }
  .studio :is(.btn-icon, .icon-close) { width: 44px; height: 44px; }
  .studio .status-pop .select { height: 44px; }
  .studio .lock-input { height: 52px; padding-right: 52px; }
  .studio .lock-go { width: 44px; height: 44px; min-height: 44px !important; }
  .studio :is(label.check, #audit-result label:has(input[type="checkbox"])) { min-height: 44px; cursor: pointer; }
}
@media (max-height: 520px) {
  .lock { gap: var(--gap-3); overflow-y: auto; }
  .lock-foot { position: static; }
}
.show-phone { display: none !important; }
@media (max-width: 860px) { .show-phone { display: inline-flex !important; } }
dialog.sheet:not([open]) { display: none !important; }
.show-phone-block { display: none !important; }
@media (max-width: 860px) { .show-phone-block { display: block !important; } }

.nowrap { white-space: nowrap; }
.well, .group { background: var(--well-bg); }

.hub-toast-action { flex: none; align-self: center; }
