/* ==========================================================================
   I A Expand and Communications: design system
   Stylesheet for the customer portal and staff console. The brochure website has its own copy of these tokens.
   All colors are tokens; every text pairing below meets WCAG 2.1 AA (4.5:1).
   ========================================================================== */

:root {
  /* Palette: night-sky navy with electric blue, after the glowing cube imagery on iaexpand.com */
  --midnight: #0B1F3A;      /* dark surfaces, body text on light */
  --midnight-2: #132B50;
  --midnight-3: #1D3A66;
  --signal: #1B5FD1;        /* primary actions and links on light (5.83:1 on white) */
  --signal-dark: #154BA6;
  --glow: #5CC8FF;          /* accents on dark (8.78:1 on midnight) */
  --ice: #EEF4FB;           /* light surfaces */
  --white: #FFFFFF;
  --steel: #52627A;         /* secondary text (6.2:1 on white) */
  --mist: #B9C7DB;          /* secondary text on dark (9.64:1 on midnight) */
  --control: #6B7C95;       /* form borders (4.25:1, above the 3:1 needed for UI parts) */
  --rule: #D6DFEC;          /* decorative dividers only */
  --success: #17784A;
  --success-bg: #E7F4EC;
  --danger: #B3261E;
  --danger-bg: #FCEDEC;
  --warning: #8A5300;
  --warning-bg: #FFF4DE;
  --amber: #F2B233;

  --font-display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --focus: var(--signal);
  --measure: 68ch;
  --wrap: 72rem;
}

/* --- Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--midnight);
  background: var(--white);
}
img, svg { max-width: 100%; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-stretch: 112%;
  line-height: 1.15;
  margin: 0 0 .5em;
  letter-spacing: -0.01em;
}
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 750; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: var(--measure); }
a { color: var(--signal); text-underline-offset: 0.18em; }
a:hover { color: var(--signal-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.muted { color: var(--steel); }
.small { font-size: .875rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--amber); color: var(--midnight); font-weight: 700;
  padding: .6rem 1rem; border-radius: 4px; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* --- Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.75rem; padding: .55rem 1.15rem;
  font: 600 1rem/1.2 var(--font-body);
  color: var(--white); background: var(--signal);
  border: 2px solid var(--signal); border-radius: 4px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--signal-dark); border-color: var(--signal-dark); color: var(--white); }
.btn--secondary { background: var(--white); color: var(--signal); }
.btn--secondary:hover { background: var(--ice); color: var(--signal-dark); }
.btn--danger { background: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: #8F1E18; border-color: #8F1E18; }
.btn--glow { background: var(--glow); border-color: var(--glow); color: var(--midnight); }
.btn--glow:hover { background: var(--white); border-color: var(--white); color: var(--midnight); }
.btn--outline-light { background: transparent; border-color: var(--mist); color: var(--white); }
.btn--outline-light:hover { background: var(--midnight-3); color: var(--white); border-color: var(--white); }
.btn--small { min-height: 2.25rem; padding: .35rem .8rem; font-size: .9rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.linklike {
  background: none; border: 0; padding: 0; font: inherit; color: inherit;
  text-decoration: underline; text-underline-offset: .18em; cursor: pointer;
}
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

/* --- Forms ------------------------------------------------------------------- */
.form { max-width: 40rem; }
.field { margin-bottom: 1.35rem; }
.field > label, .field legend { display: block; font-weight: 600; margin-bottom: .3rem; }
.field fieldset { border: 0; padding: 0; margin: 0; }
.field .opt { font-weight: 400; color: var(--steel); }
.field__help { color: var(--steel); font-size: .9rem; margin: 0 0 .4rem; }
.field__error { color: var(--danger); font-weight: 600; margin: 0 0 .4rem; }
.field__error::before { content: "Error: "; }
.field--invalid input, .field--invalid select, .field--invalid textarea { border-color: var(--danger); border-width: 2px; }
.field--invalid { border-left: 4px solid var(--danger); padding-left: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel],
input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=file],
select, textarea {
  width: 100%; max-width: 100%;
  font: 400 1rem/1.4 var(--font-body); color: var(--midnight);
  background: var(--white);
  border: 1px solid var(--control); border-radius: 4px;
  padding: .6rem .75rem; min-height: 2.75rem;
}
textarea { min-height: 7rem; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 1.25rem; height: 1.25rem; accent-color: var(--signal); margin: 0; }
.field--check .check { display: flex; gap: .6rem; align-items: flex-start; }
.field--check .check label { font-weight: 500; }
.field fieldset div > div, .field fieldset > div > label { display: flex; gap: .6rem; align-items: center; margin-bottom: .4rem; }
.field fieldset label { display: flex; gap: .6rem; align-items: center; font-weight: 500; }
.counter { font-size: .9rem; color: var(--steel); margin-top: .35rem; }

