:root {
  --jdk-blue:      #1B9BD1;
  --jdk-blue-dark: #1476A2;
  --jdk-green:     #6DBE45;
  --sidebar-bg:    #1c2b3a;
  --sidebar-hover: rgba(27,155,209,.12);
  --sidebar-active-bg: rgba(27,155,209,.2);
  --sidebar-width: 256px;
  --header-h:      60px;
  --body-bg:       #f0f4f8;
  --card-bg:       #ffffff;
  --text-main:     #2c3e50;
  --text-muted:    #7f8c9a;
  --border:        #e4e9f0;
  --online-color:  #27ae60;
  --suspended-color: #e67e22;
  --revoked-color: #e74c3c;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--body-bg);
       color: var(--text-main); font-size: 14px; }

/* ── LAYOUT ── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
  transition: width .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: var(--header-h);
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}
.sidebar-brand img { height: 34px; width: auto; flex-shrink: 0; border-radius: 4px; mix-blend-mode: lighten; }
.brand-text {
  color: #fff; font-size: 13px; font-weight: 600; letter-spacing: .3px;
  line-height: 1.2; white-space: nowrap;
}
.brand-text span { display: block; color: var(--jdk-blue); font-size: 11px; font-weight: 400; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  padding: 12px 20px 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  color: rgba(255,255,255,.3); text-transform: uppercase;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; color: rgba(255,255,255,.72);
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.nav-link i { width: 18px; text-align: center; font-size: 15px; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--jdk-blue);
  border-left-color: var(--jdk-blue);
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--jdk-blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-meta { flex: 1; overflow: hidden; }
.user-name { color: #fff; font-size: 13px; font-weight: 600;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,.45); font-size: 11px; text-transform: capitalize; }
.logout-btn {
  color: rgba(255,255,255,.4); font-size: 16px; text-decoration: none;
  padding: 4px; transition: color .15s;
}
.logout-btn:hover { color: #e74c3c; }

/* ── MAIN CONTENT ── */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; }

