* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: #0F1319;
  color: #E4E8EE;
}

/* --- Login --- */
.login-body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #1B2128;
  border-radius: 12px;
  padding: 40px;
  width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.brand { color: #7A8699; font-size: 13px; text-align: center; }
.login-card h1 { font-size: 20px; text-align: center; margin: 4px 0 24px; }
.login-card label { display: block; font-size: 12px; color: #AAB4C2; margin-bottom: 4px; margin-top: 12px; }
.login-card input {
  width: 100%; padding: 10px; border-radius: 6px; border: 1px solid #2A323C;
  background: #12161C; color: #E4E8EE; font-size: 14px;
}
.login-card button {
  width: 100%; margin-top: 20px; padding: 10px; border: none; border-radius: 6px;
  background: #3B82F6; color: white; font-size: 14px; font-weight: 600; cursor: pointer;
}
.login-card button:hover { background: #2563EB; }
.error { color: #F87171; font-size: 12px; margin-top: 10px; min-height: 14px; }

/* --- Dashboard --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid #232A33;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .user { font-size: 13px; color: #8891A0; }
.topbar button.logout {
  background: none; border: 1px solid #2A323C; color: #AAB4C2; padding: 6px 14px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}

/* --- Navbar --- */
.navbar {
  display: flex; gap: 4px; padding: 0 28px; border-bottom: 1px solid #232A33;
  background: #131820;
}
.nav-item {
  background: none; border: none; color: #8891A0; padding: 14px 18px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav-item:hover { color: #C9D2DE; }
.nav-item.active { color: #E4E8EE; border-bottom-color: #3B82F6; }

.container { padding: 24px 28px; max-width: 1200px; margin: 0 auto; }
.section { margin-bottom: 32px; }
.section h2 { font-size: 15px; color: #AAB4C2; margin-bottom: 12px; font-weight: 600; }

.card { background: #171C23; border: 1px solid #232A33; border-radius: 10px; padding: 20px; }

.filters { display: flex; gap: 10px; margin-bottom: 14px; }
.filters select, .filters input {
  padding: 8px 10px; border-radius: 6px; border: 1px solid #2A323C;
  background: #12161C; color: #E4E8EE; font-size: 13px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #232A33; }
th { color: #8891A0; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #1B2128; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: #2A323C; color: #C9D2DE;
}
.badge.floor1 { background: #1E3A5F; color: #7EB6FF; }
.badge.floor2 { background: #3D2E5C; color: #C4A6FF; }
.badge.floor3 { background: #1E4D3A; color: #7EE6B0; }

/* PC state badges (SNMP movement detection) */
.badge.state-ok { background: #1E4D3A; color: #7EE6B0; }
.badge.state-disconnected { background: #4A3A1E; color: #FBBF24; }
.badge.state-disconnected-long { background: #4A1E1E; color: #F87171; }
.badge.state-moved { background: #4A1E1E; color: #F87171; font-weight: 700; }
.badge.state-unknown { background: #2A323C; color: #8891A0; }

/* --- Plants & Floors editor --- */
.plant-block {
  border: 1px solid #232A33; border-radius: 8px; padding: 14px 16px; margin-bottom: 14px;
  background: #12161C;
}
.plant-block:last-of-type { margin-bottom: 18px; }
.plant-header { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.plant-header .pn-input {
  flex: 1; padding: 8px 10px; border-radius: 6px; border: 1px solid #2A323C;
  background: #0F1319; color: #E4E8EE; font-size: 14px; font-weight: 600;
}
.floor-table { margin-bottom: 12px; }
.floor-table th { font-size: 11px; }
.floor-table input {
  padding: 6px 8px; border-radius: 5px; border: 1px solid #2A323C;
  background: #0F1319; color: #E4E8EE; font-size: 12px; width: 100%;
}
.floor-table td input.f-ipstart,
.floor-table td input.f-ipend,
.floor-table td input.f-portstart,
.floor-table td input.f-portend { width: 110px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input {
  padding: 8px 10px; border-radius: 6px; border: 1px solid #2A323C;
  background: #12161C; color: #E4E8EE; font-size: 13px;
}
/* --- Plants & Floors drill-down tabs --- */
.pf-tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid #232A33; padding-bottom: 10px; }
.pf-tab {
  background: #171C23; border: 1px solid #2A323C; color: #AAB4C2;
  padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.pf-tab:hover { color: #E4E8EE; border-color: #3A4452; }
.pf-tab.active { background: #1B2733; color: #E4E8EE; border-color: #3B82F6; }
.pf-tab-add { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.pf-tab-add input {
  padding: 7px 10px; border-radius: 6px; border: 1px solid #2A323C;
  background: #12161C; color: #E4E8EE; font-size: 13px; width: 150px;
}
.pf-plant-header { display: flex; gap: 8px; align-items: center; margin: 16px 0 10px; }
.pf-plant-header .pn-input { font-weight: 600; }
.pf-floor-tabs { border-bottom: none; padding-bottom: 0; margin-top: 4px; }
.hint { color: #8891A0; font-size: 12px; margin-top: 14px; }

.stale { color: #F59E0B; }
.offline { color: #F87171; }

.btn { padding: 8px 16px; border-radius: 6px; border: none; background: #3B82F6; color: white;
  font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:hover { background: #2563EB; }
.btn.secondary { background: #2A323C; }
.btn.secondary:hover { background: #343E4B; }
.btn.danger { background: #7F1D1D; }
.btn.danger:hover { background: #991B1B; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.release-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid #232A33; }
.release-row:last-child { border-bottom: none; }
.release-current { color: #7EE6B0; font-size: 11px; font-weight: 700; margin-left: 8px; }

.upload-form { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.upload-form input[type="text"] { padding: 8px 10px; border-radius: 6px; border: 1px solid #2A323C;
  background: #12161C; color: #E4E8EE; font-size: 13px; }

.toast { position: fixed; bottom: 20px; right: 20px; background: #1B2128; border: 1px solid #2A323C;
  padding: 12px 18px; border-radius: 8px; font-size: 13px; }
.toast.error { border-color: #7F1D1D; color: #F87171; }
.toast.success { border-color: #14532D; color: #7EE6B0; }

/* --- Floor / subnet / line editor --- */
.floor-block {
  border: 1px solid #232A33; border-radius: 8px; padding: 14px; margin: 12px 0;
  background: #12161C;
}
.floor-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.floor-header .f-label { font-weight: 600; }
.subnet-row { font-size: 13px; line-height: 1.9; }
.subnet-pill { display: inline-block; padding: 3px 9px; border-radius: 6px; border: 1px solid #1F4A33;
  background: #12261C; color: #4ADE80; font-size: 12px; margin-right: 6px; }
.floor-subsection { margin-top: 12px; }
.floor-subsection-title { font-size: 11px; color: #8891A0; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
.mini-table th, .mini-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #1E242C; }
.mini-table th { color: #6E7887; font-weight: 600; font-size: 11px; text-transform: uppercase; }
.mini-table input { width: 100px; padding: 5px 7px; border-radius: 5px; border: 1px solid #2A323C; background: #171C23; color: #E4E8EE; font-size: 12px; }
.btn.small { padding: 4px 10px; font-size: 12px; }