.error-summary {
  border: 2px solid var(--danger); border-left-width: 6px; background: var(--danger-bg);
  padding: 1rem 1.25rem; margin-bottom: 1.5rem; border-radius: 4px; max-width: 40rem;
}
.error-summary h2 { font-size: 1.1rem; margin-bottom: .4rem; }
.error-summary ul { margin: 0; padding-left: 1.2rem; }
.error-summary a { color: var(--danger); font-weight: 600; }

/* --- Notices and badges -------------------------------------------------------- */
.notices { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.notice {
  padding: .8rem 1rem; border-radius: 4px; border-left: 5px solid var(--signal);
  background: var(--ice); margin-bottom: .6rem; max-width: 52rem;
}
.notice--success { border-color: var(--success); background: var(--success-bg); }
.notice--error { border-color: var(--danger); background: var(--danger-bg); }
.notice--warning { border-color: var(--warning); background: var(--warning-bg); }

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .82rem; font-weight: 600; line-height: 1.2;
  padding: .2rem .55rem; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap;
}
.badge::before { content: ""; width: .5rem; height: .5rem; background: currentColor; }
.badge--ok { color: var(--success); background: var(--success-bg); }
.badge--ok::before { border-radius: 50%; }
.badge--bad { color: var(--danger); background: var(--danger-bg); }
.badge--bad::before { transform: rotate(45deg); }
.badge--warn { color: var(--warning); background: var(--warning-bg); }
.badge--warn::before { border-radius: 1px; }
.badge--info { color: var(--signal); background: var(--ice); }
.badge--info::before { border-radius: 50%; width: .45rem; }
.badge--neutral { color: var(--steel); background: var(--white); }

/* --- Tables -------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
caption { text-align: left; font-weight: 700; padding: .9rem 1rem .4rem; }
th, td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-size: .85rem; font-weight: 700; color: var(--steel); background: var(--ice); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 2rem 1rem; color: var(--steel); }

.pagination { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }

/* --- Brand mark ---------------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; }
.brand:hover { color: inherit; }
.brand__mark { color: var(--glow); flex: none; }
.brand__name { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 1.2rem; letter-spacing: .01em; }
.brand__sub { font-size: .85rem; color: var(--mist); }

/* ==========================================================================
   App shell (customer portal and staff console)
   ========================================================================== */
