:root {
    color-scheme: dark;
    --bg: #090d12;
    --panel: #101821;
    --panel-2: #0d141d;
    --line: #202936;
    --line-soft: #172231;
    --text: #e6edf3;
    --muted: #8d9aaa;
    --healthy: #33d17a;
    --warning: #f5c542;
    --critical: #ff5c63;
    --unknown: #8a95a3;
    --accent: #4aa3ff;
}

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

a {
    color: var(--accent);
}

.eyebrow {
    display: block;
    margin-bottom: 0.18rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.btn {
    border-radius: 8px;
}

.btn-card {
    border: 1px solid var(--line);
    background: #111a25;
    color: #cbd5e1;
    font-size: 0.76rem;
    padding: 0.38rem 0.55rem;
    transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.btn-touch {
    min-height: 44px;
    border: 1px solid rgba(74, 163, 255, 0.36);
    border-radius: 8px;
    background: #12304a;
    color: #d9edff;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.65rem 0.85rem;
}

.btn-touch:hover {
    border-color: rgba(74, 163, 255, 0.72);
    background: #173a59;
    color: #fff;
}

.btn-touch.compact {
    min-height: 34px;
    width: 100%;
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
}

.btn-card:hover {
    transform: translateY(-1px);
    border-color: #34465c;
    background: #162232;
    color: #fff;
}

.btn-card.primary,
.btn-accent {
    border-color: rgba(74, 163, 255, 0.4);
    background: #12304a;
    color: #d9edff;
}

.btn-card.danger {
    border-color: rgba(255, 92, 99, 0.35);
    color: #ffb8bd;
}

.icon-button {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #101821;
    color: #d8e1ec;
    font-weight: 800;
}

.icon-button:hover {
    border-color: #34465c;
    background: #162232;
}

.settings-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.login-page {
    min-height: calc(100vh - 3rem);
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-panel {
    width: min(100%, 380px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 1.25rem;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.login-panel h2 {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
}

.login-panel p {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.login-panel form {
    display: grid;
    gap: 0.85rem;
}

.login-error {
    border: 1px solid rgba(255, 92, 99, 0.35);
    border-radius: 8px;
    background: rgba(255, 92, 99, 0.08);
    color: #ffb8bd;
    font-size: 0.82rem;
    padding: 0.55rem 0.65rem;
}

.text-success {
    color: var(--healthy) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-danger {
    color: var(--critical) !important;
}

.text-secondary {
    color: var(--unknown) !important;
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(92px, 1fr)) auto;
    gap: 0;
    overflow: hidden;
    margin-bottom: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}

.data-panel,
.alert-panel,
.monitor-card,
.editor-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.status-strip div {
    min-width: 0;
    padding: 0.48rem 0.62rem;
    border-right: 1px solid rgba(40, 52, 69, 0.75);
}

.status-strip div:last-child {
    border-right: 0;
}

.status-strip .overview-card.is-critical {
    background: rgba(248, 81, 73, 0.13);
    box-shadow: inset 3px 0 0 var(--critical);
}

.status-strip .overview-card.is-warning {
    background: rgba(210, 153, 34, 0.13);
    box-shadow: inset 3px 0 0 var(--warning);
}

.status-strip .status-action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.5rem;
    border-right: 0;
    background: #0c131c;
}

.status-strip span,
.metric-line span,
.section-heading p,
.alert-row span,
.table-toolbar span,
.ops-table small {
    color: var(--muted);
    font-size: 0.78rem;
}

.status-strip strong {
    display: block;
    margin-top: 0.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.dashboard-main {
    display: grid;
    gap: 0.85rem;
}

.dashboard-section {
    min-width: 0;
}

.section-heading,
.panel-title,
.page-head,
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.section-heading {
    margin-bottom: 0.42rem;
}

.section-heading h2,
.panel-title h2,
.page-head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.section-heading p {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.15rem 0 0;
}

.section-count {
    flex: 0 0 auto;
    color: #aab7c7;
    font-size: 0.78rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    background: #0e1620;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
    gap: 0.45rem;
}

.monitor-card {
    min-width: 0;
    min-height: 118px;
    padding: 0.48rem;
    border-left-width: 3px;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.monitor-card:hover {
    transform: translateY(-2px);
    border-color: #34465c;
    background: #111b26;
}

.status-border-healthy {
    border-left-color: var(--healthy);
}

.status-border-warning {
    border-left-color: var(--warning);
}

.status-border-critical {
    border-left-color: var(--critical);
}

.status-border-unknown {
    border-left-color: var(--unknown);
}

.card-head {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 0.38rem;
    align-items: start;
}

.card-head .status-pill {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 0.08rem;
}

.asset-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    border-radius: 8px;
    padding: 0.28rem;
    background: #0b1118;
    border: 1px solid var(--line-soft);
}

.asset-title {
    min-width: 0;
}

.asset-title h3 {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.18;
    font-size: 0.76rem;
    font-weight: 700;
}

.asset-title span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 0.64rem;
}

.card-body-compact {
    display: grid;
    gap: 0.18rem;
    margin: 0.34rem 0 0;
}

.metric-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.36rem;
    min-height: 1rem;
}

.metric-line strong {
    color: #edf4fb;
    font-size: 0.68rem;
    font-weight: 650;
}

.metric-line span {
    font-size: 0.66rem;
}

.health-dot-line {
    align-items: center;
}

.health-dots {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.34rem;
}

.status-dot-only {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.status-dot-only.healthy {
    color: var(--healthy);
}

.status-dot-only.warning {
    color: var(--warning);
}

.status-dot-only.critical {
    color: var(--critical);
}

.status-dot-only.unknown {
    color: var(--unknown);
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--line-soft);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 1.05rem;
    border-radius: 999px;
    padding: 0.08rem 0.34rem;
    font-size: 0.58rem;
    font-weight: 700;
    border: 1px solid currentColor;
}

.status-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background: currentColor;
}

.status-pill.healthy {
    color: var(--healthy);
    background: rgba(51, 209, 122, 0.09);
}

.status-pill.warning {
    color: var(--warning);
    background: rgba(245, 197, 66, 0.09);
}

.status-pill.critical {
    color: var(--critical);
    background: rgba(255, 92, 99, 0.09);
}

.status-pill.unknown {
    color: var(--unknown);
    background: rgba(138, 149, 163, 0.09);
}

.alert-strip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.65rem;
    margin-bottom: 0.85rem;
    padding: 0.45rem 0.55rem;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.alert-strip-title {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex: 0 0 auto;
    padding-right: 0.55rem;
    border-right: 1px solid var(--line-soft);
}

.alert-strip-title strong {
    font-size: 0.78rem;
}

.alert-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    max-width: 260px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    padding: 0.25rem 0.45rem;
    background: #0c131b;
}

.alert-chip > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #c6d0dc;
    font-size: 0.74rem;
}

.settings-page {
    display: grid;
    gap: 1rem;
}

.table-toolbar {
    align-items: center;
}

.notification-type-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.7rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.notification-type-options > span {
    width: 100%;
    color: var(--muted);
}

.notification-type-options label {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    color: var(--text);
    font-size: 0.78rem;
}

.search-input {
    max-width: 430px;
}

.form-control,
.form-select {
    min-height: 2.45rem;
    color: var(--text);
    background-color: #0c131b;
    border-color: #273448;
}

.form-control:focus,
.form-select:focus {
    color: var(--text);
    background-color: #0c131b;
    border-color: var(--accent);
    box-shadow: 0 0 0 0.15rem rgba(74, 163, 255, 0.15);
}

.data-panel {
    overflow-x: auto;
}

.ops-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

.ops-table th,
.ops-table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
    font-size: 0.84rem;
}

