:root {
    color-scheme: light;
    --bg: #f5f7fa;
    --panel: #ffffff;
    --ink: #18202f;
    --muted: #647084;
    --line: #d8dee8;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --blue: #2563eb;
    --danger: #b42318;
    --danger-soft: #fee4e2;
    --warning: #b54708;
    --warning-soft: #fef0c7;
    --success: #067647;
    --success-soft: #dcfae6;
    --shadow: 0 10px 30px rgba(24, 32, 47, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-size: 16px;
}

body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

label {
    color: var(--ink);
    font-weight: 650;
}

input,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    background: #fff;
    color: var(--ink);
}

input:focus,
select:focus,
button:focus,
a:focus {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 0.85rem 0.8rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    color: var(--ink);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    min-height: 68px;
    padding: 0.75rem clamp(1rem, 3vw, 2rem);
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.app-brand {
    display: inline-flex;
    gap: 0.65rem;
    align-items: center;
    color: var(--ink);
    font-weight: 750;
}

.brand-mark {
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(7, 23, 40, 0.18);
}

.app-nav {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
    display: none;
}

.app-nav a,
.user-menu a,
.user-menu button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.45rem 0.7rem;
    border-radius: 8px;
    color: var(--muted);
    white-space: nowrap;
}

.app-nav a:hover,
.user-menu a:hover,
.user-menu button:hover {
    background: #edf2f7;
    color: var(--ink);
    text-decoration: none;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.user-menu form {
    margin: 0;
}

.user-menu button {
    border: 0;
    background: transparent;
}

.app-main {
    width: min(1240px, 100%);
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem);
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    line-height: 1.05;
}

.eyebrow {
    margin: 0 0 0.35rem;
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.heading-actions,
.button-row,
.panel-subhead,
.inline-form {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.panel-title-row,
.vpn-status-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.panel-title-row h2,
.vpn-status-card h3 {
    margin: 0;
}

.vpn-panel {
    margin-top: 1rem;
    padding: 1rem;
}

.plex-panel {
    padding: 1rem;
}

.plex-panel h2 {
    margin: 0;
}

.plex-details {
    margin: 1rem 0;
}

.plex-session-grid {
    display: grid;
    gap: 1rem;
    margin-top: 0.9rem;
}

.plex-session-card {
    overflow: hidden;
    border: 1px solid #303642;
    border-radius: 12px;
    background: #171a1f;
    color: #f5f7fa;
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.18);
}

.plex-session-summary {
    display: grid;
    grid-template-columns: 156px minmax(0, 1fr);
    min-height: 232px;
}

.plex-poster-wrap {
    min-height: 232px;
    background: #0e1116;
}

.plex-poster {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 232px;
    object-fit: cover;
}

.plex-poster-fallback {
    display: grid;
    place-items: center;
    color: #e5a00d;
    font-size: 2.25rem;
}

.plex-session-content {
    min-width: 0;
    padding: 1.1rem 1.2rem;
}

.plex-title-row,
.plex-stream-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.plex-title-row h3 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    line-height: 1.25;
}

.plex-media-meta {
    display: flex;
    gap: 0.65rem;
    margin: 0.35rem 0 0;
    color: #aeb6c2;
    font-size: 0.86rem;
    text-transform: capitalize;
}

.plex-state,
.plex-decision {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: #303742;
    color: #dce2ea;
    font-size: 0.78rem;
    font-weight: 750;
    white-space: nowrap;
    text-transform: capitalize;
}

.plex-state.is-playing {
    background: rgba(52, 211, 153, 0.16);
    color: #74e6bc;
}

.plex-state.is-paused {
    background: rgba(229, 160, 13, 0.17);
    color: #f4c45b;
}

.plex-progress {
    margin-top: 1rem;
}

.plex-progress progress {
    display: block;
    width: 100%;
    height: 7px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: #353b46;
    accent-color: #e5a00d;
}

.plex-progress progress::-webkit-progress-bar {
    background: #353b46;
}

.plex-progress progress::-webkit-progress-value {
    background: #e5a00d;
}

