:root {
    --brand-indigo-dark: #090714;
    --brand-indigo-medium: #120e25;
    --brand-indigo-light: #1f1a3a;
    --brand-pink-neon: #ff007f;
    --brand-pink-neon-glow: rgba(255, 0, 127, 0.5);
    --brand-cyan-neon: #00f3ff;
    --brand-cyan-neon-glow: rgba(0, 243, 255, 0.5);
    --glass-bg: rgba(18, 14, 37, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
}
@font-face {
    font-family: 'GyeonggiCheonnyeon';
    src: url('GyeonggiTitleM.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: 'Noto Sans KR', 'Segoe UI', 'Malgun Gothic', '맑은 고딕', Arial, sans-serif;
    overflow: hidden;
    transition: filter 0.5s;
    user-select: none;
    background-color: var(--brand-indigo-dark);
    color: #e2e8f0;
    overscroll-behavior: none;
}

#licenseLockScreen {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(9, 7, 20, 0.96);
    z-index: 10000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
}

.license-card {
    background: var(--glass-bg);
    border: 1px solid var(--brand-pink-neon);
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 0 40px var(--brand-pink-neon-glow);
    width: 450px;
    text-align: center;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.cheat-detected {
    border: 2px solid #ef4444 !important;
    animation: pulse-red 2s infinite;
}

body.simulation-shutdown .rack-location {
    border-color: #333;
}

body.simulation-shutdown .switch-device:not(.device-ups):not(.device-splitter) {
    filter: grayscale(100%) opacity(0.3) brightness(0.5);
    transition: all 0.5s;
}

body.simulation-shutdown .room-block,
body.simulation-shutdown .ap-wrapper,
body.simulation-shutdown .text-label-block {
    filter: grayscale(100%) opacity(0.3) brightness(0.5);
    border-color: #444;
    transition: all 0.5s;
}

body.simulation-shutdown .link-line-path {
    stroke: #444 !important;
    stroke-dasharray: 5 5 !important;
    opacity: 0.2 !important;
    animation: none !important;
}

body.simulation-shutdown .ups-power-flow {
    background: #222 !important;
}

body.simulation-shutdown .device-ups {
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
    border-color: #ef4444;
}

.switch-device {
    transition: filter 0.3s ease-out, border-color 0.2s, box-shadow 0.2s;
}

.switch-device.pending-power {
    filter: grayscale(100%) opacity(0.3) brightness(0.5) !important;
    pointer-events: none;
}

@keyframes power-on-flash {
    0% {
        filter: brightness(2.0);
        box-shadow: 0 0 15px #fff;
    }

    100% {
        filter: none;
        box-shadow: none;
    }
}

.power-on-active {
    animation: power-on-flash 0.5s ease-out;
}

.admin-restricted.btn-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    filter: grayscale(100%);
}

.rack-location {
    background: var(--brand-indigo-medium);
    border: 1px solid var(--glass-border);
    border-radius: 0.8rem;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.rack-header {
    padding: 0.6rem 0.9rem;
    background: rgba(9, 7, 20, 0.7);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.switch-device {
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    cursor: grab;
    border-radius: 6px;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.02) 10%, transparent 50%, rgba(0, 0, 0, 0.2) 90%, rgba(0, 0, 0, 0.5) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.8),
        0 4px 8px -2px rgba(0, 0, 0, 0.6),
        0 2px 4px -2px rgba(0, 0, 0, 0.4);
}

.switch-device::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 70%;
    background-image: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0, 0, 0, 0.5) 3px, rgba(0, 0, 0, 0.5) 5px);
    opacity: 0.8;
    pointer-events: none;
    border-radius: 2px;
}

