/* ArtLabs · studio catalogue styling */
:root {
  --paper: #f5f1ea;
  --paper-2: #ebe5da;
  --card: #fbf9f5;
  --ink: #1e1c19;
  --ink-2: #5d574f;
  --ink-3: #8b8478;
  --line: #ddd5c8;
  --accent: #b4532a;
  --accent-soft: #f1e1d6;
  --ok: #3d6a4a;
  --ok-soft: #e1ebe2;
  --err: #a5392a;
  --err-soft: #f4dfda;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
  --tap: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Brand ── */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand { color: #000; }
.brand .mark { width: 24px; height: 24px; flex: none; }
.brand span { font: 600 21px/1 var(--serif); letter-spacing: .01em; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #000; }
.btn.danger { color: var(--err); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.icon { width: 20px; height: 20px; flex: none; }

/* ── Inputs ── */
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); font-size: 16px; color: var(--ink);
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--paper-2); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235d574f' fill='none' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.row { display: flex; gap: 10px; align-items: end; }
.row > * { flex: 1; min-width: 0; }

/* ── App shell ── */
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(245, 241, 234, .94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); padding-top: var(--safe-t);
}
.topbar-inner { display: flex; align-items: center; gap: 14px; max-width: 1480px; margin: 0 auto; padding: 12px 20px; }
.topbar .spacer { flex: 1; }
.demo-banner { background: var(--accent-soft); color: var(--ink); font-size: 13px; text-align: center; padding: 6px 12px; }
main { max-width: 1480px; margin: 0 auto; padding: 20px 20px calc(120px + var(--safe-b)); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search .input { padding-left: 38px; border-radius: 999px; min-height: 44px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip-select { min-height: 40px; border-radius: 999px; padding: 0 32px 0 14px; font-size: 14px; width: auto; }
.count { color: var(--ink-3); font-size: 14px; white-space: nowrap; }

/* ── Grid ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 34px 24px; }
.card { position: relative; cursor: pointer; user-select: none; -webkit-user-select: none; text-decoration: none; display: block; }
.card .frame {
  aspect-ratio: 4 / 5; background: var(--paper-2); border-radius: 4px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 14px;
  transition: box-shadow .15s;
}
.card .frame img { max-height: 100%; width: auto; max-width: 100%; object-fit: contain; box-shadow: 0 6px 18px rgba(30, 28, 25, .14); }
.card .frame .noimg { color: var(--ink-3); font-size: 13px; }
.card h3 { font: 500 17px/1.3 var(--serif); margin: 12px 0 2px; }
.card h3.draft { font-style: italic; color: var(--ink-3); }
.card .meta { font-size: 13px; color: var(--ink-2); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--ink-3); }
.dot.available { background: var(--ok); } .dot.sold { background: var(--accent); } .dot.on_hold { background: #c49a2c; }
.card .check {
  position: absolute; top: 10px; left: 10px; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(30, 28, 25, .25); display: none; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.selecting .card .check { display: flex; }
.card.selected .frame { box-shadow: 0 0 0 3px var(--ink); }
.card.selected .check { background: var(--ink); }
.card.selected .check::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }
.card.uploading .frame { opacity: .55; }

.empty { text-align: center; padding: 90px 20px; max-width: 460px; margin: 0 auto; }
.empty h2 { font: 400 32px/1.15 var(--serif); margin: 0 0 10px; }
.empty p { color: var(--ink-2); margin: 0 0 24px; }
.dropzone-active main { outline: 3px dashed var(--ink-3); outline-offset: -10px; border-radius: 16px; }

/* ── Bars (bottom on phone, selection) ── */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: none;
  background: rgba(251, 249, 245, .97); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 8px 12px calc(8px + var(--safe-b));
}
.bottombar .inner { display: flex; align-items: center; gap: 8px; max-width: 640px; margin: 0 auto; }
.bottombar .btn { min-height: var(--tap); }
.bottombar .grow { flex: 1; }
.tabbtn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-2);
  background: none; border: 0; min-height: var(--tap); cursor: pointer; text-decoration: none; justify-content: center; }
