/* MiGateway Shire, styled from Matt Englehart's "Launcher Wireframe v0.2" (Rich, 2026-10-12: "i like it").
   Brand tokens: MiHIN letterhead, MarComm FINAL 01.01.26 (BSASD-14949), as recorded in the wireframe; not re-checked
   with MarComm. Section tints, icon colours and text greys are the wireframe's derived values, "not brand-approved".
   Every colour is a theme token, so a per-HIN theme is one override of the block below.
   Open Sans is used when installed; no web font is fetched (no third-party request from a health-data product). */
:root {
  --mihin-navy: #223C89; --mihin-navy-2: #26358E; --mihin-gray: #949599; --mihin-gray-2: #8A8B8D;
  --brand: var(--mihin-navy); --brand-deep: var(--mihin-navy-2); --brand-rule: var(--mihin-gray); --brand-ink: #ffffff;
  --bg: #f4f5f8; --surface: #ffffff; --card: var(--surface); --line: #dde0e7; --line-2: #c3c8d3;
  --ink: #1d2433; --ink-2: #404040; --ink-3: #66676b; --muted: var(--ink-3);
  --accent: var(--brand); --accent-soft: #e9edf7;
  --sec0: #223C89; --sec1: #3A5DB8; --sec2: #56688F; --sec3: #16275C; --sec4: #6E6F74; --sec5: #2F4A9E; --sec6: #4B5D7E; --sec7: #6B6C70;
  --warn: #a35f00; --warn-soft: #fff4e0; --warn-bg: var(--warn-soft); --warn-ink: var(--warn);
  --ok: #1f7a4d; --ok-soft: #e5f5ec; --error: #a4262c;
  --radius: 10px;
  font-family: "Open Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; font-weight: 700; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.page-title { margin: 0; padding-bottom: 0.4rem; border-bottom: 4px solid var(--brand); display: inline-block; }
.page-sub { color: var(--ink-3); margin: 0.4rem 0 1rem; }

/* The navy band with the reversed wordmark, as on the letterhead. */
.top { display: flex; align-items: center; gap: 1.25rem; padding: 0.6rem 1.5rem; background: var(--brand-deep); color: var(--brand-ink); }
.top a { color: var(--brand-ink); text-decoration: none; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.brand .mark { font-weight: 800; letter-spacing: 0.04em; }
.brand .divider { width: 1px; height: 1.3rem; background: rgba(255, 255, 255, 0.5); }
.brand .product { font-weight: 600; }
#nav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
#nav a { opacity: 0.85; font-size: 0.95rem; }
#nav a:hover, #nav a.active { opacity: 1; text-decoration: underline; }
#who { display: flex; gap: 0.75rem; align-items: center; font-size: 0.9rem; position: relative; }
#who .link { color: var(--brand-ink); }
.avatar { width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.7); background: var(--brand); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.user-menu { position: absolute; right: 0; top: 2.6rem; z-index: 20; width: 300px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); padding: 0.9rem 1rem; }
.user-menu .who-name { font-weight: 700; }
/* #who makes header links white; inside the white menu they must be brand blue again (Add, Verify, Sign out). */
#who .user-menu a, #who .user-menu .link { color: var(--brand); }
.user-menu hr { border: none; border-top: 1px solid var(--line); margin: 0.7rem 0; }

#banner { background: var(--warn-bg); color: var(--warn-ink); padding: 0.6rem 1.5rem; border-bottom: 1px solid #e8d38f; }
#banner button { margin-left: 0.5rem; }

main { flex: 1; padding: 1.5rem; max-width: 1240px; width: 100%; margin: 0 auto; }
.foot { padding: 0.75rem 1.5rem; color: var(--ink-3); font-size: 0.8rem; text-align: center; border-top: 3px solid var(--brand-rule); background: var(--surface); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.narrow { max-width: 460px; margin: 3rem auto; }
.muted { color: var(--ink-3); }
.error { color: var(--error); }
.okay { color: var(--ok); }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.row h1 { margin: 0; flex: 1; }
.spacer { flex: 1; }

button, .button { font: inherit; padding: 0.45rem 0.9rem; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { border-color: var(--brand); }
button.primary, .button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.danger { color: var(--error); border-color: var(--error); }
pre.json { white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem; font-size: 0.85rem; }
button.link { background: none; border: none; padding: 0; text-decoration: underline; color: var(--brand); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.seg { border-radius: 0; margin-left: -1px; }
button.seg:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
button.seg:last-child { border-radius: 0 6px 6px 0; }
button.seg.on { background: var(--accent-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
input, select, textarea { font: inherit; padding: 0.45rem 0.6rem; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; color: var(--ink); }
input[type="search"] { min-width: 280px; }
textarea { width: 100%; max-width: 480px; }
label.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; font-size: 0.9rem; }
label.field input, label.field select, label.field textarea { width: 100%; max-width: 480px; }
label.check { display: flex; gap: 0.5rem; align-items: center; padding: 0.25rem 0; }

/* ---- the launch pad (wireframe v0.2) ---- */
.lp-toolbar { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.lp-toolbar .search { flex: 1; min-width: 220px; max-width: 420px; }
.lp-toolbar kbd { font-size: 0.75rem; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 0.3rem; color: var(--ink-3); }
.lp { display: grid; grid-template-columns: 210px 1fr; gap: 1.5rem; align-items: start; }
.rail { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.15rem; }
.rail a { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.6rem; border-radius: 6px; color: var(--ink-2); text-decoration: none; font-size: 0.92rem; }
.rail a:hover { background: var(--accent-soft); color: var(--brand); }
.rail .count { color: var(--ink-3); font-size: 0.85rem; }
.section { margin-bottom: 1.5rem; }
.section-head { display: flex; align-items: baseline; gap: 0.6rem; border-bottom: 2px solid var(--line); padding-bottom: 0.35rem; margin-bottom: 0.8rem; }
.section-head h2 { margin: 0; font-size: 1.05rem; }
.section-head .count { color: var(--ink-3); font-size: 0.85rem; }
.section-head .desc { color: var(--ink-3); font-size: 0.85rem; flex: 1; }
.section-head button { font-size: 0.85rem; padding: 0.15rem 0.5rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.tile { position: relative; display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; min-height: 150px; cursor: pointer; }
.tile:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(34, 60, 137, 0.12); }
.tile .icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.1rem; overflow: hidden; }
.tile .icon img { width: 100%; height: 100%; object-fit: cover; }
.tile .name { font-weight: 700; color: var(--ink); }
.tile .desc { color: var(--ink-3); font-size: 0.85rem; line-height: 1.35; flex: 1; }
.tile .meta { display: flex; gap: 0.4rem; align-items: center; font-size: 0.78rem; color: var(--ink-3); flex-wrap: wrap; }
.tile .corner { position: absolute; top: 0.5rem; right: 0.5rem; display: flex; gap: 0.15rem; }
.tile .corner button { border: none; background: none; padding: 0.15rem 0.35rem; color: var(--ink-3); font-size: 1rem; line-height: 1; }
.tile .corner button:hover { color: var(--brand); }
.tile .corner .fav.on { color: #c79a00; }
.badge { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.badge.ial { background: var(--warn-soft); color: var(--warn); border: 1px solid #f0d199; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.mode { background: var(--accent-soft); color: var(--brand); }
.show-all { margin-top: 0.6rem; }

/* Icons layout: about three times as many on screen. */
.layout-icons .tiles { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.75rem; }
.layout-icons .tile { align-items: center; text-align: center; min-height: 0; padding: 0.8rem 0.5rem; }
.layout-icons .tile .desc, .layout-icons .tile .meta { display: none; }
.layout-icons .tile .name { font-size: 0.85rem; font-weight: 600; }
/* List layout: power users and accessibility. */
.layout-list .tiles { grid-template-columns: 1fr; gap: 0.4rem; }
.layout-list .tile { flex-direction: row; align-items: center; min-height: 0; padding: 0.55rem 0.8rem; }
.layout-list .tile .icon { width: 32px; height: 32px; font-size: 0.85rem; border-radius: 7px; }
.layout-list .tile .name { min-width: 200px; }
.layout-list .tile .corner { position: static; order: 9; }

/* Menus and dialogs. */
.menu { position: absolute; z-index: 25; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); padding: 0.3rem; min-width: 190px; }
.menu button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 0.45rem 0.6rem; border-radius: 6px; }
.menu button:hover { background: var(--accent-soft); color: var(--brand); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; max-width: 520px; width: calc(100% - 2rem); }
dialog::backdrop { background: rgba(20, 30, 60, 0.45); }
dialog h3 { margin-top: 0; }

/* An app opened within Shire, with the app switcher. */
.within { display: flex; flex-direction: column; height: calc(100vh - 150px); }
.within-bar { display: flex; gap: 1rem; align-items: center; padding: 0 0 0.5rem; flex-wrap: wrap; }
.within-bar .spacer { flex: 1; }
.within iframe { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* Locked to one app (spec LP-5): the app fills the window. */
body.locked .top, body.locked .foot, body.locked #banner { display: none; }
body.locked main { padding: 0; max-width: none; }
body.locked .within { height: 100vh; }
body.locked .within iframe { border: none; border-radius: 0; }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); font-size: 0.92rem; vertical-align: top; }
th { color: var(--ink-3); font-weight: 600; }
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 0.4rem; align-items: center; padding: 0.2rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 0.88rem; }
.chip button { border: none; padding: 0 0.2rem; background: none; color: var(--error); }
.steps { display: flex; gap: 0.5rem; margin-bottom: 1rem; color: var(--ink-3); font-size: 0.9rem; }
.steps .now { color: var(--ink); font-weight: 600; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0; }
dl.facts dt { color: var(--ink-3); }
dl.facts dd { margin: 0; }
.tile-wrap { display: flex; flex-direction: column; gap: 0.35rem; }

/* Phones and tablets (spec NF-11). */
@media (max-width: 900px) {
  .lp { grid-template-columns: 1fr; }
  .rail { position: static; flex-direction: row; flex-wrap: wrap; gap: 0.3rem; }
  .rail a { border: 1px solid var(--line); background: var(--surface); }
}
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.6rem 1rem; }
  #nav { order: 3; flex-basis: 100%; gap: 0.4rem 0.9rem; }
  #who { margin-left: auto; }
  main { padding: 1rem; }
  .card { padding: 1rem; }
  .narrow { margin: 1.5rem auto; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  input[type="search"] { min-width: 0; width: 100%; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
  .layout-list .tile .name { min-width: 0; }
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dd { margin-bottom: 0.4rem; overflow-wrap: anywhere; }
  .within { height: calc(100vh - 180px); }
  .user-menu { width: min(300px, calc(100vw - 2rem)); }
}

/* Section colours for app icons (wireframe v0.2 tints; "not brand-approved"). */
.tile .icon[data-sec="0"] { background: var(--sec0); } .tile .icon[data-sec="1"] { background: var(--sec1); }
.tile .icon[data-sec="2"] { background: var(--sec2); } .tile .icon[data-sec="3"] { background: var(--sec3); }
.tile .icon[data-sec="4"] { background: var(--sec4); } .tile .icon[data-sec="5"] { background: var(--sec5); }
.tile .icon[data-sec="6"] { background: var(--sec6); } .tile .icon[data-sec="7"] { background: var(--sec7); }

/* ---- the admin console (Matt Englehart's Admin Consoles Wireframe v0.1) ---- */
.admin { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: start; }
.admin-nav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; }
.admin-scope { font-weight: 700; color: var(--brand); padding: 0.2rem 0.5rem 0.6rem; border-bottom: 3px solid var(--brand); margin-bottom: 0.4rem; font-size: 0.92rem; }
.admin-nav-head { text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72rem; color: var(--ink-3); padding: 0.8rem 0.5rem 0.25rem; }
.admin-nav a { display: block; padding: 0.4rem 0.6rem; border-radius: 6px; color: var(--ink-2); text-decoration: none; font-size: 0.93rem; }
.admin-nav a:hover { background: var(--accent-soft); color: var(--brand); }
.admin-nav a.active { background: var(--accent-soft); color: var(--brand); font-weight: 600; border-left: 3px solid var(--brand); }
.admin-main { min-width: 0; }
.warnbox { background: var(--warn-soft); color: var(--warn); border-color: #f0d199; }
.badge.bad { background: #fdecec; color: var(--error); border: 1px solid #f3c2c4; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { display: block; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--radius); padding: 0.9rem 1rem; color: var(--ink); text-decoration: none; }
a.stat:hover { border-color: var(--brand); }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--brand); }
.stat-label { color: var(--ink-3); font-size: 0.88rem; }
.row.bulk { background: var(--accent-soft); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.75rem; }
.matrix-wrap { overflow-x: auto; }
.matrix-wrap table td, .matrix-wrap table th { white-space: nowrap; }
details.card summary { cursor: pointer; font-weight: 600; }

@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .admin-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 0.3rem; }
  .admin-nav-head { display: none; }
  .admin-scope { flex-basis: 100%; }
}
/* Phones (spec NF-11): table rows become cards, each cell labelled with its column. */
@media (max-width: 640px) {
  table.cards-on-phone { display: block; white-space: normal; overflow: visible; background: none; }
  table.cards-on-phone thead { display: none; }
  table.cards-on-phone tbody, table.cards-on-phone tr, table.cards-on-phone td { display: block; width: 100%; }
  table.cards-on-phone tr { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.75rem; margin-bottom: 0.6rem; }
  table.cards-on-phone td { border: none; padding: 0.2rem 0; }
  table.cards-on-phone td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; color: var(--ink-3); font-size: 0.78rem; }
  .matrix-wrap table.cards-on-phone td { white-space: normal; }
}