.top-header {
  height: var(--header-h); background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.page-title { font-size: 17px; font-weight: 700; color: var(--text-main); flex: 1; }
.page-title small { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 8px; }

.page-content { padding: 24px; flex: 1; }

/* ── STAT CARDS ── */
.stat-card {
  background: var(--card-bg); border-radius: 10px;
  padding: 22px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex; align-items: center; gap: 18px;
  border-left: 4px solid transparent;
}
.stat-card.online   { border-left-color: var(--online-color); }
.stat-card.total    { border-left-color: var(--jdk-blue); }
.stat-card.suspended{ border-left-color: var(--suspended-color); }
.stat-card.companies{ border-left-color: var(--jdk-green); }

.stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-card.online   .stat-icon { background: rgba(39,174,96,.12); color: var(--online-color); }
.stat-card.total    .stat-icon { background: rgba(27,155,209,.12); color: var(--jdk-blue); }
.stat-card.suspended .stat-icon{ background: rgba(230,126,34,.12); color: var(--suspended-color); }
.stat-card.companies .stat-icon{ background: rgba(109,190,69,.12); color: var(--jdk-green); }

.stat-value { font-size: 30px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

/* ── CONTENT CARD ── */
.content-card {
  background: var(--card-bg); border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  overflow: hidden;
}
.content-card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.content-card-title { font-size: 14px; font-weight: 700; color: var(--text-main); }
.content-card-body { padding: 20px; }

/* ── TABLES ── */
.table-custom { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-custom thead th {
  background: #f8fafc; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted);
  padding: 11px 14px; border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table-custom tbody tr { transition: background .12s; }
.table-custom tbody tr:hover { background: #f6f9fc; }
.table-custom tbody td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; font-size: 13.5px;
}
.table-custom tbody tr:last-child td { border-bottom: none; }

/* ── STATUS BADGES ── */
.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
}
.badge-status.active    { background: rgba(39,174,96,.12); color: #27ae60; }
.badge-status.suspended { background: rgba(230,126,34,.12); color: #e67e22; }
.badge-status.revoked   { background: rgba(231,76,60,.12);  color: #e74c3c; }

.online-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--online-color);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(39,174,96,.4);
  animation: pulse-green 2s infinite;
}
.offline-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #bdc3c7; display: inline-block;
}
@keyframes pulse-green {
  0%   { box-shadow: 0 0 0 0 rgba(39,174,96,.4); }
  70%  { box-shadow: 0 0 0 8px rgba(39,174,96,0); }
  100% { box-shadow: 0 0 0 0 rgba(39,174,96,0); }
}

.badge-type {
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
}
.badge-type.router { background: #eaf4fb; color: #1B9BD1; }
.badge-type.device { background: #eefbea; color: #27ae60; }
.badge-type.user   { background: #fef9e7; color: #d4ac0d; }
.badge-type.PC     { background: #f5eef8; color: #8e44ad; }

/* ── BUTTONS ── */
.btn-jdk {
  background: var(--jdk-blue); color: #fff; border: none;
  padding: 8px 18px; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.btn-jdk:hover { background: var(--jdk-blue-dark); color: #fff; }
.btn-jdk.danger { background: #e74c3c; }
.btn-jdk.danger:hover { background: #c0392b; }
.btn-jdk.warning { background: #e67e22; }
.btn-jdk.warning:hover { background: #ca6f1e; }
.btn-jdk.success { background: #27ae60; }
.btn-jdk.success:hover { background: #1e8449; }
.btn-jdk.secondary { background: #7f8c9a; }
.btn-jdk.secondary:hover { background: #626e7a; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.filter-bar input, .filter-bar select {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 12px; font-size: 13px; background: #fff; color: var(--text-main);
  outline: none; transition: border-color .15s;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--jdk-blue); }
.filter-bar input[type="text"] { width: 220px; }

/* ── CN NAME LINK ── */
.cn-link { color: var(--jdk-blue); text-decoration: none; font-weight: 600; font-family: monospace; font-size: 13px; }
.cn-link:hover { text-decoration: underline; }

/* ── DETAIL PAGE ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.info-row { display: flex; padding: 9px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { width: 160px; font-size: 12px; color: var(--text-muted); text-transform: uppercase;
              letter-spacing: .4px; font-weight: 600; flex-shrink: 0; padding-top: 1px; }
.info-value { font-size: 13.5px; color: var(--text-main); font-weight: 500; }
.info-value.mono { font-family: monospace; }

/* ── ACTION PANEL ── */
.action-panel { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

/* ── ALERT ── */
.alert { border-radius: 8px; padding: 12px 16px; margin-bottom: 16px;
         display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.alert-success { background: #eafaf1; color: #1e8449; border-left: 4px solid #27ae60; }
.alert-danger   { background: #fdedec; color: #c0392b; border-left: 4px solid #e74c3c; }
.alert-warning  { background: #fef9e7; color: #9a7d0a; border-left: 4px solid #f1c40f; }
.alert-info     { background: #eaf4fb; color: #1a5276; border-left: 4px solid #2980b9; }

/* ── NEVER-SUSPEND BADGE ── */
.badge-ns { background: #eefbea; color: #27ae60; padding: 2px 8px; border-radius: 4px;
            font-size: 11px; font-weight: 600; }

/* ── LOGIN PAGE ── */
.login-page { min-height: 100vh; background: var(--sidebar-bg);
              display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 14px; padding: 44px 40px;
              width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 60px; width: auto; }
.login-title { font-size: 18px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted);
               text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 7px; font-size: 14px; color: var(--text-main);
  outline: none; transition: border-color .15s;
}
.form-control:focus { border-color: var(--jdk-blue); }
.btn-login {
  width: 100%; padding: 11px; background: var(--jdk-blue); color: #fff;
  border: none; border-radius: 7px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background .15s; margin-top: 8px;
}
.btn-login:hover { background: var(--jdk-blue-dark); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sidebar { width: 0; overflow: hidden; }
  .main-content { margin-left: 0; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ── UTILITIES ── */
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.mb-3 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.flex-1 { flex: 1; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.mono { font-family: monospace; }

/* DataTables overrides */
div.dataTables_wrapper div.dataTables_filter input { border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; }
div.dataTables_wrapper div.dataTables_length select { border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; }
div.dataTables_info { font-size: 12px; color: var(--text-muted); padding-left: 16px; }

/* DataTables pagination */
.dataTables_paginate { text-align: center; margin-top: 16px; }
.dataTables_paginate .paginate_button {
  display: inline-block; padding: 6px 10px; margin: 2px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text-muted); text-decoration: none; transition: all .15s;
}
.dataTables_paginate .paginate_button a {
  color: var(--text-muted); text-decoration: none;
}
.dataTables_paginate .paginate_button:hover:not(.disabled) {
  background: var(--jdk-blue); color: #fff; border-color: var(--jdk-blue);
}
.dataTables_paginate .paginate_button:hover:not(.disabled) a {
  color: #fff;
}
.dataTables_paginate .paginate_button.active {
  background: var(--jdk-blue); color: #fff; border-color: var(--jdk-blue);
}
.dataTables_paginate .paginate_button.active a {
  color: #fff;
}
.dataTables_paginate .paginate_button.disabled {
  opacity: .5; cursor: not-allowed;
}
