:root {
  --ink: #171b24;
  --muted: #667085;
  --line: #dfe4ea;
  --paper: #ffffff;
  --canvas: #f4f6f8;
  --navy: #0d1420;
  --teal: #0a8f87;
  --teal-bright: #15d3c3;
  --violet: #6d28d9;
  --amber: #d97706;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--canvas); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px max(20px, calc((100vw - 1240px) / 2)); background: #050b14; color: white; }
.brand { display: flex; align-items: center; gap: 15px; font-weight: 800; }
.brand img { width: 150px; height: 44px; object-fit: contain; object-position: left center; }
.brand span { padding-left: 15px; border-left: 1px solid #344054; color: #d8e1ea; font-size: 14px; }
.account { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.account a { color: var(--teal-bright); font-weight: 700; }
.footer { padding: 24px; border-top: 1px solid var(--line); color: var(--muted); background: white; text-align: center; font-size: 12px; }
.auth-body { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 40px 20px; background: #101722; }
.auth-card { width: min(100%, 470px); padding: 34px; border-radius: 8px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.auth-card h1, .install-card h1 { margin: 8px 0 10px; font-size: 32px; letter-spacing: 0; }
.eyebrow { margin: 0; color: var(--teal); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.6; }
.form-stack, .form-grid { display: grid; gap: 18px; margin-top: 24px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 8px; color: #344054; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cfd6df; border-radius: 6px; background: white; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(21,211,195,.16); }
.button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 17px; border: 0; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 800; }
.button.primary { background: var(--teal); color: white; }
.button.secondary { border: 1px solid #cfd6df; background: white; color: var(--ink); }
.button.warning { background: var(--amber); color: white; }
.button.derm { background: var(--violet); color: white; }
.alert { margin: 20px 0 0; padding: 13px 15px; border-radius: 6px; font-size: 13px; font-weight: 700; }
.alert.error { border: 1px solid #fecaca; background: #fff1f2; color: #9f1239; }
.alert.success { border: 1px solid #a7f3d0; background: #ecfdf5; color: #065f46; }
.invitation-panel { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 18px; margin: 0 0 22px; padding: 24px; border: 1px solid #7dd3c7; border-radius: 8px; background: #effcf9; }
.invitation-panel h2 { margin: 7px 0; font-size: 22px; }
.invitation-panel p:last-child { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.invitation-panel textarea { grid-column: 1 / -1; width: 100%; min-height: 255px; resize: vertical; padding: 14px; border: 1px solid #b8d8d3; border-radius: 6px; background: white; color: var(--ink); font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.install-shell { width: min(1100px, calc(100% - 40px)); display: grid; grid-template-columns: .75fr 1.25fr; margin: 50px auto; overflow: hidden; border-radius: 8px; box-shadow: 0 24px 70px rgba(0,0,0,.22); }
.install-brand { padding: 48px 38px; background: #08111c; color: white; }
.install-brand img { width: 210px; }
.install-brand p { margin-top: 32px; color: #c7d2de; line-height: 1.7; }
.install-brand ul { margin: 34px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; color: #dce5ed; font-size: 14px; }
.install-brand li { padding-left: 18px; border-left: 3px solid var(--teal-bright); }
.install-card { width: 100%; max-width: none; border-radius: 0; box-shadow: none; }
.form-separator { height: 1px; background: var(--line); }
.admin-layout { width: min(1240px, calc(100% - 36px)); min-height: calc(100vh - 76px); display: grid; grid-template-columns: 220px 1fr; gap: 32px; margin: 34px auto 60px; }
.admin-nav { align-self: start; display: grid; gap: 5px; padding: 14px; border-radius: 8px; background: var(--navy); color: white; }
.admin-nav a { padding: 12px; border-radius: 5px; font-size: 13px; font-weight: 700; }
.admin-nav a:hover { background: rgba(255,255,255,.08); color: var(--teal-bright); }
.nav-label { margin: 5px 12px 10px; color: #8492a6; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.admin-content { min-width: 0; }
.admin-content > h1 { margin: 8px 0 26px; font-size: 36px; letter-spacing: 0; }
.pending-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding: 20px; border: 1px solid #f2c879; border-radius: 8px; background: #fff8e8; }
.pending-banner h2 { margin: 5px 0; font-size: 21px; }
.pending-banner p:last-child { margin: 0; color: #714b0a; font-size: 14px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metrics article { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.metrics span, .metrics small { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; margin: 12px 0 7px; font-size: 31px; }
.metrics .metric-alert { border-color: #f2c879; background: #fffaf0; }
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px; }
.product-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.product-grid article > span { display: block; width: 36px; height: 4px; margin-bottom: 15px; border-radius: 4px; background: var(--teal); }
.product-grid article:nth-child(2) > span { background: var(--violet); }
.product-grid article:nth-child(3) > span { background: #d97706; }
.product-grid article:nth-child(4) > span { background: #2563eb; }
.product-grid h2 { min-height: 34px; margin: 0; font-size: 14px; }
.product-grid strong { display: block; margin-top: 12px; font-size: 27px; }
.product-grid small { color: var(--muted); }
.panel, .client-card, .empty { margin-top: 22px; padding: 25px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.panel h2, .client-card h2 { margin: 7px 0; font-size: 23px; }
.panel > .button { margin-top: 16px; }
.empty { text-align: center; color: var(--muted); }
.client-card { scroll-margin-top: 20px; }
.client-card.needs-attention { border-color: #edbd61; box-shadow: 0 0 0 3px #fff0c9; }
.client-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.account-editor { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.account-editor summary { cursor: pointer; font-size: 13px; font-weight: 800; }
.add-access { display: flex; align-items: end; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.add-access label { flex: 1; }
.badges { display: flex; flex-wrap: wrap; gap: 7px; }
.badge { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: #eaf7f5; color: #08766f; font-size: 11px; font-weight: 800; }
.badge.pending { background: #fff0c9; color: #8a5300; }
.badge.active { background: #d1fae5; color: #065f46; }
.licence-grid { display: grid; gap: 14px; margin-top: 22px; }
.subpanel { padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfc; }
.subpanel-title { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.subpanel-title span { color: var(--muted); font-size: 11px; font-weight: 800; }
fieldset { margin: 18px 0; padding: 0; border: 0; }
legend { margin-bottom: 10px; font-size: 13px; font-weight: 800; }
.checks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.checks label { min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: white; font-weight: 500; }
.checks input { width: 16px; min-height: 16px; box-shadow: none; }
.client-devices, .history { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading h3 { margin: 5px 0 0; }
.section-heading > p { max-width: 480px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.device-row { display: grid; grid-template-columns: 1fr 180px auto; align-items: end; gap: 15px; margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: #fafbfc; }
.device-row.device-pending { border-color: #edbd61; background: #fffaf0; }
.device-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.device-row p, .device-row small { display: block; margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.status { padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.status.active { background: #d1fae5; color: #065f46; }
.status.pending { background: #fde68a; color: #854d0e; }
.status.revoked { background: #ffe4e6; color: #9f1239; }
.empty-inline { padding: 15px; border: 1px dashed #cbd5e1; border-radius: 6px; color: var(--muted); font-size: 13px; }
.history summary { cursor: pointer; font-size: 13px; font-weight: 800; }
.table-wrap { margin-top: 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #f4f6f8; color: var(--muted); text-transform: uppercase; }
.result-ok { color: #067647; font-weight: 800; }
.result-no { color: #b42318; font-weight: 800; }
.user-shell { min-height: calc(100vh - 76px); padding: 55px max(20px, calc((100vw - 1050px) / 2)); background: #111827; }
.user-hero { color: white; }
.user-hero h1 { margin: 12px 0; font-size: 46px; }
.user-hero > p:last-child { max-width: 680px; color: #cbd5e1; line-height: 1.7; }
.software-card { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 25px; margin-top: 32px; padding: 28px; border-radius: 8px; background: white; }
.software-card .button { grid-column: 1 / -1; }
.software-mark { width: 46px; height: 46px; display: grid; place-items: center; float: left; margin-right: 15px; border-radius: 7px; background: var(--violet); color: white; font-size: 23px; font-weight: 900; }
.software-card h2 { margin: 6px 0; }
.user-help { margin: 18px 0 0; text-align: right; }
.user-help a, .launcher-help { color: #8fe3da; font-size: 13px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.onboarding-shell { width: min(900px, calc(100% - 36px)); margin: 38px auto 60px; }
.onboarding-heading { max-width: 720px; }
.onboarding-heading h1 { margin: 9px 0 12px; font-size: 38px; }
.onboarding-heading > p:last-child { color: var(--muted); line-height: 1.65; }
.onboarding-steps { display: grid; gap: 12px; margin-top: 28px; }
.onboarding-steps article { display: grid; grid-template-columns: 45px 1fr; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.onboarding-steps article > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: white; font-weight: 900; }
.onboarding-steps h2 { margin: 1px 0 7px; font-size: 19px; }
.onboarding-steps p { margin: 0; color: var(--muted); line-height: 1.55; }
.download-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.download-unavailable { min-height: 43px; display: inline-flex; align-items: center; padding: 10px 15px; border: 1px dashed #b8c0cc; border-radius: 6px; color: var(--muted); background: #f8fafc; font-size: 13px; font-weight: 700; }
.onboarding-note { margin-top: 16px; padding: 19px 22px; border-left: 4px solid var(--teal); background: #eaf7f5; }
.onboarding-note p { margin: 6px 0 0; color: #365a56; line-height: 1.55; }
.onboarding-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.launcher { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 35px 20px; background: #111827; }
.launcher-card { width: min(660px, 100%); padding: 34px; border-radius: 8px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.launcher-heading { display: flex; align-items: center; gap: 4px; }
.launcher-heading h1 { margin: 6px 0 0; font-size: 27px; }
.derm-text { color: var(--violet); }
.launcher-status { min-height: 95px; display: flex; align-items: center; gap: 17px; margin-top: 28px; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; }
.launcher-status p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.spinner { width: 23px; height: 23px; flex: 0 0 auto; border: 3px solid #ddd6fe; border-top-color: var(--violet); border-radius: 50%; }
.launcher-status.busy .spinner { animation: spin .8s linear infinite; }
.launcher-device { color: var(--muted); font-size: 13px; }
.launcher-actions { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 20px; }
.launcher-help { color: var(--violet); }
.app-frame { position: fixed; inset: 0; z-index: 100; background: #f6f3fb; }
.app-frame iframe { width: 100%; height: 100%; border: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { grid-template-columns: repeat(3, 1fr); }
  .nav-label { grid-column: 1 / -1; }
  .metrics, .product-grid { grid-template-columns: repeat(2, 1fr); }
  .checks { grid-template-columns: repeat(2, 1fr); }
  .device-row { grid-template-columns: 1fr 180px; }
  .device-row .button { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .topbar { align-items: flex-start; }
  .brand span, .account span { display: none; }
  .brand img { width: 135px; }
  .auth-card { padding: 26px; }
  .install-shell { width: min(100% - 24px, 700px); grid-template-columns: 1fr; margin: 20px auto; }
  .install-brand { padding: 28px; }
  .form-grid, .metrics, .product-grid, .checks, .device-row { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .admin-layout { width: min(100% - 24px, 800px); margin-top: 20px; }
  .admin-nav { grid-template-columns: 1fr; }
  .pending-banner, .client-card > header, .section-heading { align-items: flex-start; flex-direction: column; }
  .add-access { align-items: stretch; flex-direction: column; }
  .admin-content > h1 { font-size: 30px; }
  .user-hero h1 { font-size: 36px; }
  .software-card { grid-template-columns: 1fr; }
  .software-card .button { grid-column: auto; }
  .invitation-panel { grid-template-columns: 1fr; }
  .invitation-panel textarea { grid-column: auto; }
  .onboarding-heading h1 { font-size: 31px; }
  .onboarding-steps article { grid-template-columns: 1fr; }
  .onboarding-actions, .launcher-actions { align-items: stretch; flex-direction: column; }
}

@media print {
  .topbar, .footer, .onboarding-actions, .download-actions { display: none !important; }
  .onboarding-shell { width: 100%; margin: 0; }
  .onboarding-steps article { break-inside: avoid; }
}