.switch-device:hover {
    border-color: var(--brand-pink-neon);
    box-shadow: 0 0 12px var(--brand-pink-neon-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.switch-device.drag-target-active {
    border-top: 3px solid #60a5fa !important;
    margin-top: 5px;
    opacity: 1 !important;
}

.block-port {
    background: linear-gradient(180deg, #e7e5e4, #d6d3d1);
    border: 1px solid #78716c;
    border-bottom-color: #444;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.1s;
    cursor: pointer;
    z-index: 20;
    width: 2rem;
    height: 1rem;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.block-port:hover {
    border-color: #fff;
    transform: scale(1.4);
    z-index: 50;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    background: #f5f5f4;
}

.block-port span {
    color: #000 !important;
    font-weight: bold;
    font-size: 8px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.rj45-port {
    background: #111;
    border: 1px solid #4a5568;
    border-top: 2px solid #222;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.9);
    position: relative;
    transition: all 0.1s;
    cursor: pointer;
    z-index: 20;
}

.rj45-port::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background-image: repeating-linear-gradient(90deg, #facc15, #facc15 1px, transparent 1px, transparent 2px);
    opacity: 0.6;
    pointer-events: none;
}

.rj45-port:hover {
    border-color: #fff;
    transform: scale(1.6);
    z-index: 50;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.9), 0 0 8px rgba(255, 255, 255, 0.5);
}

.fiber-port {
    background: #1a1a1a;
    border: 1px solid #9ca3af;
    border-bottom-color: #4b5563;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.9), 0 1px 1px rgba(255, 255, 255, 0.2);
    transition: all 0.1s;
    cursor: pointer;
    z-index: 20;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    position: relative;
}

.fiber-port::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background: radial-gradient(circle, #444 0%, #000 80%);
    pointer-events: none;
}

.fiber-port:hover {
    border-color: #fff;
    background: #000;
    transform: scale(1.6);
    z-index: 50;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.9), 0 0 8px #facc15;
}

.sfp-slot-port {
    background: #111;
    border: 1px solid #94a3b8;
    border-bottom: 2px solid #475569;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.9);
    transition: all 0.1s;
    cursor: pointer;
    z-index: 20;
    width: 2rem;
    height: 1rem;
    border-radius: 2px;
    position: relative;
}

.sfp-slot-port::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.sfp-slot-port:hover {
    border-color: #fff;
    background: #000;
    transform: scale(1.6);
    z-index: 50;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.9), 0 0 8px #facc15;
}

.combo-port {
    background: linear-gradient(180deg, #334155, #1e293b);
    border: 1px solid #64748b;
    color: #94a3b8;
    font-size: 8px;
    font-weight: bold;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    cursor: pointer;
    z-index: 20;
    position: relative;
}

.combo-port:hover {
    border-color: #fff;
    transform: scale(1.6);
    z-index: 50;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 8px rgba(255, 255, 255, 0.5);
}

.rj45-port.connected,
.fiber-port.connected,
.sfp-slot-port.connected,
.combo-port.connected,
.block-port.connected {
    border-color: var(--line-color, #facc15);
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.8), 0 0 6px var(--line-color, #facc15);
}

.led-light {
    width: 6px;
    height: 4px;
    background: radial-gradient(circle at 30% 30%, #666 0%, #222 100%);
    border: 1px solid #111;
    border-radius: 2px;
    margin: 0 auto 1px auto;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.led-light.active {
    background: radial-gradient(circle at 30% 30%, #fff 0%, var(--brand-cyan-neon) 40%, #009cb3 100%);
    border-color: var(--brand-cyan-neon);
    box-shadow: 0 0 8px var(--brand-cyan-neon), inset 0 1px 2px rgba(255, 255, 255, 0.8);
}

.device-firewall {
    background-color: #7f1d1d;
    border-color: #991b1b;
}

.device-security-l2 {
    background-color: #14532d;
    border-color: #059669;
}

.device-poe-switch {
    background-color: #1e3a8a;
    border-color: #2563eb;
}

.device-ups {
    background-color: #4a5568;
    border-color: #64748b;
    color: #fff;
}

.device-fdf {
    background-color: #0e7490;
    border-color: #06b6d4;
}

.device-block {
    background-color: #44403c;
    border-color: #78716c;
    color: #e7e5e4;
}

.device-olt {
    background-color: #334155;
    border-color: #475569;
}

.device-splitter {
    background: linear-gradient(180deg, #f8fafc, #cbd5e1);
    border-color: #94a3b8;
    color: #0f172a !important;
    box-shadow: inset 0 1px 0 #fff, 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.device-splitter::after {
    display: none;
}

/* No vents for splitter */
.device-splitter .led-light {
    display: none;
}

.device-splitter .fiber-port {
    border-color: #94a3b8;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.building-bg {
    background-color: var(--brand-indigo-dark);
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    overflow: auto;
}

body:not(.b4-printing) .floor-line {
    position: absolute;
    left: 0;
    width: 100%;
    border-top: 2px dashed rgba(255, 255, 255, 0.3);
    pointer-events: none;
    font-size: 50px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.2);
    padding-left: 20px;
    z-index: 5;
}

.room-block {
    cursor: pointer;
    user-select: none;
    position: absolute;
    border: 1px solid var(--glass-border);
    background: rgba(31, 26, 58, 0.4);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    z-index: 10;
    transition: box-shadow 0.1s, transform 0.1s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-width: 40px;
    min-height: 40px;
    overflow: visible;
}

.room-block:hover {
    background: rgba(31, 26, 58, 0.65);
    border-color: var(--brand-cyan-neon);
    box-shadow: 0 0 10px var(--brand-cyan-neon-glow);
}

.room-block.selected,
.ap-wrapper.selected .ap-block,
.text-label-block.selected {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 2px #ef4444 !important;
}

.room-block.conn-optical {
    border-color: #22c55e !important;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

.room-block.conn-copper {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.conn-badge {
    position: absolute;
    bottom: -6px;
    right: -4px;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 4px;
    border-radius: 4px;
    z-index: 20;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.conn-badge.ont {
    background: #15803d;
    color: #fff;
    border: 1px solid #4ade80;
}

.conn-badge.utp {
    background: #1e40af;
    color: #fff;
    border: 1px solid #60a5fa;
}

.room-link-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #334155;
    border: 1px solid #94a3b8;
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 101;
    pointer-events: auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.room-link-btn:hover {
    background: #2563eb;
    transform: scale(1.1);
    border-color: #fff;
}

.room-block:hover .room-link-btn {
    opacity: 1;
}

.room-title-display {
    pointer-events: auto;
    cursor: pointer;
    position: relative;
    z-index: 101;
}

.room-title-display:hover {
    text-decoration: underline;
    color: #93c5fd;
}

.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.5) 50%);
    cursor: se-resize;
    z-index: 20;
}

.resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, #facc15 50%);
}

.ap-wrapper {
    position: absolute;
    cursor: pointer;
    user-select: none;
    z-index: 15;
    width: 30px;
    height: 30px;
}

.ap-block {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #22c55e;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    transition: transform 0.2s;
}

.ap-wrapper:hover .ap-block {
    transform: scale(1.1);
    box-shadow: 0 0 15px #4ade80;
}

.text-label-block {
    position: absolute;
    cursor: grab;
    user-select: none;
    z-index: 12;
    padding: 2px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
    line-height: 1.1;
    font-family: 'Noto Sans KR', 'Segoe UI', 'Malgun Gothic', '맑은 고딕', Arial, sans-serif;
}

.text-label-block:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.ap-label {
    position: absolute;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #cbd5e1;
    text-shadow: 0 1px 2px black;
    white-space: nowrap;
    pointer-events: none;
}

.link-group {
    filter: none !important;
}

.link-line-path {
    transition: stroke-width 0.2s, opacity 0.2s;
    stroke-width: 1.5px;
    opacity: 0;
    fill: none !important;
    filter: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    stroke-dasharray: 0;
    stroke-dashoffset: 0;
    animation: none;
}

@keyframes dash-flow {
    to {
        stroke-dashoffset: -12;
    }
}

.link-group.active .link-line-path {
    stroke-width: 3px !important;
    stroke: var(--active-color) !important;
    opacity: 1 !important;
    stroke-dasharray: 8 4;
    animation: dash-flow 0.8s linear infinite;
    filter: drop-shadow(0 0 3px var(--brand-pink-neon-glow)) !important;
}

.link-text {
    font-size: 10px;
    fill: #94a3b8;
    text-anchor: middle;
    dominant-baseline: middle;
    opacity: 0;
    pointer-events: none;
    text-shadow: none !important;
}

.link-group.active .link-text {
    fill: var(--active-color);
    font-weight: bold;
    font-size: 12px;
    opacity: 1;
}

.link-hit-area {
    stroke: rgba(255, 255, 255, 0);
    stroke-opacity: 0;
    stroke-width: 15px;
    fill: none !important;
    cursor: pointer;
    filter: none !important;
}

#svgContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 90;
}

@keyframes flash-highlight {

    0%,
    100% {
        box-shadow: 0 0 0 transparent;
        border-color: rgba(255, 255, 255, 0.5);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 10px #facc15;
        border-color: #facc15;
        background-color: rgba(250, 204, 21, 0.1);
        transform: scale(1.01);
        z-index: 50 !important;
    }
}

.blink-active {
    animation: flash-highlight 0.8s infinite;
    border-color: #facc15 !important;
    z-index: 50 !important;
}

@keyframes flash-highlight-green {

    0%,
    100% {
        box-shadow: 0 0 0 transparent;
        border-color: #fff;
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 10px #22c55e;
        border-color: #22c55e;
        transform: scale(1.1);
        z-index: 60 !important;
    }
}

.blink-active-green {
    animation: flash-highlight-green 0.8s infinite;
    border-color: #22c55e !important;
    z-index: 60 !important;
}

.ap-wrapper.blink-active-green .ap-block {
    animation: flash-highlight-green 0.8s infinite;
    border-color: #22c55e !important;
}

@keyframes online-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.room-online {
    border-color: #4ade80 !important;
    animation: online-pulse 2s infinite !important;
    z-index: 15 !important;
}

.device-online {
    border-color: #4ade80 !important;
    box-shadow: 0 0 10px #22c55e !important;
}

.dragging {
    opacity: 0.5;
}

#buildingContainer {
    position: relative;
    cursor: crosshair;
    user-select: none;
}

#buildingContent {
    min-width: 2000px;
    min-height: 3800px;
    position: relative;
    transition: transform 0.2s ease-out;
    transform-origin: top left;
}

#customTooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    z-index: 9999;
    border: 1px solid #475569;
    opacity: 0;
    transition: opacity 0.1s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    max-width: 320px !important;
    width: auto !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-all !important;
}

.color-btn {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-btn.selected {
    border-color: white;
    transform: scale(1.1);
}

.grid-cols-12 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

#buildingContainer.drag-over-active {
    background-color: rgba(60, 120, 240, 0.1);
    border: 2px dashed #60a5fa;
}

#selectionBox {
    position: absolute;
    border: 2px dashed #60a5fa;
    background-color: rgba(96, 165, 250, 0.2);
    pointer-events: none;
    z-index: 999;
    display: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    background: #60a5fa;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid white;
}

input[type=range]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: #60a5fa;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid white;
}

