/* ====================================================
   CommerceOS Auth Pages — Light theme · DM Sans · Shopify Green
   ==================================================== */

:root {
  --green:       var(--cos-green-600);
  --green-dark:  var(--cos-green-700);
  --green-light: var(--cos-green-500);
  --green-glow:  rgba(0,128,96,0.14);
  --bg:          #f4faf7;
  --surface:     #ffffff;
  --border:      #d4e5de;
  --border-s:    rgba(0,128,96,0.14);
  --text:        #0c1a16;
  --muted:       #5a7268;
  --muted-2:     #8aada3;
  --error:       #dc2626;
  --radius:      12px;
  --shadow:      0 1px 3px rgba(0,40,32,0.05), 0 8px 24px rgba(0,40,32,0.07);
  --shadow-md:   0 4px 6px rgba(0,40,32,0.04), 0 20px 48px rgba(0,40,32,0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--cos-font);
  background: transparent;
  color: var(--text);
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

/* ── Background ──────────────────────────────────── */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(0,128,96,0.1), transparent 60%),
    #f4faf7;
}

/* ── Header ──────────────────────────────────────── */
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--border-s);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(12px);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.auth-logo > span:not(.auth-logo__icon) { color: var(--green); }
.auth-logo__icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  box-shadow: 0 2px 8px rgba(0,128,96,0.25);
  flex-shrink: 0;
}
/* Wordmark image logo */
.cos-logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.cos-logo--img img { display: block; width: auto; }

.auth-header a.auth-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
}
.auth-header a.auth-link strong { color: var(--green); font-weight: 600; }
.auth-header a.auth-link:hover strong { text-decoration: underline; }

/* ── Main layout ─────────────────────────────────── */
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 60px;
}

.auth-shell { width: 100%; max-width: 480px; }