.tabbtn.on { color: var(--ink); }
.addbtn { flex: 1.4; min-height: 54px; font-size: 16px; }
.selbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-b)); z-index: 35;
  background: var(--ink); color: var(--paper); border-radius: 999px; padding: 8px 8px 8px 20px; display: flex; gap: 8px; align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: calc(100vw - 24px); }
.selbar .btn { background: transparent; color: var(--paper); border-color: rgba(255, 255, 255, .25); }
.selbar .btn.primary { background: var(--paper); color: var(--ink); }
.selbar .n { font-weight: 600; white-space: nowrap; margin-right: 4px; }

/* ── Artwork detail ── */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; min-height: 40px; }
.detail { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 48px; align-items: start; margin-top: 8px; }
.stage { background: var(--paper-2); border-radius: 6px; display: flex; align-items: center; justify-content: center; padding: 28px; min-height: 360px; aspect-ratio: 5 / 4; }
.stage img { max-height: 100%; max-width: 100%; width: auto; object-fit: contain; box-shadow: 0 10px 30px rgba(30, 28, 25, .16); }
.thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 12px 0 4px; }
.thumb { position: relative; flex: none; width: 84px; height: 84px; border-radius: 6px; background: var(--paper-2); border: 2px solid transparent; padding: 4px; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb.on { border-color: var(--ink); }
.thumb .tag { position: absolute; left: 4px; bottom: 4px; font-size: 10px; background: var(--ink); color: var(--paper); padding: 1px 5px; border-radius: 4px; }
.thumb.add { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--ink-3); color: var(--ink-2); font-size: 28px; }
.imgtools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.imgtools select { width: auto; min-height: 36px; font-size: 14px; border-radius: 999px; }

.panel h1 { font: 400 34px/1.15 var(--serif); margin: 0 0 4px; }
.panel .sub { color: var(--ink-2); margin: 0 0 22px; }
.form { display: grid; gap: 14px; }
.section { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 18px; }
.section h2 { font: 500 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 14px; display: flex; justify-content: space-between; align-items: center; }
.savestate { font-size: 13px; color: var(--ink-3); min-height: 20px; }
.savestate.ok { color: var(--ok); } .savestate.err { color: var(--err); }
.loc-now { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.loc-now b { font: 500 18px/1.2 var(--serif); display: block; }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline time { color: var(--ink-3); }
.timeline .note { color: var(--ink-2); display: block; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.files li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--ink-3); font-size: 14px; }

