:root {
  color-scheme: light;
  --ink: #162930;
  --muted: #526670;
  --petrol: #142c35;
  --petrol-light: #203d46;
  --green: #08715e;
  --green-hover: #055e4e;
  --mint: #c2f5df;
  --surface: #fff;
  --canvas: #f3f6f5;
  --line: #dce5e2;
  --warning: #805104;
  --warning-bg: #fff2cf;
  --info: #225280;
  --info-bg: #eaf2fb;
  --error: #922b28;
  --error-bg: #fff1ef;
  --font-ui: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-data: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
  --radius: 12px;
  --control-radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font: 0.9375rem/1.5 var(--font-ui); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #0b836c; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 3vw, 2.6rem); letter-spacing: -0.052em; line-height: 1.13; }
h2 { font-size: 1.2rem; line-height: 1.25; letter-spacing: -0.022em; }
h3 { font-size: 1.05rem; }
p { color: var(--muted); }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.boot-view { padding: 32px; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 1.42rem; letter-spacing: -0.048em; font-weight: 720; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--mint); color: var(--petrol); }
.brand-mark::before { content: ''; width: 14px; height: 18px; border: 2px solid currentColor; border-radius: 4px; background: linear-gradient(currentColor,currentColor) center bottom 3px/5px 1px no-repeat; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 42px; padding: 7px 14px; font-weight: 650; line-height: 1.25; border: 1px solid transparent; border-radius: var(--control-radius); white-space: nowrap; text-decoration: none; }
.button:disabled { opacity: .58; }
.button.primary { background: var(--green); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--green-hover); }
.button.secondary { color: var(--ink); border-color: var(--line); background: var(--surface); }
.button.secondary:hover:not(:disabled) { background: #edf4f1; border-color: #b9cac4; }
.button.edit { color: var(--green-hover); background: #edf7f2; border-color: #b6d8cb; }
.button.compact { min-height: 38px; padding-inline: 12px; }
.plus, .refresh-mark { display: inline-block; position: relative; flex: none; width: 14px; height: 14px; }
.plus::before, .plus::after { content: ''; position: absolute; background: currentColor; border-radius: 2px; inset: 6px 1px; }
.plus::after { inset: 1px 6px; }
.refresh-mark { width: 12px; height: 12px; border: 1.6px solid currentColor; border-right-color: transparent; border-radius: 50%; }
.refresh-mark::after { content: ''; position: absolute; top: -1px; right: -1px; width: 4px; height: 4px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; }

.login-shell { display: grid; grid-template-columns: minmax(230px, .9fr) minmax(320px, 1.15fr); max-width: 835px; min-height: 455px; overflow: hidden; margin: max(42px, 10vh) auto 42px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.login-intro { display: flex; flex-direction: column; justify-content: space-between; min-height: 100%; padding: 32px; background: var(--petrol); overflow: hidden; }
.login-intro > p { color: #bdd4d4; font-weight: 550; }
.login-illustration { position: relative; display: grid; place-items: center; min-height: 230px; margin-inline: -32px; isolation: isolate; }
.login-illustration::before { content: ''; position: absolute; z-index: -1; width: 240px; aspect-ratio: 1; border: 1px solid #3b5b61; border-radius: 50%; box-shadow: 0 0 0 21px #1c383f, 0 0 0 22px #304d53, 0 0 0 45px #18323a, 0 0 0 46px #2b494f; }
.phone-outline { display: flex; flex-direction: column; justify-content: center; gap: 10px; width: 83px; height: 144px; padding: 14px; border: 2px solid #a4d7c8; border-radius: 19px; background: var(--petrol); }
.phone-outline::before { content: ''; width: 17px; height: 2px; margin: 0 auto 5px; background: #8bc6b7; border-radius: 2px; }
.phone-outline i { display: block; height: 7px; border-radius: 2px; background: #4b786f; }
.phone-outline i:first-child { width: 67%; background: var(--mint); }
.login-main { display: grid; align-items: center; padding: clamp(30px, 5vw, 56px); }
.login-form { display: grid; gap: 18px; max-width: 340px; }
.login-form h1 { font-size: clamp(1.75rem, 3.2vw, 2.45rem); }
.login-form .button { justify-self: start; }

.dashboard { display: grid; min-height: 100vh; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; padding: 28px 20px 22px; color: #fff; background: var(--petrol); }
.sidebar .brand { margin-left: 5px; }
.sidebar-nav { margin-top: 40px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 12px 13px; border-radius: var(--control-radius); text-decoration: none; color: #e1f1ed; font-weight: 650; }
.nav-link[aria-current] { background: var(--petrol-light); box-shadow: inset 3px 0 0 #91dfc4; }
.nav-link:focus-visible, .signout:focus-visible { outline-color: var(--mint); }
.phone-small { display: inline-block; width: 12px; height: 17px; border: 1.5px solid currentColor; border-radius: 3px; background: linear-gradient(currentColor,currentColor) center bottom 2px/4px 1px no-repeat; }
.sidebar-footer { display: grid; align-content: end; gap: 3px; margin-top: auto; padding: 30px 0 0 12px; color: #bad0cf; font-size: .825rem; }
.signout { width: fit-content; padding: 4px 0; border: 0; background: transparent; color: #fff; font-weight: 620; }
.signout:hover { text-decoration: underline; }
.main-content { display: flex; flex-direction: column; align-items: stretch; gap: 20px; width: min(100%, 1410px); margin-inline: auto; padding: 38px 36px 58px; }
.main-content:focus { outline: none; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 3px; }
.page-header p { margin-top: 8px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice { padding: 11px 14px; border: 1px solid #b6dfce; border-radius: var(--control-radius); background: #e9f8f0; color: #105947; }
.notice[data-error="true"], .inline-alert { border-color: #edc4bf; background: var(--error-bg); color: var(--error); }
.live-status { border-color: var(--line); background: var(--surface); color: var(--muted); }
.request-notice { position: sticky; top: 10px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; border-color: #e7ca88; background: var(--warning-bg); color: var(--warning); box-shadow: 0 2px 4px #291e1020; }
.request-notice p { flex: 1 1 190px; color: inherit; overflow-wrap: anywhere; }
.request-notice .button { border-color: #e1c485; }
.main-content:has(.request-notice:not([hidden])) :is(.editor, #inventory-section) { scroll-margin-top: 92px; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric { display: grid; gap: 4px; min-height: 92px; padding: 14px 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-align: left; }
.metric[aria-pressed="true"] { border-color: #77b6a3; box-shadow: inset 0 3px 0 #258875; }
.metric:hover { background: #fafdfe; }
.metric span { color: var(--muted); font-size: .875rem; line-height: 1.2; font-weight: 640; }
.metric strong { font-size: 1.7rem; line-height: 1.2; font-weight: 670; letter-spacing: -.055em; }
.dot { display: inline-block; width: 7px; height: 7px; margin: 0 6px 2px 0; border-radius: 50%; background: #15856b; }
.dot.requested { background: #a36c13; }
.dot.pending { background: #4277a5; }

.surface { overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.surface-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 20px; }
.search { position: relative; display: block; max-width: 260px; width: 38%; }
.search input { width: 100%; min-height: 39px; padding: 7px 10px 7px 33px; border: 1px solid var(--line); border-radius: var(--control-radius); color: var(--ink); background: #fafcfb; }
.search > span:first-child { position: absolute; top: 12px; left: 12px; width: 11px; height: 11px; border: 1.5px solid #526671; border-radius: 50%; pointer-events: none; }
.search > span:first-child::after { content: ''; position: absolute; top: 7px; left: 7px; width: 5px; height: 1.5px; background: #526671; transform: rotate(45deg); transform-origin: left; }
.table-scroll { overflow: auto; }
table { width: 100%; border-spacing: 0; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 16px; border-block: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); background: #f7f9f8; font-size: .8rem; font-weight: 680; }
td:first-child, th:first-child { padding-left: 20px; }
td:last-child, th:last-child { padding-right: 20px; text-align: right; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
.device-name { font-weight: 670; word-break: break-word; }
.device-serial { display: block; margin-top: 3px; color: var(--muted); font: .75rem/1.3 var(--font-data); overflow-wrap: anywhere; }
.version { font-family: var(--font-data); font-size: .83rem; }
.version-history, .status-detail { display: block; margin-top: 4px; color: var(--muted); font: .8rem/1.35 var(--font-ui); }
.status-detail { max-width: 22ch; }
.updated-column { color: var(--muted); font-size: .825rem; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; width: max-content; padding: 4px 8px; border-radius: 6px; background: #e6f6ef; color: #145d4b; font-size: .75rem; font-weight: 680; }
.badge.requested { background: var(--warning-bg); color: var(--warning); }
.badge.pending { background: var(--info-bg); color: var(--info); }
.badge .dot { margin-bottom: 0; width: 6px; height: 6px; }
.empty-state { display: grid; justify-items: center; gap: 8px; text-align: center; min-height: 255px; align-content: center; padding: 30px 20px; }
.empty-state .button { margin-top: 8px; }
.empty-phone { display: grid; place-items: center; width: 49px; height: 49px; margin-bottom: 4px; border-radius: 13px; background: #eaf4ef; color: #367061; }
.empty-phone .phone-small { transform: scale(1.25); }

.editor { scroll-margin-top: 14px; overflow: clip; }
.editor-header { display: grid; align-items: flex-start; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); }
.editor-header p { margin-top: 4px; }
.editor-body { display: grid; gap: 20px; padding: 20px; }
fieldset { padding: 0; border: 0; margin: 0; min-inline-size: 0; }
.pair-fields { display: grid; align-items: start; grid-template-columns: minmax(140px, .7fr) minmax(160px, 1fr) minmax(160px, 1fr); gap: 14px; }
.field { display: block; color: var(--ink); font-size: .875rem; font-weight: 670; }
.field input { display: block; width: 100%; min-height: 44px; margin-top: 5px; padding: 8px 10px; border: 1px solid #c5d2ce; border-radius: var(--control-radius); color: var(--ink); background: var(--surface); font-size: 1rem; font-weight: 400; }
.field input::placeholder { color: #637577; }
.field input[aria-invalid="true"] { border-color: var(--error); }
.field small { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; }
.optional { margin-left: 4px; color: var(--muted); font-weight: 400; }
.field .enrollment-code { font-family: var(--font-data); text-transform: uppercase; }
.field .enrollment-code::placeholder { font: .92rem var(--font-ui); text-transform: none; }
.policy-fields legend { padding: 0; font-size: 1rem; font-weight: 700; }
.app-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; color: var(--muted); font-size: .875rem; }
.app-toolbar .app-search { width: auto; min-width: 130px; flex: 1 1 140px; max-width: 240px; margin-left: auto; }
.app-lookup { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--control-radius); background: #eef5f2; }
.app-lookup[data-error="true"] { background: var(--error-bg); }
.app-lookup[data-error="true"] p { color: var(--error); }
.app-empty { padding: 8px 0; }
.absent-apps { margin-top: 15px; }
.absent-apps > p { margin: 4px 0 8px; }
.absent-apps .check-row { background: #f7f9f8; }
.text-button { border: 0; padding: 5px 0; background: transparent; color: var(--green-hover); font-weight: 680; }
.text-button:hover { text-decoration: underline; }
.text-button:disabled { opacity: .56; }
.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.check-row { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--control-radius); background: #fafcfb; cursor: pointer; }
.check-row:has(input:checked) { border-color: #a8cbbb; background: #f0f8f3; }
.check-row:has(input:disabled) { cursor: default; }
.check-row input { accent-color: var(--green); width: 17px; height: 17px; flex: none; margin: 0; cursor: inherit; }
.check-row span { overflow-wrap: anywhere; }
.functions { display: flex; flex-wrap: wrap; gap: 8px; }
.functions legend { margin-bottom: 9px; }
.functions .check-row { flex: 1 1 190px; }
.editor-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; position: sticky; bottom: 0; z-index: 1; padding: 14px 20px; background: #f8faf9; border-top: 1px solid var(--line); }
.editor :is(input, button) { scroll-margin-bottom: 90px; }
.inline-alert { padding: 10px 12px; border: 1px solid #edc4bf; border-radius: var(--control-radius); }
.editor-note { padding: 10px 12px; background: #eef5f2; border-radius: var(--control-radius); }
.provisioning-dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; overflow: auto; }
.provisioning-dialog::backdrop { background: #142c3580; }
.provisioning-body { display: grid; gap: 16px; padding: 20px; }
.provisioning-body ol { display: grid; gap: 8px; margin: 0; padding-inline-start: 22px; }
.provisioning-qr { display: block; justify-self: center; width: min(100%, 320px); height: auto; }

@media (max-width: 1020px) {
  .dashboard { grid-template-columns: 176px minmax(0, 1fr); }
  .main-content { padding-inline: 24px; }
  .updated-column { display: none; }
}
@media (max-width: 760px) {
  .dashboard { display: block; }
  .sidebar { flex-direction: row; min-height: 59px; align-items: center; gap: 15px; padding: 10px 16px; }
  .sidebar .brand { margin: 0; }
  .sidebar-nav, .sidebar-footer span { display: none; }
  .sidebar-footer { padding: 0; margin: 0 0 0 auto; }
  .main-content { padding: 24px 16px 38px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .login-shell { margin: 24px 16px; }
  .pair-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 570px) {
  .login-shell { display: block; min-height: 0; }
  .login-intro { min-height: 0; gap: 12px; padding: 23px; }
  .login-illustration { display: none; }
  .login-main { padding: 23px; }
  .summary { gap: 6px; }
  .metric { padding: 11px 8px; min-height: 79px; }
  .metric .dot { display: none; }
  .metric span { font-size: .755rem; }
  .metric strong { font-size: 1.45rem; }
  .surface-header { flex-wrap: wrap; padding-inline: 13px; }
  .search { max-width: none; width: 100%; }
  td:first-child, th:first-child { padding-left: 10px; }
  td:last-child, th:last-child { padding-right: 10px; }
  .table-scroll th, .table-scroll td { padding-inline: 8px; }
  .table-scroll table { min-width: 320px; }
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-body, .editor-actions { padding-inline: 13px; }
  .pair-fields { grid-template-columns: minmax(0, 1fr); }
  .main-content:has(.request-notice:not([hidden])) :is(.editor, #inventory-section) { scroll-margin-top: 150px; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .metric, .check-row { transition: background-color 120ms ease, border-color 120ms ease; }
}
