/* ==========================================================================
   VLSM CALCULATOR - PROFESSIONAL NETWORK NOC STYLESHEET
   Clean, Neat, and High-Contrast Network Operations Center Theme
   ========================================================================== */

:root {
    /* NOC Cyber Dark Theme (Default) */
    --bg-base: #060913;
    --bg-surface: #0c1222;
    --bg-surface-elevated: #111a30;
    --bg-surface-card: rgba(13, 20, 38, 0.88);
    --border-color: #1e2942;
    --border-glow: rgba(6, 182, 212, 0.35);
    
    --accent-cyan: #06b6d4;
    --accent-cyan-hover: #0891b2;
    --accent-cyan-glow: rgba(6, 182, 212, 0.25);
    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.2);
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-purple: #8b5cf6;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #38bdf8;

    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, Monaco, "Courier New", monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 4px 12px -2px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.15);
}

/* Cisco Blue Tech Theme */
body.theme-cisco {
    --bg-base: #051024;
    --bg-surface: #0a1b38;
    --bg-surface-elevated: #0f2852;
    --bg-surface-card: rgba(10, 27, 56, 0.92);
    --border-color: #1d3e75;
    --border-glow: rgba(59, 130, 246, 0.4);
    --accent-cyan: #00bceb;
    --accent-blue: #049fd9;
    --text-accent: #38bdf8;
}

/* Matrix Terminal Green Theme */
body.theme-matrix {
    --bg-base: #030a06;
    --bg-surface: #06150b;
    --bg-surface-elevated: #0d2615;
    --bg-surface-card: rgba(6, 21, 11, 0.92);
    --border-color: #143d20;
    --border-glow: rgba(16, 185, 129, 0.4);
    --accent-cyan: #10b981;
    --accent-blue: #059669;
    --accent-emerald: #00ff88;
    --text-accent: #34d399;
}

/* High Contrast Light Theme */
body.theme-light {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-surface-card: #ffffff;
    --border-color: #cbd5e1;
    --border-glow: rgba(2, 132, 199, 0.2);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-accent: #0284c7;
    --accent-cyan: #0284c7;
    --accent-blue: #2563eb;
    --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Global Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(6, 182, 212, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(59, 130, 246, 0.06) 0%, transparent 45%),
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 36px 36px, 36px 36px;
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* Main Container */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem 1.5rem;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
    background: var(--bg-surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.75rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(16px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 1.15rem;
}

.brand-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(59, 130, 246, 0.18));
    border: 1px solid var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.25);
}

.brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.brand-title span.highlight {
    background: linear-gradient(90deg, var(--accent-cyan), #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.35);
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    letter-spacing: 0.05em;
}

.brand-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.theme-selector {
    display: flex;
    align-items: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.2rem;
}

.theme-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.theme-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.theme-btn:hover:not(.active) {
    color: var(--text-secondary);
}

/* ==========================================================================
   CARD BASE STYLES
   ========================================================================== */
.card {
    background: var(--bg-surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(14px);
    overflow: hidden;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    border-color: rgba(6, 182, 212, 0.3);
}

/* ==========================================================================
   STEP 1: INPUT SECTION (CENTERED, SPACIOUS & CLEAN)
   ========================================================================== */
.input-section-wrapper {
    max-width: 900px;
    margin: 0 auto 2.5rem auto;
    transition: all 0.3s ease;
}

.input-card .card-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.015);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.step-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-cyan);
    color: #060913;
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.input-card .card-body {
    padding: 2rem 1.75rem;
}

/* Form Blocks */
.form-block {
    margin-bottom: 2rem;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.15rem;
}

.block-title {
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-accent);
}

.badge-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 9999px;
    color: var(--accent-cyan);
    font-weight: 600;
}

/* IP Input Grid */
.grid-ip-inputs {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 1.25rem;
}