.plex-progress progress::-moz-progress-bar {
    background: #e5a00d;
}

.plex-progress span {
    display: block;
    margin-top: 0.45rem;
    color: #c5ccd6;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.plex-connection-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem 1rem;
    margin: 1rem 0 0;
}

.plex-connection-grid div {
    min-width: 0;
}

.plex-connection-grid dt {
    margin-bottom: 0.18rem;
    color: #8993a2;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.plex-connection-grid dd {
    overflow-wrap: anywhere;
    margin: 0;
    color: #f0f3f6;
    font-size: 0.88rem;
}

.plex-stream-details {
    border-top: 1px solid #343a45;
    background: #1d2127;
}

.plex-stream-details summary {
    min-height: 48px;
    padding: 0.85rem 1.1rem;
    color: #eef1f5;
    font-weight: 700;
    cursor: pointer;
}

.plex-stream-details summary::marker {
    color: #e5a00d;
}

.plex-stream-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0 1rem 1rem;
}

.plex-stream-card {
    min-width: 0;
    padding: 0.85rem;
    border: 1px solid #343b47;
    border-radius: 8px;
    background: #242931;
}

.plex-stream-heading {
    align-items: center;
}

.plex-stream-heading h4 {
    margin: 0;
    color: #fff;
}

.plex-stream-card p {
    margin: 0.7rem 0 0;
    color: #edf0f4;
    font-size: 0.84rem;
}

.plex-stream-card p span {
    display: block;
    margin-bottom: 0.15rem;
    color: #8e98a7;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.table-secondary-text {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.vpn-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.vpn-status-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.vpn-status-card p {
    margin: 0.8rem 0;
}

.vpn-users {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.8rem;
}

.vpn-user {
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    background: #edf2f7;
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 650;
}

.vpn-connection-table {
    margin-top: 0.9rem;
    font-size: 0.8rem;
}

.vpn-connection-table table {
    min-width: 680px;
}

.vpn-connection-table th,
.vpn-connection-table td {
    padding: 0.45rem 0.55rem;
    white-space: nowrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 750;
    white-space: nowrap;
}

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

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.metric-card {
    display: grid;
    gap: 0.35rem;
    min-height: 132px;
    padding: 1rem;
    color: var(--ink);
}

.metric-card:hover {
    border-color: rgba(15, 118, 110, 0.5);
    text-decoration: none;
}

.metric-card strong {
    font-size: 2rem;
    line-height: 1;
}

.metric-label,
.subtle {
    color: var(--muted);
    font-size: 0.88rem;
}