/* B4 Portrait 용지 규격 브라우저 자동 설정을 위해 최상위 레벨 선언 */
@page {
    size: B4 portrait;
    margin: 10mm;
}

@media print {
    /* B4 portrait 1페이지 흰색 배경 양식 최적화 */
    html, body {
        background-color: #ffffff !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        overflow: hidden !important;
        height: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        page-break-after: avoid !important;
        page-break-before: avoid !important;
    }

    /* 2페이지 이중 출력 버그 방지: main과 header 이외의 숨겨진 모달/오버레이 형제 요소를 완전히 인쇄 제외 */
    body > *:not(main):not(header) {
        display: none !important;
    }

    .fixed,
    [class*="fixed"],
    .no-print,
    .resize-handle,
    #customTooltip,
    .rack-header i.fa-plus,
    .rack-header i.fa-pen-to-square,
    header button,
    header .fa-school,
    header p,
    .admin-btn,
    .selection-ui,
    #mobileMenuBtn,
    #minimapContainer,
    #mobileOverlay,
    #mobileFab,
    nav {
        display: none !important;
    }

    ::-webkit-scrollbar {
        display: none;
    }

    header {
        background: #ffffff !important;
        border-bottom: 2px solid #000000 !important;
        height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 4px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 인쇄 시 헤더 내부 요소 모두 숨기고 print-title만 표시 */
    header > * {
        display: none !important;
    }

    header #printSchoolTitle {
        display: block !important;
        font-size: 18pt !important;
        font-weight: 900 !important;
        color: #000000 !important;
        text-align: center !important;
        width: 100% !important;
        line-height: 36px !important;
        font-family: 'Noto Sans KR', 'Malgun Gothic', '맑은 고딕', Arial, sans-serif !important;
    }

    #mainTitle {
        font-size: 18pt !important;
        font-weight: 900 !important;
        color: #000000 !important;
        display: block !important;
        text-align: center !important;
        width: 100% !important;
        line-height: 28px !important;
    }

    main {
        display: block !important;
        position: relative !important;
        height: calc(100% - 44px) !important; /* 헤더 제외 높이 */
        overflow: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 6px !important;
        background: #ffffff !important;
        zoom: normal !important;
    }

    /* leftPanel: 인쇄 시 적절한 너비로 장비 목록 표시 (너무 압축되어 일그러지지 않도록) */
    #leftPanel {
        position: absolute !important;
        left: 6px !important;
        top: 6px !important;
        width: 460px !important;
        min-width: 460px !important;
        max-width: 460px !important;
        zoom: 0.52 !important;
        height: calc(100% - 12px) !important;
        max-height: calc(100% - 12px) !important;
        overflow: hidden !important;
        border-right: 2px solid #334155 !important;
        flex-shrink: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        transform: none !important;
        transition: none !important;
        z-index: 10000 !important;
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
    }

    #locationsContainer {
        height: 100% !important;
        max-height: 100% !important;
        overflow: hidden !important;
        padding-bottom: 0 !important;
    }

    .rack-location {
        page-break-inside: avoid !important;
        margin-bottom: 10px !important;
        border: 2px solid #1e293b !important;
        background: #ffffff !important;
        color: #000000 !important;
    }

    .rack-header {
        background: #e2e8f0 !important;
        border-bottom: 2px solid #1e293b !important;
        color: #000000 !important;
    }

    .rack-header span {
        color: #000000 !important;
    }

    .switch-device {
        box-shadow: none !important;
        border: 1px solid #1e293b !important;
        background: #ffffff !important;
    }

    .ups-text {
        color: #000000 !important;
        text-shadow: none !important;
    }

    .rj45-port,
    .combo-port,
    .fiber-port,
    .sfp-slot-port,
    .block-port {
        background-color: #ffffff !important;
        border: 1px solid #000000 !important;
        color: #000000 !important;
    }

    .rj45-port span,
    .combo-port span,
    .fiber-port span,
    .sfp-slot-port span,
    .block-port span {
        color: #000000 !important;
        font-weight: bold !important;
    }

    /* rightPanel: 교실 배치도 영역을 최대한 가득 채우기 위해 가변 너비로 설정 */
    #rightPanel {
        position: absolute !important;
        left: 280px !important; /* Will be updated dynamically in JS */
        top: 6px !important;
        width: calc(100% - 280px) !important; /* Will be updated dynamically in JS */
        height: calc(100% - 12px) !important;
        overflow: hidden !important;
        border: none !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
    }

    /* rightPanel 내 제목 줄 숨김 */
    #rightPanel > .no-print,
    #rightPanel > .p-3 {
        display: none !important;
    }

    #buildingContainer {
        flex-grow: 1 !important;
        width: 100% !important;
        overflow: hidden !important;
        background: #ffffff !important;
        border: 2px solid #1e293b !important;
        display: block !important;
        position: relative !important;
    }

    /* buildingContent: JS에서 zoom 및 위치를 동적으로 제어 */
    #buildingContent {
        zoom: 0.30;
        transform: none !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 1500px;
        height: 3800px;
        display: block !important;
        background: #ffffff !important;
    }

    /* 링크 연결선(SVG) 인쇄 시 숨김 */
    #svgContainer {
        display: none !important;
    }


    #floorLabels {
        display: block !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 50 !important;
    }

    #buildingContent #floorLabels .floor-line,
    #floorLabels .floor-line,
    .floor-line {
        position: absolute !important;
        left: 0 !important;
        width: 2000px !important;
        padding-left: 30px !important;
        text-align: left !important;
        font-family: 'Noto Sans KR', 'Segoe UI', 'Malgun Gothic', '맑은 고딕', Arial, sans-serif !important;
        color: #000000 !important;
        border-top: 4px dashed #555555 !important;
        text-shadow: none !important;
        font-size: 52px !important;
        font-weight: 900 !important;
        height: 80px !important;
        line-height: 80px !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 9999 !important;
    }

    /* ::before 비활성화 - innerText를 직접 사용하므로 중복 방지 */
    #buildingContent #floorLabels .floor-line::before,
    #floorLabels .floor-line::before,
    .floor-line::before {
        content: none !important;
        display: none !important;
    }

    .ap-label {
        display: none !important;
    }

    .room-size-display {
        display: none !important;
    }

    /* 교실 블록: 흰색 배경 위에서 글씨가 안 보이지 않도록 글자색 선명하게 오버라이드 */
    .room-block {
        opacity: 1 !important;
        visibility: visible !important;
        position: absolute !important;
    }

    .room-block .room-title-display,
    .room-block span,
    .room-block div,
    .room-block p {
        color: #000000 !important;
        text-shadow: none !important;
        font-weight: bold !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .text-label-block.text-white {
        color: #000000 !important;
    }

    svg path[stroke="#ffffff"], svg path[stroke="white"] {
        stroke: #1e293b !important; /* 연결선 어두운 색상 복원 */
    }

    .text-label-block {
        border: none !important;
    }
}

