/* Sunflower Craft Co. colors, taken from the logo. app/Mail.php uses the same ones. */
:root {
  --bg: #fbeed2;      /* cream */
  --card: #fffaee;
  --tint: #ffefc2;    /* pale petal */
  --ink: #402c18;     /* brown */
  --muted: #7a6044;
  --line: #ead6a6;
  --sun: #fbb411;     /* yellow petal */
  --orange: #f99c10;
  --deep: #8f5300;    /* orange dark enough for text */
  --stage: #e2cfa6;
  --ok: #46682a;
  --warn: #8f5300;
  --bad: #a32e12;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  border-top: 5px solid var(--sun);
}
a { color: var(--deep); }
button, input, select { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--ink); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button[aria-pressed="true"], button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); }
.primary { background: var(--sun); border: 2px solid var(--ink); color: var(--ink); font-weight: 700; padding: 10px 20px; }
.primary:hover:not(:disabled) { background: var(--orange); }

/* ---------- studio ---------- */
.studio { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0; }
.brand img { display: block; }
.brand .flower { width: 50px; height: 50px; }
.brand .wordmark { width: auto; height: 40px; }
.top p { margin: 0; color: var(--muted); border-left: 2px solid var(--line); padding-left: 16px; }
.testmode { margin-left: auto; background: var(--ink); color: var(--card); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; }
.testmode[hidden] { display: none; }
main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 14px; padding: 0 14px 14px; }
.stage { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; border-radius: 20px; overflow: hidden; background: var(--stage); }
.stage:has(#btnLight[aria-pressed="true"]) { background: #1c130a; }
#viewer { grid-area: 2 / 1; min-width: 0; min-height: 0; touch-action: none; }
#viewer canvas { display: block; }
.tools { grid-area: 3 / 1; display: flex; justify-content: center; flex-wrap: wrap; gap: 7px 14px; padding: 6px 10px 12px; }
.tool-group { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px; }
.tools button, .scale-tools button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.tools button { padding: 7px 10px; font-size: 13px; }
.room-tools button { background: var(--tint); border-color: #c4b797; font-weight: 600; }
.preview-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.tools button[aria-pressed="true"] { background: var(--sun); border-color: var(--sun); color: var(--ink); }
.scale-panel { grid-area: 1 / 1; display: grid; justify-items: start; gap: 5px; padding: 12px 12px 0; }
.scale-tools { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); pointer-events: auto; }
.scale-tools button { border-color: transparent; padding: 6px 11px; font-size: 12px; font-weight: 600; }
.dims { margin: 0; max-width: 100%; padding: 4px 10px; border-radius: 9px; color: var(--ink); background: var(--card); font-size: 12px; font-variant-numeric: tabular-nums; }
.dims:empty { display: none; }

.panel { display: flex; flex-direction: column; min-height: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 12px 12px 0; }
.types:empty { display: none; }
.types button { font-weight: 700; border-radius: 12px; }
.types button[aria-pressed="true"] { background: var(--sun); border-color: var(--ink); color: var(--ink); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); }
.lightcolors { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; }
.lightcolors[hidden] { display: none; }
.lightcolors button { width: 26px; height: 26px; padding: 0; border: 2px solid var(--card); }
.lightcolors button[aria-pressed="true"] { border-color: var(--card); box-shadow: 0 0 0 3px var(--ink); }
.controls { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 18px; }
.controls h3 { margin: 18px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 6px 12px; font-size: 13px; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 10px 0; }
.slider output { color: var(--muted); font-variant-numeric: tabular-nums; }
.slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--orange); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 34px; height: 34px; padding: 0; border: 1px solid rgba(64, 44, 24, .25); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.choice { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 6px 0; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--tint); }
.choice span:last-child { margin-left: auto; color: var(--muted); }
.note { color: var(--muted); font-size: 12px; }

.buy { border-top: 1px solid var(--line); padding: 12px 16px 14px; }
.checks { list-style: none; margin: 0 0 8px; padding: 0; font-size: 12.5px; }
.checks .ok { color: var(--ok); }
.checks .warn { color: var(--warn); }
.checks .error { color: var(--bad); }
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price-row small { display: block; color: var(--muted); }
.price-row strong { font-size: 24px; letter-spacing: -.02em; }

dialog { background: var(--card); color: var(--ink); border: 0; border-top: 6px solid var(--sun); border-radius: 20px; padding: 22px; width: min(440px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(64, 44, 24, .35); }
dialog::backdrop { background: rgba(64, 44, 24, .55); }
dialog h2 { margin: 0 0 12px; font-size: 19px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; }
.total { font-weight: 700; font-size: 17px; }
.agree { display: flex; gap: 8px; align-items: center; }
.error { color: var(--bad); }
.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }

/* ---------- the lamp in a room ---------- */
dialog.rooms { --ratio: 1.3333; width: min(1180px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); padding: 14px 16px 14px; }
.rooms-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rooms-head h2 { margin: 0; }
.rooms-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 10px 0; }
.roomcolors { display: flex; gap: 8px; }
.roomcolors[hidden] { display: none; }
.roomcolors button { width: 26px; height: 26px; padding: 0; border: 2px solid var(--card); }
.roomcolors button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.rooms-view { position: relative; margin: 0 auto; width: min(100%, calc((100dvh - 210px) * var(--ratio))); aspect-ratio: var(--ratio); background: #2a2018; border-radius: 12px; overflow: hidden; }
.rooms-view canvas, .rooms-view img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.rooms-view [hidden] { display: none; }
.rooms-status { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px); margin: 0; padding: 5px 14px; font-size: 12.5px; text-align: center; background: rgba(255, 250, 238, .92); border-radius: 999px; }
.rooms-status:empty { display: none; }
.rooms-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rooms-foot .note { margin: 0; }
.rooms-foot a { margin-left: auto; border-radius: 999px; text-decoration: none; }
.rooms-foot a[hidden] { display: none; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 9px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 24px); }
.toast.show { opacity: 1; }

/* ---------- simple pages (success, demo payment, admin) ---------- */
.page { max-width: 560px; margin: 28px auto 40px; padding: 0 16px; }
.logo-top { display: block; width: 150px; margin: 0 auto 20px; }
.logo-top img { display: block; width: 100%; height: auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; margin-bottom: 14px; }
.card h1, .card h2 { margin-top: 0; }
.banner { background: var(--tint); border: 1px solid var(--sun); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }

@media (max-width: 820px) {
  .studio { height: auto; min-height: 100dvh; overflow: visible; display: block; }
  .top { padding: 8px 14px; gap: 10px; }
  .brand .flower { width: 38px; height: 38px; }
  .brand .wordmark { height: 30px; }
  .top p { font-size: 12px; border-left: 0; padding-left: 0; }
  main { display: block; padding: 0 8px 8px; }
  .stage { position: sticky; top: 0; height: 46dvh; z-index: 2; border-radius: 16px; }
  .panel { margin-top: 8px; overflow: visible; }
  .controls { overflow: visible; }
  .buy { position: sticky; bottom: 0; background: var(--card); z-index: 3; border-radius: 0 0 20px 20px; }
  .tools { gap: 5px; padding: 5px 6px 8px; }
  .tool-group { gap: 4px; }
  dialog.rooms { padding: 10px; }
  .lightcolors { right: 8px; gap: 5px; }
  .lightcolors button { width: 22px; height: 22px; }
  .tools button { padding: 6px; font-size: 11px; }
  .tools .preview-icon { width: 14px; height: 14px; }
}

.studio {
  --bg: #f7f6f1;
  --card: #fffefa;
  --line: #deddd2;
  --ink: #34362e;
  --muted: #62635a;
  --stage: #e9e5da;
  --tint: #f6f2e6;
  border-top-width: 3px;
}
.studio .top { padding-block: 12px; }
.stage, .panel { box-shadow: 0 4px 18px rgb(47 46 33 / 6%); }
.rooms-head h2 {
  font: 500 clamp(1.35rem, 2vw, 1.8rem)/1.15 Georgia, serif;
  letter-spacing: -.035em;
}
.studio .tools button { box-shadow: 0 2px 8px rgb(38 38 26 / 8%); }
.tool-group[hidden], .scale-tools button[hidden], .tabs[hidden], .tabs button[hidden], .buy[hidden] { display: none; }
.tabs:has([data-tab="extras"][hidden]) { grid-template-columns: repeat(2, 1fr); }
.preview-note { margin: 0; padding: 12px 16px; color: var(--muted); border-top: 1px solid var(--line); }
@media (max-width: 420px) {
  .view-tools { display: grid; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .view-tools button { min-width: 0; flex-direction: column; gap: 2px; padding: 4px 0; }
  .studio .types button { padding-inline: 5px; }
}
@media (prefers-reduced-motion: no-preference) {
  .studio button { transition: background-color .18s, border-color .18s, transform .18s; }
  @media (hover: hover) {
    .tools button:hover { transform: translateY(-2px); }
  }
  dialog.rooms[open] { animation: room-enter .22s ease-out; }
  @keyframes room-enter { from { opacity: 0; transform: translateY(8px); } }
}
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0; }
.stepper-field { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: white; overflow: visible; }
.stepper-field button { min-width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px; background: var(--tint); font-size: 18px; }
.stepper-field input { appearance: textfield; width: 5ch; text-align: right; border: 0; background: transparent; font: inherit; font-variant-numeric: tabular-nums; }
.stepper-field input::-webkit-inner-spin-button { appearance: none; }
.stepper-field span { padding: 0 6px 0 3px; color: var(--muted); font-size: 12px; }
