:root {
    --bg: #F0F2F5; --surface: #fff; --nav: #162032; --accent: #2B8A94; --accent-light: #E6F4F5;
    --avail: #34A853; --avail-bg: #D6F0DC; --used: #E68A2E; --used-bg: #FDF1E1;
    --danger: #D64545; --danger-bg: #FDE8E8; --text: #1A2332; --mid: #4A5568;
    --light: #8896A6; --border: #E2E6EC; --rack-bg: #2A3142; --rack-slot: #1E2533;
    --sw-body: #3D4F65; --poe: #8B5CF6; --poe-bg: #EDE9FE; --pp: #0E7490; --pp-bg: #E0F7FA;
    --fn: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--fn); background: var(--bg); color: var(--text); }

/* Login */
.login-wrap { min-height: 100vh; background: var(--nav); display: flex; align-items: center; justify-content: center; }
.login-box { background: var(--surface); border-radius: 12px; padding: 36px; width: 340px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-header { text-align: center; margin-bottom: 28px; }
.login-header h1 { font-size: 20px; font-weight: 700; color: var(--text); margin: 8px 0 0; }
.login-header p { font-size: 13px; color: var(--mid); margin-top: 4px; }
.logo-icon { width: 48px; height: 48px; border-radius: 10px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.login-hint { margin-top: 16px; font-size: 11px; color: var(--light); text-align: center; }
.pin-input { letter-spacing: 4px; }

/* Fields */
.field { margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--mid); display: block; margin-bottom: 4px; }
.field input, .field select, .field textarea, input[type="text"], input[type="password"], select, textarea {
    padding: 8px 12px; font-size: 13px; font-family: var(--fn); border: 1px solid var(--border);
    border-radius: 6px; outline: none; width: 100%; box-sizing: border-box; background: #fff;
}
textarea { resize: vertical; }

/* Buttons */
.btn { padding: 8px 18px; font-size: 13px; font-weight: 600; font-family: var(--fn); border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; transition: background 0.15s; }
.btn:hover { background: #f0f0f0; }
.btn-primary { background: var(--accent); color: #fff; border: none; }
.btn-primary:hover { background: #24747c; }
.btn-danger { background: var(--danger); color: #fff; border: none; }
.btn-danger:hover { background: #b33a3a; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-ghost { background: transparent; color: #94a3b8; border: 1px solid #4A5568; }
.btn-ghost:hover { background: rgba(255,255,255,0.05); }
.btn-full { width: 100%; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.btn-row-spread { display: flex; justify-content: space-between; margin-top: 8px; }

/* Badges */
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; white-space: nowrap; display: inline-block; }
.badge-avail { background: var(--avail-bg); color: var(--avail); }
.badge-used { background: var(--used-bg); color: var(--used); }
.badge-danger { background: var(--danger); color: #fff; }
.badge-poe { background: var(--poe-bg); color: var(--poe); }
.badge-pp { background: var(--pp-bg); color: var(--pp); }
.badge-admin { background: var(--accent); color: #fff; }
.badge-tech { background: var(--accent-light); color: var(--accent); }
.badge-eq { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* Top bar */
.topbar { background: var(--nav); padding: 0 16px; display: flex; align-items: center; justify-content: space-between; height: 48px; flex-wrap: wrap; gap: 4px; }
.topbar-left { display: flex; align-items: center; gap: 8px; }
.nav-logo { width: 26px; height: 26px; border-radius: 5px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.nav-title { color: #fff; font-weight: 700; font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topbar-user { color: #cbd5e0; font-size: 12px; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 16px 14px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mid); margin-bottom: 14px; }
.breadcrumb a { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: none; }
.breadcrumb .sep { color: var(--light); }

/* Customer cards */
.customer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.customer-card { background: var(--surface); border-radius: 8px; padding: 16px; cursor: pointer; border: 1px solid var(--border); transition: box-shadow 0.15s; }
.customer-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.customer-card h3 { font-size: 14px; margin: 0; }
.card-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 6px; }
.card-meta { display: flex; gap: 14px; font-size: 11px; color: var(--mid); margin-bottom: 6px; }
.util-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.util-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }

/* Cabinet card */
.cab-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; min-width: 220px; max-width: 340px; }
.cab-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cab-item { display: flex; justify-content: space-between; align-items: center; padding: 3px 6px; margin-top: 2px; border-radius: 4px; cursor: pointer; background: #F7F8FA; border: 1px solid transparent; font-size: 10px; transition: all 0.1s; }
.cab-item:hover { background: #EEEEF2; }
.cab-item.active { border-color: var(--accent); background: rgba(43,138,148,0.08); }
.cab-item-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* Rack view */
.rack-wrap { background: var(--rack-bg); border-radius: 8px; padding: 8px 6px; display: inline-flex; flex-direction: column; align-items: center; min-width: 260px; }
.rack-header { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; width: 100%; justify-content: center; }
.rack-header span { color: #fff; font-size: 10px; font-weight: 600; }
.rack-body { position: relative; background: var(--rack-slot); border-radius: 3px; border: 2px solid #3f4f63; }
.rack-u { position: absolute; left: 0; width: 100%; border-bottom: 1px solid rgba(255,255,255,0.04); display: flex; align-items: center; }
.rack-u-label { font-size: 7px; color: rgba(255,255,255,0.15); width: 12px; text-align: right; padding-right: 1px; }
.rack-item { position: absolute; left: 14px; right: 2px; border-radius: 2px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 0 5px; transition: all 0.15s; z-index: 2; }
.rack-item-label { font-size: 8px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rack-item-stat { font-size: 7px; color: rgba(255,255,255,0.55); flex-shrink: 0; margin-left: 3px; }
.rack-port-bar { display: flex; gap: 0.5px; flex-shrink: 0; }
.rack-port-pip { width: 2px; border-radius: 1px; }

/* Port detail panel */
.port-panel { background: var(--surface); border-radius: 8px; border: 1px solid var(--border); padding: 16px; margin-top: 4px; }
.port-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 6px; }
.port-panel h4 { font-size: 15px; font-weight: 700; margin: 0; }

/* Front panel */
.front-panel { background: #1E2533; border-radius: 6px; padding: 8px 8px 5px; margin-bottom: 8px; }
.front-panel-label { font-size: 8px; color: rgba(255,255,255,0.35); margin-bottom: 3px; font-weight: 600; }
.front-row { display: flex; gap: 2px; margin-bottom: 2px; flex-wrap: wrap; }
.front-port { width: 24px; height: 18px; border-radius: 2px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 7px; font-weight: 700; color: #fff; transition: transform 0.1s; position: relative; }
.front-port:hover { transform: scale(1.2); z-index: 5; }
.front-port.in-use { background: #B45309; border: 1.5px solid #F59E0B; }
.front-port.available { background: #15803D; border: 1.5px solid #22C55E; }
.poe-indicator { position: absolute; top: -4px; right: -2px; font-size: 6px; color: #C4B5FD; }

/* Port table */
.port-table-wrap { max-height: 300px; overflow-y: auto; }
.port-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.port-table th { padding: 5px 8px; text-align: left; font-weight: 600; color: var(--mid); border-bottom: 1px solid var(--border); font-size: 11px; position: sticky; top: 0; background: #F7F8FA; z-index: 1; }
.port-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
.port-table tr { cursor: pointer; }
.port-table tbody tr:hover { background: #F7F8FA; }
.port-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 3px; }
.text-muted { color: var(--light); }

/* Flex helpers */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-14 { margin-bottom: 14px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: var(--surface); border-radius: 10px; padding: 24px; width: 440px; max-width: 94vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
.modal-box.wide { width: 560px; }
.modal-box h3 { margin: 0 0 16px; font-size: 16px; color: var(--text); }

/* Error */
.error-msg { color: var(--danger); font-size: 12px; margin: 0 0 10px; background: var(--danger-bg); padding: 6px 10px; border-radius: 4px; }

/* History */
.history-list { max-height: 120px; overflow-y: auto; background: #F7F8FA; border-radius: 6px; padding: 8px; }
.history-entry { font-size: 11px; color: var(--mid); margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.history-entry:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* PoE section */
.poe-section { background: #F8F7FF; border: 1px solid #E9E5FF; border-radius: 6px; padding: 12px; margin-bottom: 14px; }
.poe-section label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); }
.poe-section input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--poe); }

/* Site header */
.site-header { margin: 0; font-size: 14px; color: var(--text); border-left: 3px solid var(--accent); padding-left: 8px; }

/* Responsive */
@media (max-width: 600px) {
    .topbar { height: auto; padding: 8px 12px; }
    .topbar-right { width: 100%; justify-content: flex-end; }
    .container { padding: 10px 8px; }
    .customer-grid { grid-template-columns: 1fr; }
}