/* ─── IP 호스트 테이블 스타일 ─── */
.bg-slate-750 { background-color: #1e293b; }

.host-row:hover { background-color: rgba(6, 182, 212, 0.06) !important; }

.host-name-input:focus,
.host-type-select:focus {
    border-color: #06b6d4 !important;
    background-color: #0f172a !important;
    outline: none;
}

#hostTableBody tr.host-row td:first-child {
    border-left: 2px solid transparent;
    transition: border-color 0.15s;
}
#hostTableBody tr.host-row:hover td:first-child {
    border-left-color: #06b6d4;
}

/* 모달 너비 전환 부드럽게 */
#commonModalBox {
    transition: width 0.2s ease;
    max-width: 95vw;
}

.ups-power-flow {
    height: 60px;
    background: #001100;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 0.4rem 0.4rem;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9), inset 0 2px 4px rgba(0, 0, 0, 0.5);
    border-top: 2px solid #222;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.power-wave {
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, transparent, #4ade80, #facc15, #60a5fa, transparent);
    position: absolute;
    opacity: 0.9;
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.8);
    animation: flow 3s linear infinite alternate;
}

@keyframes flow {
    0% {
        transform: scaleX(0.5) translateX(-50%);
    }

    100% {
        transform: scaleX(0.5) translateX(50%);
    }
}