/* ── Lists (locations, settings) ── */
.page-title { font: 400 38px/1.1 var(--serif); margin: 6px 0 22px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.list .item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.list .item .grow { flex: 1; min-width: 0; }
.list .item b { font: 500 18px/1.25 var(--serif); }
.meter { height: 8px; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.meter.full i { background: var(--err); }

/* ── Sheet (bottom on phone, centred dialog on larger screens) ── */
.scrim { position: fixed; inset: 0; background: rgba(30, 28, 25, .38); z-index: 60; display: flex; align-items: center; justify-content: center; animation: fade .15s; }
.sheet { background: var(--paper); width: min(520px, calc(100vw - 32px)); max-height: min(86vh, 760px); overflow: auto; border-radius: 16px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.sheet h2 { font: 400 26px/1.2 var(--serif); margin: 0 0 6px; }
.sheet p { color: var(--ink-2); margin: 0 0 18px; }
.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer; text-align: left; width: 100%; }
.choice.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice small { color: var(--ink-3); display: block; }
.choice .grow { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }

/* ── Toasts & upload tray ── */
.toasts { position: fixed; z-index: 80; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; font-size: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: fade .2s; }
.toast.ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8fd19e; flex: none; }
.toast.err { background: var(--err); }
.toast .grow { flex: 1; }
.toast button { background: none; border: 1px solid rgba(255, 255, 255, .4); color: inherit; border-radius: 99px; padding: 4px 12px; cursor: pointer; }
.tray { position: fixed; z-index: 40; right: 20px; bottom: calc(24px + var(--safe-b)); width: min(360px, calc(100vw - 24px)); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 34px rgba(0, 0, 0, .14); padding: 14px 16px; }
.tray .bar { height: 4px; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.tray .bar i { display: block; height: 100%; background: var(--ink); transition: width .3s; }
.tray .fails { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--err); max-height: 120px; overflow: auto; }
.tray .fails li { padding: 3px 0; }

/* ── Sign-in ── */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin .box { width: min(400px, 100%); }
.signin h1 { font: 400 40px/1.1 var(--serif); margin: 28px 0 8px; }
.signin p { color: var(--ink-2); margin: 0 0 24px; }
.signin form { display: grid; gap: 12px; }
.code-input { letter-spacing: .4em; font-size: 24px !important; text-align: center; }
.hint { font-size: 13px; color: var(--ink-3); }
.err-text { color: var(--err); font-size: 14px; min-height: 20px; }

/* ── Phone ── */
@media (max-width: 760px) {
  .topbar-inner { padding: 10px 16px; }
  .desk { display: none !important; }
  main { padding: 14px 14px calc(110px + var(--safe-b)); }
  .bottombar { display: block; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .card .frame { padding: 8px; }
  .card h3 { font-size: 15px; margin-top: 8px; }
  .card .meta { font-size: 12px; }
  .search { max-width: none; flex-basis: 100%; }
  .detail { grid-template-columns: 1fr; gap: 20px; }
  .stage { padding: 14px; min-height: 260px; aspect-ratio: 1; }
  .panel h1 { font-size: 28px; }
  .selbar { bottom: calc(76px + var(--safe-b)); padding-left: 16px; }
  .tray { right: 12px; left: 12px; width: auto; bottom: calc(80px + var(--safe-b)); }
  .scrim { align-items: flex-end; }
  .sheet { width: 100%; border-radius: 18px 18px 0 0; padding: 20px 18px calc(20px + var(--safe-b)); animation: up .2s ease-out; max-height: 88vh; }
  .sheet .actions { flex-direction: column-reverse; }
  .sheet .actions .btn { width: 100%; min-height: 50px; }
  .page-title { font-size: 30px; }
  .timeline li { grid-template-columns: 82px 1fr; }
}
@media (min-width: 761px) { .phone { display: none !important; } }
@media (hover: hover) { .card:hover .frame { box-shadow: 0 0 0 1px var(--line); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.panel h1.draft { font-style: italic; color: var(--ink-3); }
[aria-invalid="true"] { border-color: var(--err) !important; }

/* ── Stage 2: documents ── */
.mainnav { display: flex; gap: 2px; margin-left: 14px; }
.iconbtn { padding: 0 10px; }
.h2 { font: 400 24px/1.2 var(--serif); margin: 0 0 14px; }
.create-row { display: flex; gap: 8px; flex-wrap: wrap; margin: -8px 0 22px; }
.bhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.bhead .page-title { margin-bottom: 6px; }
.bactions { display: flex; gap: 8px; padding-top: 10px; }
.bactions-inline { display: flex; gap: 10px; margin-top: 24px; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; align-items: start; margin-top: 4px; }
.bform .sub { color: var(--ink-2); margin: 0 0 18px; }
.bpreview { position: sticky; top: 84px; background: var(--paper-2); border-radius: 10px; padding: 14px 18px 18px; max-height: calc(100vh - 104px); overflow: auto; }
.pv-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 12px; }
#pv-pages { display: grid; gap: 16px; justify-items: center; }
.pv-page { display: block; background: #fff; box-shadow: 0 4px 18px rgba(30, 28, 25, .14); }
.section.first { border-top: 0; margin-top: 0; padding-top: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { text-align: left; padding: 12px 14px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); cursor: pointer; min-height: 60px; }
.seg button small { display: block; color: var(--ink-3); font-size: 13px; }
.seg button.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.toggle { display: flex; gap: 10px; align-items: center; min-height: 46px; cursor: pointer; font-size: 15px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
.worklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.worklist li { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 8px 8px 10px; }
.worklist li .grow, .inv-item .grow { flex: 1; min-width: 0; }
.worklist small, .inv-item small { display: block; color: var(--ink-3); font-size: 13px; }
.worklist b, .inv-item b { font: 500 16px/1.25 var(--serif); }
.worklist .btn { min-width: 40px; padding: 0 10px; }
.pthumb { width: 48px; height: 48px; flex: none; background: var(--paper-2); border-radius: 4px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pthumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pick .choice { min-height: 64px; }
.pick .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.pick .choice.on .tick { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 4px var(--card); }
a.choice { text-decoration: none; color: inherit; }
.inv-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.inv-item .price { width: 120px; flex: none; text-align: right; }
.warn { color: #9a6a12 !important; }
.note { background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; margin: 0; font-size: 14px; }
.total-line { text-align: right; font-size: 17px; padding: 14px 0 0; border-top: 1px solid var(--line); margin-top: 18px; }
.total-line b { font: 500 24px/1 var(--serif); margin-left: 10px; }
.chip { display: inline-block; font: 500 12px/1 var(--sans); padding: 5px 9px; border-radius: 99px; vertical-align: middle; background: var(--paper-2); color: var(--ink-2); }
.chip.paid { background: var(--ok-soft); color: var(--ok); }
.chip.overdue { background: var(--err-soft); color: var(--err); }
.amt { font: 500 18px/1 var(--serif); white-space: nowrap; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.kv span { color: var(--ink-3); }
.brandrow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.brandbox { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.brandbox > .muted:first-child { width: 100%; }
.bimg { width: 100%; height: 90px; background: #fff; border-radius: 6px; display: flex; align-items: center; justify-content: center; padding: 8px; }
.bimg img { max-height: 100%; max-width: 100%; object-fit: contain; }
.sigpad { width: 100%; aspect-ratio: 3 / 1; background: #fff; border: 1px dashed var(--ink-3); border-radius: 8px; touch-action: none; cursor: crosshair; }
.panel-box { max-width: 760px; }
@media (min-width: 761px) and (max-width: 1100px) {
  .builder { grid-template-columns: 1fr; }
  .bpreview { position: static; max-height: none; }
  .mainnav .btn { padding: 0 10px; }
}
@media (max-width: 760px) {
  .builder { grid-template-columns: 1fr; gap: 24px; }
  .bpreview { position: static; max-height: none; padding: 12px; margin: 0 -6px; }
  .bactions-inline { display: none; }
  .bottombar .addbtn { padding: 0 12px; font-size: 15px; }
  .bottombar .tabbtn { font-size: 10.5px; }
  .brandrow { grid-template-columns: 1fr; }
  .inv-item .price { width: 96px; }
  .seg { grid-template-columns: 1fr; }
  .create-row { margin-top: -10px; }
}
@media (max-width: 1180px) { #storage-mini { display: none; } }
@media (min-width: 761px) and (max-width: 980px) { .topbar .btn.primary.desk { padding: 0 14px; } .mainnav { margin-left: 4px; } }
.missing { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 40px; color: var(--err); font-size: 13px; text-align: center; }
.missing-box { text-align: center; max-width: 340px; display: grid; gap: 8px; justify-items: center; }
.missing-box b { font: 500 20px/1.2 var(--serif); }
.missing-box p { color: var(--ink-2); margin: 0 0 6px; font-size: 14px; }
.viewer-img { width: 100%; max-height: 62vh; object-fit: contain; background: var(--paper-2); border-radius: 8px; -webkit-touch-callout: default; user-select: auto; }
.warn-note:empty { display: none; }
.warn-note { background: var(--err-soft); color: var(--err); margin: 0 0 12px; }
.ori { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; margin-right: 8px; vertical-align: -2px; }
.ori.p { width: 11px; height: 15px; } .ori.l { width: 15px; height: 11px; vertical-align: 0; }
#name-prompt .row { align-items: center; }
/* Current section in the top menu: soft highlight, text stays dark */
.mainnav .btn.ghost.primary { background: var(--paper-2); color: var(--ink); border-color: transparent; }

/* Photo framing that works the same in Safari: the photo fills its frame's inner box and is
   scaled to fit (never cropped or stretched); the shadow follows the photo itself. */
.stage, .card .frame { position: relative; }
.stage > img, .card .frame > img {
  position: absolute; top: 28px; left: 28px; width: calc(100% - 56px); height: calc(100% - 56px);
  max-width: none; max-height: none; object-fit: contain; object-position: center;
  box-shadow: none; filter: drop-shadow(0 10px 22px rgba(30, 28, 25, .16));
}
.card .frame > img { top: 14px; left: 14px; width: calc(100% - 28px); height: calc(100% - 28px); filter: drop-shadow(0 6px 14px rgba(30, 28, 25, .14)); }
@media (max-width: 760px) {
  .stage > img { top: 14px; left: 14px; width: calc(100% - 28px); height: calc(100% - 28px); }
  .card .frame > img { top: 8px; left: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }
}

/* Navigation fit: six sections on Mac, iPad and iPhone */
.icon.flip { transform: rotate(180deg); }
.list .item .pthumb { width: 44px; height: 44px; }
@media (max-width: 1180px) {
  .mainnav { margin-left: 8px; gap: 0; }
  .mainnav .btn { padding: 0 11px; font-size: 14.5px; }
  .topbar-inner { gap: 10px; }
}
@media (min-width: 761px) and (max-width: 1060px) {
  .addworks { width: 44px; padding: 0; }
  .addworks .lbl { display: none; }
  .brand span { font-size: 19px; }
}
@media (min-width: 761px) and (max-width: 860px) {
  .mainnav .btn { padding: 0 8px; font-size: 14px; }
  .brand .mark { width: 20px; height: 20px; }
}
@media (max-width: 760px) {
  .bottombar .inner { gap: 4px; }
  .bottombar .tabbtn { min-width: 0; font-size: 10.5px; white-space: nowrap; letter-spacing: -.01em; }
  .bottombar .addbtn { flex: 1.1; min-width: 0; }
}

/* Sign-in: password, links */
.linkbtn { background: none; border: 0; padding: 6px 0; min-height: 36px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 15px; }
.linkbtn.strong { color: var(--ink); font-weight: 600; }
.pw-label { display: flex; justify-content: space-between; align-items: center; }
.pw-label .linkbtn { font-size: 13px; min-height: 0; padding: 0; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.auth-alt { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-2); }
.pw-note { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.pw-note-actions { display: flex; gap: 6px; }

/* Delete / Void */
.doc-manage { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.chip.void { background: var(--paper-2); color: var(--ink-3); text-decoration: line-through; }
.amt.voided { color: var(--ink-3); text-decoration: line-through; }
.list .item > a.grow { color: inherit; min-width: 0; }
@media (max-width: 760px) {
  .bottombar .btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 359px) {
  .bottombar .inner { gap: 3px; }
  .bottombar { padding-left: 6px; padding-right: 6px; }
  .bottombar .addbtn { padding: 0 8px; font-size: 14px; }
  .bottombar .addbtn .icon { display: none; }
  .bottombar .tabbtn { font-size: 9.5px; }
}
/* Previews never force the page wider than the screen */
.builder > * { min-width: 0; }
.pv-page { max-width: 100%; height: auto !important; }
/* Very narrow phones (e.g. original iPhone SE): stack paired fields */
input[type="date"].input { min-width: 0; }
@media (max-width: 359px) {
  .form .row, .sheet .row { flex-direction: column; align-items: stretch; }
  .form .row > *, .sheet .row > * { flex: none !important; width: 100%; }
}
@media (min-width: 360px) and (max-width: 420px) {
  .bottombar .addbtn { padding: 0 9px; gap: 5px; }
  .bottombar .addbtn .icon { width: 18px; height: 18px; }
}
