/* Hipocti Business portal stylesheet.
   Served by the portal itself from /static (CSP: style-src 'self').
   RTL-first: logical properties only, so the same rules serve Hebrew and English.
   System fonts only: no font files are loaded. */

:root {
  --brand-primary: #4169E1;
  --brand-heading: #29387E;
  /* The logo's teal (ANSWER-464 s1). Non-text accents only: under 4.5:1 on white (tested). */
  --brand-accent: #13A89E;
  --brand-surface-soft: #D1ECFB;
  --surface: #FFFFFF;
  --text: #000000;
  --text-muted: #2E3440;
  --border: #B8C4D6;
  --focus-ring: #29387E;
  --radius-card: 1rem;
  --radius-pill: 999px;
  --shadow-card: 0 0.25rem 1.5rem rgba(41, 56, 126, 0.12);
  /* Status: text on a tint, never colour alone (REPORT-470 s4, approved ANSWER-474). */
  --status-ok-bg: #DFF3EA;
  --status-ok-fg: #14532D;
  --status-info-bg: #D1ECFB;
  --status-info-fg: #29387E;
  --status-warn-bg: #FDF0D5;
  --status-warn-fg: #6B3F00;
  --status-bad-bg: #FBE3E4;
  --status-bad-fg: #7F1D1D;
  --status-muted-bg: #E8ECF2;
  --status-muted-fg: #2E3440;
  --surface-sunken: #F4F7FB;
  --radius-control: 0.75rem;
  --font-system: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Hebrew", "Noto Sans", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.business {
  margin: 0;
  min-block-size: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-system);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--brand-surface-soft);
  text-align: start;
}

/* Header band (signed in): navy, as the sign-in panel (ANSWER-473 s4). */

.site-header {
  background: var(--brand-heading);
  color: var(--surface);
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  max-inline-size: 64rem;
  margin-inline: auto;
  padding-block: 1rem;
  padding-inline: 1rem;
}

.brand {
  margin: 0;
}

/* The header logo: a fixed height, its width follows the image. Without this the PNG renders at
   its natural width and fills the band. */

.logo {
  display: block;
  block-size: 2.25rem;
  inline-size: auto;
}

.wordmark {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--surface);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  flex: 1 1 auto;
}

.site-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-inline-start: auto;
}

.site-header a {
  color: var(--surface);
  text-decoration: none;
  font-weight: 600;
  padding-block: 0.25rem;
}

.site-header a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.site-nav a {
  padding-inline: 0.75rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.site-nav a[aria-current="page"] {
  color: var(--brand-heading);
  background: var(--surface);
  text-decoration: none;
}

.sign-out {
  margin: 0;
}

/* Main column. */

.site-main {
  flex: 1 0 auto;
  inline-size: 100%;
  max-inline-size: 64rem;
  margin-inline: auto;
  padding-block: 2rem 3rem;
  padding-inline: 1rem;
}

.site-main h1,
.site-main h2 {
  color: var(--brand-heading);
  line-height: 1.25;
}

/* Centred card for the sign-in states and the error page. */

.card {
  inline-size: 100%;
  max-inline-size: 28rem;
  margin-inline: auto;
  margin-block: 1rem;
  padding-block: 2rem;
  padding-inline: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.card-title {
  margin-block: 0 0.75rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--brand-heading);
}

.card-intro {
  margin-block: 0 1.5rem;
  color: var(--text-muted);
}

.status-code {
  margin-block: 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand-heading);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
}

/* Fields. */

.field-label {
  font-weight: 600;
  color: var(--brand-heading);
}

.field-input {
  inline-size: 100%;
  min-block-size: 3rem;
  padding-block: 0.625rem;
  padding-inline: 1rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0.75rem;
}

.field-input:hover {
  border-color: var(--brand-primary);
}

/* Pill buttons. */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 3rem;
  padding-block: 0.625rem;
  padding-inline: 1.75rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.button-primary {
  inline-size: 100%;
  margin-block-start: 0.5rem;
  color: var(--surface);
  background: var(--brand-primary);
}

.button-primary:hover {
  background: var(--brand-heading);
}

.button-quiet {
  min-block-size: 2.25rem;
  padding-inline: 1.25rem;
  color: var(--brand-heading);
  background: var(--surface);
}

.button-quiet:hover {
  background: var(--brand-surface-soft);
}

/* Visible keyboard focus everywhere. */

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.site-header a:focus-visible,
.site-header button:focus-visible,
.site-header summary:focus-visible {
  outline-color: var(--surface);
}

/* Inside a menu panel the surface is white again: the focus ring goes back to navy (Codex,
   PR 396 round 1 - a white ring on the white panel was invisible). More specific than the
   header rule above, so it wins wherever a panel opens. */

