/* Health Management — Licensing portal
   One stylesheet, no dependencies, no web fonts (the portal must look the same
   on a locked-down server as it does on a laptop). */

:root {
  --ink:        #14182a;
  --ink-soft:   #4a5266;
  --ink-faint:  #7b8296;
  --line:       #e2e5ee;
  --line-soft:  #eef0f6;
  --paper:      #ffffff;
  --wash:       #f5f6fa;
  --royal:      #2c3ea8;
  --royal-dk:   #1f2c7c;
  --royal-lt:   #eef0ff;
  --teal:       #0f8f80;
  --violet:     #7048b6;
  --amber:      #b5760a;
  --rose:       #b8423e;
  --green:      #1c7a4d;
  --radius:     14px;
  --shadow:     0 1px 2px rgba(20, 24, 42, .05), 0 10px 30px -18px rgba(20, 24, 42, .28);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--wash);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--royal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }

.mono { font-family: var(--mono); font-size: .92em; letter-spacing: .02em; }
.small { font-size: 13px; }
.muted { color: var(--ink-faint); }
.sub { color: var(--ink-faint); font-size: 12px; margin-top: 2px; }
.centred { text-align: center; }
.grow { flex: 1 1 auto; }
.mt { margin-top: 18px; }
.right { text-align: right; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }

/* --------------------------------- top bar -------------------------------- */

