/* ===== GSM Flyer Studio — payment comparison ===== */
:root {
  --blue: #0a3d91; --blue-600: #14509b; --blue-300: #3a8dde; --blue-050: #eef4fd;
  --ink: #141a2a; --muted: #5b6474; --line: #e2e8f2;
  --bg: #eef1f7; --surface: #ffffff; --surface-2: #f7f9fd;
  --danger: #c0362c;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,32,64,.06), 0 8px 24px rgba(16,32,64,.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
[data-theme="dark"] {
  --blue: #5b9bf5; --blue-600: #6ea3f5; --blue-300: #4d8df0; --blue-050: #17233c;
  --ink: #e7ecf6; --muted: #9aa6bd; --line: #26314b;
  --bg: #0d1322; --surface: #141b2c; --surface-2: #1a2236;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }

/* ---- Brand + buttons ---- */
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; background: var(--blue); color: #fff; border-radius: 10px; font-weight: 800; letter-spacing: .04em; font-size: 15px; }
.brand-lockup.sm .brand-mark { width: 34px; height: 34px; font-size: 13px; border-radius: 8px; }
.brand-name { font-weight: 700; font-size: 16px; color: var(--ink); }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; color: var(--ink); background: transparent; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--blue-300); outline-offset: 2px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }
.btn-ghost { border-color: var(--line); background: var(--surface); }
.btn-ghost:hover { border-color: var(--blue-300); }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 44px; padding: 0; }
.btn-block { width: 100%; }
.inline { display: inline; margin: 0; }

