/* eSIM Ara design system
   Palette: ink on foam, sea for action, coral and sun as rare accents.
   Type: Bricolage Grotesque (display), Albert Sans (body), IBM Plex Mono (data). */

:root {
  --ink: #0B2540;
  --mist: #4A6572;
  --foam: #F4FBFA;
  --white: #FFFFFF;
  --sea: #0E7C86;
  --sea-deep: #0A5A62;
  --sea-tint: #E2F2F1;
  --coral: #FF6B5E;
  --sun: #FFC862;
  --line: #D5E8E6;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(11, 37, 64, 0.07);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Albert Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
}

.shell { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.shell.narrow { max-width: 680px; }

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.45em;
}
h1 { font-size: clamp(2.1rem, 5.5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 700; }

a { color: var(--sea); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

.mono { font-family: var(--mono); font-weight: 600; }
.muted { color: var(--mist); }
.lede { font-size: 1.12rem; color: var(--mist); max-width: 56ch; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sea);
  margin: 0 0 10px;
}

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--white); }
.header-row { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; }
.wordmark { text-decoration: none; color: var(--ink); display: inline-flex; flex-direction: column; gap: 2px; }
.wordmark-text { font-family: var(--display); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.02em; }
.wordmark-text.small { font-size: 1.1rem; }
.wordmark-wave { width: 92px; height: 11px; color: var(--sea); }
.main-nav { display: flex; gap: 26px; }
.main-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.main-nav a:hover { color: var(--sea); }

/* Hero */
.hero { background: var(--sea-tint); padding: 72px 0 0; position: relative; }
.hero h1 { max-width: 12ch; }
.hero-sub { font-size: 1.15rem; color: var(--mist); max-width: 52ch; }
.hero-wave { display: block; width: 100%; height: 60px; margin-top: 48px; }

.hero-search {
  display: flex;
  max-width: 560px;
  margin: 26px 0 18px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero-search input {
  flex: 1;
  border: 0;
  padding: 16px 18px;
  font: inherit;
  font-size: 1.05rem;
  background: transparent;
}
.hero-search input::placeholder { color: var(--mist); }
.hero-search button {
  border: 0;
  background: var(--sea);
  color: var(--white);
  font: inherit;
  font-weight: 600;
  padding: 0 26px;
  cursor: pointer;
}
.hero-search button:hover { background: var(--sea-deep); }

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
}
.chip img { border-radius: 3px; }
.chip:hover { border-color: var(--sea); color: var(--sea); }

/* Plan picker (chips are built by app.js; without JS all plans show) */
[hidden] { display: none !important; }
.picker { display: grid; gap: 18px; margin-top: 26px; }
.picker-step { display: grid; gap: 10px; }
.picker-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sea);
}
button.chip { cursor: pointer; font-family: var(--body); }
.chip.selected { background: var(--sea); border-color: var(--sea); color: var(--white); }
.chip.selected:hover { color: var(--white); }

/* Sections */
.section { padding: 56px 0; }
.section.alt { background: var(--foam); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.text-link { font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* Country grid */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 14px;
  margin-top: 22px;
}
.country-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.country-card:hover { border-color: var(--sea); transform: translateY(-2px); }
.country-card img { grid-row: 1 / 3; border-radius: 4px; }
.country-name { font-weight: 600; }
.from-price { font-size: 0.88rem; color: var(--mist); }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 24px; }
.step { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step-label {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--coral);
}
.step h3 { margin-top: 8px; }
.step p { color: var(--mist); margin-bottom: 0; }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding: 14px 0; }
summary { font-weight: 600; cursor: pointer; }
details p { color: var(--mist); }

/* Plan cards */
.crumbs { font-size: 0.9rem; margin-bottom: 14px; color: var(--mist); }
.crumbs a { text-decoration: none; }
.country-head { display: flex; align-items: center; gap: 16px; }
.country-head img { border-radius: 6px; }
.region-title { margin-top: 38px; }
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 16px;
  margin-top: 22px;
}
.plan-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}
.plan-data { display: flex; align-items: baseline; gap: 6px; }
.plan-speed { margin: -6px 0 0; font-size: 0.88rem; color: var(--mist); }
.plan-badge {
  margin-left: auto;
  align-self: center;
  background: var(--sea-tint);
  color: var(--sea-deep);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.data-amount { font-size: 2.5rem; line-height: 1; color: var(--sea); }
.data-unit { font-weight: 600; color: var(--mist); }
.plan-meta { display: grid; gap: 6px; margin: 0; }
.plan-meta div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.plan-meta dt { color: var(--mist); }
.plan-meta dd { margin: 0; font-weight: 500; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.price { font-size: 1.25rem; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--sea);
  color: var(--white);
  border: 2px solid var(--sea);
  border-radius: 10px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--sea-deep); border-color: var(--sea-deep); }
