@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap');

:root {
    --bg: #091122;
    --bg-soft: #111e37;
    --glass: rgba(12, 25, 49, 0.78);
    --line: rgba(255, 255, 255, 0.08);
    --text: #e6f1ff;
    --muted: #99aecf;
    --accent: #10b981;
    --accent-2: #22d3ee;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(circle at 18% 10%, #163465 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, #2a1f55 0%, transparent 48%),
                linear-gradient(140deg, #070d1b 0%, #091122 45%, #0c1630 100%);
    color: var(--text);
    font-family: 'Manrope', sans-serif;
}

.bg-orb {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.35;
}

.orb-a {
    top: -60px;
    right: -60px;
    background: #22d3ee;
}

.orb-b {
    left: -80px;
    bottom: -90px;
    background: #10b981;
}

.hidden {
    display: none !important;
}

.glass {
    background: var(--glass);
    border: 1px solid var(--line);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
}

.install-warning {
    max-width: 620px;
    margin: 90px auto;
    padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--glass);
}

.install-warning .button {
    margin-top: 12px;
}

.login-wrap {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 460px;
    border-radius: 24px;
    padding: 30px;
}

.login-card h1 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
}

.login-card p {
    margin: 10px 0 24px;
    color: var(--muted);
}

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

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(7, 15, 29, 0.9);
    color: var(--text);
    padding: 11px 12px;
    font: inherit;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

.button {
    border: 1px solid var(--line);
    background: rgba(30, 41, 59, 0.9);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, filter 0.16s ease;
}

.button:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.button.primary {
    background: linear-gradient(135deg, #10b981, #14b8a6);
    border-color: transparent;
}

.button.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: transparent;
}

.error-msg {
    color: #fca5a5;
    min-height: 22px;
    margin: 8px 0 0;
}

.app-shell {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 18px;
    padding: 16px;
}

.sidebar {
    border-radius: var(--radius);
    padding: 20px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 22px;
}

.brand h2 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: 0.4px;
}

.brand span {
    color: var(--muted);
    font-size: 13px;
}

.sidebar nav {
    display: grid;
    gap: 10px;
}

.nav-btn {
    text-align: left;
    border: 1px solid transparent;
    border-radius: 12px;
    background: rgba(8, 16, 32, 0.75);
    color: #d8e8ff;
    padding: 12px;
    font-size: 14px;
    cursor: pointer;
}

.nav-btn.active {
    border-color: rgba(34, 211, 238, 0.5);
    background: rgba(8, 24, 45, 0.95);
    color: #f5fbff;
}

.content {
    display: grid;
    gap: 14px;
    align-content: start;
}

.topbar {
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
    font-family: 'Space Grotesk', sans-serif;
}

.topbar p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.view-section {
    display: grid;
    gap: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(110px, 1fr));
    gap: 12px;
}

.stat-card {
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(8, 18, 35, 0.85);
    padding: 16px;
}

.stat-card h3 {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 27px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar input[type='search'] {
    flex: 1;
    min-width: 220px;
}

.table-wrap {
    border-radius: 14px;
    overflow: auto;
}

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

th,
td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    font-size: 13px;
}

th {
    background: rgba(6, 15, 30, 0.95);
    color: #d8e8ff;
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody tr:hover {
    background: rgba(16, 185, 129, 0.06);
}

.badge {
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
}

.badge.ok {
    background: rgba(16, 185, 129, 0.18);
    color: #6ee7b7;
}

.badge.no {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.notice {
    border-radius: 14px;
    padding: 14px;
    color: var(--muted);
}

code {
    background: rgba(10, 16, 34, 0.85);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 2px 6px;
    color: #d4f7ff;
}

.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-row .button {
    padding: 7px 10px;
    font-size: 12px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 24, 0.7);
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.modal-card {
    width: 100%;
    max-width: 600px;
    max-height: calc(100dvh - 36px);
    border-radius: 16px;
    padding: 18px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 12px;
    overflow: hidden;
}

.modal-card h3 {
    margin: 0;
}

.modal-card .form-grid {
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
    -webkit-overflow-scrolling: touch;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 0;
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(8, 16, 32, 0), rgba(8, 16, 32, 0.92) 24%);
    padding-top: 10px;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
    }
}

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

    .sidebar {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

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

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

    .stats-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 520px) {
    .sidebar nav {
        grid-template-columns: 1fr;
    }

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

    .modal {
        padding: 10px;
    }

    .modal-card {
        max-height: calc(100dvh - 20px);
        padding: 14px;
    }
}
