/* GoToCreatives brand: near-black, sky-blue accent, Bricolage / Fraunces / Manrope */
:root {
  --bg: #0A0A0A;
  --surface: rgba(255,255,255,0.04);
  --surface-2: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);
  --text: #F4F4F5;
  --text-2: rgba(212,212,216,0.9);
  --text-3: #71717A;
  --accent: #38BDF8;
  --accent-hover: #7DD3FC;
  --on-accent: #000;
  --danger: #F87171;
  --warn: #FBBF24;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --font-display: 'Bricolage Grotesque', 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-serif: 'Fraunces', 'Playfair Display', Georgia, serif;
  --font-body: 'Manrope', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.5; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
img { max-width: 100%; }
.hidden { display: none !important; }
em, .acc { font-family: var(--font-serif); font-style: italic; font-weight: 500; color: var(--accent); }

/* header */
.header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(12px + var(--safe-t)) 16px 12px; background: rgba(10,10,10,.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 14px rgba(56,189,248,.55); }
.brand b { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -.02em; display: block; line-height: 1.1; }
.brand small { color: var(--text-3); font-size: 12px; display: block; }
.spacer { flex: 1; }
.who { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

/* nav: bottom bar on phones, top tabs on larger screens */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: rgba(10,10,10,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding-bottom: var(--safe-b); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--nav-h); font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--text-3); text-decoration: none; }
.tabs a.active { color: var(--accent); }
.tabs svg { width: 22px; height: 22px; }
main { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
@media (min-width: 768px) {
  .tabs { position: static; justify-content: center; border-top: 0; border-bottom: 1px solid var(--border); background: transparent; backdrop-filter: none; padding: 0; }
  .tabs a { flex: none; flex-direction: row; gap: 8px; padding: 14px 20px; min-height: 0; font-size: 14px; border-bottom: 2px solid transparent; }
  .tabs a.active { border-bottom-color: var(--accent); }
  .tabs svg { width: 17px; height: 17px; }
  main { padding: 28px 24px 48px; }
}

/* type */
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin: 4px 0 6px; }
h1 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-size: clamp(30px, 8vw, 44px); margin: 0 0 14px; }
h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: 19px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }

.card { background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01)); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 22px; border-radius: 12px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 15px; cursor: pointer; text-decoration: none; touch-action: manipulation; transition: background .15s, transform .05s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: scale(.98); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover { background: rgba(56,189,248,.10); }
.btn.plain { background: var(--surface); border-color: var(--border-strong); color: var(--text); font-weight: 700; }
.btn.plain:hover { background: var(--surface-2); }
.btn.danger { background: transparent; border-color: rgba(248,113,113,.5); color: var(--danger); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; color: var(--text); font-size: 16px; flex: none; }
.iconbtn:hover { background: var(--surface-2); }

:focus-visible { outline: 3px solid rgba(56,189,248,.55); outline-offset: 2px; }

