@charset "UTF-8";

:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --panel: #fff;
  --panel2: #f1f5fa;
  --line: #e1e6ee;
  --text: #101a30;
  --muted: #536178;
  --accent: #0866ed;
  --accent-hover: #0054cb;
  --accent-soft: #e8f1ff;
  --gold: var(--accent);
  --gold-dark: var(--accent-hover);
  --turquoise: var(--accent);
  --danger: #d5223b;
  --danger-soft: #fff0f2;
  --success: #087852;
  --success-soft: #e8f7ef;
  --warning: #815b07;
  --warning-soft: #fff6df;
  --font: "Segoe UI", Roboto, Arial, sans-serif;
  --sidebar-width: 216px;
  --header-height: 72px;
  --radius: 8px;
}

* { box-sizing: border-box; }
html { min-height: 100%; font-size: 14px; scroll-padding-top: 96px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #6aa6ff; outline-offset: 3px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -.6px; }
h2 { font-size: 18px; font-weight: 650; line-height: 1.35; }
h3 { font-size: 16px; font-weight: 650; line-height: 1.4; }
h4 { font-size: 14px; font-weight: 650; }
img { max-width: 100%; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden], .hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 300; left: 12px; top: -100px; padding: 12px 16px; border-radius: var(--radius); background: var(--text); color: #fff; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
.eyebrow { margin-bottom: 8px; color: var(--accent); font-size: 11px; font-weight: 650; letter-spacing: 1px; }

.admin-shell { min-width: 0; min-height: 100vh; padding: 100px 28px 24px; }
body.is-authenticated .admin-shell { margin-left: var(--sidebar-width); }
.admin-header { position: fixed; z-index: 60; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 20px; height: var(--header-height); padding: 0 28px; border-bottom: 1px solid var(--line); background: #fff; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; color: #0d1529; font-size: 27px; font-weight: 800; line-height: 1; letter-spacing: -.8px; }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; flex-shrink: 0; }
.brand > span { font-size: inherit; }
.brand small { display: none; }
.header-context { padding-left: 20px; border-left: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.admin-identity { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 13px; }
.admin-identity .avatar, .admin-identity .admin-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--panel2); color: #34425a; font-size: 16px; font-weight: 500; }
.identity-copy { display: flex; flex-direction: column; line-height: 1.4; }
.identity-copy strong { font-weight: 600; }
.identity-copy small { color: var(--muted); font-size: 11px; }
body:not(.is-authenticated) .admin-identity { display: none; }
.owner-label { margin-left: auto; color: var(--muted); font-size: 12px; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.admin-heading > div { min-width: 0; }
.admin-heading .eyebrow { display: none; }
.admin-heading .muted { margin: 6px 0 0; }
.heading-actions, .form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.heading-actions { flex-shrink: 0; }

.admin-tabs { display: none; }
.is-authenticated .admin-tabs { position: fixed; z-index: 50; inset: var(--header-height) auto 0 0; display: flex; flex-direction: column; gap: 4px; width: var(--sidebar-width); margin: 0; padding: 20px 12px; border-right: 1px solid var(--line); background: #fbfcfe; overflow-y: auto; }
.admin-tabs a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border-radius: var(--radius); color: #26344e; font-size: 13px; font-weight: 500; text-decoration: none; }
.admin-tabs a:hover { background: var(--panel2); }
.admin-tabs a[aria-current="page"] { background: var(--accent-soft); color: #005ad5; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 20px; width: 20px; height: 20px; }
.nav-icon svg { width: 18px; height: 18px; }
.admin-tabs #requests-count { color: inherit; font-variant-numeric: tabular-nums; }
#nav-toggle { display: none; }
.nav-backdrop { display: none; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; max-width: 100%; padding: 8px 14px; border: 1px solid transparent; border-radius: var(--radius); font-size: 13px; font-weight: 600; line-height: 1.4; text-align: center; text-decoration: none; white-space: normal; }
.button:hover { text-decoration: none; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover:enabled { background: var(--accent-hover); }
.button.secondary { background: #fff; border-color: #d7deea; color: #24334b; }
.button.secondary:hover:enabled { background: var(--panel2); border-color: #b9c6d9; }
.button.danger { background: #e32642; color: #fff; }
.button.danger:hover:enabled { background: #c81732; }
.button.danger-outline { background: var(--danger-soft); border-color: #f5ced5; color: #b91831; }
.button.danger-outline:hover:enabled { background: #ffe3e9; }
.button.compact { min-height: 36px; padding: 6px 10px; font-size: 12px; }
.text-button { min-height: 40px; padding: 8px 10px; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 500; }
.text-button:hover:enabled { color: var(--accent); background: var(--accent-soft); border-radius: var(--radius); }
.icon-button { display: inline-grid; place-items: center; min-width: 36px; min-height: 36px; padding: 8px; border: 1px solid transparent; border-radius: var(--radius); color: var(--muted); background: transparent; }
.icon-button:hover { background: var(--panel2); }
input, select, textarea { width: 100%; min-width: 0; min-height: 40px; padding: 9px 12px; border: 1px solid #d7dfeb; border-radius: var(--radius); background: #fff; color: var(--text); line-height: 1.45; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: #aebed4; }
input:disabled, select:disabled, textarea:disabled { background: #f1f4f8; color: #6b778b; cursor: not-allowed; }
input[readonly] { background: #f5f7fa; }
input::placeholder, textarea::placeholder { color: #7b879b; opacity: 1; }
input[type="checkbox"] { flex: 0 0 auto; width: 20px; min-height: 20px; height: 20px; padding: 0; margin: 0; accent-color: var(--accent); cursor: pointer; }
input[type="checkbox"]:disabled { cursor: not-allowed; }
textarea { resize: vertical; }
input[type="file"] { padding: 6px; font-size: 13px; overflow: hidden; }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 6px 10px; border: 1px solid #d7deea; border-radius: 5px; background: var(--panel2); color: #24334b; font: inherit; cursor: pointer; }
label { color: #34425a; }

.login-panel { width: min(100%, 420px); margin: 52px auto; padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 8px 28px #17223b08; }
.login-panel h1 { font-size: 24px; }
.login-panel label { display: block; margin: 24px 0 8px; font-size: 13px; font-weight: 500; }
.login-panel .button { width: 100%; margin-top: 20px; }
.login-panel .muted { margin-bottom: 0; }
.notice { padding: 12px 16px; border: 1px solid #cddff8; border-radius: var(--radius); background: #eef5ff; color: #235080; font-size: 13px; overflow-wrap: anywhere; margin-bottom: 20px; }
.notice:empty { display: none; }
.notice.error { background: var(--danger-soft); border-color: #f3c8d0; color: #a51d32; }
.notice.success { background: var(--success-soft); border-color: #cce9dc; color: #086847; }
.notice.info { background: #eef5ff; border-color: #cddff8; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.stat strong { display: block; margin-bottom: 4px; color: #18253f; font-size: 26px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }

.table-panel { min-width: 0; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; scroll-margin-top: 96px; }
.table-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; }
.table-heading > div { min-width: 0; }
.table-heading h2 { margin: 0; font-size: 17px; }
.table-heading .muted { margin: 4px 0 0; }
.device-filters { display: flex; flex: 1; gap: 8px; max-width: 520px; }
.device-filters input { min-width: 160px; }
.device-filters select { max-width: 200px; }
.table-scroll { width: 100%; max-width: 100%; overflow: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th { padding: 12px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f6f8fb; color: #526079; font-size: 11px; font-weight: 500; white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid #edf0f5; min-width: 112px; max-width: 300px; vertical-align: top; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
td small { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 4px; }
td .cell-value { min-width: 0; }
.table-note { padding: 14px 20px 16px; margin: 0; border-top: 1px solid #edf0f5; color: var(--muted); font-size: 11px; line-height: 1.6; }
.status-label { color: var(--success); }
.status-label.failed { color: var(--danger); }
.device-code { font-variant-numeric: tabular-nums; }
.access-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 20px; font-size: 11px; line-height: 1.4; font-weight: 500; }
.access-badge.allowed { background: var(--success-soft); color: #086847; }
.access-badge.blocked { background: var(--danger-soft); color: #ac2136; }
.access-badge.pending { background: var(--warning-soft); color: #76520a; }
.request-actions .button, .device-actions .button { display: flex; width: 100%; margin-bottom: 6px; text-align: center; }
.request-actions .button:last-child, .device-actions .button:last-child { margin-bottom: 0; }
td .payment-status { color: #26344c; font-weight: 600; }
td .block-reason { color: #b32237; }
td .version-rule { color: #4d6487; }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); }
.pagination p { margin: 0; color: var(--muted); font-size: 12px; }
.page-links, #device-page-links { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.page-links [aria-current="page"] { background: var(--accent-soft); border-color: #b9d5ff; color: #075ccc; opacity: 1; }
.page-gap { padding: 4px; }
#devices[aria-busy="true"] { opacity: .55; }

.access-rules { margin-bottom: 20px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.access-rules summary { min-height: 20px; color: #35435a; font-size: 13px; font-weight: 600; cursor: pointer; }
.access-rules summary::marker { color: #65758e; }
.access-rules h2 { margin: 0 0 10px; font-size: 15px; }
.access-rules p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.access-rules strong { font-weight: 600; color: #29374e; }
.policy-editor { padding: 20px; border-top: 1px solid var(--line); background: #f8faff; }
.policy-editor h3 { margin-bottom: 8px; overflow-wrap: anywhere; }
.policy-editor label, .release-form label { display: block; margin: 16px 0 6px; font-size: 12px; font-weight: 500; color: #37455d; }
.policy-editor textarea { max-width: 880px; }
.policy-editor .form-actions { margin-top: 16px; }
.policy-editor > .muted { margin-top: 12px; }
.owner-editor { padding: 20px; margin: 0 0 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.owner-editor h2 { font-size: 18px; }
.owner-editor label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 500; }
.owner-editor input { max-width: 560px; }
.owner-editor .form-actions { margin-top: 16px; }
.owner-cell .button { display: flex; margin-top: 8px; }

.release-list { padding: 0 20px; }
.release-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 0; border-top: 1px solid var(--line); }
.release-copy { min-width: 0; overflow-wrap: anywhere; }
.release-copy > strong { display: block; margin-bottom: 4px; font-size: 16px; font-weight: 650; }
.release-copy > p { margin: 8px 0 0; max-width: 800px; }
.release-action { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.release-form { padding: 20px; border-top: 1px solid var(--line); background: #fff; }
.release-form > summary { font-size: 14px; font-weight: 600; cursor: pointer; }
.release-form h3 { font-size: 17px; margin-bottom: 6px; }
.release-form > .muted { max-width: 920px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid > div { min-width: 0; }
.release-form > .form-actions { margin-top: 20px; }
.upload-state { padding: 16px; margin-top: 20px; border: 1px solid #cddff8; border-radius: var(--radius); background: #f3f8ff; }
.operation-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; }
.operation-title strong { font-weight: 600; }
.upload-state progress { display: block; width: 100%; height: 8px; margin-top: 12px; accent-color: var(--accent); }
.upload-state p { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.upload-state #upload-percent { color: var(--accent); font-variant-numeric: tabular-nums; }
.release-audience { display: block; margin-bottom: 8px; color: var(--accent); font-size: 11px; font-weight: 600; }
.release-trial { border-left: 3px solid #80aff7; padding-left: 16px; }
.release-target { padding: 0 16px 16px; margin-top: 20px; border: 1px solid #d9e6f8; border-radius: var(--radius); background: #f6f9ff; }
.release-target p { margin: 12px 0 0; }
#release-vin { text-transform: uppercase; letter-spacing: .5px; }

/* Compatibility with existing release storage markup until its table is mounted. */
#release-storage .release-list { padding: 0; }
#release-storage label.release-row { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; min-height: 44px; margin: 0; padding: 16px 0; }
#release-storage label.release-row input[type="checkbox"] { margin-top: 2px; }
#release-storage label.release-row .release-copy > * { display: block; }
#release-storage label.release-row .release-copy > strong { font-size: 14px; }
#release-storage label.release-row .release-copy > .muted { font-size: 12px; }

dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 24px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: #fff; box-shadow: 0 24px 64px #18233b30; overflow: auto; }
dialog::backdrop { background: #17223b40; }
dialog h2 { margin-bottom: 12px; font-size: 20px; }
dialog .form-actions { justify-content: flex-end; margin-top: 20px; }
dialog pre, pre#detail { max-width: 100%; margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #f7f9fc; color: #29374e; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.7; }
.diagnostic-layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.diagnostic-panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.diagnostic-list { display: grid; gap: 8px; }
.diagnostic-list .button { width: 100%; justify-content: flex-start; text-align: left; }
.diagnostic-report { display: block; width: 100%; min-height: 64px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; text-align: left; }
.diagnostic-report:hover { background: #f5f9ff; border-color: #bfd4f3; }
.diagnostic-report[aria-current="true"], .diagnostic-report[aria-selected="true"] { background: var(--accent-soft); border-color: #a9cbfc; }
.diagnostic-report > strong, .diagnostic-title { display: block; color: #26344c; font-size: 13px; font-weight: 600; }
.diagnostic-report > span, .diagnostic-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.diagnostic-detail { min-width: 0; }
.diagnostic-meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0 0 20px; font-size: 12px; }
.diagnostic-meta dt { color: var(--muted); }
.diagnostic-meta dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.diagnostic-events { max-width: 100%; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.diagnostic-empty, .empty-state { padding: 32px 20px; text-align: center; color: var(--muted); }
footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 20px; margin-top: 28px; border-top: 1px solid var(--line); color: #69778c; font-size: 11px; }
footer b { color: #465570; font-weight: 500; }
.footer-word { font-size: 10px; letter-spacing: 1px; }

@media (min-width: 1600px) {
  .admin-shell { max-width: 1800px; }
}
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .device-filters { flex-direction: column; max-width: 300px; min-width: 220px; }
  .device-filters select { max-width: none; }
  .table-heading { align-items: flex-start; }
  td { padding: 12px; }
  th { padding: 12px; }
}
@media (max-width: 960px) {
  .admin-shell { padding-right: 20px; padding-left: 20px; }
  .table-heading { flex-direction: column; gap: 16px; }
  .device-filters { flex-direction: row; width: 100%; max-width: none; min-width: 0; }
  .device-filters select { max-width: 220px; }
  .diagnostic-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  :root { --header-height: 64px; }
  html { scroll-padding-top: 84px; }
  .admin-shell, body.is-authenticated .admin-shell { margin-left: 0; padding: 88px 20px 24px; }
  .admin-header { gap: 12px; padding: 0 20px; }
  .brand { font-size: 21px; letter-spacing: -.5px; }
  .brand img { width: 28px; height: 28px; }
  .header-context { border: 0; padding: 0; font-size: 11px; }
  .admin-identity { gap: 0; }
  .identity-copy, .owner-label { display: none; }
  .admin-identity .avatar, .admin-identity .admin-avatar { width: 32px; height: 32px; font-size: 14px; }
  body.is-authenticated #nav-toggle { display: inline-grid; place-items: center; flex: 0 0 44px; width: 44px; min-height: 44px; padding: 10px; margin-left: -10px; border: 0; border-radius: var(--radius); background: transparent; color: #34425a; }
  #nav-toggle:hover { background: var(--panel2); }
  .is-authenticated .admin-tabs { display: none; width: min(280px, calc(100vw - 48px)); box-shadow: 12px 0 24px #17223b12; }
  .is-authenticated.nav-open .admin-tabs { display: flex; }
  .is-authenticated.nav-open .nav-backdrop { position: fixed; z-index: 40; inset: var(--header-height) 0 0; display: block; border: 0; border-radius: 0; background: #18233b40; }
  .is-authenticated.nav-open { overflow: hidden; }
  .admin-tabs a { min-height: 48px; font-size: 14px; }
  .admin-heading { align-items: flex-start; gap: 12px; margin-bottom: 20px; }
  h1 { font-size: 24px; }
  .heading-actions { gap: 4px; }
  .heading-actions .button, .heading-actions .text-button { min-height: 44px; padding: 8px 10px; font-size: 12px; }
  .button, .button.compact, .text-button, .icon-button { min-height: 44px; }
  .icon-button { min-width: 44px; }
  input, select, textarea { min-height: 44px; }
  input[type="checkbox"] { width: 20px; height: 20px; min-height: 20px; }
  .login-panel { margin: 28px auto; padding: 24px; }
  .notice { padding: 12px; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
  .stat { padding: 12px; }
  .stat strong { font-size: 22px; }
  .stat span { font-size: 11px; }
  .access-rules { margin-bottom: 16px; padding: 12px 16px; }
  .access-rules summary { min-height: 28px; padding: 4px 0; }
  .table-panel { margin-bottom: 16px; }
  .table-heading { padding: 16px; gap: 12px; }
  .table-heading h2 { font-size: 16px; }
  .device-filters { flex-direction: column; }
  .device-filters input { min-width: 0; }
  .device-filters select { max-width: none; }
  .table-scroll { overflow: visible; }
  .table-scroll table { display: block; }
  .table-scroll thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-scroll tbody { display: grid; gap: 12px; padding: 0 12px 12px; }
  .table-scroll tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 8px; }
  .table-scroll tbody td { display: block; min-width: 0; max-width: none; padding: 8px; border: 0; font-size: 13px; }
  .table-scroll td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; color: #66758c; font-size: 10px; font-weight: 600; line-height: 1.4; }
  .table-scroll td small { font-size: 11px; }
  .table-scroll td[colspan], .table-scroll td.device-actions, .table-scroll td.request-actions, .table-scroll tbody tr > td:last-child { grid-column: 1 / -1; }
  .table-scroll td.device-actions, .table-scroll td.request-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .table-scroll td.device-actions::before, .table-scroll td.request-actions::before { flex-basis: 100%; }
  .device-actions .button, .request-actions .button { flex: 1 1 120px; width: auto; margin: 0; }
  .table-note { padding: 12px 16px; }
  .pagination { gap: 8px; padding: 12px 16px; }
  .pagination .page-links { flex-wrap: wrap; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .policy-editor, .owner-editor, .release-form { padding: 16px; }
  .release-list { padding: 0 16px; }
  .release-row { flex-direction: column; gap: 12px; padding: 16px 0; }
  .release-action { flex-direction: row; align-items: center; flex-wrap: wrap; width: 100%; }
  .release-action .button { flex: 1 1 120px; }
  .release-action .access-badge { flex-shrink: 0; }
  .release-copy > strong { font-size: 15px; }
  .release-target { padding: 0 12px 12px; }
  .owner-editor .form-actions, .policy-editor .form-actions, .release-form > .form-actions { gap: 8px; }
  .owner-editor .form-actions .button, .policy-editor .form-actions .button { flex: 1 1 120px; }
  .upload-state { padding: 12px; }
  .operation-title { font-size: 13px; }
  dialog { padding: 20px; width: calc(100% - 32px); border-radius: 12px; }
  dialog .form-actions .button { flex: 1; }
  .diagnostic-panel { padding: 16px; }
  pre#detail { padding: 12px; font-size: 11px; }
  footer { margin-top: 20px; padding-top: 16px; }
  .footer-word { display: none; }
}
@media (max-width: 400px) {
  .admin-shell, body.is-authenticated .admin-shell { padding: 84px 16px 20px; }
  .admin-header { padding: 0 16px; gap: 8px; }
  .header-context { display: none; }
  .admin-heading { flex-wrap: wrap; }
  .heading-actions { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-scroll tbody tr { grid-template-columns: minmax(0, 1fr); }
  .table-scroll tbody td { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Preserve the fleet summary while keeping mobile work screens compact. */
.stats-summary{margin:0 0 20px}
.stats-summary>summary{display:none}
.stats-summary .stats-grid{margin-bottom:0}
@media(max-width:760px){
 .stats-summary{border:1px solid var(--line);border-radius:var(--radius);background:var(--panel);margin-bottom:16px}
 .stats-summary>summary{display:list-item;min-height:48px;padding:14px 16px;cursor:pointer;font-weight:600}
 .stats-summary .stats-grid{padding:0 12px 12px}
}


/* Keep diagnostics controls and report content aligned with panel headings. */
.diagnostic-search{padding:0 16px 16px}
.diagnostic-search label{display:block;margin-bottom:6px;font-size:12px;font-weight:500}
.diagnostic-list #list{display:grid;gap:8px;padding:0 12px 12px}
.diagnostic-meta{padding:0 20px}
.diagnostic-events-title{padding:0 20px}
.diagnostic-raw{margin:16px 20px 20px}
.diagnostic-raw>summary{padding:8px 0;cursor:pointer;color:var(--muted);font-size:12px;font-weight:500}
@media(max-width:760px){.diagnostic-raw>summary{min-height:44px;padding:12px 0}}


/* Model summaries use the same compact design tokens as the device workspace. */
.model-summary{margin:0 0 20px}
.model-summary-heading{display:flex;align-items:baseline;gap:12px;margin-bottom:12px;flex-wrap:wrap}
.model-summary-heading h2{margin:0;font-size:17px}
.model-summary-heading p{margin:0}
.model-stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.model-stat-card{display:block;min-width:0;padding:16px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel);color:var(--text)}
.model-stat-card:hover{border-color:#a8c9f8;background:#f5f9ff;text-decoration:none}
.model-stat-card[aria-current=true]{border-color:#8db8f6;background:var(--accent-soft)}
.model-stat-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.model-stat-heading strong{font-size:14px;font-weight:650}
.model-block{display:inline-block;max-width:100%;padding:2px 6px;border-radius:4px;background:#edf1f7;color:#465671;font-size:10px;line-height:1.5;overflow-wrap:anywhere}
.model-stat-primary{display:flex;align-items:baseline;gap:8px;margin:10px 0 8px;font-size:11px;color:var(--muted)}
.model-stat-primary strong{color:var(--text);font-size:26px;line-height:1.2;font-weight:650;font-variant-numeric:tabular-nums}
.model-stat-secondary{display:flex;flex-wrap:wrap;gap:2px 10px;color:var(--muted);font-size:10px;line-height:1.6}
.model-stats-note{margin:8px 0 0;color:var(--muted);font-size:11px;line-height:1.55}
.model-stats-empty{grid-column:1/-1;padding:16px;border:1px solid var(--line);border-radius:var(--radius);background:var(--panel)}
.car-model-name{display:block;font-size:13px;font-weight:600;margin-bottom:4px}
.car-model-cell .model-unknown{color:#76520a}
.owner-inline-form{min-width:160px;max-width:280px}
.owner-inline-form input{min-height:36px;padding:7px 9px;font-size:13px}
.owner-inline-actions{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}
.owner-cell .owner-inline-actions .button{margin:0;min-height:32px;font-size:11px;padding:6px 8px}
.owner-inline-status{display:block;margin-top:6px;color:var(--muted);font-size:11px;line-height:1.4}
.owner-inline-status[role=alert]{color:var(--danger)}
.owner-saved{color:var(--success)}
.device-filters:has(#device-model-filter){max-width:660px;flex-wrap:wrap}
#device-model-filter{max-width:180px}
@media(max-width:1200px){.model-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.device-filters:has(#device-model-filter){min-width:220px;max-width:340px}.device-filters #device-model-filter{max-width:none}}
@media(max-width:760px){.model-summary{margin-bottom:16px}.model-summary-heading{gap:4px;margin-bottom:10px}.model-summary-heading h2{font-size:15px}.model-stat-grid{gap:8px}.model-stat-card{padding:12px}.model-stat-heading{gap:4px}.model-stat-heading strong{font-size:13px}.model-stat-primary{display:block;margin:8px 0 6px}.model-stat-primary strong{font-size:24px;margin-right:5px}.model-stat-secondary{display:grid;gap:2px}.model-stats-note{font-size:10px}.owner-inline-form{min-width:0;max-width:none}.owner-inline-form input{min-height:44px}.owner-cell .owner-inline-actions .button{min-height:44px;padding:8px 10px;font-size:12px}.device-filters:has(#device-model-filter){max-width:none;min-width:0}}
