/* ---------- The studio: Flowers -> Wrap -> Card -> Send ---------- */
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 6; }
.logo { font-family: var(--serif); font-size: 21px; white-space: nowrap; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 6px 2px; }
.link-btn:hover { color: var(--ink); }

/* step tabs */
.steps { display: flex; gap: 4px; background: #f4ede5; border-radius: 999px; padding: 4px; }
.steps button { border: 0; background: none; border-radius: 999px; padding: 8px 18px; font-size: 14px; font-weight: 500; color: var(--muted); transition: background .2s, color .2s; position: relative; }
.steps button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(60, 40, 20, .15); }
.steps button.done:not(.on) { color: var(--green); }
.steps button.done:not(.on)::after { content: ''; position: absolute; right: 7px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--green); }

input, textarea { font: inherit; width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; background: #fff; color: var(--ink); }
input:focus, textarea:focus { outline: 2px solid #e9b8c9; border-color: transparent; }
.primary { background: var(--green); color: #fff; border: 0; border-radius: 999px; padding: 13px 24px; font-weight: 600; font-size: 15px; transition: opacity .2s, transform .15s; }
.primary.small { padding: 10px 18px; font-size: 14px; }
.primary.wide { width: 100%; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.primary:not(:disabled):active { transform: scale(.98); }
.secondary { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 11px 18px; font-weight: 500; font-size: 14px; color: var(--ink); white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.secondary:disabled { opacity: .45; cursor: not-allowed; }
.err { color: #b3261e; font-size: 13px; min-height: 18px; margin-top: 10px; }
.muted { color: var(--muted); }
.grow { flex: 1; }

/* layout */
main { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; padding: 24px 28px 60px; max-width: 1280px; margin: 0 auto; }
.step { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; animation: step-in .35s ease both; }
@keyframes step-in { from { opacity: 0; transform: translateY(8px); } }
.step h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0; }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.step-foot { display: flex; align-items: center; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.step-foot .primary { margin-left: auto; }
.only-phone { display: none !important; }

.count-pill { font-size: 13px; color: var(--muted); background: #f4ede5; border-radius: 999px; padding: 6px 12px; font-variant-numeric: tabular-nums; }
.count-pill b { color: var(--ink); }

/* flowers */
.modes { display: flex; background: #f4ede5; border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.modes button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 10px 12px; font-size: 14px; font-weight: 500; color: var(--muted); }
.modes button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(60, 40, 20, .15); }
.auto-note { border: 1px dashed #e7a9bf; background: #fff7fa; border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; font-size: 14px; line-height: 1.45; }
.auto-note b { font-weight: 600; }
.auto-note .reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.auto-note .reasons span { background: #fff; border: 1px solid #f0d3de; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.auto-note .row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.auto-note .row-btns button { padding: 8px 14px; font-size: 13px; }
.link-inline { background: none; border: 0; padding: 0; color: var(--rose); text-decoration: underline; font-size: inherit; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.grid.auto { opacity: .9; }
.fcard { position: relative; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 10px; text-align: center; transition: border-color .2s, box-shadow .2s; user-select: none; }
.fcard.on { border-color: #e7a9bf; box-shadow: 0 0 0 3px var(--rose-soft); }
.fcard .pick { display: block; width: 100%; background: none; border: 0; padding: 0; color: var(--ink); }
.fcard .pick:disabled { cursor: default; }
.fcard .pick:active { transform: scale(.97); }
.flower-icon { width: 100%; height: 80px; display: block; }
.fname { font-weight: 600; font-size: 13.5px; margin-top: 6px; line-height: 1.25; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--cream); font-size: 17px; line-height: 1; color: var(--ink); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper span { min-width: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.badge { position: absolute; top: 8px; right: 8px; background: var(--rose); color: #fff; font-size: 12px; font-weight: 600; border-radius: 999px; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 6px; transform: scale(0); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.fcard.on .badge { transform: scale(1); }

/* wrap */
.opt-label { font-size: 13px; font-weight: 600; color: var(--ink); margin: 4px 0 10px; }
.wraps + .opt-label { margin-top: 22px; }
.wraps { display: flex; gap: 10px; flex-wrap: wrap; }
.wrap-opt { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px 6px 6px; font-size: 14px; color: var(--ink); }
.wrap-opt i { width: 26px; height: 26px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.wrap-opt.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

/* card */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 13px; color: var(--ink); }
.chip.on { background: var(--rose-soft); border-color: #e7a9bf; }
#message { min-height: 104px; resize: vertical; font-family: var(--hand); font-size: 25px; line-height: 1.2; }
.count { text-align: right; font-size: 12px; color: var(--muted); margin-top: 4px; }
.auto-inline { margin-top: 6px; font-size: 13px; color: var(--rose); line-height: 1.4; }

.extras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.extra { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 1px dashed #d9cbbd; background: #fffdf9; border-radius: 14px; padding: 14px 8px; font-size: 13.5px; font-weight: 500; color: var(--ink); position: relative; min-height: 92px; justify-content: center; }
.extra svg { width: 24px; height: 24px; color: var(--rose); }
.extra.has { border-style: solid; border-color: #e7a9bf; background: #fff7fa; }
.extra .thumb { max-width: 100%; max-height: 46px; border-radius: 6px; }
.extra .thumb.photo { width: 46px; height: 46px; object-fit: cover; }
.extra .x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(43, 42, 40, .75); color: #fff; font-size: 15px; line-height: 24px; text-align: center; cursor: pointer; }
.extra:disabled { opacity: .5; }

/* preview */
aside { position: sticky; top: 84px; align-self: start; }
.preview { background: radial-gradient(120% 90% at 50% 0%, #fff, #f6ebe4); border: 1px solid var(--line); border-radius: 18px; padding: 16px 16px 18px; }
.preview .bq-holder { width: 100%; max-width: 360px; margin: 0 auto; aspect-ratio: 600 / 730; display: grid; place-items: center; }
.empty { color: var(--muted); text-align: center; font-size: 14px; padding: 0 20px; }
.mini-card { background: var(--paper); border-radius: 6px; margin: -10px auto 0; width: 90%; padding: 14px 18px; box-shadow: 0 16px 30px -22px rgba(110, 60, 40, .6); transform: rotate(-1deg); font-family: var(--hand); font-size: 22px; line-height: 1.2; position: relative; }
.mini-card .sig { color: var(--rose); text-align: right; margin-top: 6px; }
.mini-card .sig img { height: 40px; }
.mini-card .ph { color: #c7bdb2; }
.mini-card .att { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-family: var(--sans); font-size: 12px; color: var(--muted); }
.mini-card .att img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); transform: rotate(3deg); }
.preview-actions { display: flex; justify-content: center; margin-top: 14px; }
.close-preview { position: absolute; top: 12px; right: 12px; }

/* send */
.ready { display: grid; gap: 14px; }
.summary { display: flex; flex-wrap: wrap; gap: 8px; }
.summary span { background: #f4ede5; border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.summary span.missing { background: #fff1e6; color: #9a5b00; }
.sent-box { display: grid; gap: 12px; }
.sent-box h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 21px; }
.link-row { display: flex; gap: 8px; }
.link-row input { font-size: 14px; color: var(--ink); background: #faf6f1; }
.send-main { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.sms { background: #34c759; color: #fff; text-decoration: none; border-radius: 999px; padding: 12px 20px; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
details.edit-sms { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 0 14px; }
details.edit-sms summary { cursor: pointer; padding: 12px 0; font-size: 14px; color: var(--ink); list-style: none; display: flex; justify-content: space-between; }
details.edit-sms summary::after { content: '+'; color: var(--muted); }
details.edit-sms[open] summary::after { content: '\2212'; }
details.edit-sms[open] { padding-bottom: 14px; }
#smsText { font-family: var(--sans); font-size: 15px; line-height: 1.4; min-height: 84px; }
.sms-warn { font-size: 12.5px; color: #9a5b00; margin-top: 6px; line-height: 1.35; }
.sms-tools { display: flex; justify-content: flex-end; margin-top: 6px; }

.history { margin-top: 20px; }
.history h4 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.history a { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 9px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.history a span:last-child { color: var(--muted); white-space: nowrap; }

/* sheets (signature / voice) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(43, 32, 28, .35); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.sheet-backdrop.open { opacity: 1; }
.sheet { background: var(--paper); border-radius: 20px; padding: 20px; width: min(520px, 100%); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .35); transform: translateY(12px); transition: transform .25s ease; }
.sheet-backdrop.open .sheet { transform: none; }
.sheet h3 { margin: 0 0 14px; font-family: var(--serif); font-weight: 400; font-size: 22px; }
.sheet-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.sig-pad { position: relative; height: 200px; background: #fff; border: 1px solid var(--line); border-radius: 14px; touch-action: none; overflow: hidden; }
.sig-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.sig-line { position: absolute; left: 24px; right: 24px; bottom: 46px; border-bottom: 1px dashed #d9cbbd; pointer-events: none; }
.sig-hint { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font-size: 13px; color: #b9ada2; pointer-events: none; }
.rec { display: grid; justify-items: center; gap: 10px; padding: 10px 0 4px; text-align: center; }
.rec-btn { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--rose); display: grid; place-items: center; box-shadow: 0 10px 24px -10px rgba(200, 64, 111, .8); }
.rec-btn span { width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: border-radius .2s, width .2s, height .2s; }
.rec-btn.on { animation: rec-pulse 1.4s ease-in-out infinite; }
.rec-btn.on span { width: 22px; height: 22px; border-radius: 4px; }
@keyframes rec-pulse { 50% { box-shadow: 0 0 0 12px rgba(200, 64, 111, .15); } }
.rec-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.rec-time b { color: var(--ink); }
.rec-msg { font-size: 13.5px; color: var(--muted); }
.rec audio { width: 100%; margin-top: 4px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; transition: .3s; pointer-events: none; z-index: 70; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.has-action.show { pointer-events: auto; }
.toast { white-space: nowrap; display: flex; align-items: center; }
.toast button { background: none; border: 0; color: #f6b8cc; font-weight: 600; margin-left: 12px; padding: 0; font-size: 14px; }
@media (max-width: 980px) { .toast { bottom: calc(92px + env(safe-area-inset-bottom)); } }

/* ---------- phones and small tablets ---------- */
@media (max-width: 980px) {
  header { padding: 10px 12px; flex-direction: column; align-items: stretch; gap: 10px; }
  .logo { text-align: center; font-size: 19px; }
  .steps button { flex: 1; padding: 9px 6px; font-size: 13.5px; }
  .steps button.done:not(.on)::after { right: 4px; }
  main { display: block; padding: 12px 12px 24px; }
  .step { padding: 16px; border-radius: 16px; }
  .step h2 { font-size: 21px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
  .flower-icon { height: 66px; }
  .stepper button { width: 38px; height: 38px; }
  .only-phone { display: inline-flex !important; }
  /* Back / Preview / Next stick to the bottom of the screen */
  .step-foot { position: sticky; bottom: 0; z-index: 5; margin: 18px -16px -16px; padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    background: rgba(255, 253, 249, .96); backdrop-filter: blur(6px); border-radius: 0 0 16px 16px; }
  .step-foot .secondary, .step-foot .primary { padding: 11px 14px; font-size: 14px; }
  /* the preview opens as a full-screen sheet */
  aside { display: none; }
  body.preview-open { overflow: hidden; }
  body.preview-open aside { display: block; position: fixed; inset: 0; z-index: 40; overflow: auto; background: var(--cream); padding: 56px 12px 24px; }
  /* on the Send step the preview sits above the send options */
  body[data-view="send"] aside { display: block; position: static; margin-bottom: 12px; }
  body[data-view="send"] .close-preview { display: none !important; }
  body[data-view="send"] main { display: flex; flex-direction: column-reverse; }
}
@media (max-width: 460px) {
  .row { grid-template-columns: 1fr; }
  .extras { gap: 8px; }
  .extra { font-size: 12.5px; padding: 12px 6px; }
  #message { font-size: 23px; }
  .send-main { grid-template-columns: 1fr; }
  .wrap-opt { font-size: 13px; padding: 5px 12px 5px 5px; }
}