@media (max-width: 680px) {
    .grid-ip-inputs {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 0.95rem;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.form-control {
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.form-control.has-icon {
    padding-left: 2.65rem;
}

.form-control:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px var(--accent-cyan-glow);
    background: rgba(17, 26, 48, 0.9);
}

select.form-control {
    cursor: pointer;
    font-family: var(--font-mono);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.5rem;
}

select.form-control option {
    background: #0d1527;
    color: #f8fafc;
}

.input-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Live IP Info Pills */
.live-meta-pills {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}

@media (max-width: 768px) {
    .live-meta-pills {
        grid-template-columns: repeat(2, 1fr);
    }
}

.meta-pill {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-family: var(--font-mono);
}

.pill-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.pill-value {
    font-size: 0.82rem;
    color: var(--accent-cyan);
    font-weight: 700;
}

/* Division Table-like Rows Header */
.division-table-header {
    display: grid;
    grid-template-columns: 36px 1fr 180px 42px;
    gap: 0.75rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.65rem;
}

.division-table-header .col-num { text-align: center; }
.division-table-header .col-hosts { text-align: right; }
.division-table-header .col-action { text-align: center; }

/* Division List Container */
.division-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.25rem;
    margin-bottom: 1rem;
}

.division-list-container::-webkit-scrollbar {
    width: 6px;
}
.division-list-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 9999px;
}

.division-row {
    display: grid;
    grid-template-columns: 36px 1fr 180px 42px;
    gap: 0.75rem;
    align-items: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.division-row:hover {
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(255, 255, 255, 0.03);
}

.row-index {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-cyan);
    font-weight: 700;
    text-align: center;
}

.division-row input.dept-name {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    padding: 0.55rem 0.85rem;
}

.division-row input.dept-hosts {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    padding: 0.55rem 0.85rem;
    text-align: right;
}

.btn-remove-row {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.25);
    color: var(--accent-rose);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-remove-row:hover {
    background: var(--accent-rose);
    color: #ffffff;
    border-color: var(--accent-rose);
}

/* Row Actions Bar */
.row-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.15rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--accent-rose);
    background: rgba(244, 63, 94, 0.08);
}

.btn-preset {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(6, 182, 212, 0.4);
    color: var(--accent-cyan);
    font-size: 0.82rem;
    padding: 0.55rem 1rem;
}

.btn-preset:hover {
    background: var(--accent-cyan);
    color: #060913;
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.4);
}

/* Submit Action Area */
.submit-action-area {
    margin-top: 1.5rem;
    text-align: center;
}