.site-header .menu-panel a:focus-visible,
.site-header .menu-panel button:focus-visible {
  outline-color: var(--focus-ring);
}

/* Signed-in screens inherit the palette; their content is unchanged. */

table {
  inline-size: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 0.5rem;
}

th,
td {
  padding-block: 0.5rem;
  padding-inline: 0.75rem;
  text-align: start;
  vertical-align: top;
  border-block-end: 1px solid var(--border);
}

th {
  color: var(--brand-heading);
  background: var(--brand-surface-soft);
}

.site-main a {
  color: var(--brand-heading);
}

/* Footer. */

.site-footer {
  background: var(--brand-heading);
  color: var(--surface);
}

.footer-brand {
  max-inline-size: 64rem;
  margin-inline: auto;
  margin-block: 0;
  padding-block: 1.25rem;
  padding-inline: 1rem;
  font-weight: 700;
}

/* Wider screens: the card gets room to breathe and the button sizes to its text. */

@media (min-width: 480px) {
  .site-main {
    padding-block: 3.5rem 4rem;
  }

  .card {
    padding-block: 2.5rem;
    padding-inline: 2.5rem;
  }

  .button-primary {
    inline-size: auto;
    align-self: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none;
    animation: none;
  }
}

/* Signed-out split screen (ANSWER-466 s2, ANSWER-474 s2): CSS only - no image beyond David's
   logos, no font, no script (the CSP is unchanged). The white logo and the tagline sit in the
   MIDDLE of the panel, both axes. The panel is navy to 80% (white on navy 10.71:1) and only then
   blends into the logo's teal, which carries no text (white on teal is 2.95:1). Mobile stacks
   the panel above the card, solid navy with a teal edge. */

body.business.auth {
  background: var(--brand-surface-soft);
}

.auth-layout {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  min-block-size: 100vh;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.5rem;
  padding-block: 4rem;
  padding-inline: 3rem;
  color: var(--surface);
  background: linear-gradient(to bottom, var(--brand-heading) 0%, var(--brand-heading) 80%, var(--brand-accent) 100%);
}

.auth-panel-logo {
  inline-size: min(14rem, 70%);
  block-size: auto;
}

.auth-tagline {
  margin: 0;
  max-inline-size: 22ch;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.card-logo {
  inline-size: 10rem;
  block-size: auto;
}

.auth-support {
  margin: 0;
}

.auth-tools {
  display: flex;
  justify-content: flex-end;
  inline-size: 100%;
  max-inline-size: 28rem;
}

@media (max-width: 48rem) {
  .auth-layout {
    grid-template-columns: minmax(0, 1fr);
    min-block-size: 0;
  }

  .auth-panel {
    padding-block: 2rem;
    padding-inline: 1.5rem;
    gap: 1rem;
    background: var(--brand-heading);
    border-block-end: 0.5rem solid var(--brand-accent);
  }

  .auth-tagline {
    font-size: 1.25rem;
  }
}

/* ------------------------------------------------------------------
   Design-system components (REPORT-470 s4, approved ANSWER-474). Shared by every
   screen; the screens adopt them unit by unit (ANSWER-473 s3). */

/* Menu (<details>): the language switch and the account menu. No script. */

.menu {
  position: relative;
}

.menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-block-size: 2.5rem;
  padding-inline: 0.875rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu > summary::after {
  content: "\25BE";
  font-size: 0.75em;
}

.menu-on-dark > summary {
  color: var(--surface);
  border: 2px solid var(--surface);
}

.menu-on-light > summary {
  color: var(--brand-heading);
  border: 2px solid var(--border);
  background: var(--surface);
}

.menu-panel {
  position: absolute;
  inset-inline-end: 0;
  inset-block-start: calc(100% + 0.5rem);
  z-index: 10;
  min-inline-size: 12rem;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  color: var(--text);
  background: var(--surface);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-card);
}

.menu-panel form {
  margin: 0;
}

.menu-item {
  display: flex;
  inline-size: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.625rem;
  padding-inline: 0.75rem;
  font: inherit;
  color: var(--text);
  text-align: start;
  background: none;
  border: 0;
  border-radius: 0.5rem;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-sunken);
}

.menu-item[aria-current="true"] {
  font-weight: 700;
  color: var(--brand-heading);
}

.menu-item[aria-current="true"]::after {
  content: "\2713";
}

.menu-meta {
  padding-block: 0.5rem;
  padding-inline: 0.75rem;
  margin-block-end: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-block-end: 1px solid var(--border);
}

/* Panel: the signed-in card, with a head and a body. */

.panel {
  margin-block-end: 1.5rem;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 1rem;
  padding-inline: 1.25rem;
  border-block-end: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 1.125rem;
}

