:root {
  --primary: #168fc5;
  --primary-dark: #10233e;
  --primary-light: #e5f7fb;
  --cyan: #20c4d8;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #f44336;
  --bg: #f0f4f8;
}

body {
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "\5FAE\8F6F\96C5\9ED1", sans-serif;
}

/* ---- Navbar ---- */
.navbar-top {
  min-height: 76px;
  background: radial-gradient(600px 180px at 85% 0%, rgba(32,196,216,.18), transparent 68%), linear-gradient(135deg, #10233e 0%, #183c5e 100%);
  border-bottom: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 6px 20px rgba(7,27,48,.16);
}
.navbar-top .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.navbar-top .navbar-brand { color: #fff !important; font-size: 1.05rem; font-weight: 700; letter-spacing: .08em; }
.navbar-top .navbar-brand i { color: var(--cyan); }
.navbar-top .navbar-brand span { margin-left: .55rem; padding-left: .65rem; border-left: 1px solid rgba(255,255,255,.22); color: #bfeef4; font-size: .78rem; font-weight: 500; letter-spacing: .04em; }
.home-link { display: inline-flex; align-items: center; padding: .48rem .75rem; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; color: #d9f9fd; text-decoration: none; font-size: .86rem; transition: background .18s, border-color .18s, transform .18s; }
.home-link:hover { color: #fff; border-color: var(--cyan); background: rgba(32,196,216,.14); transform: translateY(-1px); }
@media (max-width: 575px) { .navbar-top { min-height: 64px; } .navbar-top .navbar-brand span { display: none; } .home-link { padding: .4rem .55rem; } }

/* ---- Stepper ---- */
.wizard-stepper {
  display: flex; justify-content: center; align-items: center;
  gap: 0; margin: 1.5rem 0 2rem;
  flex-wrap: wrap;
}
.wizard-step-item {
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; user-select: none; position: relative; min-width: 72px;
}
.wizard-step-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem;
  background: #cfd8dc; color: #fff;
  transition: all .25s;
}
.wizard-step-item.active .wizard-step-dot { background: var(--primary); box-shadow: 0 0 0 4px rgba(21,101,192,.2); }
.wizard-step-item.completed .wizard-step-dot { background: var(--success); }
.wizard-step-item.skippable .wizard-step-dot { border: 2px dashed #90a4ae; background: transparent; color: #90a4ae; }
.wizard-step-label {
  font-size: .78rem; margin-top: 4px; color: #78909c; font-weight: 500;
  white-space: nowrap;
}
.wizard-step-item.active .wizard-step-label { color: var(--primary); font-weight: 700; }
.wizard-step-item.completed .wizard-step-label { color: var(--success); }
.wizard-step-line {
  flex: 0 0 40px; height: 2px; background: #cfd8dc; margin-top: -18px;
}
.wizard-step-line.done { background: var(--success); }

/* ---- Cards ---- */
.card-w {
  border: none; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.card-w .card-header {
  background: #fff; border-bottom: 2px solid var(--primary);
  border-radius: 12px 12px 0 0 !important;
  padding: 1rem 1.25rem; font-weight: 600; color: var(--primary);
}

/* ---- Table ---- */
.table-w thead th {
  background: var(--primary); color: #fff; font-weight: 600; border: none; padding: .85rem .75rem;
}
.table-w tbody td { padding: .75rem; vertical-align: middle; }
.table-w tbody tr:hover { background: #f5f8ff; }

/* ---- Buttons ---- */
.btn-primary-w {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none; color: #fff; border-radius: 8px; font-weight: 600;
}
.btn-primary-w:hover { opacity: .9; color: #fff; }
.btn-success-w {
  background: linear-gradient(135deg, var(--success) 0%, #388E3C 100%);
  border: none; color: #fff; border-radius: 8px; font-weight: 600;
}
.btn-success-w:hover { opacity: .9; color: #fff; }

/* ---- Form ---- */
.form-control, .form-select {
  border: 2px solid #e0e0e0; border-radius: 8px;
  padding: .6rem .9rem; transition: all .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(21,101,192,.12);
}

/* ---- Info badge ---- */
.info-badge {
  display: inline-flex; align-items: center;
  padding: .35rem .75rem; background: var(--primary-light);
  color: var(--primary); border-radius: 20px; font-size: .82rem; font-weight: 500;
}

/* ---- Misc ---- */
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.fade-in { animation: fadeIn .3s ease-out; }
.section-step { display: none; }
.section-step.active { display: block; }

/* ---- CCTV camera dropdown (reused from cctv.html) ---- */
.cam-dropdown { position: relative; user-select: none; }
.cam-dropdown .cam-trigger {
  display: flex; align-items: center; gap: 8px;
  padding: .4rem .7rem; border: 2px solid #e0e0e0; border-radius: 8px;
  background: #fff; cursor: pointer; min-width: 180px;
}
.cam-dropdown .cam-trigger:hover { border-color: var(--primary); }
.cam-dropdown .cam-trigger img { width: 40px; height: 28px; object-fit: contain; background: #1a1a2e; border-radius: 3px; }
.cam-dropdown .cam-trigger .cam-label { flex: 1; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-dropdown .cam-menu {
  display: none; position: absolute; z-index: 1050;
  width: 260px; max-height: 320px; overflow-y: auto;
  background: #fff; border: 2px solid var(--primary); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); top: calc(100% + 2px); left: 0;
}
.cam-dropdown.open .cam-menu { display: block; }
.cam-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; cursor: pointer; transition: background .12s;
}
.cam-item:hover, .cam-item.selected { background: #e8eef8; }
.cam-item img { width: 40px; height: 28px; object-fit: contain; background: #1a1a2e; border-radius: 3px; flex-shrink: 0; }
.cam-item .cam-item-label { flex: 1; font-size: .82rem; }
.badge-ip { background: #0288D1; color: #fff; font-size: .65rem; padding: 1px 6px; border-radius: 10px; }
.badge-ir { background: #EF6C00; color: #fff; font-size: .65rem; padding: 1px 6px; border-radius: 10px; }

/* ---- Zone table ---- */
.zone-table td { vertical-align: middle; }
.zone-table .form-control, .zone-table .form-select {
  padding: .35rem .5rem; font-size: .85rem;
}

/* ---- Topology ---- */
.topo-node {
  border: 2px solid var(--primary); border-radius: 8px;
  padding: .5rem .75rem; background: #fff; font-size: .82rem;
  display: inline-block; min-width: 120px; text-align: center;
}
.topo-node.switch { border-color: #FF9800; }
.topo-node.camera { border-color: #78909c; font-size: .75rem; }
.topo-link { stroke: #90a4ae; stroke-width: 2; }
.topo-link.fiber { stroke: #FF9800; stroke-dasharray: 6 3; }

/* ---- Storage panel ---- */
.storage-panel {
  background: #fafafa; border-radius: 8px; padding: 1rem;
  border: 1px solid #e0e0e0;
}
.storage-panel .storage-row { display: flex; justify-content: space-between; padding: .25rem 0; font-size: .88rem; }
.storage-panel .storage-total { font-weight: 700; border-top: 2px solid var(--primary); padding-top: .5rem; margin-top: .5rem; }
