/* Iris Capture — dark, premium salon look with gold accent + per-brand/category colours */
:root {
  --bg: #0e0e10;
  --bg-2: #141417;
  --surface: #1b1b1f;
  --surface-2: #232328;
  --line: rgba(255,255,255,.08);
  --line-2: rgba(255,255,255,.16);
  --ink: #f4f2ee;
  --ink-2: #b9b6ae;
  --ink-3: #7d7a74;
  --gold: #d4af5a;
  --gold-2: #f0cf7e;
  --gold-ink: #1a1405;
  --ok: #4ccf8a;
  --err: #ff6b5c;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --tap: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(900px 500px at 50% -200px, rgba(212,175,90,.14), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
::selection { background: rgba(212,175,90,.35); }

main, .stepper, .topbar { max-width: 520px; margin-inline: auto; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 10px;
}
.topbar-title { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; flex: none; position: relative;
  background: linear-gradient(145deg, #2a2a30, #121215);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 6px 16px rgba(0,0,0,.4);
}
.logo::before {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  border: 2.5px solid var(--gold);
}
.logo > span {
  position: absolute; left: 50%; top: 50%; width: 9px; height: 9px;
  transform: translate(-50%, -50%); border-radius: 50%; background: var(--gold-2);
  box-shadow: 0 0 10px rgba(240,207,126,.9);
}
.app-name { font-weight: 800; letter-spacing: -.01em; line-height: 1.1; font-size: 17px; }
.app-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.storage-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2);
  background: var(--surface);
}
.storage-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.storage-pill.azure { color: #7cc4ff; border-color: rgba(124,196,255,.35); background: rgba(124,196,255,.08); }
.storage-pill.local { color: #ffc65c; border-color: rgba(255,198,92,.35); background: rgba(255,198,92,.08); }

/* ---------- Stepper ---------- */
.stepper { display: flex; align-items: center; gap: 6px; padding: 6px 18px 14px; }
.step {
  display: flex; align-items: center; gap: 8px; background: none; border: 0;
  padding: 6px 4px; border-radius: 8px; color: var(--ink-3); cursor: pointer;
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; border: 1.5px solid var(--line-2); background: var(--surface);
  transition: background .2s, border-color .2s, color .2s;
}
.step-label { font-size: 13px; font-weight: 700; }
.step.active { color: var(--ink); }
.step.active .step-num { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212,175,90,.18); }
.step.done { color: var(--ink-2); }
.step.done .step-num { background: var(--ok); color: #08301b; border-color: var(--ok); }
.step:disabled { cursor: default; }
.step-sep { flex: 1; height: 1.5px; background: var(--line-2); border-radius: 2px; }

/* ---------- Screens ---------- */
main { padding: 0 18px; }
.screen { animation: rise .25s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.screen-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 4px; }
.screen-hint { margin: 0 0 18px; color: var(--ink-3); font-size: 14px; }

/* ---------- Brand grid ---------- */
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.brand-card {
  --c: var(--gold);
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 136px; border-radius: var(--radius); cursor: pointer;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  padding: 16px; text-align: left;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.brand-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--c);
}
.brand-glow {
  position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: var(--c); opacity: .18; filter: blur(30px); z-index: -1;
  transition: opacity .2s;
}
.brand-card:active { transform: scale(.96); border-color: var(--c); }
.brand-card:active .brand-glow { opacity: .35; }
.brand-code { font-size: 32px; font-weight: 900; letter-spacing: -.04em; line-height: 1; color: var(--c); }
.brand-name { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.brand-dot {
  position: absolute; right: 14px; bottom: 14px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 12px var(--c);
}

/* ---------- Category list ---------- */
.category-list { display: flex; flex-direction: column; gap: 10px; }
.category-card {
  --c: #a3a3a8;
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 76px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  cursor: pointer; text-align: left;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.category-card:active { transform: scale(.98); border-color: var(--c); background: var(--surface-2); }
.category-icon {
  width: 48px; height: 48px; border-radius: 14px; flex: none; color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  display: grid; place-items: center;
}
.category-text { flex: 1; min-width: 0; }
.category-name { font-weight: 800; font-size: 16px; }
.category-hint { font-size: 13px; color: var(--ink-3); }
.category-arrow { color: var(--ink-3); flex: none; }

/* ---------- Context chips ---------- */
.context-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.context-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px 7px 10px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 14px;
}
.context-row .context-chip { margin-bottom: 0; }
.context-chip:empty { display: none; }
.context-chip b { color: var(--ink); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
.chip-tag { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 800; }
.context-chip button {
  border: 0; background: none; padding: 0 2px; margin-left: 2px; color: var(--gold); font-size: 12px; font-weight: 700;
  cursor: pointer;
}

/* ---------- Field ---------- */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field-label em { font-style: normal; color: var(--ink-3); font-weight: 500; }
.field input {
  width: 100%; height: 50px; padding: 0 14px; border-radius: var(--radius-sm); font: inherit;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,90,.18); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 20px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 800; cursor: pointer; width: 100%; letter-spacing: -.01em;
  transition: transform .12s ease, opacity .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.98); filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink);
  box-shadow: 0 8px 24px rgba(212,175,90,.28), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-xl { min-height: 66px; font-size: 18px; }

/* ---------- Capture box ---------- */
.capture-box {
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px 16px; border-radius: var(--radius);
  border: 1.5px dashed var(--line-2);
  background:
    radial-gradient(300px 120px at 50% 0%, rgba(212,175,90,.10), transparent 70%),
    rgba(255,255,255,.02);
}

/* ---------- Preview ---------- */
.preview-frame {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: #000; box-shadow: var(--shadow); border: 1px solid var(--line-2);
}
.preview-frame img { width: 100%; max-height: 60dvh; object-fit: contain; }
.preview-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; font-size: 12px; font-weight: 600;
}
.preview-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 12px; }

/* ---------- Upload state ---------- */
.upload-state { padding: 18px 0 0; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.progress-bar {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width .2s ease, background .3s ease;
}
.progress-bar.ok { background: var(--ok); }
.progress-bar.err { background: var(--err); }
.status-text { margin: 12px 0 18px; font-weight: 700; color: var(--ink-2); }
.status-text.ok { color: var(--ok); }
.status-text.err { color: var(--err); }
.done-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Session log ---------- */
.session { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.session-head { display: flex; align-items: baseline; justify-content: space-between; }
.session-head h2 { font-size: 15px; margin: 0 0 10px; font-weight: 800; }
.session-count { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.session-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.session-item {
  --c: #a3a3a8;
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-left: 3px solid var(--c);
}
.session-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; background: #2a2a2e; }
.session-text { flex: 1; min-width: 0; }
.session-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-status { font-size: 12px; font-weight: 800; flex: none; }
.session-status.ok { color: var(--ok); }
.session-status.err { color: var(--err); }
.session-status.pending { color: var(--gold); }
.session-retry {
  border: 1px solid rgba(255,107,92,.4); background: rgba(255,107,92,.12); color: var(--err);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 800; cursor: pointer;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 50;
}
.toast.err { background: var(--err); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .btn, .brand-card, .category-card, .brand-glow { transition: none; }
}
