/* ==========================================================================
   PROFESSIONAL ENTERPRISE LICENSING CONSOLE DESIGN SYSTEM
   - Strict Neutral Dark Palette (No AI neon glows / no purple-on-dark)
   - Clean, Flat Structural Layout (No excessive nested boxes)
   - High-Density Screen-Fitted Architecture
   - Precise Tabular & Typography Alignment
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Surface & Background */
  --bg-app: #0c0e12;
  --bg-sidebar: #101318;
  --bg-surface: #141820;
  --bg-surface-subtle: #191e28;
  --bg-surface-hover: #1e2430;
  --bg-input: #0f1217;
  
  /* Borders */
  --border-hairline: #1e232f;
  --border-muted: #282f3f;
  --border-focus: #3b82f6;

  /* Typography */
  --text-pure: #f8fafc;
  --text-main: #d1d5db;
  --text-muted: #808b9d;
  --text-dim: #505a6b;
  
  /* Enterprise Accents (Clean, non-AI colors) */
  --brand-blue: #2563eb;
  --brand-blue-hover: #1d4ed8;
  --brand-blue-subtle: rgba(37, 99, 235, 0.12);
  
  /* Status Colors */
  --status-active-bg: rgba(16, 185, 129, 0.1);
  --status-active-border: rgba(16, 185, 129, 0.3);
  --status-active-text: #34d399;
  
  --status-unused-bg: rgba(148, 163, 184, 0.08);
  --status-unused-border: rgba(148, 163, 184, 0.25);
  --status-unused-text: #94a3b8;
  
  --status-banned-bg: rgba(239, 68, 68, 0.1);
  --status-banned-border: rgba(239, 68, 68, 0.3);
  --status-banned-text: #f87171;
  
  --status-paused-bg: rgba(245, 158, 11, 0.1);
  --status-paused-border: rgba(245, 158, 11, 0.3);
  --status-paused-text: #fbbf24;

  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Sizing & Density */
  --sidebar-width: 230px;
  --topbar-height: 52px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
}

/* Global Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* Custom Lean Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--border-muted);
  border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* App Layout Grid */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 50;
  user-select: none;
}

.brand-section {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-hairline);
}

.brand-logo {
  width: 28px;
  height: 28px;
  background: #1e293b;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 11px;
}

.brand-info .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-pure);
  letter-spacing: -0.01em;
}

.brand-info .subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 14px 6px 14px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item-content {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-item-content svg {
  stroke-width: 1.8;
  color: var(--text-muted);
  transition: color 0.12s ease;
}

.nav-item:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-pure);
}

.nav-item:hover .nav-item-content svg {
  color: var(--text-pure);
}

.nav-item.active {
  background: var(--brand-blue);
  color: #ffffff;
  font-weight: 600;
}

.nav-item.active .nav-item-content svg {
  color: #ffffff;
}

.nav-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  border-radius: 10px;
  border: 1px solid var(--border-hairline);
}

.nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: transparent;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.server-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.status-dot-green {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
}

/* ==========================================================================
   MAIN CONTENT AREA (Fitted Viewport Architecture)
   ========================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.topbar-title h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-pure);
  letter-spacing: -0.01em;
}

.topbar-title p {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tab Container */
.tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 14px 18px;
  overflow-y: auto;
  gap: 12px;
}

.tab-content.active {
  display: flex;
}

/* ==========================================================================
   OVERVIEW STATS RIBBON (Compact, Flat, No AI Bento Boxes)
   ========================================================================== */
.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
}

.stat-box {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--border-hairline);
}

.stat-box:last-child {
  border-right: none;
}

.stat-box-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-box-value {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-pure);
  font-family: var(--font-sans);
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.02em;
}

.stat-box-desc {
  font-size: 10.5px;
  color: var(--text-dim);
}

/* ==========================================================================
   PANELS & CONTAINERS (Structured Flat Design)
   ========================================================================== */
.content-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel-toolbar {
  padding: 8px 12px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-pure);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 2-Column Split Grid */
.grid-split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

/* ==========================================================================
   TABLES (High Density, Pixel-Aligned Tabular Grids)
   ========================================================================== */
.table-viewport {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: #11141a;
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
  z-index: 10;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-hairline);
  transition: background 0.08s ease;
}

.data-table tbody tr:hover {
  background: var(--bg-surface-hover);
}

.data-table tbody td {
  padding: 7px 12px;
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tbody td.text-pure {
  color: var(--text-pure);
  font-weight: 500;
}

.data-table tbody td.text-muted {
  color: var(--text-muted);
  font-size: 11.5px;
}

/* Code Pills (Monospace, no neon gradients) */
.code-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #93c5fd;
  background: #0e1626;
  border: 1px solid #1e3a5f;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: border-color 0.12s ease;
}

.code-tag:hover {
  border-color: #3b82f6;
  color: #bfdbfe;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status-active {
  background: var(--status-active-bg);
  border: 1px solid var(--status-active-border);
  color: var(--status-active-text);
}

.status-unused {
  background: var(--status-unused-bg);
  border: 1px solid var(--status-unused-border);
  color: var(--status-unused-text);
}

.status-banned {
  background: var(--status-banned-bg);
  border: 1px solid var(--status-banned-border);
  color: var(--status-banned-text);
}

.status-paused {
  background: var(--status-paused-bg);
  border: 1px solid var(--status-paused-border);
  color: var(--status-paused-text);
}

.tier-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-weight: 600;
  background: #182232;
  border: 1px solid #27374d;
  color: #93c5fd;
}

/* ==========================================================================
   BUTTONS & INPUTS (Crisp, High-Density, Perfectly Aligned)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.12s ease;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn svg {
  stroke-width: 2;
}

.btn-primary {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: #1d4ed8;
}
.btn-primary:hover {
  background: var(--brand-blue-hover);
}

.btn-secondary {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  border-color: var(--border-hairline);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  color: var(--text-pure);
  border-color: var(--border-muted);
}

.btn-danger {
  background: #2a1215;
  color: #fca5a5;
  border-color: #5c1d24;
}
.btn-danger:hover {
  background: #3f161c;
  color: #fecaca;
  border-color: #7f1d1d;
}

.btn-sm {
  height: 24px;
  padding: 0 7px;
  font-size: 11px;
}

.btn-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Inputs & Dropdowns */
.input-control {
  height: 28px;
  padding: 0 9px;
  background: var(--bg-input);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  color: var(--text-pure);
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.12s ease;
}

.input-control:focus {
  border-color: var(--border-focus);
}

.input-control::placeholder {
  color: var(--text-dim);
}

select.input-control {
  cursor: pointer;
}

/* ==========================================================================
   CODE GENERATOR AREA
   ========================================================================== */
.code-generator-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.code-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
}

.code-view {
  background: #080a0e;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #93c5fd;
  line-height: 1.6;
  overflow: auto;
  flex: 1;
  min-height: 0;
  user-select: text;
}

/* ==========================================================================
   MODALS (Clean, Non-Floating, Direct Enterprise Style)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

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

.modal-dialog {
  width: 440px;
  max-width: 95vw;
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 10px 14px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-pure);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close-btn:hover {
  color: var(--text-pure);
}

.modal-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-footer {
  padding: 10px 14px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-shelf {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2000;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #11151d;
  border: 1px solid var(--border-muted);
  border-left: 3px solid var(--brand-blue);
  color: var(--text-pure);
  padding: 8px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  animation: slideToast 0.15s ease-out;
}

.toast-danger {
  border-left-color: #ef4444;
}

@keyframes slideToast {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