.ups-text {
    position: relative;
    z-index: 10;
    font-size: 10px;
    font-weight: bold;
    color: #4ade80;
    text-shadow: 0 0 8px #4ade80, 0 0 2px #000;
    font-family: monospace;
    letter-spacing: 1px;
}

.building-bg {
    background-color: #1e293b !important;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px) !important;
    background-size: 40px 40px !important;
}

.room-block {
    border: none !important;

    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(0, 0, 0, 0.1) 100%);

    box-shadow:
        1px 1px 0px #0f172a,
        2px 2px 0px #0f172a,
        3px 3px 0px #0f172a,
        4px 4px 0px #0f172a,
        5px 5px 10px rgba(0, 0, 0, 0.5) !important;

    transition: all 0.1s ease-out !important;
    border-radius: 4px !important;
    z-index: 20;
    /* 선보다 위에 보이게 */
}

.room-block:hover {
    transform: translateY(-2px);
    box-shadow:
        2px 2px 0px #0f172a,
        4px 4px 0px #0f172a,
        6px 6px 0px #0f172a,
        7px 7px 15px rgba(0, 0, 0, 0.6) !important;
    z-index: 50;
}

.room-block.selected {
    transform: translateY(2px);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5) !important;
    border: 2px solid #ef4444 !important;
}