.btn-primary-lg {
    background: linear-gradient(135deg, #0284c7, #06b6d4);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    padding: 1rem 2.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(6, 182, 212, 0.55);
    background: linear-gradient(135deg, #0369a1, #0891b2);
}

.btn-primary-lg:active {
    transform: translateY(0);
}

.submit-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* ==========================================================================
   STEP 2: RESULTS SECTION (FULL-WIDTH, HIGH READABILITY)
   ========================================================================== */
.results-section-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Results Top Action Bar */
.results-top-bar {
    background: var(--bg-surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(14px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-badge-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.active-badge {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.35);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
}

.active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
}

.param-summary-pill {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.param-summary-pill strong {
    color: var(--text-primary);
}

.results-action-buttons {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.btn-edit-param {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #93c5fd;
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit-param:hover {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.btn-tool {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-tool:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
}

/* KPI Summary Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

@media (max-width: 960px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.kpi-card {
    background: var(--bg-surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.35rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-cyan);
}

.kpi-card.emerald::after { background: var(--accent-emerald); }
.kpi-card.blue::after { background: var(--accent-blue); }
.kpi-card.amber::after { background: var(--accent-amber); }

.kpi-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
}

.kpi-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Subnet Allocation Map (Visual Bar) */
.allocation-card {
    padding: 1.5rem 1.75rem;
}

.allocation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.allocation-title {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-primary);
}

.allocation-title svg {
    color: var(--accent-cyan);
}

.range-indicator {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.25);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.allocation-bar {
    height: 38px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.bar-segment {
    height: 100%;
    position: relative;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    padding: 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-segment:hover {
    filter: brightness(1.25);
    z-index: 2;
}

.bar-segment.free {
    background: repeating-linear-gradient(
        45deg,
        rgba(100, 116, 139, 0.15),
        rgba(100, 116, 139, 0.15) 10px,
        rgba(100, 116, 139, 0.3) 10px,
        rgba(100, 116, 139, 0.3) 20px
    );
    color: var(--text-muted);
}

.allocation-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.78rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ==========================================================================
   OUTPUT TABLE - EXACT IMAGE 2 SPECIFICATION
   ========================================================================== */
.table-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.table-card-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.table-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
}

.table-header-title svg {
    color: var(--accent-cyan);
}

.table-header-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 9999px;
}

/* EXACT VLSM Table */
.vlsm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.vlsm-table th,
.vlsm-table td {
    padding: 1rem 1.15rem;
    border: 1px solid var(--border-color);
}

.vlsm-table thead th {
    color: var(--text-primary);
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    letter-spacing: 0.02em;
}

.vlsm-table thead tr:first-child th {
    background: #090e1c;
    border-bottom: 2px solid rgba(6, 182, 212, 0.4);
    font-size: 0.88rem;
}

.vlsm-table thead tr:nth-child(2) th {
    background: #0d1527;
    font-size: 0.82rem;
}

.vlsm-table tbody tr {
    background: rgba(15, 23, 42, 0.45);
    transition: background 0.15s ease;
}

.vlsm-table tbody tr:nth-child(even) {
    background: rgba(30, 41, 59, 0.25);
}

.vlsm-table tbody tr:hover {
    background: rgba(6, 182, 212, 0.09);
}

.vlsm-table td.cell-dept {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.vlsm-table td.cell-req {
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 600;
    color: #e2e8f0;
}

.vlsm-table td.cell-prefix {
    text-align: center;
}

.badge-prefix {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.35);
}

.vlsm-table td.cell-mask,
.vlsm-table td.cell-net,
.vlsm-table td.cell-broad,
.vlsm-table td.cell-first,
.vlsm-table td.cell-last {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    text-align: center;
}

.cell-net {
    color: #38bdf8;
    font-weight: 600;
}

.cell-broad {
    color: #f43f5e;
    font-weight: 600;
}

.cell-first, .cell-last {
    color: #10b981;
}

/* Free Space Row */
.vlsm-table tr.row-free-space {
    background: rgba(100, 116, 139, 0.08) !important;
    border-top: 2px dashed rgba(100, 116, 139, 0.4);
}

.vlsm-table tr.row-free-space td {
    color: var(--text-muted);
}

.badge-free {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.4);
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

/* ==========================================================================
   STEPS ACCORDION / EDUCATIONAL BREAKDOWN
   ========================================================================== */
.guide-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.guide-summary {
    padding: 1.25rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.guide-summary:hover {
    background: rgba(255, 255, 255, 0.02);
}

.guide-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.guide-title svg {
    color: var(--accent-cyan);
}

.accordion-arrow {
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.guide-content {
    padding: 0 1.75rem 1.75rem 1.75rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.guide-intro {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 1rem;
}

.code-inline {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
}

.steps-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.guide-step-item {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.15rem;
}

.guide-step-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.step-num-badge {
    display: inline-flex;
    width: 22px;
    height: 22px;
    background: rgba(6, 182, 212, 0.25);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.guide-formula-box {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: #93c5fd;
    line-height: 1.6;
}

/* ==========================================================================
   CISCO CLI GENERATOR
   ========================================================================== */
.cisco-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.cisco-header {
    padding: 1.25rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
}

.cisco-code-block {
    background: #040711;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 1.75rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: #a7f3d0;
    line-height: 1.65;
    max-height: 320px;
    overflow-y: auto;
    white-space: pre;
}

/* ==========================================================================
   ERROR & TOASTS
   ========================================================================== */
.alert-error {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid var(--accent-rose);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    color: #fecdd3;
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
    display: none;
    align-items: flex-start;
    gap: 0.75rem;
    white-space: pre-line;
}

.alert-error.visible {
    display: flex;
}

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.toast {
    background: #0f172a;
    border: 1px solid var(--accent-cyan);
    color: #f8fafc;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-error {
    border-color: var(--accent-rose);
    background: #1f0b12;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 3rem 0 1rem 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

.footer-sub {
    margin-top: 0.25rem;
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* Print Specific Styling */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        background-image: none !important;
    }

    body::before {
        display: none !important;
    }

    .app-header,
    .input-section-wrapper,
    .results-action-buttons,
    .btn-edit-param,
    .theme-selector,
    .toast-container,
    .app-footer,
    .guide-card,
    .cisco-card {
        display: none !important;
    }

    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .results-section-wrapper {
        display: block !important;
    }

    .table-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }

    .vlsm-table th,
    .vlsm-table td {
        border: 1px solid #000 !important;
        color: #000 !important;
        background: #fff !important;
    }

    .badge-prefix, .badge-free {
        border: 1px solid #000 !important;
        color: #000 !important;
        background: transparent !important;
    }
}