/* ===== Login ===== */
.auth-body { display: grid; place-items: center; padding: 24px; }
.auth-wrap { width: 100%; max-width: 440px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 30px; }
.auth-card h1 { font-size: 22px; margin: 20px 0 6px; }
.auth-card .muted { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.auth-form { display: grid; gap: 8px; }
.auth-form label { font-size: 13px; font-weight: 600; color: var(--muted); }
.auth-form input { width: 100%; min-height: 46px; padding: 0 14px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); }
.auth-form input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-050); }
.auth-form .btn { margin-top: 8px; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.muted { color: var(--muted); }

/* ===== App shell ===== */
.app-body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: var(--surface); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.studio { flex: 1 1 auto; display: grid; grid-template-columns: 384px 1fr; min-height: 0; }
.panel { min-height: 0; min-width: 0; }
.inputs { border-right: 1px solid var(--line); background: var(--surface); }
.panel-scroll { height: 100%; overflow-y: auto; padding: 20px; }
.preview { background: var(--bg); }
.preview-scroll { height: 100%; overflow-y: auto; padding: 28px; display: flex; justify-content: center; }

/* ---- Form ---- */
.field-group { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.field-group:last-child { border-bottom: none; }
.group-title { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.grid-2 .field { margin-bottom: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-weight: 400; color: var(--muted); font-style: normal; font-size: 12px; }
.field input, .field textarea, .field select { width: 100%; min-height: 42px; padding: 9px 12px; font-size: 15px; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-family: inherit; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-050); }
.file-input { font-size: 13px; padding: 8px; }
.file-input::file-selector-button { margin-right: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 7px 12px; font-weight: 600; cursor: pointer; font-size: 13px; }
.fineprint { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* Scenario input cards */
.scn-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.scn-head { font-size: 12px; font-weight: 700; color: var(--blue); margin-bottom: 8px; }
.scn-block .field input { min-height: 38px; font-size: 14px; }

/* ===== Comparison flyer (fixed light palette so screen == print) ===== */
.flyer-stage { width: 100%; max-width: 680px; }
.cmp-flyer {
  --f-blue: #0a3d91; --f-blue-600: #16549e; --f-ink: #1c2536; --f-muted: #5b6579;
  --f-line: #dbe3f0; --f-shade: #eef3fa; --f-head: #123a7a;
  width: 100%; aspect-ratio: 8.5 / 11; background: #fff; color: var(--f-ink);
  border-radius: 8px; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; padding-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
/* Photo + banner */
.cmp-photo { position: relative; height: 30%; flex: 0 0 30%; background: #cfd8e6 center/cover no-repeat; display: grid; place-items: center; }
.photo-empty { color: #8391aa; font-size: 13px; font-weight: 600; }
.cmp-photo.has-photo .photo-empty { display: none; }
.cmp-banner { position: absolute; left: 0; bottom: 16px; background: var(--f-blue); color: #fff; font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: .01em; padding: 9px 20px 9px 22px; max-width: 78%; box-shadow: 0 3px 10px rgba(10,20,40,.28); }

/* Grid of scenario columns */
.cmp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 16px 6px; }
.cmp-col { border: 1px solid var(--f-line); border-radius: 4px; overflow: hidden; display: flex; flex-direction: column; }
.cmp-col-head { background: var(--f-head); color: #fff; text-align: center; font-weight: 800; font-size: 9.5px; letter-spacing: .04em; padding: 5px 4px; text-transform: uppercase; }
.cmp-col-body { flex: 1 1 auto; }
.cmp-row { display: flex; justify-content: space-between; gap: 6px; padding: 3px 7px; font-size: 9.5px; line-height: 1.25; }
.cmp-row:nth-child(even) { background: var(--f-shade); }
.cmp-row-l { color: var(--f-muted); }
.cmp-row-v { color: var(--f-ink); font-weight: 700; text-align: right; white-space: nowrap; }
.cmp-total { background: var(--f-shade); border-top: 1px solid var(--f-line); text-align: center; padding: 6px 4px 7px; }
.cmp-total-l { font-size: 8.5px; color: var(--f-muted); font-weight: 600; }
.cmp-total-v { font-size: 15px; font-weight: 800; color: var(--f-blue); margin-top: 1px; }

.cmp-ratesnote { padding: 2px 18px 0; font-size: 8px; font-style: italic; color: #7a8499; }

/* Footer / co-brand */
.cmp-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 10px 18px 4px; }
.cmp-officer { display: flex; gap: 9px; align-items: center; }
.cmp-officer.alt { justify-content: flex-end; }
.cmp-officer.alt .cmp-avatar { order: 2; }
.cmp-officer.alt .cmp-officer-lines { text-align: right; }
.cmp-avatar { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 6px; background: #dbe3f0 center/cover no-repeat; }
.cmp-officer-lines { min-width: 0; }
.cmp-o-name { font-size: 12px; font-weight: 800; color: var(--f-ink); line-height: 1.1; }
.cmp-o-title { font-size: 9px; color: var(--f-blue); font-weight: 700; }
.cmp-o-co { font-size: 9px; color: var(--f-muted); }
.cmp-o-contact { font-size: 8.5px; color: #3f4a60; line-height: 1.35; }
.cmp-o-contact .lbl { color: var(--f-blue); font-weight: 700; }
.cmp-o-nmls { font-size: 8.5px; color: var(--f-muted); margin-top: 1px; }

.cmp-logo { display: grid; place-items: center; }
.cmp-logo img { width: 74px; height: 74px; object-fit: contain; }
.cmp-logo-fallback { width: 74px; height: 74px; border-radius: 50%; border: 3px solid var(--f-blue); color: var(--f-blue); place-items: center; text-align: center; padding: 6px; }
.cmp-logo-fallback span { font-size: 6.5px; font-weight: 700; letter-spacing: .06em; }
.cmp-logo-fallback strong { font-size: 17px; font-weight: 900; line-height: 1; }

/* Disclaimer */
.cmp-eho { display: none; }
.cmp-disclaimer { padding: 6px 20px 4px; font-size: 6.6px; line-height: 1.45; color: #8b95ab; text-align: center; outline: none; }
.cmp-disclaimer:focus { box-shadow: 0 0 0 2px var(--f-blue) inset; }

/* Editable banner affordance (screen only) */
#cmpBanner { outline: none; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); transition: opacity .2s, transform .2s; z-index: 100; max-width: min(90vw, 460px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .app-body { height: auto; overflow: visible; }
  .studio { grid-template-columns: 1fr; }
  .inputs { border-right: none; border-bottom: 1px solid var(--line); }
  .panel-scroll, .preview-scroll { height: auto; }
  .preview-scroll { padding: 20px; }
}

/* ===== Print — only the flyer ===== */
@media print {
  @page { size: Letter portrait; margin: 0.3in; }
  .topbar, .inputs, .toast, #themeToggle, #printBtn { display: none !important; }
  html, body { height: auto; background: #fff; overflow: visible; }
  .app-body, .studio, .preview, .preview-scroll { display: block; height: auto; overflow: visible; padding: 0; background: #fff; }
  .flyer-stage { max-width: none; }
  .cmp-flyer { width: 100%; aspect-ratio: auto; height: auto; min-height: 10.2in; box-shadow: none; border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cmp-photo { height: 2.5in; flex-basis: 2.5in; }
  .cmp-disclaimer:focus { box-shadow: none; }
}
