:root {
    --bg-main: #060913;
    --bg-card: rgba(16, 23, 42, 0.65);
    --border-glow: rgba(14, 165, 233, 0.25);
    --border-focus: #0ea5e9;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --cyan-neon: #00f2ff;
    --green-neon: #10b981;
    --magenta-neon: #ff007f;
    --yellow-neon: #f59e0b;
    --red-neon: #ef4444;
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-tech: 'Space Grotesk', 'Courier New', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    line-height: 1.6;
}

/* CRT & Background Atmosphere */
.crt-scanlines {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0, 0, 0, 0.25) 50%,
        rgba(0, 0, 0, 0.25)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.6;
}

.cyber-grid {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-image: 
        linear-gradient(to right, rgba(14, 165, 233, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(14, 165, 233, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: -2;
}

.ambient-glow {
    position: fixed;
    top: 20%; left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.08) 0%, rgba(16, 185, 129, 0.04) 50%, transparent 70%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), 0 0 20px rgba(0, 242, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Pulse dots & colors */
.pulse-dot {
    display: inline-block;
    width: 10px; height: 10px;
    background-color: var(--cyan-neon);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--cyan-neon);
    animation: pulse 1.5s infinite;
}
.pulse-dot.green {
    background-color: var(--green-neon);
    box-shadow: 0 0 10px var(--green-neon);
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 15px var(--cyan-neon); }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.text-green { color: var(--green-neon); }
.text-cyan { color: var(--cyan-neon); font-family: var(--font-tech); }
.text-yellow { color: var(--yellow-neon); font-family: var(--font-tech); }
.text-blue { color: #38bdf8; }

/* ==================== LOGIN VIEW ==================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.login-container {
    width: 100%;
    max-width: 460px;
    z-index: 10;
}

.login-card {
    padding: 2.5rem 2rem;
    text-align: center;
    border: 1px solid rgba(0, 242, 255, 0.3);
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.1);
}

.badge-portal {
    display: inline-block;
    background: rgba(0, 242, 255, 0.1);
    color: var(--cyan-neon);
    border: 1px solid var(--cyan-neon);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.glitch-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.4), 0 0 30px var(--cyan-neon);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid var(--red-neon);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    text-align: left;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.login-form .input-group {
    text-align: left;
    margin-bottom: 1.25rem;
}
.login-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.icon-prefix {
    position: absolute;
    left: 12px;
    font-size: 1.1rem;
    pointer-events: none;
    opacity: 0.8;
}
.input-wrapper input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.8rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}
.input-wrapper input:focus {
    outline: none;
    border-color: var(--cyan-neon);
    box-shadow: 0 0 12px rgba(0, 242, 255, 0.3);
    background: rgba(0, 0, 0, 0.7);
}

.cyber-btn-primary {
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border: 1px solid var(--cyan-neon);
    color: #fff;
    font-family: var(--font-tech);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}
.cyber-btn-primary:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 0 30px var(--cyan-neon);
    transform: translateY(-2px);
}

.login-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

/* ==================== PORTAL PANEL VIEW ==================== */
.panel-body {
    padding: 1.5rem;
}

.portal-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 10;
    position: relative;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.logo-box {
    background: linear-gradient(135deg, var(--green-neon), #059669);
    color: #000;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
    letter-spacing: 1px;
}
.brand-text h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}
.brand-text .sub-label {
    font-size: 0.8rem;
    color: var(--cyan-neon);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.user-name {
    font-size: 0.95rem;
    color: #fff;
}
.role-tag {
    background: rgba(255, 0, 127, 0.15);
    color: var(--magenta-neon);
    border: 1px solid var(--magenta-neon);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 0.2rem;
}
.logout-btn {
    padding: 0.6rem 1.2rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--red-neon);
    color: #fca5a5;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.logout-btn:hover {
    background: var(--red-neon);
    color: #fff;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Cluster Status Strip */
.cluster-status-strip {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), rgba(14, 165, 233, 0.15));
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}
.status-indicator .highlight {
    color: var(--green-neon);
    font-weight: 700;
    text-decoration: underline;
}
.status-details {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Instruction banner */
.instruction-banner {
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.instruction-banner .icon-col {
    font-size: 2.5rem;
}
.instruction-banner .text-col {
    flex-grow: 1;
}
.instruction-banner h3 {
    font-size: 1.2rem;
    color: var(--cyan-neon);
    margin-bottom: 0.4rem;
}
.instruction-banner p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.instruction-banner code {
    background: rgba(0,0,0,0.5);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: var(--yellow-neon);
    font-family: var(--font-tech);
}
.slots-meter {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    text-align: center;
    min-width: 160px;
}
.meter-title {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1px;
}
.meter-val {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--cyan-neon);
    margin-top: 0.2rem;
}

/* 6 Slots Grid */
.slots-grid-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.5rem;
}
.slot-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    border-left: 4px solid var(--text-muted);
}
.slot-card.active-slot {
    border-left: 4px solid var(--green-neon);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.15);
}
.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.slot-badge {
    font-family: var(--font-tech);
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.2rem 0.7rem;
    border-radius: 6px;
}
.slot-status {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}
.slot-status.ready {
    background: rgba(16, 185, 129, 0.2);
    color: var(--green-neon);
    border: 1px solid var(--green-neon);
}

