/* Shared studio shell and controls adapted from the published DDOKD product selector. */
:root {
  --studio-width: 1280px;
  --studio-workspace: #f1f3f6;
  --studio-preview: #e4e8ef;
  --studio-panel-radius: 14px;
  --gutter: clamp(12px, 1.6vw, 24px);
  --subtle: var(--surface-subtle);
  --muted: var(--ink-muted);
  --chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%234b515a' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--studio-workspace); color: var(--ink); font: 15px/1.6 var(--font-sans); letter-spacing: -.01em; word-break: keep-all; overflow-wrap: anywhere; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 200; top: 8px; left: 8px; padding: 8px 14px; background: var(--surface); border-radius: var(--radius-sm); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8);
  min-height: var(--control-height); padding: 8px 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; line-height: 1.5; text-decoration: none; cursor: pointer;
  background: var(--surface);
}
.btn:disabled { cursor: not-allowed; background: var(--subtle); color: var(--ink-disabled); border-color: var(--line); }
.btn-primary { background: var(--yellow); color: var(--on-yellow); border-color: var(--yellow); }
.btn-primary:hover:not(:disabled) { background: var(--yellow-soft); }
.btn-ink { background: var(--ink); color: var(--canvas); }
.btn-ink:hover:not(:disabled) { background: #34373a; }
.btn-outline { background: var(--surface); border-color: var(--line-strong); }
.btn-outline:hover:not(:disabled), .btn-text:hover:not(:disabled) { background: var(--subtle); }
.btn-text { background: transparent; color: var(--muted); }
.btn-danger { background: var(--danger); color: var(--surface); }
.btn-danger:hover:not(:disabled) { background: #b50024; }
.btn-sm { min-height: 34px; padding: 0 12px; }
.btn-lg { min-height: 48px; padding-inline: 24px; font-size: 16px; }
.input {
  display: block; width: 100%; min-width: 0; min-height: var(--control-height);
  padding: 8px 12px; border: 1px solid #dce1e8; border-radius: var(--radius-sm);
  background: var(--surface); font-size: 14px; line-height: 1.5;
}
select.input {
  appearance: none; padding-inline-end: 36px;
  background-image: var(--chevron-down); background-repeat: no-repeat;
  background-position: right 12px center; background-size: 16px 16px; cursor: pointer;
}
.input::placeholder { color: var(--ink-muted); }
.panel { min-width: 0; padding: clamp(16px, 1.8vw, 24px); border: 1px solid var(--line); border-radius: var(--studio-panel-radius); background: var(--surface); }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border: 0; border-radius: var(--radius-xs); background: var(--subtle); color: var(--neutral); font-size: 12px; font-weight: 600; text-decoration: none; }
.tag:hover { background: var(--neutral-soft); cursor: pointer; }
.quiet { color: var(--muted); font-size: 14px; }
.empty { padding: 32px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--muted); text-align: center; }
.empty h1, .empty h3 { color: var(--ink); }
.empty .btn { margin-top: var(--space-16); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.demo-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; min-height: 40px; padding: 8px clamp(14px, 2vw, 24px); background: var(--charcoal); color: var(--surface); font-size: 13px; }
.demo-banner p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.demo-banner strong { padding: 1px 8px; border-radius: var(--radius-xs); background: var(--yellow); color: var(--ink); font-size: 12px; }
.demo-banner a { margin-inline-start: auto; color: inherit; text-underline-offset: 3px; }
.demo-banner a:focus-visible { outline-color: var(--surface); }
.demo-toolbar { display: flex; min-height: 60px; align-items: center; justify-content: space-between; gap: 4px 12px; padding-inline: var(--gutter); border-bottom: 1px solid var(--line); background: var(--surface); }
.demo-title { font-size: clamp(14px, 2vw, 24px); font-weight: 750; line-height: 1.25; letter-spacing: -.035em; text-decoration: none; }
.mode-switch { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius-md); background: var(--subtle); }
.mode-switch a { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--neutral); font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.mode-switch a:hover { color: var(--ink); }
.mode-switch a[aria-current] { background: var(--ink); color: var(--surface); }
.app-shell { width: min(var(--studio-width), calc(100% - var(--gutter) * 2)); margin: var(--gutter) auto 0; }
.app-shell.is-admin { display: grid; grid-template-columns: 204px minmax(0, 1fr); width: 100%; margin-top: 0; background: var(--surface); }
.app-main { min-width: 0; padding-bottom: 44px; }
.is-admin .app-main { padding: var(--gutter) var(--gutter) 44px; background: var(--studio-workspace); }
.app-main:focus, .app-main h1:focus, .app-main h2:focus { outline: none; }
.side-nav { min-width: 0; padding: 16px; background: var(--surface); }
.side-menu { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.side-link { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--neutral); font-size: 14px; font-weight: 550; text-decoration: none; }
.side-link:hover, .side-link[aria-current] { background: var(--subtle); color: var(--ink); }
.side-link[aria-current] { font-weight: 750; }
.side-link[aria-current]::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 2px; background: var(--yellow); }
.side-ico { display: flex; flex: none; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 16px; }
.view-title { font-size: clamp(20px, 2vw, 24px); font-weight: 750; line-height: 1.25; letter-spacing: -.035em; }
.view-desc { margin-top: 5px; color: var(--muted); }
.studio-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 77px; padding: 16px clamp(16px, 5.2vw, 76px); background: var(--surface); border-top: 1px solid var(--line); }
.studio-footer img { width: 99px; height: auto; }
.studio-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--neutral); font-size: 12px; text-underline-offset: 3px; }

.dlg { width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 24px; border: 0; border-radius: var(--radius-2xl); color: var(--ink); box-shadow: 0 16px 48px #0003; overscroll-behavior: contain; }
.dlg::backdrop { background: rgba(9, 11, 14, .45); }
html:has(.dlg[open]) { overflow: hidden; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.dlg-head h2 { font-size: 21px; letter-spacing: -.03em; }
.dlg-close { display: grid; place-items: center; flex: 0 0 40px; height: 40px; border: 0; border-radius: var(--radius-sm); background: var(--subtle); cursor: pointer; }
.dlg p { font-size: 14px; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; margin-top: 20px; }
.toast.visible { position: fixed; z-index: 300; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: var(--radius-md); background: var(--charcoal); color: var(--surface); font-size: 14px; font-weight: 600; box-shadow: 0 6px 24px #0003; }
.toast:not(.visible) { position: fixed; opacity: 0; pointer-events: none; }

@media (max-width: 880px) {
  .app-shell.is-admin { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side-nav { padding: 8px 12px; }
  .side-menu { display: flex; flex-wrap: wrap; }
  .side-link[aria-current]::before { top: auto; right: 12px; bottom: 0; left: 12px; width: auto; height: 2px; }
}
@media (max-width: 600px) {
  .demo-toolbar { padding-block: 5px; }
  .demo-title { font-size: 12px; }
  .mode-switch a { min-height: 44px; padding-inline: 6px; font-size: 12px; }
  .app-shell { margin-top: 14px; }
  .side-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .side-link { gap: 6px; padding: 5px 8px; font-size: 13px; }
  .btn, .input, .dlg-close { min-height: var(--control-height-touch); }
  .input { font-size: 16px; }
  .dlg { padding: 16px; }
  .studio-footer img { width: 80px; }
}
@media (forced-colors: active) {
  select.input { appearance: auto; background-image: none; }
}