.app { background: var(--ice); }
.shell { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.shell__top {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  background: var(--midnight); color: var(--white); padding: .7rem 1.5rem; min-height: 3.75rem;
}
.shell__top :focus-visible, .shell__nav :focus-visible { outline-color: var(--glow); }
.shell__top .brand__name { font-size: 1.05rem; }
.shell__area { font-size: .85rem; color: var(--mist); padding-left: 1.25rem; border-left: 1px solid var(--midnight-3); }
.shell__user { margin-left: auto; display: flex; gap: 1.25rem; align-items: center; font-size: .92rem; }
.shell__user a, .shell__user .linklike { color: var(--white); }
.shell__role { display: block; color: var(--mist); font-size: .8rem; }
.shell__user form { margin: 0; }
.shell__nav { background: var(--midnight-2); padding: 1.25rem .75rem; }
.shell__nav ul { list-style: none; margin: 0; padding: 0; }
.shell__nav li + li { margin-top: .15rem; }
.shell__nav .nav-group { margin-top: 1.25rem; padding: 0 .75rem .35rem; font-size: .8rem; color: var(--mist); }
.shell__nav a {
  display: block; padding: .55rem .75rem; border-radius: 4px;
  color: var(--white); text-decoration: none; border-left: 3px solid transparent;
}
.shell__nav a:hover { background: var(--midnight-3); color: var(--white); }
.shell__nav a[aria-current="page"] { background: var(--midnight-3); border-left-color: var(--glow); font-weight: 700; }
.shell__main { padding: 2rem 2.25rem 4rem; min-width: 0; }

/* Staff console carries an amber rule so staff always know which site they're on. */
.app--staff .shell__top { box-shadow: inset 0 -4px 0 var(--amber); }
.app--staff .shell__area { color: var(--amber); font-weight: 700; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.85rem; margin: 0; }
.page-head__actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.breadcrumb { font-size: .9rem; margin-bottom: .35rem; }

.panel { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 1.5rem; margin-bottom: 1.5rem; }
.panel > h2 { font-size: 1.2rem; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.panel__head h2 { margin: 0; font-size: 1.2rem; }
.panel--flush { padding: 0; overflow: hidden; }
.panel--flush .panel__head { padding: 1.25rem 1.5rem 0; }
.panel--flush .table-wrap { border: 0; border-radius: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--white); border: 1px solid var(--rule); border-left: 4px solid var(--signal); border-radius: 6px; padding: 1rem 1.2rem; }
.stat__value { font-family: var(--font-display); font-stretch: 112%; font-weight: 800; font-size: 1.75rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat__label { color: var(--steel); font-size: .9rem; }
.stat a { font-size: .9rem; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .5rem 1.5rem; margin: 0; }
.dl dt { color: var(--steel); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.filters { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filters .field { margin: 0; }
.filters input, .filters select { min-width: 14rem; }

.checklist-steps { list-style: none; counter-reset: s; padding: 0; margin: 0; }
.checklist-steps li { counter-increment: s; padding: .75rem 0 .75rem 2.5rem; position: relative; border-bottom: 1px solid var(--rule); }
.checklist-steps li::before { content: counter(s); position: absolute; left: 0; top: .7rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--ice); color: var(--signal); font-weight: 700; display: grid; place-items: center; }
.checklist-steps li.done::before { content: "✓"; background: var(--success); color: var(--white); }

.preview { background: var(--ice); border-radius: 12px 12px 12px 2px; padding: .9rem 1.1rem; max-width: 26rem; white-space: pre-wrap; overflow-wrap: anywhere; }
progress { width: 100%; height: .8rem; accent-color: var(--signal); }

.qr { background: var(--white); padding: .75rem; border: 1px solid var(--rule); border-radius: 8px; width: 13rem; }
.secret { font-size: 1.05rem; letter-spacing: .06em; word-spacing: .3em; }

/* Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); background: var(--white); }
.auth__side { background: var(--midnight); color: var(--white); padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth__side p { color: var(--mist); }
.auth__side h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); font-stretch: 125%; font-weight: 850; line-height: 1.05; }
.auth--staff .auth__side { box-shadow: inset 6px 0 0 var(--amber); }
.auth__main { padding: 3rem clamp(1.5rem, 6vw, 5rem); display: flex; flex-direction: column; justify-content: center; }
.auth__main .form { max-width: 26rem; }
.auth__main h1 { font-size: 1.9rem; }
.auth__main .btn { width: 100%; max-width: 26rem; }

.session-dialog { border: 0; border-radius: 10px; padding: 1.75rem; max-width: 28rem; box-shadow: 0 20px 60px rgba(11, 31, 58, .35); }
.session-dialog::backdrop { background: rgba(11, 31, 58, .6); }
.session-dialog form { margin: 0; }

/* --- Responsive ------------------------------------------------------------------ */
@media (max-width: 60rem) {
  .two-col, .auth { grid-template-columns: minmax(0, 1fr); }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell__nav { padding: .5rem; }
  .shell__nav ul { display: flex; flex-wrap: wrap; gap: .25rem; }
  .shell__nav li + li { margin-top: 0; }
  .shell__nav .nav-group { display: none; }
  .shell__main { padding: 1.5rem 1.1rem 3rem; }
  .auth__side { padding: 2rem 1.5rem; }
}
@media (max-width: 38rem) {
  .dl { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .dl dd { margin-bottom: .6rem; }
}

@media (forced-colors: active) {
  .badge::before { forced-color-adjust: none; }
  .btn { border: 2px solid ButtonText; }
}

@media print {
  .shell__nav, .shell__top, .page-head__actions { display: none; }
  .shell { display: block; }
}

/* Tabs (used by the Services console) */
.tabs ul { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 1.5rem; padding: 0; border-bottom: 1px solid var(--rule); }
.tabs a { display: block; padding: .55rem .9rem; text-decoration: none; color: var(--midnight); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--signal); }
.tabs a[aria-current="page"] { border-bottom-color: var(--signal); font-weight: 700; }
.check { display: flex; gap: .6rem; align-items: flex-start; }
