:root {
    color-scheme: light;

    --navy: #071d31;
    --navy-light: #102f4b;
    --blue: #0067b8;
    --blue-light: #e8f3fb;
    --green: #0a7d50;
    --green-light: #e7f6ef;
    --orange: #b65b00;
    --orange-light: #fff3e4;
    --red: #b42318;
    --red-light: #feeceb;
    --gray-25: #fcfcfd;
    --gray-50: #f7f8fa;
    --gray-100: #edf0f3;
    --gray-200: #dce1e6;
    --gray-500: #66717e;
    --gray-700: #34404c;
    --text: #17212b;
    --white: #ffffff;
    --shadow: 0 16px 40px rgba(7, 29, 49, 0.10);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--gray-50);
    color: var(--text);
    font-family:
        Inter,
        "Segoe UI",
        Arial,
        sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.login-view {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 520px) 1fr;
    background: var(--white);
}

.login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px clamp(28px, 6vw, 72px);
}

.brand-block,
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-block {
    margin-bottom: 56px;
}

.brand-block h1 {
    margin: 0;
    font-size: 24px;
}

.brand-block p {
    margin: 5px 0 0;
    color: var(--gray-500);
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #00a36c, #0067b8);
    color: var(--white);
    font-size: 26px;
    font-weight: 800;
}

.brand-mark.small {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 20px;
}

.login-copy h2 {
    margin: 0;
    font-size: 34px;
}

.login-copy p {
    margin: 12px 0 28px;
    max-width: 430px;
    color: var(--gray-500);
    line-height: 1.6;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 700;
}

.login-form input,
.search-input {
    width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 13px 14px;
    outline: none;
    background: var(--white);
}

.login-form input:focus,
.search-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 103, 184, 0.12);
}

.primary-button,
.secondary-button {
    border: 0;
    border-radius: 10px;
    padding: 12px 18px;
    font-weight: 700;
}

.primary-button {
    margin-top: 14px;
    background: var(--blue);
    color: var(--white);
}

.primary-button:hover {
    background: #00589e;
}

.primary-button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.secondary-button {
    background: var(--blue-light);
    color: var(--blue);
}

.form-error {
    margin: 8px 0 0;
    border-radius: 10px;
    padding: 10px 12px;
    background: var(--red-light);
    color: var(--red);
    font-size: 14px;
}

.login-security {
    display: grid;
    gap: 6px;
    margin-top: 28px;
    color: var(--gray-500);
    font-size: 13px;
}

