:root {
  --bg-dark: #0a0f1e;
  --bg-card: #111827;
  --bg-card-hover: #1f2937;
  --bg-input: #0d1321;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-main: #f1f5f9;
  --text-muted: #64748b;
  --border-color: #1e293b;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', system-ui, sans-serif; }

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 5px var(--primary-glow); } 50% { box-shadow: 0 0 20px var(--primary-glow), 0 0 40px rgba(99, 102, 241, 0.1); } }

.animate-in { animation: fadeIn 0.4s ease-out; }
.animate-section { animation: fadeIn 0.3s ease-out; }

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  animation: toastIn 0.3s ease-out;
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.toast.removing { animation: toastOut 0.3s ease-out forwards; }
.toast-success { background: rgba(16, 185, 129, 0.15); color: var(--success); border-color: rgba(16, 185, 129, 0.3); }
.toast-error { background: rgba(239, 68, 68, 0.15); color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }
.toast-info { background: rgba(99, 102, 241, 0.15); color: var(--primary); border-color: rgba(99, 102, 241, 0.3); }
.toast-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); border-color: rgba(245, 158, 11, 0.3); }
.toast i { font-size: 18px; }

.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, rgba(10, 15, 30, 0.45), rgba(15, 23, 42, 0.55)), url('index-walpaper.jpg') center/cover no-repeat fixed;
  padding: 20px;
  position: relative;
}

