/* Shared administration and utility surfaces. Published designs own their palettes. */
:root[data-theme] {
  --canvas: #eef0f3;
  --ink: #1c1d21;
  --negative: #a03636;
  --muted: #555a64;
  --line: #d9dce2;
  --stroke: #7c8492;
  --surface: #fbfcfd;
  --surface-2: #f1f3f6;
  --surface-3: #e5e8ee;
  --input: #fff;
  --glass: var(--surface);
  --green: #2859a9;
  --accent: #2859a9;
  --accent-soft: #e9edf4;
  --selected: #e2ebfa;
  --button: #2859a9;
  --button-ink: #fff;
  --side: var(--surface);
  --veil: #fbfcfde6;
  --shade: #12192555;
  --shadow: 0 12px 35px #10182816;
  --focus: #215fbc;
  --radius: 22px;
  --control-radius: 12px;
  --panel-radius: 20px;
  --floating-radius: 24px;
  --motion: 160ms;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --canvas: #0c0d0f;
  --ink: #f1f2f5;
  --negative: #ffb7af;
  --muted: #b1b6c1;
  --line: #333740;
  --stroke: #767d8d;
  --surface: #17191e;
  --surface-2: #202329;
  --surface-3: #292d35;
  --input: #101216;
  --green: #a4c4ff;
  --accent: #a4c4ff;
  --accent-soft: #272d38;
  --selected: #273957;
  --button: #a4c4ff;
  --button-ink: #10213d;
  --veil: #17191eeb;
  --shade: #06080cb0;
  --shadow: 0 16px 40px #0005;
  --focus: #adcbff;
}

:root[data-theme] body:is(.casona-panel,.casona-utility) {
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.45;
}
.casona-panel::before, .casona-utility::before { display: none; }