.login-visual {
    display: flex;
    align-items: center;
    padding: 60px;
    background:
        radial-gradient(
            circle at 20% 20%,
            rgba(0, 163, 108, 0.25),
            transparent 35%
        ),
        radial-gradient(
            circle at 80% 75%,
            rgba(0, 103, 184, 0.30),
            transparent 40%
        ),
        linear-gradient(145deg, #071d31, #0d3a5d);
    color: var(--white);
}

.visual-content {
    width: min(760px, 100%);
}

.visual-chip {
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 13px;
}

.visual-content h2 {
    margin: 22px 0 38px;
    max-width: 700px;
    font-size: clamp(38px, 5vw, 66px);
    line-height: 1.08;
}

.visual-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.visual-card {
    display: grid;
    gap: 8px;
    min-height: 132px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
}

.visual-card strong {
    font-size: 20px;
}

.visual-card span {
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.5;
}

.app-view {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    background: var(--navy);
    color: var(--white);
}

.sidebar-brand {
    padding: 0 8px 26px;
}

.sidebar-brand div:last-child {
    display: grid;
    gap: 3px;
}

.sidebar-brand span {
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
}

.navigation {
    display: grid;
    gap: 8px;
}

.nav-button {
    border: 0;
    border-radius: 10px;
    padding: 12px 14px;
    text-align: left;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 650;
}

.nav-button:hover,
.nav-button.active {
    background: rgba(255, 255, 255, 0.10);
    color: var(--white);
}

.sidebar-user {
    margin-top: auto;
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    padding: 20px 6px 0;
}

.sidebar-avatar,
.avatar-fallback {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-fallback {
    display: grid;
    place-items: center;
    background: var(--blue);
    color: var(--white);
    font-weight: 800;
}

.sidebar-user-text {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.sidebar-user-text strong,
.sidebar-user-text span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-text span {
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
}

.logout-button {
    grid-column: 1 / -1;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 9px;
    padding: 9px 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
}

.main-content {
    min-width: 0;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 26px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-pill,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill.healthy,
.badge.healthy,
.badge.online {
    background: var(--green-light);
    color: var(--green);
}

.badge.warning {
    background: var(--orange-light);
    color: var(--orange);
}

.badge.critical,
.badge.issue,
.badge.offline {
    background: var(--red-light);
    color: var(--red);
}

.badge.neutral {
    background: var(--gray-100);
    color: var(--gray-700);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card,
.content-card,
.detail-card {
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 4px 16px rgba(7, 29, 49, 0.04);
}

.summary-card {
    padding: 20px;
}

.summary-label {
    color: var(--gray-500);
    font-size: 13px;
    font-weight: 700;
}

.summary-value {
    margin: 10px 0 4px;
    font-size: 34px;
    font-weight: 800;
}

.summary-note {
    color: var(--gray-500);
    font-size: 12px;
}

.content-card {
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 20px;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h2 {
    margin: 0;
    font-size: 19px;
}

.card-header p {
    margin: 5px 0 0;
    color: var(--gray-500);
    font-size: 13px;
}

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

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--gray-25);
    color: var(--gray-500);
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

td {
    font-size: 13px;
}

.asset-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.asset-thumbnail {
    width: 50px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--gray-100);
}

.asset-name {
    display: grid;
    gap: 4px;
}

.asset-name strong {
    font-size: 14px;
}

.asset-name span,
.muted {
    color: var(--gray-500);
    font-size: 12px;
}

.view-button,
.back-button,
.tab-button {
    border: 0;
    border-radius: 8px;
    padding: 8px 11px;
    background: var(--blue-light);
    color: var(--blue);
    font-weight: 750;
}

.back-button {
    margin-bottom: 18px;
}

.detail-hero {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 24px;
    margin-bottom: 20px;
    padding: 22px;
}

.detail-photo {
    width: 180px;
    height: 135px;
    border-radius: 14px;
    object-fit: cover;
    background: var(--gray-100);
}

.detail-hero h2 {
    margin: 0 0 6px;
    font-size: 28px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.detail-field {
    min-width: 0;
    padding: 13px;
    border-radius: 10px;
    background: var(--gray-50);
}

.detail-field span {
    display: block;
    margin-bottom: 5px;
    color: var(--gray-500);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-field strong {
    overflow-wrap: anywhere;
    font-size: 14px;
}

.tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    padding-bottom: 3px;
}

.tab-button {
    flex: 0 0 auto;
    background: var(--gray-100);
    color: var(--gray-700);
}

.tab-button.active {
    background: var(--navy);
    color: var(--white);
}

.tab-panel {
    padding: 20px;
}

.tab-panel h3 {
    margin-top: 0;
}

.detail-card {
    overflow: hidden;
}

.security-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.security-item {
    padding: 16px;
    border: 1px solid var(--gray-100);
    border-radius: 12px;
}

.security-item span {
    display: block;
    margin-bottom: 7px;
    color: var(--gray-500);
    font-size: 12px;
}

.empty-state,
.loading-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--gray-500);
}

.toast {
    position: fixed;
    z-index: 100;
    right: 22px;
    top: 22px;
    max-width: min(420px, calc(100vw - 44px));
    border-radius: 12px;
    padding: 13px 16px;
    background: var(--navy);
    color: var(--white);
    box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
    .login-view {
        grid-template-columns: 1fr;
    }

    .login-visual {
        display: none;
    }

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

    .detail-grid,
    .security-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .sidebar {
        position: static;
        height: auto;
    }

    .navigation {
        grid-template-columns: repeat(3, 1fr);
    }

    .nav-button {
        text-align: center;
    }

    .sidebar-user {
        margin-top: 20px;
    }

    .main-content {
        padding: 18px;
    }

    .topbar,
    .card-header {
        align-items: stretch;
        flex-direction: column;
    }

    .search-input {
        max-width: none;
    }

    .detail-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .summary-grid,
    .detail-grid,
    .security-grid {
        grid-template-columns: 1fr;
    }

    .login-panel {
        padding: 30px 22px;
    }

    .brand-block {
        margin-bottom: 36px;
    }

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

    .topbar-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

#profilePhotoButton {
    width: auto;
    min-width: 0;
    padding: 4px 0;
    margin: 4px 0 8px 60px;
    border: 0;
    background: transparent;
    color: #8fc5ff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

#profilePhotoButton:hover {
    color: #ffffff;
    text-decoration: underline;
}

#profilePhotoButton:disabled {
    opacity: 0.6;
    cursor: wait;
}

.device-photo-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.device-photo-button {
    border: 0;
    background: transparent;
    color: #0067b8;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 4px;
    cursor: pointer;
    white-space: nowrap;
}

.device-photo-button:hover {
    text-decoration: underline;
}

.device-photo-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.assigned-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}

.user-thumbnail {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #d7e0ea;
    background: #eef3f8;
}

.user-thumbnail-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f6cbd;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
}

.assigned-user-details {
    min-width: 0;
}

.assigned-user-details strong,
.assigned-user-details .muted {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assigned-user-details .muted {
    margin-top: 3px;
    font-size: 12px;
}

.asset-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.asset-status-filter {
    width: auto;
    min-width: 150px;
}

.asset-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    min-width: 170px;
}

.lifecycle-button {
    border: 0;
    border-radius: 6px;
    padding: 6px 9px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.lifecycle-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.archive-button {
    color: #7a4b00;
    background: #fff3cd;
}

.archive-button:hover {
    background: #ffe69c;
}

.restore-button {
    color: #075a2a;
    background: #dff6e8;
}

.restore-button:hover {
    background: #c9efd8;
}

.delete-button {
    color: #ffffff;
    background: #c4314b;
}

.delete-button:hover {
    background: #a4262c;
}

.audit-details {
    max-width: 420px;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .asset-toolbar {
        width: 100%;
        justify-content: stretch;
    }

    .asset-toolbar .search-input,
    .asset-status-filter {
        width: 100%;
    }
}