.auth-card {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 36px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.auth-header { text-align: center; margin-bottom: 28px; }
.auth-logo-wrap { margin-bottom: 12px; }
.auth-logo { font-size: 44px; color: var(--primary); animation: glow 3s ease-in-out infinite; }
.auth-header h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.auth-header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.auth-form .form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input, .form-control, select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-control:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn {
  padding: 10px 18px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-size: 13px;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px var(--primary-glow); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: #000; }
.btn-info { background: #0ea5e9; color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border-color); }
.btn-ghost:hover { color: var(--text-main); border-color: var(--text-muted); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 20px;
  padding-left: 10px;
  letter-spacing: -0.5px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.user-info { display: flex; flex-direction: column; }
.username { font-weight: 600; font-size: 13px; }
.role-badge { font-size: 10px; color: var(--success); font-weight: 700; letter-spacing: 0.5px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s;
}

.nav-item:hover { background: var(--bg-card-hover); color: var(--text-main); }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px var(--primary-glow); }

.nav-divider {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 14px 0 6px 10px;
  letter-spacing: 1.5px;
}

.sidebar-footer { margin-top: auto; padding-top: 12px; }

.main-content { flex: 1; padding: 24px 28px; overflow-y: auto; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.topbar-title h2 { font-size: 20px; font-weight: 700; }
.topbar-stats { display: flex; gap: 10px; }

.stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
}

.online-pill { border-color: rgba(16, 185, 129, 0.3); }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.card:hover { border-color: #2d3748; }

.stat-card { display: flex; align-items: center; gap: 14px; }

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

.card-icon.blue { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.card-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.card-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.card-val { font-size: 24px; font-weight: 700; display: block; }
.card-lbl { color: var(--text-muted); font-size: 12px; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding-top: 0; }

.table-responsive { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: rgba(99, 102, 241, 0.05); }

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-online { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-offline { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.country-flag { font-size: 20px; line-height: 1; }
.device-flag { font-size: 24px; }

.device-panel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.device-panel-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-panel-info h3 { font-size: 18px; font-weight: 700; }

.device-tabs-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.tab-category-group {
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
}

.tab-category-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.device-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn:hover { color: var(--text-main); background: var(--bg-card-hover); border-color: var(--primary-glow); }
.tab-btn.active { background: linear-gradient(135deg, var(--primary), #4f46e5); color: #fff; box-shadow: 0 4px 12px var(--primary-glow); border-color: transparent; }

.device-tab-content { animation: fadeIn 0.25s ease-out; }

.sysinfo-grid { display: flex; flex-direction: column; gap: 0; }

.sysinfo-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.sysinfo-row:last-child { border-bottom: none; }
.si-label { color: var(--text-muted); font-weight: 600; }
.si-value { color: var(--text-main); }

.drives-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding-top: 12px; }

.drive-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
}

.drive-card h4 { font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.drive-bar { height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.drive-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.drive-info { font-size: 11px; color: var(--text-muted); }

.file-path-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.file-path-input { flex: 1; font-family: monospace; }
.file-icon { width: 20px; text-align: center; color: var(--text-muted); }
.file-name-link { cursor: pointer; color: var(--primary); transition: color 0.2s; }
.file-name-link:hover { color: var(--primary-hover); text-decoration: underline; }

.terminal-card { display: flex; flex-direction: column; height: calc(100vh - 280px); min-height: 400px; }

.terminal-output {
  flex: 1;
  background: #0c0c0c;
  border: 1px solid #1a1a2e;
  border-radius: 8px;
  padding: 16px;
  overflow-y: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
}

.term-line { white-space: pre-wrap; word-break: break-all; }
.term-cmd { color: #22d3ee; }
.term-stdout { color: #e2e8f0; }
.term-stderr { color: #f87171; }
.term-system { color: #64748b; font-style: italic; }

.terminal-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: #0c0c0c;
  border: 1px solid #1a1a2e;
  border-radius: 8px;
  padding: 8px 12px;
}

.term-prompt { color: var(--success); font-family: monospace; font-weight: 700; font-size: 14px; }

.terminal-input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-family: 'Consolas', monospace;
  font-size: 13px;
  outline: none;
}

.build-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.build-type-card {
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  padding: 32px 24px;
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.build-type-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}

.build-type-icon { font-size: 52px; margin-bottom: 16px; color: var(--primary); }
.build-type-card h3 { font-size: 18px; margin-bottom: 6px; }
.build-type-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }
.build-type-tag {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
}

.screen-viewer {
  background: #000;
  border-radius: 8px;
  min-height: 300px;
  position: relative;
  overflow: hidden;
  outline: none;
}

.screen-viewer:focus { box-shadow: 0 0 0 2px var(--primary); }

.screen-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 300px;
  color: var(--text-muted);
}

.screen-placeholder p { font-size: 13px; }

.screen-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.screen-controls { display: flex; gap: 14px; }
.screen-controls label { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 12px; }
.screen-controls input[type="checkbox"] { accent-color: var(--primary); }

.live-toggle-label { display: flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; color: var(--text-main); }
.live-toggle-label input[type="checkbox"] { accent-color: var(--success); width: 16px; height: 16px; }

.announcements-container { display: flex; flex-direction: column; gap: 14px; }

.announcement-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px 20px;
}

.announcement-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.announcement-header h4 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.announcement-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; white-space: pre-line; }

.announcement-admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.announcement-admin-row:last-child { border-bottom: none; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.builder-appearance { background: var(--bg-input); border-color: var(--border-color); }
.builder-appearance h4 { margin-bottom: 14px; font-size: 14px; }

.hidden { display: none !important; }
.margin-top { margin-top: 20px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 13px; }

.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-top: 16px; }
.alert-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-success { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }

.form-row { display: flex; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.align-end { display: flex; align-items: flex-end; }

.info-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 14px;
  border-radius: 10px;
  font-size: 13px;
}

.info-banner i { font-size: 18px; color: var(--primary); }

.key-redeem-box {
  margin-top: 20px;
  background: var(--bg-input);
  padding: 18px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.key-redeem-box h4 { margin-bottom: 6px; }
.key-redeem-box p { color: var(--text-muted); font-size: 12px; margin-bottom: 14px; }

.input-group { display: flex; gap: 10px; }

.input-group input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

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

code {
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--primary);
  font-family: monospace;
}

pre {
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-main);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav-item { font-size: 12px; padding: 8px 10px; }
  .main-content { padding: 16px; }
  .form-row { flex-direction: column; }
  .topbar { flex-direction: column; gap: 10px; }
  .device-tabs { flex-wrap: wrap; }
}

/* Visual Module Grid Cards & Image Styling */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.module-card:hover {
  border-color: var(--primary);
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.35);
  background: rgba(30, 41, 59, 0.9);
}

.module-card-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s ease;
}

.module-card:hover .module-card-img {
  transform: scale(1.12) rotate(3deg);
}

.module-card .module-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 4px;
}

.module-card .module-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.module-card.full-card {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(99, 102, 241, 0.25));
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.module-card.full-card:hover {
  border-color: #ef4444;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.45);
}

/* HVNC Quick Launcher Grid */
.hvnc-launch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.hvnc-launch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.hvnc-launch-btn img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.hvnc-launch-btn span {
  font-size: 12px;
  font-weight: 500;
}

.hvnc-launch-btn:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.os-icon { font-size: 1.2em; vertical-align: middle; margin-right: 6px; }
.os-win10 { color: #0078d7; }
.os-win11 { color: #00a4ef; }
.os-server { color: #8a2be2; }