body:not(.b4-printing) .floor-line {
    font-family: 'Noto Sans KR', 'Segoe UI', 'Malgun Gothic', '맑은 고딕', Arial, sans-serif;
    color: rgba(255, 255, 255, 0.1) !important;
    border-top: 2px solid rgba(255, 255, 255, 0.1) !important;
    text-shadow: 2px 2px 0px #0f172a;
}

.ap-wrapper {
    z-index: 60 !important;
    transform: translateZ(10px);
}

#adminLoginModal,
#adminMenuModal,
#portModal,
#addDeviceModal,
#roomConnectionModal,
#commonModal {
    z-index: 100 !important;
}

#minimapContainer {
    position: fixed;
    bottom: 40px;
    right: 20px;
    width: 240px;
    height: 180px;
    background-color: rgba(15, 23, 42, 0.95);
    border: 2px solid #475569;
    border-radius: 8px;
    z-index: 2000;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: none;
}

#minimapContent {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.mini-room {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

#minimapViewport {
    position: absolute;
    border: 2px solid #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
    cursor: grab;
    z-index: 10;
    transition: background-color 0.2s;
}

#minimapViewport:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

#minimapViewport:active {
    cursor: grabbing;
    background-color: rgba(239, 68, 68, 0.3);
}

@media (max-width: 1024px) {
    #mobileMenuBtn {
        display: block !important;
    }

    #leftPanel {
        position: fixed !important;
        top: 0;
        left: -500px;
        height: 100vh;
        z-index: 5000 !important;
        transition: left 0.3s ease-in-out;
    }

    #leftPanel.active {
        left: 0 !important;
    }

    #rightPanel {
        width: 100vw !important;
    }

    header button:not(#mobileMenuBtn):not(#adminBtn):not([onclick*="saveDataLocal"]),
    header .w-px,
    header input[type="file"] {
        display: none !important;
    }

    #adminBtn span {
        display: none !important;
    }

    #adminBtn {
        padding: 6px 10px !important;
    }

    h1#mainTitle {
        font-size: 14px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }

    header {
        padding: 0 10px !important;
        height: 50px !important;
    }

    #rightPanel .border-b button {
        display: none !important;
    }

    #rightPanel .border-b span {
        display: block !important;
        font-size: 12px !important;
    }

    #mobileFab {
        display: flex !important;
    }

    #minimapContainer {
        bottom: 100px !important;
        right: 10px !important;
        width: 150px !important;
        height: 100px !important;
    }

    #legendBox {
        display: none !important;
    }
}