.slot-routing-info {
    margin-top: -0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-row label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}
.slot-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: 0.2s;
}
.slot-input:focus {
    outline: none;
    border-color: var(--cyan-neon);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.25);
}
.slot-input:disabled {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.4);
    color: #fff;
    cursor: not-allowed;
}

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-lock-slot {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: var(--font-tech);
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
}
.btn-lock-slot:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: var(--cyan-neon);
    color: var(--cyan-neon);
}
.btn-lock-slot.locked {
    background: linear-gradient(135deg, var(--green-neon), #059669);
    color: #000;
    border-color: var(--green-neon);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

/* Master Control Bar */
.master-control-bar {
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    border: 1px solid rgba(0, 242, 255, 0.3);
    background: linear-gradient(135deg, rgba(16, 23, 42, 0.8) 0%, rgba(14, 165, 233, 0.1) 100%);
}
.control-summary h4 {
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 0.5rem;
}
.control-summary p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.control-button-box {
    min-width: 380px;
    display: flex;
    flex-direction: column;
}

.cyber-btn-launch {
    padding: 1.2rem 1.5rem;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #000;
    font-family: var(--font-tech);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.btn-text-main {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
}
.btn-subtext {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.8;
    margin-top: 0.2rem;
}

/* Disabled state styling requested by user */
.disabled-launch {
    background: rgba(255, 255, 255, 0.06);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}
.disabled-launch::after {
    content: "🔒 SYNC IN PROGRESS / AUTO-QUEUE ACTIVE";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(6, 9, 19, 0.85);
    color: var(--cyan-neon);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
    backdrop-filter: blur(2px);
}
.disabled-launch:hover::after {
    opacity: 1;
}

.cluster-note-footer {
    padding: 1rem;
    background: rgba(14, 165, 233, 0.08);
    border-radius: 8px;
    border-left: 4px solid var(--cyan-neon);
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.cluster-note-footer strong {
    color: var(--text-primary);
}

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Responsive & Mobile Friendly */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .navbar { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .user-profile { align-self: flex-end; width: 100%; justify-content: space-between; }
    .cluster-status-strip { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .instruction-banner { flex-direction: column; text-align: center; }
    .slots-grid { grid-template-columns: 1fr !important; gap: 1rem; }
    .grid-2-col { grid-template-columns: 1fr !important; gap: 0.75rem !important; }
    #clientProxyGrid { grid-template-columns: 1fr !important; max-height: 300px; }
    .master-control-bar { flex-direction: column; text-align: center; gap: 1.5rem; padding: 1.25rem; }
    .control-button-box { min-width: 100%; width: 100%; }
    #btnTerminateMaster { padding: 0.8rem 1rem; font-size: 0.95rem; }
    .slot-card { padding: 1.25rem; }
}
@media (max-width: 480px) {
    .brand h1 { font-size: 1.5rem; }
    .status-indicator { flex-direction: column; text-align: center; }
}

