/*
 * Paspartou web — design system.
 *
 * Same tokens as the Flutter app so the two surfaces are recognisably one product. Two
 * colours only (navy + gold); everything else is a tint of navy. Gold is the ONE primary
 * action on a screen — the moment it appears twice it stops meaning "press this".
 *
 * Desktop-first but usable on a tablet, because a salesperson runs the onboarding wizard
 * on one. Plain CSS, no build step: AssetMapper serves this directly.
 */

:root {
  --navy: #222E42;
  --gold: #DDB227;
  --cream: #FAF5EA;
  --success: #1F6B3A;
  --danger: #C0392B;
  --surface: #FFFFFF;
  --body: #3A4150;
  --muted: #8A8F99;

  --navy-04: rgba(34, 46, 66, 0.04);
  --navy-08: rgba(34, 46, 66, 0.08);
  --navy-16: rgba(34, 46, 66, 0.16);

  --r-card: 16px;
  --r-btn: 12px;
  --gap: 16px;
  --gap-lg: 24px;

  --font-display: 'Quicksand', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  --sidebar: 246px;
  --sidebar-bg: #1A2436;
  --sidebar-active: #2C3A54;
  --sidebar-dim: #4A5568;
  --sidebar-text: #B7BFCE;
}

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  color: var(--navy);
  font-weight: 700;
  margin: 0 0 .5em;
  line-height: 1.2;
}
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

a { color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Numbers — Quicksand, like the app. Tabular so columns line up in tables. */
.figure {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.figure-lg { font-size: 32px; }

/* ---------- layout ---------- */

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

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: var(--sidebar-bg);
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 22px; }
.sidebar .brand-word { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: #fff; line-height: 1; }
.sidebar .brand-sub {
  font-family: var(--font-body); font-size: 10px; font-weight: 600;
  letter-spacing: 1px; color: var(--gold); text-transform: uppercase;
}

/* Nav item: the small square on the left is the state indicator — gold when active,
   grey when not. It reads at a glance without relying on text weight alone. */
.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 14px; font-weight: 500;
}
.sidebar nav a::before {
  content: ''; flex: 0 0 18px; width: 18px; height: 18px;
  border-radius: 5px; background: var(--sidebar-dim);
}
.sidebar nav a:hover { background: var(--sidebar-active); }
.sidebar nav a.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar nav a.active::before { background: var(--gold); }
.sidebar nav a .badge-count {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--gold); color: #4A3A08; padding: 1px 7px; border-radius: 10px;
}
.sidebar nav a .badge-plan {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: #3A4761; color: #8F99A8; padding: 2px 7px; border-radius: 10px;
}

/* Context card — which shop you are managing. Merchant portal only. */
.sidebar .context {
  display: flex; align-items: center; gap: 10px;
  background: var(--sidebar-active); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 16px;
}
.sidebar .context .avatar {
  width: 34px; height: 34px; border-radius: 9px; background: #F0D98A;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #7A5F10;
}
.sidebar .context .name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.sidebar .context .meta { font-size: 11px; color: #8F99A8; }

/* Signed-in user sits at the BOTTOM of the sidebar, not in the topbar. */
.sidebar .me {
  margin-top: auto; display: flex; align-items: center; gap: 11px;
  padding: 12px 10px; border-top: 1px solid var(--sidebar-active);
}
.sidebar .me .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--gold);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #4A3A08;
}
.sidebar .me .name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.sidebar .me .role { font-size: 11px; color: #8F99A8; }
.sidebar .me a { color: #8F99A8; font-size: 11px; text-decoration: none; }
.sidebar .me a:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--navy-08);
  padding: 18px 32px;
  display: flex; align-items: center; gap: var(--gap);
}
.topbar .title { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--navy); margin: 0; }
/* Who you are signed in as, in the sidebar-less customer area. Muted, not gold: gold marks
   the one primary action on a screen (D47), and a label is not an action. */
.topbar .brand-sub {
  font-family: var(--font-body); font-size: 10px; font-weight: 600;
  letter-spacing: 1px; color: var(--muted); text-transform: uppercase;
}
.topbar .subtitle { font-size: 13px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.topbar select { min-height: 38px; width: auto; padding: 6px 12px; font-size: 13px; }

.content { padding: 28px 32px; width: 100%; display: flex; flex-direction: column; gap: var(--gap-lg); }
.content > .card + .card, .content > .grid + .card, .content > .card + .grid { margin-top: 0; }

/* ---------- components ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--navy-08);
  border-radius: var(--r-card);
  padding: var(--gap-lg);
}
.card + .card { margin-top: var(--gap); }
.card-head { display: flex; align-items: center; gap: var(--gap); margin-bottom: var(--gap); }
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat { background: var(--surface); border: 1px solid var(--navy-08); border-radius: var(--r-card); padding: var(--gap); }
.stat .label { font-size: 13px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--r-btn);
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
/* The single primary action on the screen. */
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { filter: brightness(.95); }
.btn-secondary { background: var(--surface); color: var(--navy); border-color: var(--navy-16); }
.btn-secondary:hover { background: var(--navy-04); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; color: var(--navy); }
input[type=text], input[type=tel], input[type=email], input[type=password],
input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--navy-16); border-radius: var(--r-btn);
  background: var(--surface); color: var(--body);
  font-family: var(--font-body); font-size: 15px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); border-width: 2px; padding: 9px 13px; }