:root[data-theme] :is(.topbar,.sidebar,.mobile-bottom,.modal,.op-mobile-total) {
  border-radius: var(--floating-radius);
  corner-shape: squircle;
}
:root[data-theme] :is(.topbar,.sidebar,.mobile-bottom,.modal) {
  background: var(--surface);
  border: 1px solid var(--line);
}
@supports ((backdrop-filter: blur(18px)) or (-webkit-backdrop-filter: blur(18px))) {
  :root[data-theme] :is(.topbar,.sidebar,.mobile-bottom,.modal),
  :root[data-theme] .pos-mode .sidebar.open {
    background: var(--veil);
    -webkit-backdrop-filter: blur(18px) saturate(1.18);
    backdrop-filter: blur(18px) saturate(1.18);
  }
}
:root[data-theme] .modal-backdrop,
:root[data-theme] .pos-mode .modal-backdrop {
  background: var(--shade);
  backdrop-filter: none;
}
:root[data-theme] .sidebar:not(.open) { box-shadow: none; }
:root[data-theme] .modal { box-shadow: var(--shadow), 0 25px 70px #070c2040; }
:root[data-theme] .modal-head { border-bottom: 0; padding-bottom: 0; }
:root[data-theme] .modal-body { padding-inline: 5px; }
:root[data-theme] .modal-body.has-touch-form { padding: 0; }
:root[data-theme] .sidebar .brand strong { font-weight: 720; letter-spacing: -.065em; }
:root[data-theme] .sidebar .nav-label { text-transform: none; letter-spacing: .015em; font-size: 11px; font-weight: 620; }
:root[data-theme] .sidebar .nav button { font-size: 13px; border-radius: var(--control-radius); }
:root[data-theme] .sidebar .nav button.active { color: var(--accent); background: var(--selected); }
:root[data-theme] .nav button.active::before { display: none; }
:root[data-theme] .sidebar .user { border-color: var(--line); }
:root[data-theme] .topbar { padding-inline: 11px; gap: 8px; }
:root[data-theme] .topbar > .actions { min-width: 0; flex-wrap: nowrap; }
:root[data-theme] .topbar .breadcrumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
:root[data-theme] .top-actions button { background: transparent; border-color: transparent; }
:root[data-theme] .top-actions button:hover { background: var(--surface-2); }
:root[data-theme] .top-actions .status { color: var(--muted); }
:root[data-theme] .top-actions .appearance-toggle { min-width: 44px; }
:root[data-theme] .demo-banner {
  display: block;
  background: transparent;
  border: 0;
  padding: 2px 0;
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.45;
}
:root[data-theme] .pos-mode .demo-banner { margin: 0 0 6px; padding-inline: 3px; }
:root[data-theme] body:not(.pos-mode) .page-head h1 {
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 720;
  letter-spacing: -.045em;
  line-height: 1.06;
  overflow-wrap: anywhere;
}
:root[data-theme] body:not(.pos-mode) .page-head p { font-size: 14px; }
:root[data-theme] body:not(.pos-mode) .panel-head h2 { letter-spacing: -.025em; font-size: 19px; }
:root[data-theme] :is(.metric-value,.customer-balance,.op-total,.pc-quote,.tenant-row .value) {
  font-variant-numeric: tabular-nums;
}
:root[data-theme] .casona-panel :is(.glass,.op-product,.op-ticket,.prep-card,.entity-header,.design-card,.saved-designs,.pc-costs,.pc-product,.wallet-card):not(.hero) {
  corner-shape: squircle;
  box-shadow: none;
  backdrop-filter: none;
}
:root[data-theme] .casona-panel :is(.panel,.op-ticket,.prep-card,.design-card,.saved-designs,.pc-costs) {
  border-radius: var(--panel-radius);
}
:root[data-theme] .casona-panel :is(button,input,select,textarea,summary):not(.public-site *):not(.design-thumb *) {
  corner-shape: squircle;
  transition: background-color var(--motion), border-color var(--motion), color var(--motion), opacity var(--motion), filter var(--motion);
}
:root[data-theme] .casona-panel :is(.actions > button,.top-actions > button,.chip,.field input,.field select,.field textarea) {
  border-radius: var(--control-radius);
}
:root[data-theme] .casona-panel :is(button,[role="button"]):not(.public-site *):hover { transform: none; }
:root[data-theme] .casona-panel :is(button,[role="button"]):not(.public-site *):not(:disabled):active {
  filter: brightness(.9);
}
:root[data-theme] .casona-panel :is(button,[role="button"]):not(.public-site *):focus-visible,
:root[data-theme] .casona-panel :is(a,input,select,textarea,summary,.table-wrap):not(.public-site *):focus-visible,
:root[data-theme] .casona-utility :is(button,a,input,select):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
:root[data-theme] .casona-panel .op-product-add:focus-visible { outline-offset: -4px; }
:root[data-theme] .casona-panel button:disabled { cursor: not-allowed; }
:root[data-theme] .casona-panel :is(.metric-icon,.tenant-avatar,.entity-avatar,.avatar,.credential-symbol) { color: var(--muted); }
:root[data-theme] .casona-panel .badge { border-radius: 8px; text-transform: none; font-size: 11px; }

/* Keep selection identifiable in every module, including legacy segmented controls. */
:root[data-theme] .casona-panel :is(.recipe-tabs,.pc-tools,.op-availability,[role="group"]) > button[aria-pressed="true"]:not(.primary):not(.selected.primary):not(.public-site *) {
  background: var(--selected);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 650;
}
.role-compact { display: none; }
:root[data-theme] .modal-body>.actions:last-child,
:root[data-theme] .modal-body form>.actions:last-child {
  border-radius: 12px 12px 0 0;
}
@media (max-width: 700px) {
  .role-full { display: none; }
  .role-compact { display: inline; }
}

/* A single photographic surface on the overview. */
:root[data-theme] .hero.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(260px,.85fr);
  border-radius: var(--floating-radius);
  corner-shape: squircle;
  padding: 0;
  gap: 0;
  overflow: hidden;
  background: var(--surface);
  box-shadow: none;
  backdrop-filter: none;
}
.dashboard-hero-copy {
  padding: clamp(22px,3vw,44px);
  align-self: center;
}
:root[data-theme] .dashboard-hero h2 {
  font-family: inherit;
  font-size: clamp(30px,3.25vw,47px);
  font-weight: 690;
  letter-spacing: -.055em;
  margin-bottom: 9px;
  overflow-wrap: anywhere;
}
.dashboard-hero-facts { display: flex; flex-wrap: wrap; gap: 15px 26px; margin: 22px 0 0; }
.dashboard-hero-facts div { display: grid; gap: 3px; }
.dashboard-hero-facts dt { color: var(--muted); font-size: 12px; }
.dashboard-hero-facts dd { margin: 0; font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 680; }
.dashboard-hero-photo { position: relative; min-width: 0; min-height: 176px; }
.dashboard-hero-photo img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 58%;
}

