/* ==========================================================================
   Apple-inspired design system
   ========================================================================== */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #6e6e73;
  --muted-2: #86868b;
  --line: #e5e5ea;
  --line-2: #d2d2d7;
  --blue: #0071e3;
  --blue-press: #0064c8;
  --green: #34c759;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--blue); text-decoration: none; }

/* ---- Top bar ---- */
.nav {
  position: sticky; top: 0; z-index: 20;
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  background: rgba(245, 245, 247, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.nav .brand { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.nav .brand span { color: var(--muted); font-weight: 400; }
.nav .nav-link { font-size: 13px; color: var(--muted); }
.nav-auth { display: flex; align-items: center; gap: 12px; }
.nav-user { font-size: 13px; color: var(--ink); font-weight: 500; }
.btn-linky { background: none; border: none; color: var(--blue); font-family: var(--font);
  font-size: 13px; cursor: pointer; padding: 0; }
.btn-pill-sm { font-size: 13px !important; padding: 7px 16px !important; }

/* ---- Progress steps ---- */
.steps {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 22px 16px 4px;
}
.steps .dot {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted-2);
}
.steps .num {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--line); color: var(--muted); font-size: 12px; font-weight: 600;
  transition: all 0.3s ease;
}
.steps .dot.active .num { background: var(--blue); color: #fff; }
.steps .dot.done .num { background: var(--green); color: #fff; }
.steps .dot.active { color: var(--ink); }
.steps .bar { width: 26px; height: 2px; background: var(--line); border-radius: 2px; }

/* ---- Layout ---- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 22px 80px; }
.narrow { max-width: 560px; }
.center { text-align: center; }

.screen { display: none; animation: fade 0.4s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1.hero {
  font-size: clamp(32px, 5vw, 48px); font-weight: 600;
  letter-spacing: -0.02em; margin: 40px 0 10px;
}
.sub { font-size: 19px; color: var(--muted); margin: 0 auto 32px; max-width: 42ch; }

.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
}
/* Stacked cards (the admin panels) must not touch. Scoped to adjacent
   siblings so single-card layouts are unaffected. */
.card + .card { margin-top: 16px; }
#panel > .card:first-child { margin-top: 4px; }

/* ---- Inputs ---- */
.field { margin-bottom: 16px; text-align: left; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="url"], input[type="search"], textarea, select {
  width: 100%; font-family: var(--font); font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 13px 15px; outline: none; transition: border 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}
.mls-input { font-size: 22px !important; letter-spacing: 0.08em; text-align: center; padding: 18px !important; }

/* ---- Buttons ---- */
.btn {
  appearance: none; border: none; cursor: pointer; font-family: var(--font);
  font-size: 17px; font-weight: 500; border-radius: 980px;
  padding: 13px 26px; transition: transform 0.06s ease, background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-press); }
.btn-primary:disabled { background: var(--line-2); color: #fff; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--blue); }
.btn-secondary { background: #e8e8ed; color: var(--ink); }
.btn-block { width: 100%; }
.btn-lg { font-size: 18px; padding: 15px 30px; }

/* ---- Listing header ---- */
.listing-head {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 24px; margin-bottom: 22px;
}
.listing-head .addr { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.listing-head .meta { color: var(--muted); font-size: 14px; margin-top: 3px; }
.pill { display: inline-block; background: #f0f0f2; color: var(--ink-2); font-size: 12px;
  padding: 4px 10px; border-radius: 980px; margin-right: 6px; }

/* ---- Photo grid ---- */
.gallery-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.gallery-toolbar .count { font-size: 15px; color: var(--muted); }
.gallery-toolbar .count b { color: var(--ink); }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.photo {
  position: relative; aspect-ratio: 3 / 2; border-radius: 14px; overflow: hidden;
  cursor: pointer; background: #eee; border: 3px solid transparent;
  transition: transform 0.12s ease, border-color 0.15s ease;
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo:hover { transform: translateY(-2px); }
.photo .check {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(4px);
  border: 1.5px solid rgba(255,255,255,0.9);
  display: grid; place-items: center; color: transparent; font-size: 15px; font-weight: 700;
  transition: all 0.15s ease;
}
.photo.selected { border-color: var(--blue); }
.photo.selected .check { background: var(--blue); color: #fff; border-color: var(--blue); }
.photo.disabled { opacity: 0.4; cursor: not-allowed; }
.photo .num-badge {
  position: absolute; bottom: 8px; left: 8px; background: var(--blue); color: #fff;
  font-size: 12px; font-weight: 600; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 980px; display: none; place-items: center;
}
.photo.selected .num-badge { display: grid; }

/* ---- Order summary (sticky sidebar) ---- */
.layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }
.summary { position: sticky; top: 70px; }
.summary h3 { margin: 0 0 4px; font-size: 19px; }
.summary .hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.addon-wrap { border-top: 1px solid var(--line); }
.addon-wrap:first-child { border-top: none; }
.addon { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; }
.addon .name { font-size: 15px; }
.addon .price { color: var(--muted); font-size: 14px; }
/* Add-on image upload */
.upload-field { padding: 0 0 12px; }
.upload-btn { display: block; cursor: pointer; }
.upload-cta { display: inline-block; font-size: 13px; color: var(--blue); background: #f0f7ff;
  border: 1px dashed var(--blue); border-radius: 10px; padding: 9px 12px; width: 100%; text-align: center; }
.upload-btn:hover .upload-cta { background: #e3f0ff; }
.upload-name { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.upload-err { min-height: 0; }
.upload-err:not(:empty) { margin-top: 6px; }
/* iOS-style toggle */
.switch { position: relative; width: 48px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line-2); border-radius: 980px; transition: 0.25s; }
.switch .track::before { content: ""; position: absolute; height: 26px; width: 26px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: 0.25s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::before { transform: translateX(18px); }

.turnaround-note { display: flex; align-items: center; gap: 8px; margin-top: 14px;
  background: #f0f7ff; color: var(--ink-2); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 14px; }
.turnaround-note b { color: var(--blue); }
.turnaround-note .tt-icon { font-size: 16px; }
.turnaround-note:empty { display: none; }

.totals { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.totals .row { display: flex; justify-content: space-between; font-size: 15px; color: var(--ink-2); padding: 5px 0; }
.totals .row.total { font-size: 20px; font-weight: 600; color: var(--ink); padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--line); }

/* ---- Checkout ---- */
.check-row { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0; font-size: 14px; color: var(--ink-2); }
.check-row input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
#card-element { padding: 14px 15px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; }
.sim-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.badge-secure { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

/* ---- Success / screen 4 ---- */
.success-check {
  width: 72px; height: 72px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 38px; margin: 12px auto 18px;
  animation: pop 0.5s cubic-bezier(0.18, 0.9, 0.3, 1.3);
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.wait-box { background: #f0f7ff; border-radius: var(--radius); padding: 22px; margin: 22px 0; }
.wait-box .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.wait-box .value { color: var(--blue); font-size: 28px; font-weight: 600; margin-top: 4px; }
.detail-list { text-align: left; margin-top: 10px; }
.detail-list .row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.detail-list .row .k { color: var(--muted); }

/* ---- Misc ---- */
.error { color: #d70015; font-size: 14px; margin-top: 8px; min-height: 18px; }
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; vertical-align: -4px; }
.spinner.dark { border-color: rgba(0,0,0,0.15); border-top-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { background: #fff8e6; border: 1px solid #ffe8a3; color: #7a5b00; border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.skeleton { background: linear-gradient(90deg, #eee 25%, #f5f5f7 37%, #eee 63%); background-size: 400% 100%;
  animation: sk 1.2s ease infinite; border-radius: 14px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.hidden { display: none !important; }

/* ==========================================================================
   Walkthrough AI additions (v2) - new components in the original style
   ========================================================================== */
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Source tabs (upload vs MLS) */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 980px; background: #e8e8ed; color: var(--ink);
  cursor: pointer; font-size: 14px; font-weight: 500; }
.tab.active { background: var(--blue); color: #fff; }

/* iOS-style segmented control (auth Log in / Sign up) */
.segmented { display: flex; background: #e8e8ed; border-radius: var(--radius-sm);
  padding: 3px; margin-bottom: 20px; }
.segmented .tab { flex: 1; text-align: center; padding: 8px 14px; border-radius: 9px;
  background: transparent; color: var(--ink); font-size: 15px; font-weight: 500;
  cursor: pointer; transition: background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  -webkit-user-select: none; user-select: none; }
.segmented .tab.active { background: #fff; color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04); }

/* Fixed Photographer Login button (home screen, bottom right) */
.photog-fab { position: fixed; right: 22px; bottom: 22px; z-index: 30;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
  border-radius: 980px; padding: 11px 18px; font-size: 14px; font-weight: 500;
  transition: box-shadow 0.2s ease, transform 0.06s ease; }
.photog-fab:hover { box-shadow: var(--shadow-lg); }
.photog-fab:active { transform: scale(0.98); }
@media (max-width: 560px) { .photog-fab { right: 14px; bottom: 14px; padding: 10px 15px; } }

/* Upload dropzone */
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius);
  padding: 34px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border 0.15s, background 0.15s; }
.dropzone:hover { border-color: var(--blue); }
.dropzone.drag { border-color: var(--blue); background: #f0f7ff; }

/* Video player */
.video-wrap video { width: 100%; border-radius: var(--radius); background: #000; display: block; }

/* Status badges (dashboard + admin) */
.badge { display: inline-block; padding: 4px 11px; border-radius: 980px; font-size: 12px; font-weight: 600; }
.badge.gray { background: #e8e8ed; color: var(--muted); }
.badge.blue { background: #e6f0fb; color: var(--blue); }
.badge.green { background: #e3f7ea; color: #248a3d; }
.badge.amber { background: #fff4e0; color: #7a5b00; }
.badge.red { background: #fdecea; color: #d70015; }

/* Notice variants (base .notice is amber) */
.notice.info { background: #eef5ff; border-color: #cfe0fb; color: var(--blue); }
.notice.warn { background: #fff8e6; border-color: #ffe8a3; color: #7a5b00; }
.notice.err { background: #fdecea; border-color: #f5c6c2; color: #d70015; }

/* Big centered loading spinner */
.spinner.big { width: 40px; height: 40px; border-width: 4px; display: block; margin: 24px auto;
  border-color: rgba(0,0,0,0.12); border-top-color: var(--blue); }

/* Buttons for QA actions */
.btn-ok { background: #e3f7ea; color: #248a3d; }
.btn-danger { background: #fdecea; color: #d70015; }

/* Admin data tables + KPIs */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 12px 0; }
.kpi .box { background: var(--bg); border-radius: var(--radius-sm); padding: 14px; }
.kpi .box .n { font-size: 22px; font-weight: 600; }
.kpi .box .l { color: var(--muted); font-size: 13px; }
.addon-edit { display: flex; gap: 10px; align-items: center; padding: 8px 0; flex-wrap: wrap; border-top: 1px solid var(--line); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
