:root {
    color-scheme: dark;
    --page: #202537;
    --panel: #282e42;
    --panel-raised: #2e354b;
    --border: #3a4259;
    --text: #edf1fa;
    --muted: #9da8c0;
    --accent: #31d4c2;
    --danger: #ff4268;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--text);
    font: 14px/1.5 "Segoe UI", Arial, sans-serif;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at 50% 10%, #35415f, var(--page) 55%);
}

.login-card {
    width: min(100%, 430px);
    padding: 38px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 22px 60px #10142180;
}

.brand-mark {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #30d5c2, #4384ef);
    color: #152034;
    font-size: 24px;
    font-weight: 800;
}

.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; }
.eyebrow { margin: 18px 0 5px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.login-card h1, .topbar h1 { margin: 0; font-size: 25px; }
.muted, .login-footer, .privacy-note { color: var(--muted); }
.login-card .muted { margin: 8px 0 24px; }
.skip-password-form { margin: 0 0 18px; }
.skip-password-button {
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 10px 14px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    background: transparent;
    color: var(--accent);
    font-weight: 700;
}
.skip-password-button:hover { background: #31d4c21a; }
.logout-password-form { margin: 12px 0 0; }
.logout-password-button {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
}
.logout-password-button:hover { border-color: var(--accent); color: var(--text); }
.login-card label { display: block; margin: 16px 0 6px; color: #dce3f2; font-size: 12px; }
.login-card input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    background: #202638;
    color: var(--text);
}
.login-card input:focus, .table-toolbar input:focus, .table-toolbar select:focus { border-color: var(--accent); }
.primary-button {
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #10232d;
    font-weight: 700;
}
.primary-button:hover { filter: brightness(1.08); }
.full-width { width: 100%; height: 44px; margin-top: 24px; }
.login-footer { margin: 24px 0 0; font-size: 12px; text-align: center; }
.alert { padding: 11px 13px; border: 1px solid #a93c55; border-radius: 6px; background: #602e43; color: #ffe3e9; }
.success-alert { padding: 11px 13px; border: 1px solid #1f8d76; border-radius: 6px; background: #183f3b; color: #b6f5e4; }

.portal-page { display: flex; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    width: 218px;
    flex-direction: column;
    padding: 20px 14px;
    border-right: 1px solid var(--border);
    background: #252b3e;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 26px; color: var(--text); font-weight: 700; text-decoration: none; }
.sidebar nav { display: grid; gap: 5px; }
.nav-link { padding: 11px 12px; border-radius: 6px; color: #b6bfd1; text-decoration: none; }
.nav-link:hover, .nav-link.active { background: #333b53; color: white; }
.nav-link.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-footer { margin-top: auto; padding: 12px; color: var(--muted); font-size: 12px; }

.billing-sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    display: flex;
    width: 78px;
    flex-direction: column;
    padding: 14px 10px;
    overflow-x: hidden;
    border-right: 1px solid #252b3e;
    background: #171b27;
    transition: width .2s ease;
}
.billing-sidebar.expanded { width: 244px; }
.billing-sidebar-header { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 25px; }
.billing-sidebar-toggle {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #aab4c8;
}
.billing-sidebar-toggle:hover { background: #282e3d; color: #fff; }
.billing-sidebar-toggle svg, .sidebar-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.billing-brand { display: flex; min-width: max-content; align-items: center; gap: 10px; color: var(--text); font-size: 13px; font-weight: 750; letter-spacing: .04em; text-decoration: none; }
.billing-sidebar:not(.expanded) .billing-brand { display: none; }
.billing-sidebar nav { display: grid; gap: 7px; }
.billing-nav-link {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 17px;
    padding: 0 10px;
    overflow: hidden;
    border-radius: 8px;
    color: #9da8bc;
    text-decoration: none;
    white-space: nowrap;
}
.billing-nav-link:hover { background: #252b3b; color: #f5f7fb; }
.billing-nav-link.active { background: #292f40; color: #54d6c6; box-shadow: inset 3px 0 #39d6c2; }
.sidebar-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; }
.billing-nav-link.active .sidebar-icon { color: #54d6c6; }
.nav-text { opacity: 0; transition: opacity .12s ease; }
.billing-sidebar.expanded .nav-text { opacity: 1; }
.sidebar-overlay { display: none; }

.main-content { width: calc(100% - 218px); margin-left: 218px; padding: 28px; }
.billing-sidebar.collapsed ~ .main-content { width: calc(100% - 78px); margin-left: 78px; }
.billing-sidebar.expanded ~ .main-content { width: calc(100% - 244px); margin-left: 244px; }
.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px 24px;
    min-height: 76px;
    margin-bottom: 24px;
    padding: 0 0 18px;
    border-bottom: 1px solid var(--border);
}
.topbar > div:first-child { min-width: 0; }
.topbar .eyebrow { margin: 0 0 4px; }
.topbar h1 { overflow-wrap: anywhere; }
.user-menu { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.user-menu > span { padding: 0 8px; color: #dce3f2; font-weight: 600; }
.user-menu form { margin: 0; }
.text-button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; padding: 6px 11px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--accent); text-decoration: none; white-space: nowrap; }
.text-button:hover { border-color: var(--accent); }
.billing-topbar {
    position: relative;
    z-index: 5;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 64px;
    margin: -28px -28px 24px;
    padding: 0 20px 0 12px;
    border-bottom: 1px solid #3a4053;
    background: #292f43;
}
.topbar-brand, .topbar-actions { display: flex; min-width: 0; align-items: center; }
.topbar-brand { gap: 12px; }
.topbar-icon-button, .topbar-app-link {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #e4e9f4;
}
.topbar-icon-button:hover, .topbar-app-link:hover { background: #383f55; }
.topbar-icon-button svg, .topbar-app-link svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar-brand-copy { display: grid; min-width: 0; gap: 2px; color: #f0f3fa; }
.topbar-brand-copy strong { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.topbar-brand-copy span { overflow: hidden; color: #aab4ca; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { justify-content: flex-end; gap: 8px; }
.topbar-datetime { margin-right: 8px; color: #e4e9f4; font-size: 12px; white-space: nowrap; }
.text-button.topbar-action { min-height: 32px; padding: 5px 9px; border-color: transparent; color: #d3daea; font-size: 12px; }
.text-button.topbar-action:hover { border-color: #505971; background: #383f55; color: #fff; }
.topbar-actions form { margin: 0; }
.topbar-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; margin-left: 4px; border: 1px solid #68738c; border-radius: 50%; background: #39445b; color: #fff; font-size: 13px; font-weight: 700; }

.summary-card, .table-card { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 22px #1115223b; }
.summary-card { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; margin-bottom: 18px; }
.summary-card h2 { margin: 0 0 5px; font-size: 16px; }
.summary-card p { margin: 0; color: var(--muted); }
.record-count { display: grid; justify-items: end; color: var(--muted); }
.record-count strong { color: var(--accent); font-size: 24px; line-height: 1.1; }
.page-alert { margin-bottom: 18px; }
.table-card { overflow: hidden; }
.table-toolbar { display: flex; align-items: end; gap: 16px; padding: 20px 18px; }
.table-toolbar label { display: grid; gap: 6px; color: #cbd4e5; font-size: 12px; }
.table-toolbar .search-control { flex: 1; }
.table-toolbar input, .table-toolbar select {
    min-height: 37px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: 0;
    background: #22283a;
    color: var(--text);
}
.entries-control { display: flex !important; align-items: center; flex-direction: row; }
.entries-control select { min-width: 64px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 1120px; border-collapse: collapse; }
th, td { padding: 13px 12px; border-top: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: #292f43; color: #dce4f2; font-size: 11px; font-weight: 700; }
.sort-button { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; text-align: left; white-space: nowrap; }
.sort-button:hover { color: var(--accent); }
.sort-button span { display: inline-block; min-width: 10px; color: var(--accent); }
td { color: #d9e0ed; font-size: 12px; }
tbody tr:hover { background: #30374c; }
tbody tr[hidden] { display: none; }
.account-cell { color: #a9c5ff; white-space: nowrap; }
.address-cell { min-width: 190px; max-width: 260px; }
.status-badge { display: inline-block; padding: 4px 8px; border: 1px solid; border-radius: 4px; white-space: nowrap; }
.status-badge.installed { border-color: #1fae99; color: #5ae1c9; }
.status-badge.pending { border-color: #c48727; color: #ffd16b; }
.status-badge.other { border-color: #7484a7; color: #c4d2ec; }
.action-link { color: var(--accent); text-decoration: none; white-space: nowrap; }
.action-link:hover { text-decoration: underline; }
.inline-action-form { display: inline-block; margin: 0 0 0 6px; }
.empty-state { padding: 28px 16px; color: var(--muted); text-align: center; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.pagination { display: flex; align-items: center; gap: 9px; }
.pagination button { padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; background: transparent; color: var(--text); }
.pagination button:disabled { cursor: default; opacity: .4; }
.privacy-note { margin: 16px 0; font-size: 12px; }
.customer-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.compact-card { margin-bottom: 18px; padding: 18px; }
.customer-section { margin: 18px 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px; border-bottom: 1px solid var(--border); }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.customer-table { min-width: 720px; }
.status-badge.paid { border-color: #1fae99; color: #5ae1c9; }
.status-badge.unpaid { border-color: #c44761; color: #ff9aab; }
.status-badge.partially-paid { border-color: #c48727; color: #ffd16b; }
.role-add-toolbar { margin: 0 0 18px; }
.role-add-details { position: relative; }
.role-add-details > summary, .role-action-button, .role-delete-button {
    display: inline-block;
    padding: 7px 12px;
    border: 0;
    border-radius: 4px;
    background: var(--accent);
    color: #10232d;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.role-add-details > summary::-webkit-details-marker, .role-edit-details > summary::-webkit-details-marker { display: none; }
.role-create-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    align-items: end;
    gap: 10px 14px;
    max-width: 520px;
    margin-top: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
}
.role-create-form label, .role-edit-form label { grid-column: 1 / -1; color: #cbd4e5; font-size: 12px; }
.role-create-form input, .role-edit-form input {
    min-width: 0;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: 0;
    background: #22283a;
    color: var(--text);
}
.role-create-form input:focus, .role-edit-form input:focus { border-color: var(--accent); }
.role-create-form button { min-height: 40px; padding: 8px 18px; }
.role-form-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.role-management-card { margin-bottom: 18px; padding: 20px; }
.role-management-title { margin: 0 0 18px; font-size: 16px; }
.role-management-table { min-width: 900px; }
.role-management-table th { height: 44px; border: 1px solid var(--border); text-align: center; font-size: 13px; }
.role-management-table td { border: 1px solid var(--border); }
.role-management-table tbody tr:nth-child(odd) { background: #353c52; }
.role-management-table tbody tr:nth-child(even) { background: var(--panel); }
.role-management-table tbody tr:hover { background: #3c455f; }
.role-management-table tbody tr.clickable-role-row { cursor: pointer; }
.role-management-table tbody tr.clickable-role-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.role-management-table td:first-child, .role-count-cell, .role-actions { text-align: center; }
.role-index { width: 44px; }
.role-count-badge { display: inline-block; min-width: 24px; padding: 3px 6px; border-radius: 3px; background: var(--accent); color: #10232d; font-weight: 700; }
.role-accounts-table { min-width: 760px; }
.role-account-search {
    display: grid;
    gap: 7px;
    max-width: 680px;
    margin: 0 0 18px;
    color: #cbd4e5;
    font-size: 12px;
}
.role-account-search-controls { display: flex; align-items: center; gap: 8px; }
.role-account-search-controls input {
    flex: 1;
    min-width: 0;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: 0;
    background: #22283a;
    color: var(--text);
}
.role-account-search-controls input:focus { border-color: var(--accent); }
.role-account-search-controls button { min-height: 38px; padding: 6px 14px; }
.edit-customer-password { white-space: nowrap; }
.customer-password-dialog {
    width: min(440px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    padding: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 18px 55px #101421b3;
}
.customer-password-dialog::backdrop { background: #101421b3; }
.customer-password-form {
    display: grid;
    gap: 8px;
    padding: 22px;
    text-align: left;
}
.customer-password-form h2 { margin: 0; font-size: 18px; }
.customer-password-form > .muted { margin: 0 0 8px; overflow-wrap: anywhere; }
.customer-password-form label { color: #cbd4e5; font-size: 12px; }
.customer-password-form input {
    min-width: 0;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: 0;
    background: #22283a;
    color: var(--text);
}
.customer-password-form input:focus { border-color: var(--accent); }
.customer-password-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.customer-password-dialog-actions button { min-height: 38px; padding: 7px 12px; }
.role-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.role-page-link { display: inline-block; padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; background: transparent; color: var(--text); text-decoration: none; }
.role-page-link:hover:not(.disabled) { border-color: var(--accent); color: var(--accent); }
.role-page-link.disabled { cursor: default; opacity: .4; }
.coverage-add-card, .coverage-areas-card { margin-bottom: 18px; }
.coverage-area-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(140px, .5fr) auto;
    align-items: end;
    gap: 10px 14px;
    padding: 18px;
}
.coverage-area-field { display: grid; gap: 6px; }
.coverage-area-form label { color: #cbd4e5; font-size: 12px; }
.coverage-area-form input, .coverage-area-form select, .coverage-inline-form input,
.coverage-areas-table select, .coverage-customers-table select {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: 0;
    background: #22283a;
    color: var(--text);
}
.coverage-area-form input:focus, .coverage-area-form select:focus, .coverage-inline-form input:focus,
.coverage-areas-table select:focus, .coverage-customers-table select:focus { border-color: var(--accent); }
.coverage-area-form button { min-height: 38px; padding: 6px 14px; }
.coverage-areas-table { min-width: 760px; }
.coverage-inline-form { min-width: 150px; }
.coverage-area-actions { white-space: nowrap; }
.coverage-area-actions .action-link { margin-left: 8px; }
.coverage-customers-table { min-width: 1050px; }
.coverage-customers-table td small { display: block; margin-top: 4px; color: var(--muted); }
.edit-customer-link {
    display: inline-grid;
    width: 30px;
    height: 30px;
    margin-left: 8px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--accent);
    vertical-align: middle;
}
.edit-customer-link:hover, .edit-customer-link:focus-visible { border-color: var(--accent); background: #31d4c21a; }
.edit-customer-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.customer-edit-card { max-width: 980px; }
.customer-edit-form { padding: 18px; }
.customer-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.customer-edit-field { display: grid; min-width: 0; gap: 6px; }
.customer-edit-field label { color: #cbd4e5; font-size: 12px; }
.customer-edit-field input, .customer-edit-field select, .customer-edit-field textarea {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: 0;
    background: #22283a;
    color: var(--text);
}
.customer-edit-field textarea { resize: vertical; }
.customer-edit-field input:focus, .customer-edit-field select:focus, .customer-edit-field textarea:focus { border-color: var(--accent); }
.customer-edit-wide { grid-column: 1 / -1; }
.customer-location-map { width: 100%; height: 420px; margin-top: 18px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-raised); }
.map-help { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.customer-edit-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.customer-edit-actions .primary-button { min-height: 40px; padding: 8px 16px; }
.package-add-card, .package-list-card { margin-bottom: 18px; }
.package-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
    padding: 18px;
}
.package-field { display: grid; min-width: 0; gap: 6px; }
.package-field label { color: #cbd4e5; font-size: 12px; }
.package-field input, .package-field select, .package-field textarea, .package-table input, .package-table select {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: 0;
    background: #22283a;
    color: var(--text);
}
.package-field textarea { resize: vertical; }
.package-field input:focus, .package-field select:focus, .package-field textarea:focus,
.package-table input:focus, .package-table select:focus { border-color: var(--accent); }
.package-field-wide { grid-column: span 2; }
.package-submit { min-height: 38px; padding: 7px 14px; }
.package-table { min-width: 1150px; }
.package-table input, .package-table select { min-width: 100px; }
.package-table td:last-child { white-space: nowrap; }
.package-table .role-action-button { min-height: 34px; }
.coverage-review-card { margin-bottom: 18px; }
.coverage-review-table { min-width: 900px; }
.coverage-review-table td small { display: block; margin-top: 4px; color: var(--muted); }
.coverage-review-actions { white-space: nowrap; }
.coverage-review-actions .role-delete-button { margin-left: 6px; }
.coverage-list-summary { min-height: 46px; padding-top: 12px; padding-bottom: 12px; color: var(--muted); font-size: 12px; }
.coverage-customers-table .role-action-button { white-space: nowrap; }
.role-actions { white-space: nowrap; }
.role-edit-details { position: relative; display: inline-block; vertical-align: middle; }
.role-edit-details > summary { padding: 4px 7px; background: transparent; color: #edf1fa; text-decoration: underline; }
.role-edit-form {
    position: absolute;
    z-index: 2;
    top: 100%;
    right: 0;
    display: grid;
    width: 240px;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    box-shadow: 0 8px 22px #11152280;
    text-align: left;
}
.role-edit-form .role-action-button { justify-self: start; }
.role-delete-form { display: inline-block; margin: 0 0 0 4px; vertical-align: middle; }
.role-delete-button { background: transparent; color: #ff6d82; border: 1px solid #a93c55; }
.role-delete-button:hover { background: #602e43; }
.protected-role { color: var(--muted); font-size: 11px; }
.admin-form-card { margin-bottom: 18px; }
.admin-form { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 14px; padding: 18px; }
.admin-form label { display: grid; gap: 6px; color: #cbd4e5; font-size: 12px; }
.admin-form input, .admin-form select, .payment-form input {
    min-width: 0;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: 0;
    background: #22283a;
    color: var(--text);
}
.admin-form input:focus, .admin-form select:focus, .payment-form input:focus { border-color: var(--accent); }
.admin-form .wide-field { grid-column: span 2; }
.admin-form > button { align-self: end; min-height: 40px; }
.payment-form { display: grid; min-width: 210px; gap: 7px; }
.payment-form .primary-button { min-height: 36px; }
.admin-table { min-width: 980px; }
.admin-table small { color: var(--muted); }
.page-alert { margin: 0 0 16px; }
.customer-section .empty-state { padding: 22px; }

@media (max-width: 900px) {
    .sidebar { width: 190px; padding: 16px 10px; }
    .brand { padding: 4px 6px 22px; }
    .nav-link { padding: 10px 9px; font-size: 13px; }
    .main-content { width: calc(100% - 190px); margin-left: 190px; padding: 22px 16px; }
    .billing-sidebar.collapsed ~ .main-content { width: calc(100% - 78px); margin-left: 78px; }
    .billing-sidebar.expanded ~ .main-content { width: calc(100% - 244px); margin-left: 244px; }
    .billing-topbar { margin-right: -16px; margin-left: -16px; padding-right: 12px; }
    .topbar-datetime { font-size: 11px; }
}
@media (max-width: 620px) {
    .portal-page { display: block; }
    .sidebar {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        padding: 10px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .brand { padding: 4px 6px 10px; }
    .brand > span:last-child { display: inline; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .nav-link, .nav-link:not(.active) {
        display: block;
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }
    .sidebar-footer { display: none; }
    .main-content { width: 100%; margin: 0; padding: 18px 10px; }
    .billing-sidebar, .billing-sidebar.expanded {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        min-height: 60px;
        padding: 8px 10px;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .billing-sidebar-header { min-height: 40px; margin: 0 0 6px; }
    .billing-sidebar:not(.expanded) .billing-brand { display: flex; }
    .billing-sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .billing-nav-link { min-height: 42px; gap: 8px; padding: 2px 6px; }
    .billing-sidebar .nav-text { display: none; }
    .billing-sidebar.expanded .nav-text { display: inline; }
    .sidebar-icon { width: 30px; height: 34px; flex-basis: 30px; }
    .billing-sidebar.collapsed ~ .main-content,
    .billing-sidebar.expanded ~ .main-content { width: 100%; margin: 0; }
    .sidebar-overlay { display: none !important; }
    .topbar { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; padding-bottom: 14px; }
    .topbar h1 { font-size: 20px; }
    .user-menu { justify-content: flex-start; gap: 7px; }
    .user-menu > span { flex-basis: 100%; padding: 0 0 2px; }
    .billing-topbar {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        min-height: auto;
        margin: -18px -10px 18px;
        padding: 8px 10px;
    }
    .billing-topbar .topbar-brand { min-height: 40px; }
    .billing-topbar .topbar-actions { justify-content: flex-start; flex-wrap: wrap; gap: 4px; padding: 6px 0 2px 48px; }
    .billing-topbar .topbar-datetime { flex-basis: 100%; margin: 0 0 3px; }
    .billing-topbar .topbar-action { min-height: 30px; }
    .summary-card { align-items: flex-start; gap: 12px; padding: 18px; }
    .table-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
    .role-create-form { grid-template-columns: 1fr; }
    .role-create-form label { grid-column: auto; margin: 0; }
    .role-account-search-controls { flex-wrap: wrap; }
    .role-account-search-controls input { flex-basis: 100%; }
    .coverage-area-form { grid-template-columns: 1fr; }
    .customer-edit-grid { grid-template-columns: 1fr; }
    .customer-edit-wide { grid-column: auto; }
    .package-form { grid-template-columns: 1fr; }
    .package-field-wide { grid-column: auto; }
    .entries-control { justify-content: flex-start; }
    .table-footer { align-items: flex-start; flex-direction: column; }
    .login-card { padding: 28px 22px; }
    .customer-overview { grid-template-columns: 1fr; gap: 0; }
    .admin-form { grid-template-columns: 1fr; }
    .admin-form .wide-field { grid-column: auto; }
}