.btn.big { padding: 14px 26px; font-size: 1.05rem; }
.btn.ghost { background: transparent; color: var(--sea); }
.btn.ghost:hover { background: var(--sea-tint); }
.small-btn { padding: 4px 10px; font-size: 0.85rem; }

/* Forms */
.inline-search { display: flex; gap: 10px; max-width: 420px; margin: 18px 0; }
.inline-search input {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
}
.inline-search button,
.mock-actions button { font: inherit; }
.inline-search button {
  border: 2px solid var(--sea);
  background: var(--sea);
  color: var(--white);
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 600;
  cursor: pointer;
}

.checkout-form { display: flex; flex-direction: column; gap: 8px; margin-top: 26px; }
.checkout-form label { font-weight: 600; }
.checkout-form input[type="email"] {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 13px 15px;
  font: inherit;
}
.checkout-form input[type="email"]:focus { border-color: var(--sea); }
.checkout-form input[type="text"] {
  padding: 12px 14px; border: 1.5px solid var(--mist); border-radius: 10px;
  font-size: 1.05rem; outline: none;
}
.checkout-form input[type="text"]:focus { border-color: var(--sea); }
.btn-link {
  background: none; border: none; padding: 0; color: var(--sea);
  text-decoration: underline; cursor: pointer; font-size: 0.95rem;
  align-self: flex-start;
}
.field-hint { font-size: 0.88rem; color: var(--mist); margin: 2px 0 14px; }
.checkout-form fieldset { border: 0; padding: 0; margin: 8px 0 14px; display: grid; gap: 10px; }
.checkout-form legend { font-weight: 600; padding: 0 0 8px; }
.pay-option {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
}
.pay-option:has(input:checked) { border-color: var(--sea); background: var(--sea-tint); }
.pay-option input { margin-top: 4px; accent-color: var(--sea); }
.form-error {
  background: #FDEDEB;
  border: 1px solid var(--coral);
  color: #8A2A22;
  border-radius: 10px;
  padding: 12px 16px;
}

.summary-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--foam);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.summary-card .data-amount { font-size: 1.9rem; }
.summary-text { display: flex; flex-direction: column; flex: 1; }
.mock-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

/* Order page */
.progress-wave { width: 100%; max-width: 600px; height: 40px; margin: 26px 0; }
.progress-wave-fill {
  stroke-dasharray: 80 560;
  animation: tide 2.4s linear infinite;
}
@keyframes tide { to { stroke-dashoffset: -640; } }

.activation { display: grid; grid-template-columns: auto 1fr; gap: 30px; margin-top: 26px; align-items: start; }
.qr-box { margin: 0; text-align: center; }
.qr-box img { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 8px; max-width: 100%; height: auto; }
.qr-box figcaption { font-size: 0.85rem; color: var(--mist); max-width: 240px; margin: 8px auto 0; }
.activation-steps ol { padding-left: 20px; color: var(--mist); }
.activation-steps li { margin-bottom: 8px; }
.usage-out { background: var(--foam); border-radius: 10px; padding: 10px 14px; font-family: var(--mono); font-size: 0.92rem; }
.empty-state { color: var(--mist); margin-top: 24px; }