.field { margin-bottom: var(--gap); }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field .error { font-size: 13px; color: var(--danger); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--navy-08); }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tbody tr:hover { background: var(--navy-04); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--navy-08); color: var(--navy);
}
.badge-success { background: rgba(31,107,58,.12); color: var(--success); }
.badge-danger  { background: rgba(192,57,43,.12); color: var(--danger); }
.badge-warn    { background: rgba(221,178,39,.20); color: #7a610d; }

.flash { border-radius: var(--r-card); padding: 14px var(--gap); margin-bottom: var(--gap); border: 1px solid; }
.flash-success { background: rgba(31,107,58,.08); border-color: rgba(31,107,58,.3); color: var(--success); }
.flash-error   { background: rgba(192,57,43,.08); border-color: rgba(192,57,43,.3); color: var(--danger); }

.empty { text-align: center; padding: 56px var(--gap); color: var(--muted); }
.empty h3 { color: var(--navy); }

/* ---------- centred pages (login) ---------- */

.centred { min-height: 100vh; display: grid; place-items: center; padding: var(--gap-lg); }
.panel { width: 100%; max-width: 420px; }
.panel .card { padding: 32px; }

/* ---------- responsive: usable on the tablet the wizard runs on ---------- */

@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none;
    flex-direction: row; overflow-x: auto;
    padding: 10px var(--gap); gap: 6px;
  }
  .sidebar .brand, .sidebar .context { display: none; }
  .sidebar nav { flex-direction: row; gap: 6px; }
  .sidebar nav a { white-space: nowrap; padding: 9px 12px; }
  .sidebar nav a::before { display: none; }
  /* Keep log out reachable — just the link, not the whole user block. */
  .sidebar .me { margin: 0; padding: 0 8px; border: none; align-items: center; }
  .sidebar .me .avatar, .sidebar .me .name { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: var(--gap); }
  /* Tables scroll rather than squash — these carry money figures. */
  .table-wrap { overflow-x: auto; }
}

/* ---------- onboarding wizard ---------- */

/*
   The choice card is the wizard's main control: one tap, no typing. Selection is shown
   BOTH by the ring and by the border — colour alone would not survive a sun-lit tablet
   screen, which is where this actually gets used.
*/
.choice-grid { display: grid; gap: 12px; }
.choice-grid-2 { grid-template-columns: repeat(2, 1fr); }
.choice { display: block; cursor: pointer; margin: 0; }
.choice-input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--navy-16); border-radius: var(--r-card);
  padding: 18px;
  transition: border-color .12s, background .12s, box-shadow .12s;
  height: 100%;
}
.choice-card:hover { border-color: var(--navy); }
.choice-card .ring {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--navy-16);
  display: grid; place-items: center;
}
.choice-card .ring::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.choice-card .label { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--navy); }
.choice-card .hint { font-size: 13px; color: var(--muted); }
.choice-input:checked + .choice-card {
  border-color: var(--navy); border-width: 2px; padding: 17px;
  background: var(--navy-04);
}
.choice-input:checked + .choice-card .ring { border-color: var(--gold); background: var(--gold); }
.choice-input:checked + .choice-card .ring::after { background: var(--navy); }
.choice-input:focus-visible + .choice-card { outline: 2px solid var(--gold); outline-offset: 2px; }

.wizard { display: flex; min-height: 0; flex: 1; }

/* Left rail: every step visible at once, so a salesperson can tell a merchant
   "four more screens" rather than "a few more". */