/* wide (signup) */
.auth-shell--wide {
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

/* ── Value panel (signup left) ───────────────────── */
.auth-value-panel { padding-top: 8px; }
.avp-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  background: rgba(0,128,96,0.08);
  border: 1px solid rgba(0,128,96,0.18);
  border-radius: 99px;
  padding: 4px 12px;
  margin-bottom: 20px;
}
.auth-value-panel h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 28px;
  color: var(--text);
}
.avp-list { list-style: none; display: flex; flex-direction: column; gap: 20px; margin-bottom: 32px; }
.avp-list li { display: flex; gap: 14px; align-items: flex-start; }
.avp-icon {
  font-size: 1.3rem;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,128,96,0.07);
  border: 1px solid rgba(0,128,96,0.14);
  border-radius: 10px;
  flex-shrink: 0;
}
.avp-list strong { display: block; font-size: 0.92rem; font-weight: 700; margin-bottom: 3px; color: var(--text); }
.avp-list p { color: var(--muted); font-size: 0.82rem; line-height: 1.45; margin: 0; }
.avp-stat-row {
  display: flex; gap: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.avp-stat { display: flex; flex-direction: column; }
.avp-stat__num { font-size: 1.4rem; font-weight: 800; color: var(--green); letter-spacing: -0.02em; }
.avp-stat__label { font-size: 0.72rem; color: var(--muted); }

/* ── Card ────────────────────────────────────────── */
.auth-form-panel { width: 100%; }
.auth-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(24px, 5vw, 36px);
  box-shadow: var(--shadow-md);
}
.auth-card__icon-wrap {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: rgba(0,128,96,0.07);
  border: 1px solid rgba(0,128,96,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 18px;
}
.auth-card h1 { font-size: 1.65rem; letter-spacing: -0.03em; margin-bottom: 8px; color: var(--text); }
.auth-sub { color: var(--muted); font-size: 0.88rem; line-height: 1.55; margin-bottom: 24px; }

/* ── Step indicators ─────────────────────────────── */
.auth-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.auth-step {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f8fafb;
  font-size: 0.75rem; font-weight: 600;
  color: var(--muted);
  transition: all 0.25s;
}
.auth-step.is-active { background: rgba(0,128,96,0.07); border-color: var(--green); color: var(--green); }
.auth-step.is-done { border-color: rgba(0,128,96,0.25); color: var(--green-light); }
.auth-step-arrow { color: var(--muted-2); font-size: 0.85rem; flex-shrink: 0; }

/* ── Form panels ─────────────────────────────────── */
.auth-form { display: none; flex-direction: column; gap: 16px; }
.auth-form.is-visible { display: flex; }

/* ── Fields ──────────────────────────────────────── */
.auth-field { display: flex; flex-direction: column; }
.auth-field label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text); margin-bottom: 6px;
}
.auth-field label span.req { color: var(--green); margin-left: 2px; }
.auth-optional {
  font-size: 0.7rem; font-weight: 500; color: var(--muted);
  background: rgba(0,128,96,0.06); border-radius: 4px; padding: 2px 6px;
}
.auth-field__link {
  font-size: 0.76rem; font-weight: 500; color: var(--green); text-decoration: none;
}
.auth-field__link:hover { text-decoration: underline; }
.auth-field input,
.auth-field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #f8fafb;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--cos-font);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.auth-field input:focus,
.auth-field select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,128,96,0.1);
  background: #fff;
}
.auth-field input::placeholder { color: var(--muted-2); }
.auth-field select {
  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='%235a7268' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  background-color: #f8fafb;
}
.auth-field select option { background: #fff; color: var(--text); }
.auth-field small { margin-top: 5px; font-size: 0.73rem; color: var(--muted-2); line-height: 1.4; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Error ───────────────────────────────────────── */
.auth-error {
  padding: 11px 14px;
  border-radius: var(--radius);
  background: rgba(220,38,38,0.05);
  border: 1px solid rgba(220,38,38,0.2);
  color: var(--error);
  font-size: 0.83rem; line-height: 1.4;
}
.auth-error[hidden] { display: none; }

/* ── Action buttons ──────────────────────────────── */
.auth-actions { display: flex; gap: 10px; margin-top: 4px; }
.auth-actions--single { flex-direction: column; }
.auth-btn {
  flex: 1;
  padding: 13px 20px;
  border-radius: var(--radius);
  font-size: 0.92rem; font-weight: 600;
  font-family: var(--cos-font);
  cursor: pointer; border: none;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-btn--primary {
  background: var(--green); color: #fff;
  box-shadow: 0 4px 16px rgba(0,128,96,0.22);
}
.auth-btn--primary:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,128,96,0.32); }
.auth-btn--secondary {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
  flex: 0 0 auto; padding-left: 16px; padding-right: 16px;
}
.auth-btn--secondary:hover { color: var(--text); border-color: rgba(0,128,96,0.3); background: rgba(0,128,96,0.04); }
.auth-btn--block { width: 100%; flex: none; }

/* ── Trust bar ───────────────────────────────────── */
.auth-trust {
  display: flex; flex-wrap: wrap; gap: 10px 18px;
  margin-top: 20px; padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.73rem; color: var(--muted);
}
.auth-trust span::before { content: "✓ "; color: var(--green); font-weight: 700; }

/* ── Footer text ─────────────────────────────────── */
.auth-footer-text { text-align: center; margin-top: 20px; font-size: 0.82rem; color: var(--muted); }
.auth-footer-text a { color: var(--green); text-decoration: none; font-weight: 600; }
.auth-footer-text a:hover { text-decoration: underline; }

/* ── Professional SaaS auth extras ─────────────── */
.auth-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--green);
  background: rgba(0,128,96,0.07);
  border: 1px solid rgba(0,128,96,0.16);
  border-radius: 99px;
  padding: 6px 14px;
  margin-bottom: 20px;
}
.auth-plan-badge__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(0,128,96,0.2);
  animation: auth-pulse 2s infinite;
}
@keyframes auth-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.auth-password-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}
.auth-password-wrap input { padding-right: 56px; }
.auth-password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--cos-font);
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
}
.auth-password-toggle:hover { background: rgba(0,128,96,0.08); }

.auth-pw-strength {
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.auth-pw-strength.is-visible { opacity: 1; }
.auth-pw-strength::before {
  content: '';
  display: block;
  height: 4px;
  width: 0;
  background: var(--green);
  border-radius: 99px;
  transition: width 0.2s, background 0.2s;
  margin-bottom: 4px;
}
.auth-pw-strength span {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  min-height: 1em;
}
.auth-pw-strength[data-level="1"]::before { background: #dc2626; width: 25%; }
.auth-pw-strength[data-level="2"]::before { background: #f59e0b; width: 50%; }
.auth-pw-strength[data-level="3"]::before { background: var(--green); width: 75%; }
.auth-pw-strength[data-level="4"]::before { background: var(--green-d); width: 100%; }

.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  margin: 4px 0 8px;
}
.auth-check--block { margin: 12px 0; line-height: 1.45; }
.auth-check--muted { color: var(--muted); font-size: 0.78rem; }
.auth-check input {
  width: 16px; height: 16px;
  margin-top: 2px;
  accent-color: var(--green);
  flex-shrink: 0;
}
.auth-check a { color: var(--green); text-decoration: none; font-weight: 600; }
.auth-check a:hover { text-decoration: underline; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--muted-2);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-meta-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}
.auth-meta-list li {
  font-size: 0.78rem;
  color: var(--muted);
  padding-left: 18px;
  position: relative;
}
.auth-meta-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.auth-security-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 12px;
  background: rgba(0,128,96,0.05);
  border: 1px solid rgba(0,128,96,0.12);
  margin-top: 8px;
}
.auth-security-note svg { color: var(--green); flex-shrink: 0; margin-top: 2px; }
.auth-security-note p { margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }

.auth-included {
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafb;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.auth-included__label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  margin-bottom: 10px;
}
.auth-included ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-included li {
  font-size: 0.8rem;
  color: var(--muted);
  padding-left: 16px;
  position: relative;
}
.auth-included li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
  font-size: 0.75rem;
}

.auth-success {
  padding: 11px 14px;
  border-radius: var(--radius);
  background: rgba(0,128,96,0.06);
  border: 1px solid rgba(0,128,96,0.2);
  color: var(--green-d);
  font-size: 0.83rem;
  line-height: 1.45;
  margin-bottom: 12px;
}
.auth-success[hidden] { display: none; }

.auth-dev-link {
  font-size: 0.75rem;
  color: var(--muted);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  word-break: break-all;
  line-height: 1.45;
}
.auth-dev-link a { color: var(--green-d); font-weight: 600; }

.auth-support {
  text-align: center;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--muted-2);
}
.auth-support a { color: var(--green); text-decoration: none; font-weight: 600; }
.auth-support a:hover { text-decoration: underline; }

.auth-card__icon-wrap--muted {
  color: var(--green);
  font-size: 1.2rem;
}
.avp-list--compact { margin-bottom: 20px; }

.auth-field input { width: 100%; }
.auth-password-wrap input { width: 100%; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 780px) {
  .auth-shell--wide { grid-template-columns: 1fr; max-width: 480px; }
  .auth-value-panel { display: none; }
}
@media (max-width: 480px) {
  .auth-row { grid-template-columns: 1fr; }
  .auth-header { padding: 16px 20px; }
  .auth-main { padding: 24px 16px 48px; }
}

/* ── Connect Shopify onboarding ─────────────────── */
.auth-btn--sm {
  flex: none;
  padding: 8px 16px;
  font-size: 0.82rem;
}

.connect-value-lead {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 28px;
}

.connect-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.connect-checklist li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.connect-checklist li:last-child { border-bottom: none; }

.connect-checklist__icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  background: #f0f4f2;
  color: var(--muted);
  border: 1px solid var(--border);
}

.connect-checklist li.is-done .connect-checklist__icon {
  background: rgba(0, 128, 96, 0.12);
  color: var(--green);
  border-color: rgba(0, 128, 96, 0.25);
}

.connect-checklist li.is-active {
  background: rgba(0, 128, 96, 0.04);
}

.connect-checklist li.is-active .connect-checklist__icon {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  box-shadow: 0 2px 10px rgba(0, 128, 96, 0.28);
}

.connect-checklist strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text);
}

.connect-checklist p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.connect-permissions {
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(0, 128, 96, 0.05);
  border: 1px solid rgba(0, 128, 96, 0.14);
}

.connect-permissions h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  margin-bottom: 12px;
}

.connect-permissions ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.connect-permissions li {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  padding-left: 14px;
  position: relative;
}

.connect-permissions li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.connect-permissions li span {
  font-weight: 600;
  color: var(--text);
}

.connect-icon-wrap { color: var(--green); }

.connect-domain-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafb;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.connect-domain-input:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 128, 96, 0.1);
  background: #fff;
}

.connect-domain-input__prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--muted);
  border-right: 1px solid var(--border);
  background: rgba(0, 128, 96, 0.04);
}

.connect-domain-input input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-family: var(--cos-font);
  color: var(--text);
  min-width: 0;
}

.connect-domain-input input:focus { outline: none; }
.connect-domain-input input::placeholder { color: var(--muted-2); }

.auth-card code {
  font-family: var(--cos-font-mono);
  font-size: 0.85em;
  background: rgba(0, 128, 96, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--green-dark);
}

.connect-card--success { text-align: left; }

.connect-success-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 128, 96, 0.1);
  border: 2px solid rgba(0, 128, 96, 0.25);
  color: var(--green);
  margin-bottom: 20px;
}

.connect-next-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  border-radius: 12px;
  background: #f8fafb;
  border: 1px solid var(--border);
}

.connect-next-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.4;
}

.connect-next-steps__num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(0, 128, 96, 0.1);
  color: var(--green);
  flex-shrink: 0;
}

.connect-actions {
  flex-direction: column;
}

.connect-status {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.2em;
}

.connect-status:empty { display: none; }

.auth-btn.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

@media (max-width: 780px) {
  .connect-value-panel { display: none; }
  .auth-shell--wide { max-width: 480px; }
}