/* Admin */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 20px 0; }
.stat { background: var(--foam); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mist); }
.stat-value { font-size: 1.3rem; }
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 10px 0 30px; }
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--sea-tint);
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
}
.badge.st-fulfilled { background: #E3F4E4; }
.badge.st-needs_attention { background: #FDEDEB; }
.badge.st-pending_payment { background: #FFF4DC; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mist); }
.inline-form { display: inline; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--foam); margin-top: 40px; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.4fr;
  gap: 30px;
  padding: 38px 22px;
}
.footer-grid nav { display: flex; flex-direction: column; gap: 8px; }
.footer-grid a { color: var(--ink); text-decoration: none; }
.footer-grid a:hover { color: var(--sea); }

@media (max-width: 720px) {
  .main-nav { gap: 16px; font-size: 0.92rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .activation { grid-template-columns: 1fr; }
  .hero { padding-top: 48px; }
}

/* Phones */
@media (max-width: 600px) {
  .shell { padding: 0 16px; }
  .section { padding: 38px 0; }

  /* Header: let the nav drop below the logo instead of overflowing. */
  .header-row { flex-wrap: wrap; gap: 4px 18px; padding-top: 12px; padding-bottom: 12px; }
  .main-nav { width: 100%; justify-content: space-between; gap: 10px; }
  .main-nav a { padding: 8px 0; }

  .hero { padding-top: 40px; }
  .hero-wave { height: 40px; margin-top: 32px; }
  .hero-search button { padding: 0 18px; }

  /* Checkout: summary wraps, the pay button is full-width for thumbs. */
  .summary-card { flex-wrap: wrap; gap: 10px 16px; }
  .summary-card .price { margin-left: auto; }
  .checkout-form .btn.big { width: 100%; text-align: center; }

  .footer-grid { padding: 30px 16px; }
}

/* Touch devices: comfortable tap targets regardless of screen size. */
@media (pointer: coarse) {
  .chip { padding: 11px 18px; }
  .btn { padding: 12px 20px; }
  .btn.big { padding: 15px 26px; }
  summary { padding: 6px 0; }
}

/* ---- Live chat ---- */

.chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--sea);
  color: var(--white);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(11, 37, 64, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.chat-launcher:hover { background: var(--sea-deep); }
.chat-launcher.is-open { background: var(--ink); }

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--coral);
  color: var(--white);
  font: 600 0.75rem/20px var(--body);
  text-align: center;
}
.chat-badge.inline { position: static; display: inline-block; margin-left: 8px; }

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: min(360px, calc(100vw - 32px));
  height: min(480px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(11, 37, 64, 0.2);
  z-index: 60;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--sea);
  color: var(--white);
}
.chat-header-btns { display: flex; gap: 6px; }
.chat-icon-btn {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  border-radius: 8px;
  padding: 4px 10px;
  font: 500 0.85rem var(--body);
  cursor: pointer;
}
.chat-icon-btn:hover { background: rgba(255, 255, 255, 0.3); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--foam);
}
.chat-msg {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.95rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.chat-msg.own { align-self: flex-end; background: var(--sea); color: var(--white); border-bottom-right-radius: 4px; }
.chat-msg.other { align-self: flex-start; background: var(--sea-tint); color: var(--ink); border-bottom-left-radius: 4px; }

.chat-notice { margin: 0; padding: 10px 14px; font-size: 0.9rem; color: var(--mist); }

.chat-form { padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--white); }
.chat-name {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 400 0.95rem var(--body);
}
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input {
  flex: 1;
  resize: none;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 400 0.95rem var(--body);
  max-height: 110px;
}
.chat-send { padding: 9px 16px; }
.chat-again { margin: 0 14px 12px; }

/* Agent console */
.chat-console {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  height: min(640px, calc(100vh - 220px));
  background: var(--white);
}
.chat-conv-list { border-right: 1px solid var(--line); overflow-y: auto; padding: 8px; }
.chat-conv-list > .muted { padding: 8px; }
.chat-conv {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.chat-conv:hover { background: var(--foam); }
.chat-conv.is-active { background: var(--sea-tint); }
.chat-conv.is-closed { opacity: 0.6; }
.chat-conv-top { display: flex; align-items: center; justify-content: space-between; }
.chat-conv-preview, .chat-conv-when { display: block; font-size: 0.85rem; }

.chat-thread { display: flex; flex-direction: column; min-width: 0; }
.chat-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.chat-thread .chat-messages { background: var(--white); }
.chat-thread .chat-form { border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .chat-console { grid-template-columns: 1fr; height: auto; }
  .chat-conv-list { border-right: none; border-bottom: 1px solid var(--line); max-height: 220px; }
  .chat-thread .chat-messages { min-height: 260px; }
}

/* Admin orders: stacked cards on phones instead of a side-scrolling table */
@media (max-width: 720px) {
  .orders-table thead { display: none; }
  .orders-table, .orders-table tbody, .orders-table tr, .orders-table td { display: block; }
  .orders-table tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--foam);
    padding: 6px 14px;
    margin-bottom: 12px;
  }
  .orders-table td {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 10px;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: none;
    overflow-wrap: anywhere;
  }
  .orders-table td::before {
    content: attr(data-label);
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mist);
  }
  .orders-table td:empty { display: none; }
  .orders-table td.row-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }
  .orders-table td.row-actions::before { content: none; }
}

/* Coverage disclosure on plan cards */
.coverage-toggle {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--sea);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.coverage-toggle:hover { color: var(--sea-deep); }
.coverage-panel {
  margin: 4px 0 10px;
  padding: 10px 12px;
  background: var(--foam);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--mist);
  max-height: 220px;
  overflow-y: auto;
}
.coverage-list-items {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 18px;
}
.coverage-list-items li { break-inside: avoid; padding: 1px 0; color: var(--ink); }
@media (min-width: 600px) {
  .coverage-list-items { columns: 3; }
}