.panel-body {
  padding: 1.25rem;
}

/* A label/value list inside a panel (the eSIM Summary, 118): two columns from tablet up,
   stacked on a phone. Logical properties only, so RTL needs nothing. */

.facts {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 1.25rem;
}

.facts dt {
  font-weight: 600;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 30rem) {
  .facts {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .facts dd {
    margin-block-end: 0.5rem;
  }
}

/* Stat card: a teal top rule (the accent as a border only). */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  margin-block-end: 1.5rem;
}

.stat {
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-card);
  border-block-start: 4px solid var(--brand-accent);
  box-shadow: var(--shadow-card);
}

.stat-label {
  margin: 0;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-value {
  margin-block: 0.25rem 0;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--brand-heading);
}

/* Data table, inside a panel: scrolls within the panel, never the page. */

.table-wrap {
  overflow-x: auto;
}

.table th {
  background: var(--surface-sunken);
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
}

/* A cell never wraps: on a narrow screen the table scrolls inside its panel (.table-wrap)
   instead of squeezing "...1234" onto two lines and a package name onto five (seen in the
   rebuild render at 375 px). Line breaks the markup asks for (<br>) still apply. */

.table th,
.table td {
  white-space: nowrap;
}

.num,
.mono {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

/* Status badges: text always present; the dot is decoration. */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding-block: 0.125rem;
  padding-inline: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  border-radius: var(--radius-pill);
}

.badge::before {
  content: "";
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.badge-ok { color: var(--status-ok-fg); background: var(--status-ok-bg); }
.badge-info { color: var(--status-info-fg); background: var(--status-info-bg); }
.badge-warn { color: var(--status-warn-fg); background: var(--status-warn-bg); }
.badge-bad { color: var(--status-bad-fg); background: var(--status-bad-bg); }
.badge-muted { color: var(--status-muted-fg); background: var(--status-muted-bg); }

/* Empty state: says what will appear here; never an error (R6). */

.empty {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding-block: 2.5rem;
  padding-inline: 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

/* Screens on the components (ANSWER-473 s3 rebuilds): a page head, a panel footer
   for "showing the first entries only", and the support contact list. */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-block-end: 1.5rem;
}

.page-head h1 {
  margin: 0;
}

/* Coverage on the Plans screen (ANSWER-510, ANSWER-512): flag + name, wrapping, and the full list
   in a native popover - no script, the CSP unchanged. */
.table td.coverage {
  white-space: normal;
  min-width: 14rem;
}
.coverage-inline,
.coverage-all {
  list-style: none;
  margin: 0;
  padding: 0;
}
.coverage-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}
/* (I-c): at most two lines at every width - ONLY where the popover trigger exists, which
   names the total, so hiding is honest. A list of four or fewer has no trigger, so it is
   never clipped: long names may take a third line rather than hide a country (Codex,
   PR 418 round 1). */
.coverage-inline.coverage-clamped {
  max-height: calc(2 * 1.5rem + 0.25rem);
  overflow: hidden;
}
.coverage-inline li {
  height: 1.5rem;
}
.coverage-inline li,
.coverage-all li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.flag {
  width: 20px;
  height: 15px;
  flex: none;
  border-radius: 2px;
}
.coverage-more {
  margin-top: 0.35rem;
}
.coverage-note {
  margin: 0.35rem 0 0;
  font-size: 0.875em;
}
.coverage-panel {
  max-height: 80vh;
  width: min(48rem, calc(100vw - 2rem));
  overflow-y: auto;
  padding: 1.25rem;
  border: 1px solid currentColor;
  border-radius: 0.5rem;
}
.coverage-panel::backdrop {
  background: rgb(0 0 0 / 0.35);
}
.coverage-all {
  columns: 3 12rem;
  column-gap: 1.5rem;
  margin: 0.75rem 0 1rem;
}
.coverage-all li {
  display: flex;
  break-inside: avoid;
  padding: 0.15rem 0;
}
@media (max-width: 600px) {
  .coverage-panel {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    border-radius: 0;
  }
  .coverage-all {
    columns: 1;
  }
}

.panel-foot {
  margin: 0;
  padding-block: 0.75rem;
  padding-inline: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-block-start: 1px solid var(--border);
}

.support-panel h1 {
  margin: 0;
  font-size: 1.5rem;
}

.contact-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-inline-start: 1.25rem;
}

/* The consumer reveal page (/e/<token>, M4): the QR is inline SVG from the POST response, sized to the
   card and centred; no image URL of its own (design 5 s5.4). */
.reveal-qr {
  inline-size: min(100%, 18rem);
  margin-inline: auto;
}

.reveal-qr svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
}