.ops-table th {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.table-asset {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.table-asset img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.ops-table small {
    display: block;
    margin-top: 0.15rem;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
}

.editor-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.58);
}

.editor-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 50;
    width: min(620px, 100vw);
    height: 100vh;
    overflow: auto;
    padding: 1rem;
    border-radius: 0;
    animation: slide-in 160ms ease-out;
}

.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 50;
    width: min(520px, 100vw);
    height: 100vh;
    overflow: auto;
    padding: 1rem;
    border-left: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    animation: slide-in 160ms ease-out;
}

.detail-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.detail-title img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 0.35rem;
    background: #0b1118;
}

.detail-title span,
.detail-status span,
.detail-notes span {
    color: var(--muted);
    font-size: 0.78rem;
}

.detail-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.85rem 0 0.65rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--line-soft);
}

.detail-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
    gap: 0.55rem;
    margin-bottom: 1rem;
}

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

.detail-notes {
    margin-top: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #0c131b;
}

.detail-notes p {
    margin: 0.3rem 0 0;
    color: #d8e1ec;
    font-size: 0.84rem;
}

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

.form-grid label {
    display: grid;
    gap: 0.35rem;
    color: #c6d0dc;
    font-size: 0.8rem;
    font-weight: 650;
}

.form-grid .wide {
    grid-column: 1 / -1;
}

.toggle-row {
    display: flex !important;
    align-items: center;
    gap: 0.55rem;
}

.password-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem;
}

.unifi-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: center;
}

.unifi-error {
    border: 1px solid rgba(255, 92, 99, 0.35);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    color: #ffb8bd;
    background: rgba(255, 92, 99, 0.08);
    font-size: 0.8rem;
}

.unifi-device-list {
    display: grid;
    gap: 0.45rem;
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 0.55rem;
    background: #0c131b;
}

.unifi-device-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem !important;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 0.55rem;
    background: #101821;
}

.unifi-device-row input {
    width: 1rem;
    height: 1rem;
}

.unifi-device-row span {
    min-width: 0;
}

.unifi-device-row strong,
.unifi-device-row small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unifi-device-row small {
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.72rem;
}

.editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line-soft);
}

.validation-message,
.validation-errors {
    color: #ff9ca2;
}

.loading-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    background: var(--panel);
}

@keyframes slide-in {
    from {
        transform: translateX(28px);
        opacity: 0.65;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 1100px) {
    .status-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .status-strip .status-action {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .content {
        padding: 0.85rem;
    }

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

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

    .section-heading,
    .page-head,
    .table-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .unifi-toolbar {
        grid-template-columns: 1fr;
    }
}
