:root {
    color-scheme: dark;
    --bg: #0a0f14;
    --panel: #111922;
    --panel-soft: #172231;
    --panel-raised: #1d2a38;
    --input: #0d141c;
    --text: #edf5f8;
    --muted: #94a7b8;
    --line: #263646;
    --line-strong: #3a5165;
    --blue: #70a8ff;
    --blue-soft: rgba(112, 168, 255, .16);
    --teal: #43d6bd;
    --teal-soft: rgba(67, 214, 189, .15);
    --green: #5ce28f;
    --green-soft: rgba(92, 226, 143, .14);
    --amber: #ffc861;
    --amber-soft: rgba(255, 200, 97, .15);
    --red: #ff7b8a;
    --red-soft: rgba(255, 123, 138, .16);
    --shadow: 0 18px 46px rgba(0, 0, 0, .34);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

body.modal-open {
    overflow: hidden;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
}

.auth-shell {
    width: min(100%, 420px);
}

.auth-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.auth-brand,
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-brand {
    margin-bottom: 22px;
}

.auth-brand h1,
.topbar h1,
.section-head h2,
.surface h2,
.surface h3 {
    margin: 0;
}

.auth-brand p,
.surface p,
.section-head p,
.topbar p,
.dealer-identity small,
.metric-card small,
.data-table small {
    margin: 0;
    color: var(--muted);
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--teal);
    color: #06110f;
    font-weight: 800;
}

.auth-form,
.form-panel {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
}

label span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--input);
    color: var(--text);
    padding: 9px 11px;
    outline: none;
}

input:focus,
select:focus,
.editable-name:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}

.btn,
.endpoint-list button,
.row-actions button {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 13px;
    background: var(--panel-raised);
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn-primary {
    background: var(--teal);
    color: #06110f;
}

.btn-soft,
.endpoint-list button,
.row-actions button {
    border-color: var(--line);
    background: var(--panel-soft);
}

.remote-band-box {
    flex: 1 1 100%;
    width: min(320px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input);
}

.remote-band-box summary {
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: var(--teal);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.remote-band-box form {
    display: grid;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--line);
}

.remote-band-box label {
    gap: 4px;
}

.remote-band-box input {
    min-height: 34px;
    font-size: 12px;
}

.remote-band-box button {
    width: 100%;
}

.device-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    padding: 18px;
}

.device-modal.is-open {
    display: grid;
    place-items: center;
}

.device-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 10, .76);
    backdrop-filter: blur(8px);
}

.device-modal-panel {
    position: relative;
    z-index: 1;
    width: min(1120px, 100%);
    max-height: min(860px, calc(100vh - 36px));
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.device-modal-head,
.band-control-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.device-modal-head {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-soft);
}

.device-modal-head h3,
.device-modal-head p,
.band-control-head p {
    margin: 0;
}

.device-modal-head h3 {
    font-size: 24px;
}

.device-modal-head p,
.band-control-head p,
.muted-copy {
    color: var(--muted);
    line-height: 1.45;
}

.modal-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 8px;
    font-size: 20px;
    border: 1px solid var(--line);
    background: var(--input);
    color: var(--text);
    cursor: pointer;
}

.manage-title {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.manage-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.manage-meta .dealer-chip {
    margin-bottom: 0;
}

.manage-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.manage-tabs button {
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    background: var(--input);
    color: var(--muted);
    font-weight: 900;
    cursor: pointer;
}

.manage-tabs button.is-active {
    border-color: rgba(67, 214, 189, .52);
    background: var(--teal-soft);
    color: var(--teal);
}

.manage-content {
    overflow: auto;
    padding: 18px 20px 20px;
}

.manage-tab-panel {
    display: none;
}

.manage-tab-panel.is-active {
    display: block;
}

.manage-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.manage-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    padding: 15px;
}

.manage-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.manage-card-head span,
.band-control-head strong {
    font-size: 15px;
    font-weight: 900;
}

.manage-card-head small,
.band-control-head p {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.device-kv {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 9px 12px;
    margin: 0;
}

.device-kv dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.device-kv dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.quick-copy-grid,
.band-form-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.quick-copy-grid button,
.band-form-actions button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-raised);
    color: var(--text);
    font-weight: 900;
    cursor: pointer;
    padding: 9px 12px;
}