/* <--- 여기가 @media 닫는 괄호입니다. 이 위쪽에 넣으셔야 해요! */

#fabMenu.active {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

#fabIcon.active {
    transform: rotate(45deg);
    transition: transform 0.3s;
}

/* 케이블 범례 드래그 창 스타일 */
#legendBox {
    position: fixed;
    bottom: 40px;
    left: 480px;
    z-index: 2000;
    background-color: rgba(15, 23, 42, 0.95);
    border: 2px solid #475569;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-shadow: 1px 1px 2px black;
    pointer-events: auto;
    cursor: move;
    user-select: none;
    color: #cbd5e1;
    font-size: 12px;
}

/* [신규] IP 스캐너 동적 연동용 노란색 링 글로우 효과 */
.vms-highlight-hover {
    outline: 4px solid #eab308 !important;
    outline-offset: 4px;
    box-shadow: 0 0 25px #eab308, inset 0 0 12px #eab308 !important;
    animation: vms-pulse-neon 1s infinite alternate !important;
    z-index: 99999 !important;
}

@keyframes vms-pulse-neon {
    0% { transform: scale(1.0); }
    100% { transform: scale(1.06); }
}

@media (max-width: 1600px) {
    .header-btn-text {
        display: none !important;
    }
}

/* Device ONT styling */
.device-ont {
    background-color: #064e3b !important;
    border-color: #059669 !important;
    color: #e6fffa !important;
}

/* Looping warning animations and visual states */
.looping-flash {
    outline: 4px solid #ef4444 !important;
    outline-offset: 4px;
    box-shadow: 0 0 30px #ef4444, inset 0 0 15px #ef4444 !important;
    animation: looping-pulse 0.8s infinite alternate !important;
    position: relative;
    z-index: 50 !important;
}

@keyframes looping-pulse {
    0% { transform: scale(1.0); }
    100% { transform: scale(1.04); }
}

.looping-link-active {
    stroke: #ef4444 !important;
    stroke-width: 4px !important;
    stroke-dasharray: 8 4 !important;
    animation: looping-dash 1s linear infinite !important;
    filter: drop-shadow(0 0 8px #ef4444) !important;
}

@keyframes looping-dash {
    to {
        stroke-dashoffset: -12;
    }
}

.looping-port-active {
    border-color: #ef4444 !important;
    box-shadow: 0 0 10px #ef4444, inset 0 0 5px #ef4444 !important;
    animation: looping-port-glow 0.8s infinite alternate !important;
}

@keyframes looping-port-glow {
    0% { background-color: rgba(239, 68, 68, 0.2); }
    100% { background-color: rgba(239, 68, 68, 0.7); }
}

/* --- Realistic Device Layout & Front Panel CSS --- */

/* Standard 19" Rack-mount side ears */
.switch-device {
    position: relative;
    padding-left: 20px !important;
    padding-right: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.2), 
        inset 0 -1px 0 rgba(0, 0, 0, 0.8),
        0 4px 10px rgba(0, 0, 0, 0.5) !important;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.15) 50%, rgba(0, 0, 0, 0.4) 100%) !important;
}