.wizard-rail {
  width: 280px; flex: 0 0 280px;
  padding: 28px 24px;
  border-right: 1px solid var(--navy-08);
  background: #FAF8F2;
}
.wizard-rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wizard-rail li {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 9px;
  font-size: 13px; font-weight: 500; color: var(--muted);
}
.wizard-rail .dot {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  border: 2px solid #D4CBB6; color: var(--muted);
}
.wizard-rail li.done { color: var(--body); }
.wizard-rail li.done .dot { background: var(--success); border-color: var(--success); color: #fff; }
.wizard-rail li.current {
  background: var(--surface); color: var(--navy); font-weight: 700;
  box-shadow: 0 1px 3px rgba(34, 46, 66, .08);
}
.wizard-rail li.current .dot { background: var(--gold); border-color: var(--gold); color: #4A3A08; }

.wizard-main { flex: 1; min-width: 0; padding: 28px 32px; }
.wizard-main h2 { font-size: 26px; }
.wizard-cols { display: grid; grid-template-columns: 1fr 380px; gap: 32px; align-items: start; }

/* Stepper: bigger than a number input and usable with one thumb on a tablet. */
.stepper { display: inline-flex; align-items: center; background: var(--surface);
  border: 1px solid var(--navy-08); border-radius: var(--r-card); overflow: hidden; }
.stepper button {
  width: 56px; height: 64px; border: none; cursor: pointer;
  font-size: 26px; font-weight: 700; color: var(--navy);
  background: #F6EFD8;
}
.stepper button:last-child { background: var(--gold); }
.stepper .value {
  min-width: 88px; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--navy);
}
.stepper input { display: none; }

/* Live preview — the card the customer will actually hold. */
.preview {
  background: var(--navy); border-radius: 20px; padding: 22px; color: #fff;
  position: sticky; top: 24px;
}
.preview .label {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.55); margin-bottom: 14px;
}
.preview .card-inner { background: var(--sidebar-active); border-radius: 14px; padding: 18px; }
.preview .shop { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.preview .shop .avatar {
  width: 38px; height: 38px; border-radius: 11px; background: #F0D98A;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #7A5F10;
}
.preview .shop .name { font-size: 14px; font-weight: 600; }
.preview .shop .type { font-size: 12px; color: #8F99A8; }
.preview .dots { display: flex; flex-wrap: wrap; gap: 9px; }
.preview .dots span { width: 22px; height: 22px; border-radius: 50%; background: #3A4761; }
.preview .dots span.filled { background: var(--gold); }
.preview .summary { margin-top: 16px; font-size: 13px; color: #C7CEDA; text-align: center; }

/* Form steps: a comfortable measure. Full-width inputs on a 1400px screen look like a
   database form, and the wizard is meant to feel like a conversation. */
.wizard-form { max-width: 620px; }
.wizard-form .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--gap); }

/* Plan card — step 8. The one place a price appears, so it gets the navy panel. */
.plan-card { background: var(--navy); border-radius: var(--r-card); padding: 22px; color: #fff; margin-bottom: 20px; }
.plan-card .plan-name { font-family: var(--font-display); font-weight: 700; font-size: 22px; }
.plan-card p { color: rgba(255,255,255,.8); margin: 8px 0 16px; }
.plan-card .free-note {
  background: var(--gold); color: var(--navy);
  border-radius: 10px; padding: 12px 16px; font-weight: 600; font-size: 14px;
}

/* Signature pad — step 9. */
.sign-pad {
  background: var(--surface); border: 1px dashed var(--navy-16); border-radius: var(--r-card);
  padding: 14px;
}
.sign-pad canvas { width: 100%; height: 200px; touch-action: none; display: block; background: var(--surface); }
.sign-pad .baseline { border-top: 1px solid var(--navy-16); margin: 0 8px; }

/* Review — step 10. Each line editable in place, so a correction costs one tap. */
.review { background: var(--surface); border: 1px solid var(--navy-08); border-radius: var(--r-card); overflow: hidden; }
.review .group {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: var(--navy-04); padding: 9px 18px;
}
.review .row { display: flex; align-items: center; gap: var(--gap); padding: 12px 18px; border-top: 1px solid var(--navy-08); }
.review .row .k { flex: 0 0 190px; font-size: 13px; color: var(--muted); }
.review .row .v { flex: 1; min-width: 0; color: var(--navy); font-weight: 500; }
.review .row a { font-size: 13px; color: var(--muted); }
.review .row a:hover { color: var(--navy); }

.wizard-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--navy-08);
}
.wizard-actions .spacer { flex: 1; }

/* Start / done pages: same family as the steps, without the rail. */
.wizard-page { max-width: 640px; margin: 0 auto; padding: 48px var(--gap-lg) 64px; }
.resume-item {
  display: flex; align-items: center; gap: var(--gap);
  padding: 14px 16px; margin-top: 10px;
  background: var(--surface); border: 1px solid var(--navy-16); border-radius: var(--r-btn);
  text-decoration: none;
}
.resume-item:hover { border-color: var(--navy); }
.resume-item .name { flex: 1; font-weight: 600; color: var(--navy); }
.done-mark {
  width: 84px; height: 84px; border-radius: 50%; background: var(--success);
  display: grid; place-items: center; margin: 0 auto var(--gap-lg);
  color: #fff; font-size: 42px;
}
.next-steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.next-steps li { display: flex; gap: 12px; padding: 10px 0; counter-increment: s; color: var(--body); }
.next-steps li::before {
  content: counter(s);
  flex: 0 0 26px; height: 26px; border-radius: 50%;
  background: var(--navy-08); color: var(--navy);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}

@media (max-width: 700px) {
  .choice-grid-2 { grid-template-columns: 1fr; }
  .wizard-form .field-row { grid-template-columns: 1fr; }
  .review .row { flex-wrap: wrap; }
  .review .row .k { flex-basis: 100%; }
}
@media (max-width: 1100px) {
  .wizard-cols { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 860px) {
  .wizard { flex-direction: column; }
  .wizard-rail { width: 100%; flex: none; border-right: none; border-bottom: 1px solid var(--navy-08); }
  .wizard-rail ol { flex-direction: row; overflow-x: auto; }
  .wizard-rail li span:not(.dot) { display: none; }
}
