:root {
  --bg-dark: #090d16;
  --card-bg: rgba(17, 24, 39, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-ruby: #ef4444;
  --accent-amber: #f59e0b;
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  padding: 1.5rem 1rem;
  overflow-x: hidden;
  position: relative;
}

/* Background Animated Blobs */
.background-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  filter: blur(100px);
  border-radius: 50%;
  opacity: 0.15;
  animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: #3b82f6;
  top: -100px;
  left: -100px;
}

.blob-2 {
  width: 450px;
  height: 450px;
  background: #06b6d4;
  bottom: -50px;
  right: -50px;
  animation-delay: -5s;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: #8b5cf6;
  top: 40%;
  left: 30%;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(80px, 60px) scale(1.1); }
}

.container {
  max-width: 1640px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Glassmorphism Card Style */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Header */
.header-card {
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
}

.logo-icon svg {
  width: 26px;
  height: 26px;
  color: #fff;
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
}

.ca-badge {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.port-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-green {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.icon-total {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.icon-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.icon-blocked {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 0.25rem;
}

.active-val {
  color: #34d399;
}

.blocked-val {
  color: #f87171;
}

/* Table Card */
.main-card {
  padding: 1.75rem;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.table-title h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.count-tag {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.search-box svg {
  position: absolute;
  left: 0.9rem;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-box input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.7rem 1rem 0.7rem 2.4rem;
  color: #fff;
  font-size: 0.9rem;
  width: 240px;
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
  width: 280px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.4rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
  min-height: 44px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.25);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-table-act {
  padding: 0.25rem 0.45rem !important;
  font-size: 0.76rem !important;
  min-width: 26px;
  justify-content: center;
  border-radius: 5px;
}

/* ==========================================================================
   Dashboard 2-Column Layout (Sidebar Tree + Main Panel)
   ========================================================================== */
.dashboard-body {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  width: 100%;
}

.main-content-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Left Sidebar: Tree View */
.sidebar-tree {
  width: 250px;
  min-width: 230px;
  flex-shrink: 0;
  padding: 1rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: #f3f4f6;
  white-space: nowrap;
}

.tree-header-icon {
  width: 17px;
  height: 17px;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-add-icon {
  background: rgba(6, 182, 212, 0.15) !important;
  color: var(--accent-cyan) !important;
  border: 1px solid rgba(6, 182, 212, 0.3) !important;
}

.btn-add-icon:hover {
  background: rgba(6, 182, 212, 0.3) !important;
  color: #fff !important;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.btn-create-group-block {
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.85), rgba(59, 130, 246, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn-create-group-block:hover {
  filter: brightness(1.15);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
  transform: translateY(-1px);
}

.tree-node-actions {
  display: none;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.tree-row:hover .tree-node-actions {
  display: flex;
}

.tree-node-action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d1d5db;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.tree-node-action-btn:hover {
  background: rgba(6, 182, 212, 0.25);
  color: #fff;
  border-color: rgba(6, 182, 212, 0.4);
}

.tree-node-action-btn.btn-del:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-tree-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tree-icon svg {
  width: 15px;
  height: 15px;
}

.btn-tree-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Tree Search Box */
.tree-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.tree-search-box svg {
  position: absolute;
  left: 0.75rem;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.tree-search-box input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.2rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.82rem;
  outline: none;
  transition: all 0.2s ease;
}

.tree-search-box input:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

/* Tree Container */
.tree-view {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-right: 0.25rem;
  min-height: 180px;
  max-height: 480px;
}

.tree-view::-webkit-scrollbar {
  width: 5px;
}

.tree-view::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.tree-loading {
  padding: 1.5rem 0.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Tree Nodes */
.tree-node {
  user-select: none;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.85rem;
  color: #d1d5db;
  border: 1px solid transparent;
}

.tree-row:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.tree-row.active {
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.35);
  color: var(--accent-cyan);
  font-weight: 600;
}

.tree-expander {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
}

.tree-expander:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.tree-expander svg {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
}

.tree-expander.expanded svg {
  transform: rotate(90deg);
}

.tree-expander.empty {
  visibility: hidden;
  pointer-events: none;
}

.tree-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
}

.tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.tree-row.active .tree-badge {
  background: rgba(6, 182, 212, 0.25);
  color: #fff;
}

.tree-children {
  display: none;
  padding-left: 1.15rem;
  border-left: 1px dashed rgba(255, 255, 255, 0.12);
  margin-left: 0.85rem;
  margin-top: 0.2rem;
  margin-bottom: 0.25rem;
}

.tree-children.open {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tree-device-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tree-device-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f3f4f6;
}

.tree-device-item.highlight {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.tree-device-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tree-device-status.active {
  background: var(--accent-emerald);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.tree-device-status.blocked {
  background: var(--accent-ruby);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.tree-device-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.tree-device-alias {
  font-size: 0.72rem;
  color: #6b7280;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sidebar Batch Action Card */
.sidebar-batch-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.batch-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.batch-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.batch-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.batch-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e0e7ff;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.batch-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.batch-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.w-100 {
  width: 100%;
}

/* Row Flash Highlight Animation */
@keyframes rowPulse {
  0% { background-color: rgba(6, 182, 212, 0.35); }
  50% { background-color: rgba(6, 182, 212, 0.2); }
  100% { background-color: transparent; }
}

.row-highlight {
  animation: rowPulse 2s ease-out;
}

/* Selection Toolbar */
.selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
  animation: fadeIn 0.2s ease;
}

.selection-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.selection-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.18);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Checkboxes */
.th-checkbox, .td-checkbox {
  width: 36px;
  text-align: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.3rem !important;
}

.th-checkbox input[type="checkbox"],
.td-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
  vertical-align: middle;
}

tr.selected-row td {
  background-color: rgba(6, 182, 212, 0.08) !important;
}

/* Table */
.table-responsive {
  overflow-x: auto;
  max-width: 100%;
}

.device-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.device-table th {
  padding: 0.7rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.device-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  vertical-align: middle;
}

.device-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.text-right {
  text-align: right;
  white-space: nowrap;
}

.text-center {
  text-align: center !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.device-id-cell {
  font-weight: 600;
  color: #93c5fd;
  white-space: nowrap;
  letter-spacing: 0.01em;
  font-size: 0.8rem;
}

.serial-cell {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 0.76rem;
  cursor: pointer;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  padding-bottom: 1px;
  transition: color 0.2s ease;
  max-width: 95px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.serial-cell:hover {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.date-cell {
  white-space: nowrap;
  color: #d1d5db;
  font-size: 0.78rem;
}

.desc-cell {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.status-active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-blocked {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.loading-td, .empty-td {
  text-align: center;
  padding: 3rem !important;
  color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  padding: 2rem;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
}

.input-readonly {
  background: rgba(0, 0, 0, 0.4) !important;
  color: var(--text-muted) !important;
  cursor: not-allowed;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.flex-1 {
  flex: 1;
}

.text-danger {
  color: #f87171 !important;
}

.modal-footer-split {
  display: flex;
  align-items: center;
  justify-content: space-between !important;
  width: 100%;
}

.btn-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.25);
  color: #fff;
}

/* Channel Badges */
.channel-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.channel-stable {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.channel-beta {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.channel-canary {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Alias & Group Chip */
.alias-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.alias-title {
  font-weight: 500;
  color: #f3f4f6;
  white-space: nowrap;
}

.group-chip {
  display: inline-block;
  background: rgba(255, 255, 255, 0.06);
  color: #9ca3af;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  max-width: fit-content;
  white-space: nowrap;
}

.block-reason-text {
  font-size: 0.75rem;
  color: #f87171;
  margin-top: 0.2rem;
  display: block;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.help-text {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* Spinner */
.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 2000;
}

.toast {
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  color: #fff;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}

.toast-success {
  border-left: 4px solid var(--accent-emerald);
}

.toast-error {
  border-left: 4px solid var(--accent-ruby);
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* User Badge in Header */
.user-badge {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  font-weight: 600;
}

/* Login Overlay & Card */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 13, 22, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
}

.login-overlay.active {
  display: flex;
}

.login-card {
  max-width: 420px;
  width: 100%;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: loginCardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon-large {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem auto;
  border-radius: 16px;
}

.logo-icon-large svg {
  width: 32px;
  height: 32px;
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 0.85rem;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.login-hint {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.login-hint strong {
  color: #93c5fd;
  font-family: var(--font-mono);
}

/* Responsive adjustments */
@media (max-width: 1080px) {
  .dashboard-body {
    flex-direction: column;
  }
  .sidebar-tree {
    width: 100%;
    position: static;
    max-height: none;
  }
  .tree-view {
    max-height: 320px;
  }
}