.subtle {
    display: block;
    margin-top: 0.2rem;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel {
    padding: 1rem;
    margin-bottom: 1rem;
}

.narrow-panel {
    max-width: 760px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.panel-heading h2 {
    margin: 0;
    font-size: 1.05rem;
}

.compact-list {
    display: grid;
    gap: 0.55rem;
}

.diagnostic-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.diagnostic-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
}

.list-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.diagnostic-row {
    align-items: flex-start;
}

.list-row span:not(.status-pill) {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 750;
    white-space: nowrap;
}

.status-pill.success {
    background: var(--success-soft);
    color: var(--success);
}

.status-pill.warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.status-pill.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.table-wrap {
    overflow-x: auto;
}

.vm-table {
    min-width: 780px;
    table-layout: fixed;
}

.vm-table .vm-name-col {
    width: auto;
}

.vm-table .vm-host-col {
    width: 140px;
}

.vm-table .vm-state-col {
    width: 96px;
}

.vm-table .vm-uptime-col {
    width: 170px;
}

.vm-table .vm-status-col {
    width: 130px;
}

.vm-table .vm-actions-col {
    width: 130px;
}

.vm-table .vm-name-cell {
    overflow-wrap: anywhere;
    word-break: normal;
}

.vm-table .host-name-cell {
    white-space: nowrap;
}

.vm-table .state-cell,
.vm-table .uptime-cell {
    white-space: nowrap;
}

.vm-table .status-cell {
    overflow-wrap: break-word;
}

.vm-table .actions-cell .button-row {
    align-items: stretch;
}

.vm-table .actions-cell button {
    width: 100%;
}

@media (max-width: 860px) {
    .vpn-status-grid {
        grid-template-columns: 1fr;
    }

    .vm-table {
        min-width: 0;
    }

    .vm-table thead,
    .vm-table colgroup {
        display: none;
    }

    .vm-table,
    .vm-table tbody,
    .vm-table tr,
    .vm-table td {
        display: block;
        width: 100%;
    }

    .vm-table tr {
        display: grid;
        gap: 0.65rem;
        padding: 1rem 0;
        border-bottom: 1px solid var(--line);
    }

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

    .vm-table td {
        display: grid;
        grid-template-columns: 5.25rem minmax(0, 1fr);
        gap: 0.75rem;
        padding: 0;
    }

    .vm-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .vm-table .vm-name-cell,
    .vm-table .status-cell {
        overflow-wrap: anywhere;
    }

    .vm-table .actions-cell {
        align-items: stretch;
    }

    .vm-table .actions-cell .vm-action-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .vm-table .actions-cell .vm-action-buttons.single-action {
        grid-template-columns: 1fr;
    }
}

.pending-update-details {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.pending-update-details summary {
    padding: 0.85rem 1rem;
    font-weight: 750;
    cursor: pointer;
}

.pending-update-details .table-wrap {
    border-top: 1px solid var(--line);
}

.update-metadata-table {
    min-width: 760px;
    font-size: 0.84rem;
}

.update-metadata-table th,
.update-metadata-table td {
    padding: 0.65rem 0.7rem;
}

.update-metadata-table th:first-child,
.update-metadata-table td:first-child {
    width: auto;
    overflow-wrap: anywhere;
}

.update-metadata-table th:nth-child(n + 2),
.update-metadata-table td:nth-child(n + 2) {
    width: 8.5rem;
    white-space: nowrap;
}

.action-column {
    width: 1%;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 750;
    white-space: nowrap;
}

.primary-button {
    background: var(--accent);
    color: #fff;
}

.primary-button:hover {
    background: var(--accent-strong);
    text-decoration: none;
}

.secondary-button,
.icon-button {
    background: #fff;
    border-color: var(--line);
    color: var(--ink);
}

.secondary-button:hover,
.icon-button:hover {
    background: #edf2f7;
    text-decoration: none;
}

.danger-button {
    background: var(--danger);
    color: #fff;
}

.danger-button:hover {
    background: #8f1d16;
}

.stack {
    display: grid;
    gap: 0.7rem;
}

.inline-form {
    margin-bottom: 1rem;
}

.inline-form select {
    max-width: 340px;
}

.update-query-form select {
    flex: 1 1 420px;
    max-width: min(680px, 100%);
}

.update-query-stale-note {
    margin: 0.75rem 0 0;
}

.bulk-scan-panel {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.bulk-scan-panel .panel-heading {
    align-items: flex-start;
}

.bulk-scan-panel .panel-heading form {
    flex: 0 0 auto;
}

.scan-all-form {
    display: grid;
    gap: 0.55rem;
    max-width: 320px;
}

.scan-defender-option {
    min-height: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.automation-summary,
.scan-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    align-items: center;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.scan-progress {
    color: var(--muted);
}

.scan-progress strong {
    color: var(--ink);
}

.error-text {
    color: var(--danger);
}

.scan-results-form {
    display: grid;
    gap: 1rem;
}

.scan-target-table {
    min-width: 760px;
}

.scan-target-table td:first-child,
.scan-target-table th:first-child {
    width: 70px;
    text-align: center;
}

.scan-target-table td strong,
.scan-target-table td .subtle {
    display: block;
}

.scan-target-table td .subtle {
    margin-top: 0.2rem;
}

.scan-update-detail-row td {
    padding-top: 0;
    border-top: 0;
}

.scan-update-panel {
    margin: 0 0.35rem 0.65rem;
    background: #f8fafc;
}

.scan-update-panel-heading {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    font-weight: 750;
}

.scan-update-toggle {
    border: 0;
    font-family: inherit;
    cursor: pointer;
}

.scan-update-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.scan-update-toggle-icon {
    display: inline-block;
    margin-right: 0.2rem;
    transition: transform 0.15s ease;
}

.scan-update-toggle[aria-expanded="true"] .scan-update-toggle-icon {
    transform: rotate(90deg);
}

.target-check {
    width: 18px;
    height: 18px;
}

.scan-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
}

.scan-action-grid > div {
    display: grid;
    gap: 0.35rem;
}

.scan-action-grid input[type="datetime-local"] {
    width: 100%;
}

.scan-actions {
    justify-content: flex-end;
}

.scan-actions button {
    min-width: 150px;
}

.subtle {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.schedule-form {
    min-width: 0;
}

.schedule-form input,
.schedule-form select,
.schedule-form button {
    max-width: 100%;
    min-width: 0;
}

.schedule-form input[type="datetime-local"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    -webkit-appearance: none;
    appearance: none;
    text-align: left;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.target-group-label {
    margin: 0.65rem 0 0.2rem;
    padding-top: 0.15rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.restart-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 0.75rem;
}

.option-row {
    min-height: 34px;
}

.mini-field {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 0.65rem;
    align-items: center;
    color: var(--ink);
    font-weight: 650;
}

.mini-field input {
    min-height: 40px;
}

.maintenance-warning {
    display: grid;
    gap: 0.3rem;
    margin-top: 0.85rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(180, 35, 24, 0.24);
    border-radius: 8px;
    background: #fff7ed;
    color: #9a3412;
    line-height: 1.4;
}

.maintenance-warning strong {
    color: #7c2d12;
}

.maintenance-warning[hidden] {
    display: none;
}

.update-target-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 390px;
    overflow-y: auto;
    padding: 0.35rem 0.55rem 0.7rem 0;
    scroll-padding-bottom: 1rem;
}

.update-target-row {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    width: 100%;
    min-height: 68px;
    padding: 0.7rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 8px;
    line-height: 1.35;
    color: var(--ink);
    font-weight: 650;
}

.update-target-row:hover {
    background: #f8fafc;
}

.update-target-row input {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    min-height: 18px;
    margin: 0.2rem 0 0;
}

.check-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    min-height: 40px;
    font-weight: 600;
}

.check-row input {
    flex: 0 0 auto;
    width: 18px;
    min-height: 18px;
    margin-top: 0.2rem;
}

.target-text,
.target-name {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}

.target-text {
    flex: 1 1 auto;
    line-height: 1.35;
}

.target-name {
    font-size: 0.97rem;
    font-weight: 800;
}

.target-detail {
    display: block;
    min-width: 0;
    margin-top: 0.28rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.target-text small {
    display: block;
    margin-top: 0.18rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
}

.update-target-list + .primary-button {
    margin-top: 0.35rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 0.65rem 1rem;
    margin: 0;
}

.detail-grid dt {
    color: var(--muted);
    font-weight: 750;
}

.detail-grid dd {
    margin: 0;
    min-width: 0;
    word-break: break-word;
}

.internet-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.internet-summary-item {
    display: grid;
    gap: 0.35rem;
    align-content: start;
    min-width: 0;
    padding: 0.2rem 0 0.85rem;
    border-bottom: 1px solid var(--line);
}

.internet-summary-item strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.internet-summary-item small {
    color: var(--muted);
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.internet-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
    margin: 0 0 1rem;
    padding: 0 0 1rem;
    border-bottom: 1px solid var(--line);
}

.internet-speed-warning {
    display: grid;
    gap: 0.3rem;
    margin: 0 0 1rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid rgba(181, 71, 8, 0.28);
    border-radius: 8px;
    background: #fff8eb;
    color: #8a3f0a;
    line-height: 1.4;
}

.internet-speed-warning strong {
    color: #713307;
}

.dual-wan-panel {
    display: grid;
    gap: 1rem;
    min-width: 0;
    margin: 0 0 1.1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfe;
}

.dual-wan-heading,
.dual-wan-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dual-wan-heading h2,
.dual-wan-card-heading h3 {
    margin: 0;
}

.dual-wan-heading h2 {
    font-size: 1.2rem;
}

.dual-wan-active-route {
    display: grid;
    gap: 0.25rem;
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--accent);
    border-radius: 7px;
    background: #ecfdf5;
}

.dual-wan-active-route strong {
    font-size: 1.25rem;
}

.dual-wan-active-route small {
    color: var(--muted);
}

.dual-wan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.dual-wan-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
}

.dual-wan-card.is-active {
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.09);
}

.dual-wan-card-heading h3 {
    font-size: 1.05rem;
}

.dual-wan-card-heading h3 + span {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 650;
}

.dual-wan-card-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}