.top {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 26px;
  height: 62px;
  background: #10162e;
  background-image: linear-gradient(180deg, #141b38, #0e1329);
  color: #fff;
  flex: 0 0 auto;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #cfd6ff;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.brand-name { color: #fff; font-weight: 650; font-size: 15px; }
.brand-name:hover { text-decoration: none; color: #dfe3ff; }

.top-nav { display: flex; gap: 4px; }
.top-nav a {
  color: #b9c0dc;
  padding: 8px 13px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
}
.top-nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); text-decoration: none; }
.top-nav a.on { color: #fff; background: rgba(255, 255, 255, .13); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #dfe3f2; }
.who strong { font-weight: 600; }

.role {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 8px;
}
.role-developer { background: #e7eaff; color: #2c3ea8; }
.role-agent { background: #eef0f6; color: #4a5266; }
/* On the dark bar the same chips read the other way round. */
.top .role-developer { background: #3a4bd6; color: #fff; }
.top .role-agent { background: rgba(255, 255, 255, .16); color: #e8ebfb; }

.units-pill {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  background: #e6f6f2;
  border: 1px solid #bfe7dd;
  color: #0c6a5f;
  border-radius: 999px;
  padding: 3px 11px;
  white-space: nowrap;
}
/* Same pill, but on the dark top bar. */
.top .units-pill {
  background: rgba(15, 143, 128, .22);
  border-color: rgba(56, 209, 186, .38);
  color: #b9f4ea;
  font-weight: 600;
}

.link { color: #b9c0dc; font-size: 14px; }
.link:hover { color: #fff; }

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

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 26px 48px;
  flex: 1 1 auto;
}

.page-title { font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.page-sub { margin: 6px 0 22px; color: var(--ink-soft); font-size: 14.5px; }

.foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-faint);
  font-size: 12.5px;
}
.foot .grow { flex: 1; }

/* ---------------------------------- cards -------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--royal);
}
.stat--teal::before   { background: var(--teal); }
.stat--violet::before { background: var(--violet); }
.stat--amber::before  { background: var(--amber); }
.stat--rose::before   { background: var(--rose); }

.stat__label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stat__value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.stat__foot { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }

/* Two panels side by side; they stack on a narrow screen. */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px 22px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { flex: 1 1 auto; }

/* --------------------------------- forms --------------------------------- */

label, .label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0;
}
label small, label .hint {
  display: block;
  font-weight: 400;
  color: var(--ink-faint);
  font-size: 12.5px;
  margin-top: 3px;
  line-height: 1.45;
}

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: #fdfdfe;
  border: 1px solid #d5d9e6;
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--royal);
  box-shadow: 0 0 0 3px rgba(44, 62, 168, .14);
  background: #fff;
}
input:disabled, button:disabled { opacity: .55; cursor: not-allowed; }
input.mono { font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; }
::placeholder { color: #a8adbe; }

textarea { resize: vertical; min-height: 84px; }

.keybox {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  word-break: break-all;
  background: #f7f8fc;
  border-color: #d8dcea;
  color: #1d2440;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.issue-form { display: grid; gap: 16px; }
.issue-form .wide { grid-column: 1 / -1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #3a4cc4, var(--royal-dk));
  border: 1px solid var(--royal-dk);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 24, 42, .18);
  transition: transform .06s, filter .15s;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 8px 14px; font-size: 13.5px; }
.btn.ghost {
  color: var(--royal);
  background: #fff;
  border-color: #ccd2e6;
  box-shadow: none;
}
.btn.ghost:hover { background: var(--royal-lt); }
.btn-block { width: 100%; }

.filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.filters label { min-width: 150px; }
.filters .grow { min-width: 230px; }

.inline-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
  align-items: start;
  margin-top: 22px;
}
/* One small action box: assign units, suspend, set a password. */
.mini {
  display: grid;
  gap: 10px;
  background: #fafbff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 16px 16px;
  align-content: start;
}
.mini label { font-size: 12.5px; font-weight: 600; }
.mini input { margin-top: 5px; padding: 8px 10px; font-size: 14px; }
.mini .btn { justify-self: start; margin-top: 2px; }
.mini .hint { font-size: 12px; color: var(--ink-faint); line-height: 1.45; }

/* --------------------------------- tables -------------------------------- */

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: #f8f9fd;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbff; }
td.neg { color: var(--rose); font-weight: 600; }
td.pos { color: var(--green); font-weight: 600; }

.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 650;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.pill.live  { background: #e6f6ef; color: var(--green); }
.pill.soon  { background: #fdf3e0; color: var(--amber); }
.pill.dead  { background: #fdeceb; color: var(--rose); }

.chip {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--royal);
  background: var(--royal-lt);
  border: 1px solid #d6dafb;
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
}
.chip:hover { background: #e3e7ff; }
.chip.is-selected { background: var(--royal); border-color: var(--royal); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.agent-row.is-selected { background: var(--royal-lt); }

/* -------------------------------- messages ------------------------------- */

.flash {
  border-radius: 11px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}
.flash.ok    { background: #e9f7f0; border-color: #bfe7d4; color: #14603c; }
.flash.error { background: #fdecea; border-color: #f6cdc9; color: #8f2f2b; }

.ok-note {
  background: #e9f7f0;
  border: 1px solid #bfe7d4;
  color: #14603c;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin-top: 12px;
}

/* --------------------------------- issued -------------------------------- */

.panel.issued {
  border-color: #c3cbf3;
  background: linear-gradient(180deg, #f7f8ff, #fff);
}
.issued__head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.issued__head h2 { flex: 1 1 auto; }
.issued p { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; }

/* --------------------------------- facts --------------------------------- */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--line-soft);
}
.facts > div { background: #fff; padding: 12px 16px; }
.facts span {
  display: block;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 2px;
}
.facts strong { font-weight: 600; font-size: 14px; }

/* -------------------------------- sign-in -------------------------------- */

body.signin-page,
body.install-page { background: #0b1024; display: block; }

.signin {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  min-height: 100vh;
}

.signin__art {
  position: relative;
  padding: 56px 54px;
  color: #e9ecfb;
  background:
    radial-gradient(900px 500px at 12% 8%, rgba(70, 96, 232, .55), transparent 62%),
    radial-gradient(700px 460px at 88% 92%, rgba(15, 143, 128, .42), transparent 60%),
    linear-gradient(160deg, #131a3c, #0a0e20 70%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  overflow: hidden;
}
.signin__art::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 40% 35%, #000, transparent 78%);
  pointer-events: none;
}
.signin__art .mark-lg {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #b9c4ff;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  padding: 5px 12px;
  align-self: flex-start;
}
.signin__art h1 {
  font-size: 34px;
  font-weight: 720;
  letter-spacing: -.025em;
  max-width: 15ch;
}
.signin__art p { margin: 0; color: #aeb7d8; font-size: 15px; max-width: 40ch; line-height: 1.6; }

.signin__points { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 12px; max-width: 42ch; }
.signin__points li {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: #c6cde8;
  line-height: 1.5;
}
.signin__points b { color: #fff; font-weight: 600; }
.signin__points span.dot {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.signin__form {
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 15px;
  padding: 56px 48px;
  text-align: left;
  color: var(--ink);
}
/* The whole column is centred, the controls inside it are not. */
.signin__form > * { width: 100%; max-width: 400px; margin-inline: auto; }
.signin__form h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.signin__form label { margin-bottom: 0; }
.signin__form .btn { margin-top: 6px; }
.signin__form .fine { font-size: 12.5px; color: var(--ink-faint); margin: 6px auto 0; line-height: 1.5; }
.signin__form .flash { margin-bottom: 0; }
.divider { height: 1px; background: var(--line); margin: 18px auto; width: 100%; max-width: 400px; }

/* --------------------------------- install ------------------------------- */

body.install-page { background: var(--wash); }
.install { max-width: 780px; margin: 26px auto 60px; padding: 30px 34px 34px; }
.install h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
/* A step is a form: normal text, with a numbered badge on its heading. */
.install form.step {
  display: grid;
  gap: 15px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.install form.step h2 { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.install .num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--royal-lt);
  color: var(--royal);
  font-size: 13px;
  font-weight: 700;
}
.install .fine { font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; }
.install .divider { margin: 26px 0 6px; max-width: none; }

/* -------------------------------- responsive ----------------------------- */

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .signin { grid-template-columns: 1fr; }
  .signin__art { padding: 40px 28px; }
  .signin__art h1 { font-size: 27px; }
  .signin__form { padding: 36px 28px 48px; }
  .two { grid-template-columns: 1fr; }
  .top { height: auto; flex-wrap: wrap; padding: 12px 18px; gap: 12px; }
  .top-nav { order: 3; width: 100%; overflow-x: auto; }
  .top-right { gap: 10px; }
  .who strong { display: none; }
  .wrap { padding: 22px 16px 40px; }
}
