/* ─────────────────────────────────────────────────────────────────
   ACCOUNT APPLICATION FORM

   Tokens, fonts and motion are taken verbatim from
   design-brief-customer-application.md and the "Desktop"/"Main"
   artboards. Do not substitute values here — the brief is explicit
   that this look was arrived at by elimination, and the warm
   cream/wine-cellar version was tried and rejected.

   One page, one stylesheet. The 700px breakpoint is a real media
   query: resizing a browser window switches between the desktop
   split-panel layout and the full-bleed mobile one, live.
   ───────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

* { box-sizing: border-box; }

:root {
  --bg: #FFFFFF;
  --ink: #141414;
  --muted: #6E6E6E;
  --hair: #E6E6E6;
  --track: #EAEAEA;
  --field-bg: #FFFFFF;
  --field-border: #D9D9D9;
  /* Vinify's burnt orange by default. app.js overrides both of these
     for Secco, to its own brand red — see applyBrandStyle() there.
     Kept as two variables rather than one: the focus ring and button
     shadow need the colour's r,g,b components on their own for
     rgba(), which CSS cannot derive from a hex custom property. */
  --accent: #C1622B;
  --accent-rgb: 193, 98, 43;
  /* The left brand panel and the thin bar on it. Vinify's panel is
     black with an orange bar; Secco's panel IS its brand red, so the
     bar has to flip to white there or it disappears into its own
     background — see applyBrandStyle(). */
  --panel-bg: #111111;
  --panel-bar: var(--accent);
}

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

input, select, textarea, button { font-family: 'DM Sans', system-ui, sans-serif; }
::placeholder { color: var(--muted); }

/* ── layout ────────────────────────────────────────────────────── */

.shell { display: flex; flex-direction: row; min-height: 100vh; }

.brand-panel {
  flex: 0 0 560px;
  /* Vinify's black by default; app.js overrides this per brand — see
     applyBrandStyle() there. */
  background: var(--panel-bg, #111111);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 64px;
  color: #fff;
}
.brand-panel::before {
  content: ''; position: absolute; width: 480px; height: 480px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.14); top: -140px; right: -160px;
}
.brand-panel::after {
  content: ''; position: absolute; width: 320px; height: 320px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.1); bottom: -120px; left: -100px;
}
.brand-word {
  font-weight: 700; font-size: 44px; letter-spacing: -.02em;
  margin-bottom: 16px; position: relative; z-index: 1;
}
.brand-accent-bar {
  width: 46px; height: 4px;
  /* Vinify's accent on its black panel; Secco's panel IS the accent
     colour, so its bar would vanish against itself — app.js sets this
     to white there instead. */
  background: var(--panel-bar, var(--accent));
  border-radius: 2px;
  margin: 0 0 22px; position: relative; z-index: 1;
}
.brand-tag {
  font-size: 15px; line-height: 1.5; color: rgba(255,255,255,.72);
  max-width: 320px; position: relative; z-index: 1;
}

.form-side {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px; background: var(--bg); min-width: 0;
}
.form-card {
  background: var(--bg); border-radius: 22px;
  box-shadow: 0 30px 60px -20px rgba(23,19,15,.25);
  overflow: hidden; border: 1px solid var(--hair);
  width: 460px; max-width: 100%; height: 756px; max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
}

.card-top { padding: 22px 24px 0; flex-shrink: 0; }
.card-top-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.wordmark { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.step-count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.progress { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 2px; background: var(--accent); width: 0;
  transition: width .45s cubic-bezier(.65,0,.35,1);
}

.content { flex: 1; overflow-y: auto; padding: 22px 24px 16px; }
.content::-webkit-scrollbar { width: 0; background: transparent; }

.card-foot { padding: 0 24px 22px; flex-shrink: 0; }

/* ── the step itself ───────────────────────────────────────────── */

@keyframes stepIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: none; }
}
.step-panel { animation: stepIn .38s cubic-bezier(.2,.8,.2,1); }