/* Branded storefronts and the same preview inside the Studio. */
.public-site :is(.public-product,.public-hero,.public-faq details,.public-options,.public-search,.public-categories button,.public-cta) {
  corner-shape: squircle;
}
.public-site :is(.public-categories button,.public-search,.public-nav a,.public-options summary,.public-faq summary) {
  min-height: 44px;
}
.public-site :is(.public-nav a,.public-options summary,.public-faq summary) {
  align-content: center;
}
.public-site :is(.public-search,.public-categories button,.public-options,.public-faq details) { border-radius: 12px; }
.public-site .public-nav { gap: 12px; }
.public-site .public-nav a { text-wrap: balance; }
.public-site .public-nav a:last-child { flex-shrink: 0; }
.public-site :is(a,button,input,summary):focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}
.public-site :is(a,button,summary) { touch-action: manipulation; }
.public-site .public-product img { transition: filter var(--motion,160ms); }
.public-site .public-product:hover img { transform: none; }
.public-site :is(.public-cta,.public-categories button):active { filter: brightness(.88); }

/* Ticket and QR kit use the workspace controls, with light paper for printing. */
.casona-utility :is(.kit-controls,.ticket-panel) {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--floating-radius);
  corner-shape: squircle;
  box-shadow: none;
  backdrop-filter: none;
}
.casona-utility .ticket-page { max-width: 620px; margin: clamp(12px,5vw,56px) auto; padding: 16px; }
.casona-utility .ticket-panel { padding: clamp(18px,5vw,36px); }
.casona-utility .kit-header :is(p,span), .casona-utility .kit-controls p { color: var(--muted); }
.casona-utility .kit-header a { min-height: 44px; display: inline-flex; align-items: center; }
.casona-utility .kit-controls :is(input,select) {
  min-height: 46px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--input);
  border-color: var(--stroke);
  border-radius: var(--control-radius);
}
.casona-utility .kit-buttons button { background: var(--button); color: var(--button-ink); }
.casona-utility .kit-buttons a { background: var(--surface-2); color: var(--accent); }
.casona-utility .kit-buttons :is(button,a) { min-height: 44px; border-radius: var(--control-radius); }
.casona-utility #error { color: var(--negative); }
.casona-utility .kit-note { border-color: var(--line); }

@media (max-width: 700px) {
  :root[data-theme] .topbar { padding-inline: 6px; }
  :root[data-theme] .topbar .breadcrumb span { margin-inline: 3px; }
  :root[data-theme] .hero.dashboard-hero { grid-template-columns: 1fr; }
  .dashboard-hero-photo { min-height: clamp(130px,40vw,210px); }
  .dashboard-hero-facts { margin-top: 16px; }
  .casona-utility .ticket-page { padding: 10px; }
}
@media (prefers-reduced-transparency: reduce) {
  :root[data-theme] :is(.topbar,.sidebar,.mobile-bottom,.modal),
  :root[data-theme] .pos-mode .sidebar.open {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  :root[data-theme] :is(.casona-panel,.casona-utility) :is(button,a,input,select,textarea,summary,.fade-in,.modal,.mobile-bottom,#toast) {
    transition: none;
    animation: none;
  }
}
@media print {
  :root[data-theme] body.casona-utility, :root[data-theme] .casona-utility .ticket-panel {
    background: #fff;
    color: #111;
  }
  .casona-utility .ticket-panel { border: 0; padding: 0; }
}
