:root {
    --bg-main: #0b1220;
    --bg-card: rgba(18, 27, 46, 0.92);
    --bg-soft: rgba(255, 255, 255, 0.04);
    --border-soft: rgba(255, 255, 255, 0.08);
    --text-main: #e6eefc;
    --text-soft: #94a3b8;
    --accent: #4f46e5;
    --accent-soft: rgba(79, 70, 229, 0.18);
    --cyan-soft: rgba(6, 182, 212, 0.14);
    --success-soft: rgba(34, 197, 94, 0.15);
    --danger-soft: rgba(239, 68, 68, 0.15);
    --warning-soft: rgba(245, 158, 11, 0.16);
}

* {
    font-family: 'Inter', system-ui, sans-serif;
}

body {
    background:
        radial-gradient(circle at top right, rgba(79, 70, 229, 0.18), transparent 24%),
        radial-gradient(circle at 15% 20%, rgba(6, 182, 212, 0.14), transparent 28%),
        linear-gradient(180deg, #09111f 0%, #050814 100%);
    color: var(--text-main);
    min-height: 100vh;
    position: relative;
}

.control-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 85%);
    pointer-events: none;
}

.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    background: var(--warning-soft);
    border-bottom: 1px solid rgba(245, 158, 11, 0.28);
    color: #fde68a;
    position: relative;
    z-index: 2;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 28px 20px;
    background: rgba(8, 14, 28, 0.95);
    border-right: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    height: 100vh;
    backdrop-filter: blur(18px);
}

.brand-wrap {
    margin-bottom: 1rem;
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
}

.brand-subtitle {
    color: var(--text-soft);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 6px;
}

.control-chip-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.control-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 0.78rem;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-soft);
    border-radius: 14px;
    padding: 12px 14px;
    background: transparent;
    transition: 0.2s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: var(--text-main);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25), 0 0 24px rgba(79, 70, 229, 0.16);
}

.user-box,
.panel-card,
.stat-card,
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 22px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    inset: auto -30px -30px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.22), transparent 70%);
}

.main-content {
    padding: 32px;
}

.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: stretch;
}

.page-header-panel,
.page-header-meta {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 18px 20px;
}

.page-header-panel {
    flex: 1;
}

.page-header-meta {
    min-width: 260px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.meta-card {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.12);
}

.meta-label {
    display: block;
    color: var(--text-soft);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
}

.meta-value {
    font-weight: 700;
    color: #c7d2fe;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-soft);
    padding: 18px 22px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.card-body {
    padding: 22px;
}

.stat-label {
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-online {
    border-color: rgba(34, 197, 94, 0.18);
}

.stat-offline {
    border-color: rgba(148, 163, 184, 0.18);
}

.ops-banner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 22px 24px;
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(8, 14, 28, 0.86));
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.ops-kicker {
    color: #818cf8;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    margin-bottom: 8px;
}

.ops-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 6px;
}

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

.panel-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.18);
    color: #a5f3fc;
    font-size: 0.78rem;
    font-weight: 600;
}

.form-control,
.form-select,
textarea {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: var(--border-soft) !important;
    color: var(--text-main) !important;
    border-radius: 14px !important;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    border-color: rgba(99, 102, 241, 0.6) !important;
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15) !important;
}

.table > :not(caption) > * > * {
    background: transparent !important;
    border-bottom-color: var(--border-soft) !important;
}

.alert-soft {
    border: 1px solid transparent;
    border-radius: 16px;
}

.alert-success.alert-soft {
    background: var(--success-soft);
    border-color: rgba(34, 197, 94, 0.22);
    color: #c8f7d0;
}

.alert-danger.alert-soft {
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, 0.22);
    color: #ffd1d1;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-card {
    width: min(100%, 460px);
}

.auth-icon {
    width: 72px;
    height: 72px;
    margin-inline: auto;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: var(--accent-soft);
    font-size: 1.8rem;
    color: #a5b4fc;
}

.secret-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    padding: 12px 14px;
    word-break: break-all;
}

.stack-inline {
    display: grid;
    grid-template-columns: 120px 180px 110px auto;
    gap: 8px;
}

.list-group-item {
    color: var(--text-main);
}

.task-payload-preview {
    max-width: 260px;
}

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

    .sidebar {
        position: relative;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-soft);
    }

    .page-header,
    .ops-banner,
    .impersonation-banner {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 20px;
    }

    .stack-inline,
    .page-header-meta {
        grid-template-columns: 1fr;
    }

    .page-header-meta {
        min-width: 0;
    }
}