.switch-device::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 14px;
    height: 100%;
    background: linear-gradient(90deg, #475569, #1e293b, #334155);
    border-right: 1px solid rgba(0, 0, 0, 0.5);
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.1);
    background-image: radial-gradient(circle, #0f172a 2px, transparent 2.5px);
    background-size: 14px 18px;
    background-position: center center;
}

.switch-device::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 14px;
    height: 100%;
    background: linear-gradient(270deg, #475569, #1e293b, #334155);
    border-left: 1px solid rgba(0, 0, 0, 0.5);
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    box-shadow: inset -1px 1px 0 rgba(255, 255, 255, 0.1);
    background-image: radial-gradient(circle, #0f172a 2px, transparent 2.5px);
    background-size: 14px 18px;
    background-position: center center;
}

/* Device specific front panel finishes */
.device-switch_24_2 {
    background: linear-gradient(180deg, #1e293b, #0f172a) !important;
    border-color: #38bdf8 !important;
}

.device-security_l2 {
    background: linear-gradient(180deg, #064e3b, #022c22) !important;
    border-color: #34d399 !important;
}

.device-poe_24 {
    background: linear-gradient(180deg, #1e3a8a, #172554) !important;
    border-color: #60a5fa !important;
}

.device-firewall {
    background: linear-gradient(180deg, #7f1d1d, #450a0a) !important;
    border-color: #ef4444 !important;
}

.device-olt_chassis {
    background: linear-gradient(180deg, #1e293b, #0f172a) !important;
    border-color: #3b82f6 !important;
    /* Cards split */
    background-image: linear-gradient(90deg, transparent 49%, rgba(255,255,255,0.05) 49%, rgba(255,255,255,0.05) 51%, transparent 51%) !important;
    background-size: 190px 100% !important;
}

.device-splitter_32 {
    background: linear-gradient(180deg, #cbd5e1, #94a3b8) !important;
    border-color: #475569 !important;
}

.device-fdf {
    background: linear-gradient(180deg, #164e63, #083344) !important;
    border-color: #06b6d4 !important;
}

.device-block_110 {
    background: linear-gradient(180deg, #292524, #1c1917) !important;
    border-color: #78716c !important;
}

.device-ups {
    background: linear-gradient(180deg, #334155, #1e293b) !important;
    border-color: #94a3b8 !important;
}

/* OLT Panel styling inside OLT Chassis */
.olt-group-label {
    font-size: 8px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.olt-panel-divider {
    width: 1px;
    height: 35px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 10px;
}

/* ONT & UTP Classroom boxes badges */
.ont-box-badge {
    position: absolute;
    bottom: -8px;
    right: -6px;
    z-index: 20;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
    border-radius: 4px;
}

.utp-box-badge {
    position: absolute;
    bottom: -8px;
    right: -6px;
    z-index: 20;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
    border-radius: 4px;
}

/* Adjust border color for selected white buttons */
.color-btn.selected[style*="rgb(255, 255, 255)"],
.color-btn.selected[style*="#ffffff"],
.color-btn.selected[style*="white"],
.color-btn.selected.bg-white {
    border-color: #3b82f6 !important;
}

/* UPS LED Scanner animation styles */
.ups-led-scanner {
    width: 100%;
    height: 8px;
    background-color: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    margin-bottom: 6px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.8);
}

.scanner-dot {
    position: absolute;
    top: 1px;
    bottom: 1px;
    width: 16px;
    background: #22d3ee;
    border-radius: 2px;
    box-shadow: 0 0 6px #22d3ee, 0 0 10px #22d3ee;
}

.scanner-dot.active {
    animation: upsScanner 2s infinite ease-in-out;
}

@keyframes upsScanner {
    0% {
        left: 2px;
    }
    50% {
        left: calc(100% - 18px);
    }
    100% {
        left: 2px;
    }
}

/* 실시간 패킷 흐름 시각화 애니메이션 (Packet Flow Animation) */
.packet-flow-active {
    stroke-dasharray: 6, 12;
    stroke-linecap: round;
    animation: packetFlowAnim 8s linear infinite;
    opacity: 0.75 !important;
    stroke-width: 2px !important;
    pointer-events: none;
}

@keyframes packetFlowAnim {
    to {
        stroke-dashoffset: -120;
    }
}