.dual-wan-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 0.9rem 0 0;
}

.dual-wan-details div {
    min-width: 0;
    padding: 0.55rem 0.65rem;
    border-radius: 7px;
    background: var(--bg);
}

.dual-wan-details dt {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.dual-wan-details dd {
    margin: 0.18rem 0 0;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.dual-wan-evidence {
    margin: 0.8rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.dual-wan-outage-alert {
    display: grid;
    gap: 0.35rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(185, 28, 28, 0.3);
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    line-height: 1.4;
}

.internet-outage-history {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.internet-outage-history summary {
    padding: 0.85rem 1rem;
    cursor: pointer;
    font-weight: 750;
}

.internet-outage-history .table-wrap,
.internet-outage-history .empty-text {
    border-top: 1px solid var(--line);
}

.internet-outage-history .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.internet-outage-history .empty-text {
    margin: 0;
    padding: 1rem;
}

.internet-outage-history table {
    min-width: 880px;
}

.alert-warning {
    border-color: rgba(181, 71, 8, 0.25);
    background: #fff8eb;
    color: #8a3f0a;
}

.speedtest-running {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid rgba(15, 118, 110, 0.25);
    border-radius: 10px;
    background: #f0fdfa;
}

.speedtest-progress-heading,
.speedtest-result-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.speedtest-progress-heading div,
.speedtest-progress-heading span {
    display: grid;
    gap: 0.2rem;
}

.speedtest-progress-heading span {
    color: var(--muted);
    font-size: 0.84rem;
}

.speedtest-running progress {
    width: 100%;
    height: 10px;
    accent-color: var(--accent);
}

.speedtest-results {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfe;
}

.speedtest-result-heading {
    margin-bottom: 1rem;
}

.speedtest-result-heading h3 {
    margin: 0;
    font-size: 1.05rem;
}

.speedtest-throughput-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.speedtest-primary-metric {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 0.15rem 0.45rem;
    min-width: 0;
    padding: 1rem;
    border-radius: 9px;
    background: #eef6ff;
}

.speedtest-primary-metric.upload {
    background: #f7f1ff;
}

.speedtest-primary-metric .metric-label,
.speedtest-primary-metric small {
    grid-column: 1 / -1;
}

.speedtest-primary-metric strong {
    color: #075985;
    font-size: clamp(2rem, 6vw, 3.2rem);
    line-height: 1;
}

.speedtest-primary-metric.upload strong {
    color: #7e22ce;
}

.speedtest-primary-metric > span:not(.metric-label) {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 750;
}

.speedtest-primary-metric small {
    color: var(--muted);
    font-weight: 600;
}

.speedtest-quality-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.85rem;
}

.speedtest-quality-grid div {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.speedtest-quality-grid strong {
    overflow-wrap: anywhere;
}

.speedtest-run-details {
    margin: 0.9rem 0 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.speedtest-history {
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.speedtest-history summary {
    padding: 0.85rem 1rem;
    font-weight: 750;
    cursor: pointer;
}

.speedtest-history .table-wrap {
    border-top: 1px solid var(--line);
}

.speedtest-history table {
    min-width: 920px;
    font-size: 0.84rem;
}

.speedtest-history th,
.speedtest-history td {
    padding: 0.65rem 0.7rem;
    white-space: nowrap;
}

.speedtest-result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 0 0 1rem;
    padding: 0 0 1rem;
    border-bottom: 1px solid var(--line);
}

.speedtest-result-grid div {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.speedtest-result-grid strong {
    overflow-wrap: anywhere;
    font-size: 1.25rem;
}

.speedtest-result-grid small {
    color: var(--muted);
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.internet-detail-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.internet-detail-list > div {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
}

.internet-detail-list > div:last-child {
    border-bottom: 0;
}

.internet-detail-list dt {
    color: var(--muted);
    font-weight: 750;
}

.internet-detail-list dd {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
    margin: 0;
}

.internet-detail-list dd strong,
.internet-detail-list dd span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.internet-detail-list dd span {
    color: var(--ink);
}

.internet-detail-list .internet-dns-status {
    justify-self: start;
    margin-top: 0.2rem;
}

.internet-detail-list dd small {
    color: var(--muted);
    line-height: 1.35;
}

.essentials-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.35rem 1.2rem;
    margin: 0;
}

.essentials-grid div {
    min-width: 0;
}

.essentials-grid dt {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 650;
    margin-bottom: 0.35rem;
}

.essentials-grid dd {
    margin: 0;
    min-width: 0;
    color: var(--ink);
    word-break: break-word;
}

.essentials-grid .essentials-network-adapters {
    grid-column: 1 / -1;
}

.essentials-network-adapters > dd {
    margin-top: 0.5rem;
}

.active-adapter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.active-adapter-card {
    display: grid;
    gap: 0.8rem;
    min-width: 0;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.active-adapter-heading {
    display: grid;
    gap: 0.2rem;
}

.active-adapter-heading strong {
    overflow-wrap: anywhere;
}

.active-adapter-heading span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.active-adapter-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin: 0;
}

.active-adapter-card dl div {
    min-width: 0;
}

.active-adapter-card dl dt {
    margin-bottom: 0.18rem;
    font-size: 0.72rem;
    text-transform: uppercase;
}

.active-adapter-card dl dd {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.tool-link {
    display: grid;
    gap: 0.25rem;
    min-height: 76px;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

.tool-link:hover {
    border-color: rgba(37, 99, 235, 0.45);
    background: #f8fbff;
    text-decoration: none;
}

.tool-link span {
    color: var(--muted);
    font-size: 0.84rem;
}

.tool-link small {
    min-width: 0;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.battery-layout {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}

.battery-meter {
    position: relative;
    width: 70px;
    height: 150px;
    border: 3px solid var(--line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.battery-meter::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 22px;
    width: 22px;
    height: 8px;
    border-radius: 4px 4px 0 0;
    background: var(--line);
}

.battery-meter span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    background: var(--success);
}

.battery-meter.danger span {
    background: var(--danger);
}

.alert,
.validation-summary {
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(6, 118, 71, 0.24);
}

.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.24);
}

.update-job-detail-row td {
    padding-top: 0;
    border-top: 0;
}

.update-job-detail {
    display: grid;
    gap: 0.25rem;
    padding: 0.75rem 0.875rem;
    background: #f8fafc;
    border-left: 3px solid #94a3b8;
    color: #475569;
    overflow-wrap: anywhere;
}

.update-job-detail-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.update-job-detail.failed {
    background: #fff1f2;
    border-left-color: #dc2626;
    color: #991b1b;
}

.update-job-detail.pending {
    background: #fffbeb;
    border-left-color: #d97706;
    color: #92400e;
}

.alert-danger,
.validation-summary {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(180, 35, 24, 0.24);
}

.validation-summary-valid {
    display: none;
}

.error-text,
.field-validation-error {
    color: var(--danger);
}

.empty-text {
    color: var(--muted);
    margin: 0;
}

.auth-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1rem;
    background:
        linear-gradient(180deg, rgba(15, 118, 110, 0.12), transparent 38%),
        var(--bg);
}

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

.auth-panel {
    display: grid;
    gap: 1rem;
    padding: 1.35rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-panel h1 {
    margin: 0;
    font-size: 1.8rem;
}

.muted {
    margin: 0;
    color: var(--muted);
}

.status-pill.neutral {
    background: #eef2f6;
    color: #475569;
}

.web-traffic-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.web-traffic-summary .metric-card {
    min-height: 118px;
}

.web-traffic-summary .metric-card span,
.web-traffic-summary .metric-card small {
    color: var(--muted);
}

.web-site-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.web-site-card {
    min-width: 0;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.web-site-card.is-active {
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.09);
}

.web-site-card h3 {
    margin: 0;
    font-size: 1rem;
}

.web-site-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin: 0.8rem 0;
}

.web-site-metrics div {
    min-width: 0;
    padding: 0.55rem;
    border-radius: 7px;
    background: var(--bg);
}

.web-site-metrics dt {
    color: var(--muted);
    font-size: 0.75rem;
}

.web-site-metrics dd {
    margin: 0.2rem 0 0;
    font-size: 1rem;
    font-weight: 750;
}

.web-traffic-history {
    border: 1px solid var(--line);
    border-radius: 8px;
}

.web-traffic-history summary {
    padding: 0.85rem 1rem;
    cursor: pointer;
    font-weight: 750;
}

.web-traffic-history .table-wrap,
.web-traffic-history .empty-text {
    border-top: 1px solid var(--line);
}

.web-traffic-history .empty-text {
    padding: 1rem;
}

.web-traffic-history table,
.web-site-grid + table {
    min-width: 780px;
}

@media (max-width: 980px) {
    .app-header {
        grid-template-columns: 1fr auto;
    }

    .app-nav {
        grid-column: 1 / -1;
        order: 3;
        padding-top: 0.2rem;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .two-column {
        grid-template-columns: 1fr;
    }

    .scan-action-grid {
        grid-template-columns: 1fr;
    }

    .plex-connection-grid,
    .plex-stream-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .speedtest-quality-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .web-traffic-summary,
    .web-site-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .app-header {
        gap: 0.5rem;
    }

    .app-main {
        padding: 1rem;
    }

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

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .speedtest-progress-heading,
    .speedtest-result-heading {
        flex-direction: column;
        gap: 0.5rem;
    }

    .speedtest-throughput-grid,
    .speedtest-quality-grid {
        grid-template-columns: 1fr;
    }

    .dual-wan-heading,
    .dual-wan-card-heading {
        flex-direction: column;
    }

    .dual-wan-heading .secondary-button {
        width: 100%;
        text-align: center;
    }

    .dual-wan-grid,
    .dual-wan-details {
        grid-template-columns: 1fr;
    }

    .dual-wan-card-status {
        justify-content: flex-start;
    }

    .plex-session-summary {
        grid-template-columns: 108px minmax(0, 1fr);
        min-height: 180px;
    }

    .plex-poster-wrap,
    .plex-poster {
        min-height: 180px;
    }

    .plex-session-content {
        padding: 0.9rem;
    }

    .plex-title-row {
        flex-direction: column;
        gap: 0.55rem;
    }

    .plex-connection-grid,
    .plex-stream-grid {
        grid-template-columns: 1fr;
    }

    .plex-connection-grid {
        gap: 0.65rem;
    }

    .plex-stream-details summary {
        padding-inline: 0.9rem;
    }

    .plex-stream-grid {
        padding: 0 0.75rem 0.75rem;
    }

    .detail-grid,
    .essentials-grid,
    .diagnostic-grid,
    .battery-layout,
    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .internet-summary-grid,
    .speedtest-result-grid,
    .internet-detail-list > div {
        grid-template-columns: 1fr;
    }

    .internet-detail-list > div {
        gap: 0.35rem;
    }

    .button-row {
        align-items: stretch;
        flex-direction: column;
    }

    .button-row form,
    .button-row button {
        width: 100%;
    }

    .web-traffic-summary,
    .web-site-grid {
        grid-template-columns: 1fr;
    }

    .web-site-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .essentials-grid,
    .tool-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .essentials-grid,
    .tool-grid,
    .active-adapter-grid,
    .active-adapter-card dl {
        grid-template-columns: 1fr;
    }
}