.section-title { font-weight: 700; font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
.section-sub { font-size: 13px; color: var(--muted); margin: 0 0 22px; line-height: 1.4; }

/* ── fields ────────────────────────────────────────────────────── */

.field-label {
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  margin-bottom: 7px; display: block; letter-spacing: .01em;
}
.field-input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--field-border); background: var(--field-bg);
  /* 16px, not 14.5px, and this is not a taste decision: iOS Safari
     zooms the whole page in whenever a focused input is smaller than
     16px, and does not zoom back out. That was the form "constantly
     zooming in a little" and needing to be scrolled around. */
  font-size: 16px; color: var(--ink); outline: none; appearance: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .15); }
.field-input.invalid { border-color: #C0392B; }

select.field-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236E6E6E' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px;
}
textarea.field-input { resize: none; min-height: 72px; }

.field-group { margin-bottom: 18px; }
.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; min-width: 0; }
.field-error { font-size: 12px; color: #C0392B; margin-top: 6px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }

/* ── pills, for every choice ───────────────────────────────────── */

.pill {
  padding: 11px 16px; border-radius: 999px; border: 1.5px solid var(--field-border);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: all .16s ease;
  /* Comfortably tappable. A pill that needs aiming at is a pill that
     gets pressed twice. */
  min-height: 42px;
  -webkit-tap-highlight-color: transparent;
}
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill:active { transform: scale(.95); }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── toggles ───────────────────────────────────────────────────── */

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.toggle-label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.toggle-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.toggle {
  width: 42px; height: 25px; border-radius: 999px; background: var(--track);
  position: relative; cursor: pointer; border: none; padding: 0; flex-shrink: 0;
  transition: background .18s ease;
}
.toggle.active { background: var(--accent); }
.toggle .knob {
  position: absolute; top: 2.5px; left: 2.5px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .18s cubic-bezier(.5,0,.2,1);
}
.toggle.active .knob { transform: translateX(17px); }

/* ── buttons ───────────────────────────────────────────────────── */

.btn-primary {
  width: 100%; padding: 15px; border-radius: 14px; border: none;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14.5px;
  cursor: pointer; box-shadow: 0 10px 22px -10px rgba(var(--accent-rgb), .45);
  transition: transform .14s ease, box-shadow .14s ease, opacity .18s ease;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-primary[disabled] { opacity: .35; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-ghost {
  width: 100%; padding: 13px; border-radius: 14px;
  border: 1.5px solid var(--field-border); background: transparent;
  color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer;
  margin-top: 10px; transition: border-color .16s ease;
}
.btn-ghost:hover { border-color: var(--muted); }

.btn-back {
  background: none; border: none; color: var(--muted); font-size: 12.5px;
  font-weight: 600; cursor: pointer; display: flex; align-items: center;
  gap: 4px; padding: 0 0 16px;
}
.btn-back:hover { color: var(--ink); }

.btn-add {
  background: none; border: 1.5px dashed var(--field-border); border-radius: 12px;
  padding: 11px; width: 100%; color: var(--muted); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: border-color .16s ease, color .16s ease;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent); }

/* ── repeating cards ───────────────────────────────────────────── */

.rep-card {
  background: #fff; border: 1.5px solid var(--hair); border-radius: 14px;
  padding: 14px; margin-bottom: 10px; position: relative;
}
.rep-remove {
  position: absolute; top: 10px; right: 10px; background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px; line-height: 1;
}
.rep-remove:hover { color: var(--accent); }

.divider { height: 1px; background: var(--hair); margin: 22px 0; }

/* ── terms box ─────────────────────────────────────────────────── */

.terms-box {
  height: 300px; overflow-y: auto; border: 1.5px solid var(--field-border);
  border-radius: 14px; padding: 16px; font-size: 13px; line-height: 1.6;
  color: var(--ink); background: #FCFCFC;
}
.terms-box h4 { font-size: 13.5px; margin: 16px 0 6px; }
.terms-box h4:first-child { margin-top: 0; }
.terms-box p { margin: 0 0 10px; }
.terms-box ul { margin: 0 0 12px; padding-left: 20px; }
.terms-box li { margin-bottom: 9px; }
.terms-box li::marker { color: var(--accent); }

/* ── signature ─────────────────────────────────────────────────── */

.sig-pad {
  width: 100%; height: 150px; border: 1.5px solid var(--field-border);
  border-radius: 14px; background: #fff; touch-action: none; display: block;
  cursor: crosshair;
}
.sig-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.sig-clear {
  background: none; border: none; color: var(--muted); font-size: 12.5px;
  font-weight: 600; cursor: pointer; padding: 0;
}
.sig-clear:hover { color: var(--accent); }

/* ── address suggestions ───────────────────────────────────────── */

.suggest-wrap { position: relative; }
.suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: #fff; border: 1.5px solid var(--hair); border-radius: 12px;
  box-shadow: 0 10px 30px -12px rgba(23,19,15,.25); overflow: hidden;
}
.suggest button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 11px 14px; font-size: 13.5px; color: var(--ink); cursor: pointer;
}
.suggest button:hover { background: #F7F4F2; }
.suggest-note {
  padding: 9px 14px; font-size: 11.5px; color: var(--muted);
  border-top: 1px solid var(--hair);
}
.suggest-note:first-child { border-top: none; }

/* ── the success screen ────────────────────────────────────────── */

@keyframes popIn { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.check-circle {
  width: 84px; height: 84px; border-radius: 50%; background: #EAF7EC;
  display: flex; align-items: center; justify-content: center;
  margin: 8px auto 22px; animation: popIn .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.check-path { stroke-dasharray: 44; stroke-dashoffset: 44; animation: draw .5s .18s ease forwards; }

.contact-card {
  border: 1.5px solid var(--hair); border-radius: 14px; margin-bottom: 10px;
  background: #fff; overflow: hidden;
}
.contact-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer; width: 100%; background: none;
  border: none; text-align: left;
}
.contact-card-role {
  font-size: 10.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; margin-bottom: 2px;
}
.contact-card-name { font-size: 14px; font-weight: 700; }
.contact-card-chevron { color: var(--muted); font-size: 13px; transition: transform .2s ease; }
.contact-card-chevron.open { transform: rotate(180deg); }
.contact-card-body { padding: 0 16px 16px; }
.contact-line { font-size: 13px; color: var(--ink); margin-bottom: 4px; }
.contact-line a { color: var(--accent); text-decoration: none; }

/* ── mobile ────────────────────────────────────────────────────

   At 700px and under the brand panel goes entirely and the flow
   fills the viewport edge to edge: no card, no shadow, no rounded
   corners. A real media query, so resizing a window switches it live.
   ───────────────────────────────────────────────────────────────── */

/* ── the contact cards on the success screen ───────────────────── */

.contact-card-body { padding: 0 16px 14px; }
.contact-add {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  padding: 9px 14px; border-radius: 10px; border: 1.5px solid var(--field-border);
  background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.contact-add:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 700px) {
  .shell { flex-direction: column; min-height: 100dvh; }
  .brand-panel { display: none; }
  .form-side { padding: 0; align-items: stretch; }
  .form-card {
    width: 100%; max-width: none; height: 100dvh; max-height: none;
    border-radius: 0; box-shadow: none; border: none;
  }
  .card-top { padding: max(18px, env(safe-area-inset-top)) 18px 0; }
  /* Room for a thumb, and a target big enough to hit first time. */
  .btn-primary { padding: 17px; font-size: 15.5px; }
  .field-input { padding: 14px; }
  select.field-input { background-position: right 16px center; }
  .content { padding: 20px 18px 16px; }
  .card-foot { padding: 0 18px max(18px, env(safe-area-inset-bottom)); }
  .section-title { font-size: 20px; }
}