.status-report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.status-report-grid div {
    min-height: 66px;
    display: grid;
    align-content: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input);
    padding: 10px;
}

.status-report-grid span,
.band-active-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.status-report-grid strong,
.band-active-summary strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
    gap: 10px;
}

.command-tile {
    min-height: 74px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.command-tile:hover {
    border-color: rgba(67, 214, 189, .42);
    background: var(--teal-soft);
    transform: translateY(-1px);
}

.action-button span {
    font-weight: 900;
}

.danger-action {
    border-color: rgba(255, 123, 138, .28);
}

.danger-action:hover {
    border-color: rgba(255, 123, 138, .48);
    background: var(--red-soft);
}

.action-guide {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input);
}

.action-guide summary {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 13px;
    color: var(--teal);
    font-weight: 900;
    cursor: pointer;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    padding: 0 13px 13px;
}

.guide-grid article {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.guide-grid strong {
    display: block;
    margin-bottom: 5px;
}

.guide-grid p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.band-control-card {
    display: grid;
    gap: 14px;
}

.band-toggle-form {
    display: grid;
    gap: 14px;
}

.band-active-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.band-active-summary span {
    min-height: 54px;
    display: grid;
    align-content: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input);
    padding: 9px 10px;
}

.band-toggle-section {
    display: grid;
    gap: 9px;
}

.band-toggle-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.band-toggle-head small {
    color: var(--muted);
    font-weight: 800;
}

.band-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
}

.band-toggle {
    position: relative;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input);
    cursor: pointer;
    user-select: none;
}

.band-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.band-toggle span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.band-toggle span::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 999px;
    background: var(--line-strong);
    vertical-align: 1px;
}

.band-toggle input:checked + span {
    color: var(--teal);
}

.band-toggle input:checked + span::before {
    background: var(--teal);
}

.band-toggle:has(input:checked) {
    border-color: rgba(67, 214, 189, .7);
    background: var(--teal-soft);
}

.band-toggle:has(input:checked) span {
    color: var(--teal);
}

.band-report {
    display: grid;
    gap: 2px;
}

.btn-block {
    width: 100%;
}

.notice {
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: var(--panel);
    margin-bottom: 18px;
    font-weight: 700;
}

.notice-success {
    background: var(--green-soft);
    border-color: rgba(92, 226, 143, .36);
    color: var(--green);
}

.notice-error {
    background: var(--red-soft);
    border-color: rgba(255, 123, 138, .38);
    color: var(--red);
}

.app-page {
    display: grid;
    grid-template-columns: 258px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 24px;
    padding: 22px 16px;
    border-right: 1px solid var(--line);
    background: #0c1218;
}

.brand {
    text-decoration: none;
    padding: 4px;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: var(--muted);
}

.nav-list {
    display: grid;
    align-content: start;
    gap: 6px;
}

.nav-list a {
    min-height: 42px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    padding: 0 12px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 800;
}

.nav-list a.active,
.nav-list a:hover {
    background: var(--teal-soft);
    color: var(--teal);
}

