
:root {
    --bg: #0b1120;
    --panel: #111a2e;
    --panel-2: #16203a;
    --border: rgba(148, 163, 184, .16);
    --text: #e6edf7;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --green: #22c55e;
    --red: #ef4444;
    --amber: #f59e0b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, sans-serif;
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(56, 189, 248, .13), transparent),
        var(--bg);
    color: var(--text);
}

.app {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    background: rgba(17, 26, 46, .92);
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 34px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    font-weight: 700;
    color: #04121f;
    background: linear-gradient(135deg, #38bdf8, #22d3ee);
}

.brand-title {
    font-weight: 700;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--muted);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    transition: .2s;
}

.nav-link:hover {
    color: var(--text);
    background: rgba(56, 189, 248, .08);
}

.nav-link.active {
    color: #04121f;
    background: var(--accent);
}

.nav-link.disabled {
    opacity: .45;
    pointer-events: none;
}

.sidebar-footer {
    margin-top: auto;
}

.user-box {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    background: rgba(148, 163, 184, .07);
}

.user-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 700;
    background: var(--accent);
    color: #04121f;
}

.user-name {
    font-weight: 600;
}

.logout-link {
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
}

.logout-link:hover {
    color: var(--red);
}

.main {
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 26px 34px;
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    font-size: 22px;
    font-weight: 700;
}

.topbar-subtitle {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.connection-pill {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--green);
    background: rgba(34, 197, 94, .1);
    border: 1px solid rgba(34, 197, 94, .25);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.content {
    padding: 30px 34px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 26px;
}

.stat-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.stat-card {
    padding: 18px;
}

.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin: 8px 0 4px;
}

.stat-hint {
    font-size: 12px;
    color: var(--muted);
}

.stat-card.success .stat-value {
    color: var(--green);
}

.stat-card.danger .stat-value {
    color: var(--red);
}

.panel {
    padding: 22px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-title {
    margin: 0;
    font-size: 18px;
}

.panel-description {
    margin: 5px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.well-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px;
}

.well-card {
    display: block;
    padding: 18px;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    background: var(--panel-2);
    border: 1px solid var(--border);
    transition: .2s;
}

.well-card:hover {
    border-color: rgba(56, 189, 248, .45);
    transform: translateY(-2px);
}

.well-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.well-name {
    font-weight: 700;
}

.well-pad {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

.status-badge {
    font-size: 11px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .13);
    color: var(--muted);
}

.status-online {
    color: var(--green);
    background: rgba(34, 197, 94, .12);
}

.status-alarm {
    color: var(--red);
    background: rgba(239, 68, 68, .12);
}

.well-card-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    font-size: 12px;
    color: var(--muted);
}

.open-link {
    color: var(--accent);
    font-weight: 600;
}

.empty-state {
    padding: 34px;
    text-align: center;
    color: var(--muted);
}

@media (max-width: 1000px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .sidebar-footer {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


.login-wrap {
    min-height: 70vh;
    display: grid;
    place-items: center;
}

.login-card {
    width: min(420px, 100%);
    padding: 30px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.login-subtitle {
    color: var(--muted);
    font-size: 13px;
}

.login-card label {
    display: block;
    margin: 16px 0 7px;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .07em;
}

.login-card input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
}

.btn-primary {
    width: 100%;
    margin-top: 22px;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    font-weight: 600;
    color: #04121f;
    background: var(--accent);
    cursor: pointer;
}

.message {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.message-error {
    color: #fecaca;
    background: rgba(239, 68, 68, .12);
    border: 1px solid rgba(239, 68, 68, .25);
}


.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.metric {
    padding: 14px;
    border-radius: 12px;
    background: var(--panel-2);
    border: 1px solid var(--border);
}

.metric-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
}

.metric-value {
    display: block;
    margin-top: 7px;
    font-size: 20px;
    font-weight: 700;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.tab {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
}

.tab.active {
    color: #04121f;
    background: var(--accent);
    border-color: var(--accent);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.command-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.command-form select,
.command-form input {
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
}

.command-list {
    margin-top: 18px;
    border-top: 1px solid var(--border);
}

.command-row {
    display: grid;
    grid-template-columns: 1.3fr .7fr .8fr 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.command-status {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .13);
}

.command-status.pending {
    color: var(--amber);
    background: rgba(245, 158, 11, .12);
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 15px;
    border-radius: 12px;
    background: var(--panel-2);
    border-left: 3px solid var(--muted);
}

.event-alarm {
    border-left-color: var(--red);
}

.event-warning {
    border-left-color: var(--amber);
}

.event-info {
    border-left-color: var(--accent);
}

.event-message {
    font-weight: 600;
}

.event-time {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

.event-level {
    font-size: 11px;
    color: var(--muted);
}

@media (max-width: 1000px) {
    .detail-grid,
    .metric-grid {
        grid-template-columns: 1fr;
    }
}


.metric-value {
    word-break: break-word;
}

.metric-value:empty::after {
    content: "—";
    color: var(--muted);
}


.admin-inline-vsregister .field-code {
    min-width: 30ch;
}

.admin-inline-vsregister .field-unit,
.admin-inline-vsregister .field-min_value,
.admin-inline-vsregister .field-max_value {
    min-width: 10ch;
}