/* forms */
label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
input, select, textarea { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: rgba(255,255,255,.05); color: var(--text); font-size: 16px; /* 16px stops iOS zooming on focus */ }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.2); }
select option { background: #18181b; color: var(--text); }
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; max-width: 100%; text-align: left; line-height: 1.3; }
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; min-height: 1.3em; }
input[type=date]::-webkit-datetime-edit, input[type=time]::-webkit-datetime-edit { padding: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid > * { min-width: 0; }
.grid .full { grid-column: 1 / -1; }
.field { min-width: 0; }
.field.flag input, .field.flag select { border-color: rgba(251,191,36,.7); background: rgba(251,191,36,.08); }
.field .hint { font-size: 12px; color: var(--warn); margin-top: 4px; display: none; }
.field.flag .hint { display: block; }
.error { color: var(--danger); font-size: 14px; margin: 10px 0 0; min-height: 20px; }
.notice { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.35); color: #FDE68A; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }

/* login */
.login { max-width: 400px; margin: 0 auto; padding: calc(8vh + var(--safe-t)) 16px 32px; }
.login .card { padding: 22px; }

/* camera */
.camera { position: relative; background: #000; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 4; max-height: calc(100dvh - 330px); min-height: 280px; width: 100%; margin: 0 auto 14px; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera .guide { position: absolute; inset: 7% 9%; border: 2px dashed rgba(255,255,255,.7); border-radius: 10px; pointer-events: none; }
.camera .msg { position: absolute; left: 10px; right: 10px; bottom: 10px; text-align: center; color: #fff; font-size: 13px; font-weight: 600; text-shadow: 0 1px 4px #000; }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; max-width: 460px; margin: 0 auto; }
.controls > :first-child { justify-self: start; }
.controls > :last-child { justify-self: end; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid var(--accent); background: #fff; box-shadow: inset 0 0 0 5px #0A0A0A; cursor: pointer; padding: 0; touch-action: manipulation; }
.shutter:active { background: var(--accent); }
.queue { text-align: center; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }

/* adjust */
.stage { position: relative; display: block; width: fit-content; max-width: 100%; margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--border); }
.stage img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 380px); min-height: 220px; }
.stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.handle { fill: var(--accent); fill-opacity: .55; stroke: #fff; stroke-width: 3; cursor: grab; }
.hit { fill: transparent; cursor: grab; }
.poly { fill: rgba(56,189,248,.14); stroke: var(--accent); stroke-width: 3; }

/* paper preview: scans stay white, like real paper */
.paper { background: #fff; border-radius: 12px; padding: 8px; margin-bottom: 14px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.paper img { display: block; margin: 0 auto; max-width: 100%; max-height: 62dvh; height: auto; width: auto; cursor: zoom-in; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 14px; font-weight: 700; cursor: pointer; color: var(--text-2); }
.chip.on { border-color: var(--accent); color: #000; background: var(--accent); }
.progress { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* photo parts */
.parts { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.part { flex: none; width: 92px; text-align: center; }
.part .pic { height: 120px; border-radius: 10px; background: #fff center top / cover no-repeat; border: 1px solid var(--border-strong); }
.part .btns { display: flex; justify-content: space-between; margin-top: 6px; gap: 4px; }
.part .btns button { flex: 1; min-height: 36px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; font-size: 14px; }
.part .btns button[disabled] { opacity: .3; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-weight: 700; font-size: 13px; cursor: pointer; padding: 6px 8px; }
.seg button.on { background: var(--accent); color: #000; }

/* sticky action bar sits above the phone nav */
.actionbar { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 10; display: flex; gap: 10px; padding: 10px; margin: 16px -4px 0; background: rgba(10,10,10,.92); border: 1px solid var(--border); border-radius: 16px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.actionbar .btn { flex: 1; }
@media (min-width: 768px) { .actionbar { bottom: 12px; } }

/* line items */
.items .head, .items .item { display: grid; grid-template-columns: minmax(0, 1fr) 64px 92px 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.items .head { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); font-weight: 700; margin-bottom: 4px; }
.items .item input { min-height: 44px; padding: 8px 10px; font-size: 15px; }
@media (max-width: 480px) {
  .items .head { display: none; }
  .items .item { grid-template-columns: minmax(0, 1fr) 84px 44px; grid-template-areas: "d d d" "q t x"; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .items .i_d { grid-area: d; } .items .i_q { grid-area: q; } .items .i_t { grid-area: t; } .items .item .iconbtn { grid-area: x; }
  .items .i_q { width: 100%; }
}

/* library */
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.filters .full { grid-column: 1 / -1; }
.list { display: flex; flex-direction: column; gap: 10px; }
.rc { display: flex; gap: 12px; background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01)); border: 1px solid var(--border); border-radius: 14px; padding: 10px; text-decoration: none; color: var(--text); align-items: center; min-height: 92px; }
.rc:active { background: var(--surface-2); }
.rc .th { width: 56px; height: 74px; border-radius: 8px; background: #fff center top / cover no-repeat; flex: none; border: 1px solid var(--border-strong); }
.rc .mid { flex: 1; min-width: 0; }
.rc .mid b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rc .amt { font-weight: 800; white-space: nowrap; font-family: var(--font-display); font-size: 17px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); margin-right: 6px; }
.tag.review { background: rgba(251,191,36,.12); color: var(--warn); border: 1px solid rgba(251,191,36,.35); }
.empty { text-align: center; padding: 48px 16px; color: var(--text-3); }

/* viewer + sheet */
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 60; overflow: auto; padding: calc(64px + var(--safe-t)) 8px 32px; text-align: center; -webkit-overflow-scrolling: touch; }
.viewer img { background: #fff; display: block; margin: 0 auto; width: 100%; transition: width .15s; }
.viewer .bar { position: fixed; top: calc(8px + var(--safe-t)); left: 8px; right: 8px; display: flex; gap: 8px; justify-content: flex-end; z-index: 61; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; background: #141416; border: 1px solid var(--border-strong); border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + var(--safe-b)); }
@media (min-width: 640px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.sheet h2 { margin-bottom: 4px; }
.sheet .btn { width: 100%; margin-top: 8px; }

.urow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.urow .mid { flex: 1; min-width: 0; }
.urow .mid b, .urow .mid span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 90px); transform: translateX(-50%); background: #F4F4F5; color: #000; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; z-index: 90; max-width: 90vw; text-align: center; }

@media (max-width: 380px) { .grid { grid-template-columns: minmax(0, 1fr); } .brand small { display: none; } .who { display: none; } }
@media (min-width: 640px) { .camera { aspect-ratio: 4 / 3; max-height: 70dvh; } }
@media print { .header, .tabs, .btn, .controls, .actionbar { display: none !important; } body { background: #fff; color: #000; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- full-screen camera ---------- */
.camx { position: fixed; inset: 0; z-index: 300; background: #000; color: #fff; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.camx .spacer { flex: 1; }
.camx-top { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px; flex: none; }
.camx-ic { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; touch-action: manipulation; }
.camx-ic.on { background: var(--accent); color: #000; }
.camx-ic.big { width: 56px; height: 56px; }
.camx-view { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #000; border: 2px solid rgba(56,189,248,.75); }
.camx-view video { width: 100%; height: 100%; object-fit: contain; transform-origin: center; }
.camx-msg { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 7px 14px; border-radius: 999px; background: rgba(0,0,0,.6); font-size: 13px; font-weight: 600; text-align: center; pointer-events: none; }
.camx-zoom { position: absolute; left: 0; right: 0; bottom: 70px; display: flex; justify-content: center; gap: 8px; }
.camx-zoom button { min-width: 46px; height: 46px; border-radius: 23px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.55); color: #fff; font: 800 14px var(--font-body); cursor: pointer; touch-action: manipulation; }
.camx-zoom button.on { background: var(--accent); border-color: var(--accent); color: #000; }
.camx-seg { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; padding: 4px; border-radius: 999px; background: rgba(50,50,52,.88); }
.camx-seg button { border: 0; background: transparent; color: #fff; font: 700 16px var(--font-body); padding: 10px 24px; border-radius: 999px; cursor: pointer; touch-action: manipulation; }
.camx-seg button.on { background: rgba(255,255,255,.28); }
.camx-modes { display: flex; justify-content: center; gap: 34px; padding: 10px 0 2px; flex: none; }
.camx-modes button { position: relative; border: 0; background: transparent; color: #d4d4d8; font: 700 17px var(--font-body); padding: 8px 4px; cursor: pointer; touch-action: manipulation; }
.camx-modes button.on { color: var(--accent); }
.camx-modes button.on::after { content: ''; position: absolute; left: 20%; right: 20%; bottom: 0; height: 3px; border-radius: 2px; background: var(--accent); }
.camx-bar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 22px calc(14px + var(--safe-b)); }
.camx-side { display: flex; justify-content: flex-end; }
.camx-done { border: 0; border-radius: 999px; background: var(--accent); color: #000; font: 800 15px var(--font-body); padding: 12px 18px; min-height: 44px; cursor: pointer; }
.camx.flash .camx-view::after { content: ''; position: absolute; inset: 0; background: #fff; opacity: .75; animation: camflash .16s ease-out forwards; pointer-events: none; }
@keyframes camflash { to { opacity: 0; } }
.camx .hidden { display: none; }