.sidebar-footer {
    display: grid;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.sidebar-footer a {
    color: var(--red);
    font-weight: 800;
    text-decoration: none;
}

.app-shell {
    min-width: 0;
    padding: 24px;
}

.topbar,
.section-head,
.surface-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar {
    margin-bottom: 22px;
}

.topbar h1 {
    font-size: 28px;
}

.eyebrow {
    color: var(--teal);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.topbar-actions,
.toolbar,
.quick-links,
.row-actions,
.endpoint-list {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-chip {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: var(--panel-soft);
    color: var(--muted);
    font-weight: 800;
}

.panel-section {
    display: none;
}

.panel-section.active {
    display: block;
}

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

.metric-card,
.surface {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric-card {
    min-height: 132px;
    padding: 18px;
    display: grid;
    align-content: space-between;
}

.metric-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.metric-card strong {
    font-size: 34px;
}

.dashboard-grid,
.tools-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: 18px;
}

.surface {
    padding: 18px;
}

.surface-header {
    margin-bottom: 14px;
}

.section-head {
    margin-bottom: 14px;
}

.toolbar input {
    width: min(280px, 100%);
}

.toolbar select {
    width: min(210px, 100%);
}

.release-card {
    display: grid;
    gap: 6px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.release-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.quick-links {
    margin-top: 14px;
}

.quick-links a {
    color: var(--blue);
    font-weight: 800;
    text-decoration: none;
}

.table-region {
    min-height: 150px;
}

.table-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    color: var(--muted);
    font-weight: 800;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.data-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 3px 5px;
    color: var(--text);
}

.status-pill {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 900;
}

.status-online {
    background: var(--green-soft);
    color: var(--green);
}

.status-offline {
    background: var(--red-soft);
    color: var(--red);
}

.status-pilot,
.status-access-active,
.status-dealer {
    background: var(--blue-soft);
    color: var(--blue);
}

.status-access-blocked,
.status-unassigned {
    background: var(--red-soft);
    color: var(--red);
}

.history-type {
    background: var(--amber-soft);
    color: var(--amber);
}

.editable-name {
    min-width: 130px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 9px;
    background: var(--panel-soft);
    outline: none;
}

.device-report-cell {
    min-width: 150px;
    max-width: 190px;
}

.device-report-cell .report-line {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.device-report-cell .report-line + .report-line {
    margin-top: 4px;
}

.device-report-cell .report-line span {
    color: var(--muted);
}

.device-report-cell .report-line strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}

.dealer-cell {
    min-width: 180px;
}

.dealer-chip {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    padding: 0 9px;
    background: var(--teal-soft);
    color: var(--teal);
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 7px;
}

.dealer-chip-empty {
    background: var(--amber-soft);
    color: var(--amber);
}

.dealer-select {
    min-height: 34px;
    max-width: 180px;
    padding: 6px 8px;
    font-size: 12px;
}

.build-cell {
    min-width: 150px;
}

.test-toggle {
    width: 142px;
    min-height: 46px;
    position: relative;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input);
    padding: 5px 8px 5px 43px;
    cursor: pointer;
    user-select: none;
}

.test-toggle::before {
    content: "";
    position: absolute;
    left: 10px;
    width: 24px;
    height: 14px;
    border-radius: 999px;
    background: var(--line-strong);
    transition: background .16s ease;
}

.test-toggle::after {
    content: "";
    position: absolute;
    left: 12px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--muted);
    transition: transform .16s ease, background .16s ease;
}

.test-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.test-toggle span {
    display: grid;
    gap: 2px;
}

.test-toggle strong {
    font-size: 12px;
    line-height: 1;
}

.test-toggle small {
    font-size: 10px;
    line-height: 1.1;
}

.test-toggle.is-active {
    border-color: rgba(67, 214, 189, .62);
    background: var(--teal-soft);
}

.test-toggle.is-active::before {
    background: rgba(67, 214, 189, .42);
}

.test-toggle.is-active::after {
    transform: translateX(10px);
    background: var(--teal);
}

.test-toggle:has(input:disabled) {
    opacity: .64;
    cursor: wait;
}

.mini-table .dealer-select {
    display: none;
}

.group-row td {
    background: var(--input);
    border-bottom: 1px solid var(--line-strong);
    color: var(--teal);
    padding: 10px 12px;
}

.group-row span,
.group-row strong {
    display: inline-flex;
    align-items: center;
}

.group-row span {
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    margin-right: 10px;
}

.group-row strong {
    color: var(--muted);
    font-size: 12px;
}

.dealer-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.compact-metric {
    min-height: 104px;
}

.compact-metric strong {
    font-size: 28px;
}

.dealer-workspace {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.form-panel h3,
.dealer-create-card p {
    margin: 0;
}

.dealer-create-card {
    position: sticky;
    top: 24px;
}

.dealer-manager {
    display: grid;
    gap: 12px;
}

.dealer-list-head,
.dealer-list {
    display: grid;
    gap: 10px;
}

.dealer-list-head {
    grid-template-columns: minmax(180px, 1.2fr) minmax(96px, .45fr) minmax(112px, .55fr) minmax(76px, .35fr) minmax(82px, .35fr) minmax(140px, .7fr) minmax(170px, .8fr) minmax(72px, auto);
    padding: 0 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.dealer-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(96px, .45fr) minmax(112px, .55fr) minmax(76px, .35fr) minmax(82px, .35fr) minmax(140px, .7fr) minmax(170px, .8fr) minmax(72px, auto);
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.dealer-row:hover {
    border-color: var(--line-strong);
    background: var(--panel-raised);
}

.dealer-identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dealer-identity strong,
.dealer-identity small {
    display: block;
}

.dealer-identity strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-field {
    gap: 5px;
}

.compact-field input,
.compact-field select {
    min-height: 36px;
}

.dealer-stat,
.dealer-last {
    display: grid;
    gap: 4px;
}

.dealer-stat span,
.dealer-last span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.dealer-stat strong,
.dealer-last strong {
    font-size: 15px;
}

.dealer-last small {
    color: var(--muted);
    font-size: 11px;
}

.avatar {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 900;
}

.tools-grid {
    align-items: start;
}

.tool-span {
    grid-column: 1 / -1;
}

.endpoint-list {
    align-items: stretch;
}

.endpoint-list button {
    flex: 1 1 220px;
}

.update-loop {
    display: grid;
    gap: 12px;
}

.pilot-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.pilot-summary div {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.pilot-summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.pilot-summary strong,
.pilot-summary code {
    overflow-wrap: anywhere;
}

.tool-note {
    margin-top: 12px;
    line-height: 1.5;
}

.update-loop div {
    display: grid;
    gap: 5px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.update-loop div:last-of-type {
    border-bottom: 0;
    padding-bottom: 0;
}

.update-loop span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.update-loop strong {
    font-size: 20px;
}

.api-token {
    display: block;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.tool-frame {
    width: 100%;
    min-height: 580px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.mini-table .table-wrap {
    max-height: 360px;
}

.mini-table .table-summary,
.mini-table .row-actions,
.mini-table .device-report-cell,
.mini-table th:nth-child(8),
.mini-table th:nth-child(9),
.mini-table th:nth-child(10),
.mini-table th:nth-child(11),
.mini-table td:nth-child(8),
.mini-table td:nth-child(9),
.mini-table td:nth-child(10),
.mini-table td:nth-child(11) {
    display: none;
}

.empty-state {
    min-height: 120px;
    display: grid;
    place-items: center;
    color: var(--muted);
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: var(--panel-soft);
    font-weight: 800;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: min(360px, calc(100vw - 36px));
    background: var(--text);
    color: #071014;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    font-weight: 800;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.hidden-row {
    display: none;
}

@media (max-width: 1180px) {
    .metric-grid,
    .dealer-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .tools-grid,
    .dealer-workspace {
        grid-template-columns: 1fr;
    }

    .dealer-create-card {
        position: static;
    }

    .dealer-list-head,
    .dealer-row {
        grid-template-columns: minmax(180px, 1fr) 110px 120px 90px 90px minmax(140px, .8fr);
    }

    .dealer-list-head span:nth-child(7),
    .dealer-list-head span:nth-child(8) {
        display: none;
    }

    .password-field,
    .dealer-row .btn {
        grid-column: 1 / -1;
    }
}

@media (max-width: 820px) {
    .app-page {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        grid-template-rows: auto auto auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .nav-list {
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .topbar,
    .section-head,
    .surface-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions,
    .toolbar {
        width: 100%;
    }

    .toolbar input,
    .toolbar select,
    .toolbar button,
    .topbar-actions .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .dealer-summary-grid,
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .dealer-list-head {
        display: none;
    }

    .dealer-row {
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }

    .dealer-identity,
    .password-field,
    .dealer-row .btn,
    .dealer-last {
        grid-column: 1 / -1;
    }

    .app-shell {
        padding: 18px;
    }

    .manage-overview-grid,
    .band-active-summary,
    .status-report-grid {
        grid-template-columns: 1fr;
    }

    .device-modal {
        padding: 10px;
    }

    .device-modal-panel {
        max-height: calc(100vh - 20px);
    }

    .device-modal-head {
        padding: 15px;
    }

    .manage-content {
        padding: 14px;
    }

    .manage-tabs {
        overflow-x: auto;
        padding: 10px 14px;
    }

    .manage-tabs button {
        flex: 0 0 auto;
    }

    .device-kv {
        grid-template-columns: 1fr;
    }
}
