/* =========================================================
   MABDC ICT Lab Fleet Manager - Cyber Grid Stylesheet
   ========================================================= */

:root {
  --bg-dark: #060b13;
  --bg-card: rgba(13, 22, 38, 0.82);
  --bg-card-hover: rgba(18, 30, 52, 0.94);
  --bg-panel: rgba(10, 17, 30, 0.96);
  
  --border-subtle: rgba(56, 189, 248, 0.16);
  --border-glow: rgba(56, 189, 248, 0.5);
  --border-inactive: rgba(75, 85, 99, 0.35);

  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-purple: #a855f7;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, "Courier New", monospace;
}

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

body {
  background-color: #060b13;
  background-image: 
    linear-gradient(to right, rgba(56, 189, 248, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: 0 0;
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  touch-action: manipulation;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(6, 11, 19, 0.8);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* ================= HUD HEADER ================= */
.hud-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 11, 19, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-logo {
  position: relative;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid var(--border-glow);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-icon {
  font-size: 20px;
}

.hud-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 1px solid var(--accent-cyan);
  animation: pulse-ring 2.5s infinite;
  opacity: 0;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.hud-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.hud-subtitle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-cyan);
  letter-spacing: 0.12em;
  font-weight: 600;
}

/* Center Controls */
.hud-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  max-width: 600px;
}

.hud-site-selector {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
}

.hud-site-selector label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  font-weight: 700;
}

.hud-site-selector select {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: #fff;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-site-selector select:focus,
.hud-site-selector select:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.hud-search-box {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 12px;
  flex: 1;
  gap: 8px;
  transition: all 0.2s ease;
}

.hud-search-box:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.search-icon {
  font-size: 13px;
  color: var(--text-muted);
}

.hud-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 12px;
  width: 100%;
}

.hud-search-box input::placeholder {
  color: var(--text-muted);
}

/* Right HUD Actions */
.hud-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.telemetry-badges {
  display: flex;
  gap: 8px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.05em;
}

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

.badge-active {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}
.badge-active .badge-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.badge-inactive {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
}
.badge-inactive .badge-dot {
  background: #f43f5e;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-broadcast {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}
.btn-broadcast:hover {
  background: rgba(37, 99, 235, 0.35);
  border-color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.btn-batch {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}
.btn-batch:hover {
  background: rgba(16, 185, 129, 0.35);
  border-color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-icon {
  background: rgba(15, 23, 42, 0.85);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 10px;
}
.btn-icon:hover {
  border-color: var(--accent-cyan);
  color: #fff;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border: 1px solid #3b82f6;
}
.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
}

.btn-secondary {
  background: #1e293b;
  color: var(--text-secondary);
  border: 1px solid #334155;
}
.btn-secondary:hover {
  background: #334155;
  color: #fff;
}

.btn-accent {
  background: #059669;
  color: #fff;
  border: 1px solid #10b981;
}
.btn-accent:hover {
  background: #047857;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

/* ================= DASHBOARD MAIN ================= */
.dashboard-main {
  flex: 1;
  padding: 24px;
  max-width: 1700px;
  margin: 0 auto;
  width: 100%;
}

.grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  padding-bottom: 12px;
}

.grid-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
}

.title-bracket {
  color: var(--text-muted);
}

.device-total {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
  font-weight: 400;
}

.sync-indicator {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.08em;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: blink 1.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ================= DEVICE GRID ================= */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* Loading & Empty States */
.grid-loading, .grid-empty {
  grid-column: 1 / -1;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px dashed var(--border-subtle);
  border-radius: 12px;
  background: rgba(10, 17, 30, 0.4);
}

.radar-scanner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-cyan);
  animation: spin 1s linear infinite;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.2);
}

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

/* ================= ACTION CARD ================= */
.pc-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.pc-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65), 0 0 18px rgba(56, 189, 248, 0.18);
  transform: translateY(-2px);
}

.pc-card.inactive {
  opacity: 0.6;
  border-color: var(--border-inactive);
  filter: grayscale(0.25);
}

.pc-card.inactive:hover {
  opacity: 0.9;
  border-color: rgba(244, 63, 94, 0.4);
}

/* Card Header */
.pc-header {
  padding: 10px 14px;
  background: rgba(6, 11, 19, 0.7);
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pc-identity {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pc-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  letter-spacing: 0.04em;
}

.pc-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.pc-status-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.status-inactive {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

/* Screenshot Preview Container */
.pc-screen-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  overflow: hidden;
  cursor: pointer;
}

.pc-screenshot {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.pc-screen-wrap:hover .pc-screenshot {
  transform: scale(1.03);
}

.screen-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.9) 0%, rgba(6, 11, 19, 0.98) 100%);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.screen-placeholder .hud-wireframe {
  font-size: 26px;
  opacity: 0.6;
}

.screen-overlay-top {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(6, 11, 19, 0.75);
  backdrop-filter: blur(4px);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.screen-overlay-bottom {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(6, 11, 19, 0.75);
  backdrop-filter: blur(4px);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Card Body & Telemetry */
.pc-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.pc-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}

.pc-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Telemetry Bars */
.telemetry-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(6, 11, 19, 0.4);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.08);
}

.metric-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.metric-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.fill-cpu {
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
}

.fill-ram {
  background: linear-gradient(90deg, #10b981, #059669);
}

/* Card Actions: 4 Columns with Live Chat */
.pc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.1fr;
  gap: 6px;
  margin-top: auto;
}

.btn-card {
  padding: 7px 4px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-terminal {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}
.btn-terminal:hover {
  background: #2563eb;
  color: #fff;
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

.btn-toast {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}
.btn-toast:hover {
  background: #059669;
  color: #fff;
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.btn-patch-dropdown {
  position: relative;
}

.btn-patch {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  width: 100%;
}
.btn-patch:hover {
  border-color: var(--accent-cyan);
  color: #fff;
}

.btn-chat {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.4);
  color: #d8b4fe;
}
.btn-chat:hover {
  background: #9333ea;
  color: #fff;
  border-color: #c084fc;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.5);
}

.patch-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 6px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.8);
  z-index: 20;
  min-width: 175px;
  overflow: hidden;
}

.patch-menu.show {
  display: block;
}

.patch-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.patch-item:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #fff;
}

/* ================= MODALS ================= */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.modal-window {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.85), 0 0 28px rgba(56, 189, 248, 0.2);
  width: 100%;
  max-width: 600px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 14px 18px;
  background: rgba(6, 11, 19, 0.85);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #fff;
  letter-spacing: 0.06em;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s ease;
}
.modal-close:hover {
  color: #fff;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.input-readonly {
  background: rgba(10, 15, 26, 0.6) !important;
  color: var(--accent-cyan) !important;
  font-family: var(--font-mono) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* ================= TOAST CATEGORIES & PRESET ================= */
.category-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.btn-category {
  padding: 10px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-category .cat-icon {
  font-size: 18px;
}

.btn-category.cat-danger.active {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
}

.btn-category.cat-warning.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fde68a;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}

.btn-category.cat-general.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #6ee7b7;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

.duration-buttons, .batch-type-toggles {
  display: flex;
  gap: 8px;
}

.btn-duration, .btn-toggle {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-duration.active, .btn-toggle.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.modal-footer {
  padding: 14px 18px;
  background: rgba(6, 11, 19, 0.85);
  border-top: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ================= LIVE CHAT MODAL ================= */
.chat-window {
  max-width: 650px;
  height: 600px;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.chat-header {
  background: #0d1322;
  border-bottom: 1px solid rgba(168, 85, 247, 0.25);
}

.chat-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #d8b4fe;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  background: #040812;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.msg-row {
  display: flex;
  gap: 8px;
  max-width: 80%;
  animation: slideMsg 0.2s ease;
}

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

.msg-row.msg-user {
  align-self: flex-start;
}

.msg-row.msg-admin {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.msg-user .msg-avatar {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.msg-admin .msg-avatar {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  border: 1px solid rgba(56, 189, 248, 0.6);
}

.msg-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.msg-user .msg-bubble {
  background: #1e293b;
  color: #e2e8f0;
  border-top-left-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.msg-admin .msg-bubble {
  background: linear-gradient(135deg, #1d4ed8, #0284c7);
  color: #fff;
  border-top-right-radius: 2px;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}

.msg-time {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.msg-admin .msg-time {
  text-align: right;
}

.chat-input-bar {
  background: #090e18;
  border-top: 1px solid rgba(168, 85, 247, 0.2);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
}

.chat-input-bar input {
  flex: 1;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: #fff;
  padding: 10px 14px;
  font-size: 13px;
  outline: none;
}
.chat-input-bar input:focus {
  border-color: #a855f7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

/* ================= TERMINAL WINDOW ================= */
.terminal-window {
  max-width: 900px;
  height: 580px;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.terminal-header {
  background: #090e18;
}

.terminal-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  margin-left: 6px;
  font-weight: 700;
}

.terminal-chips {
  padding: 8px 16px;
  background: #0c1424;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.terminal-chips span {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 700;
}

.chip {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #fff;
  border-color: var(--accent-cyan);
}

.terminal-body {
  flex: 1;
  background: #030712;
  padding: 16px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #e2e8f0;
}

.term-line {
  margin-bottom: 4px;
}

.welcome-line {
  color: var(--accent-cyan);
  font-weight: bold;
}

.dim-line {
  color: var(--text-muted);
  font-size: 11px;
}

.term-cmd-entry {
  color: #38bdf8;
  margin-top: 12px;
  font-weight: bold;
}

.term-output {
  white-space: pre-wrap;
  word-break: break-all;
  color: #cbd5e1;
  margin-left: 14px;
}

.term-spinner {
  color: #f59e0b;
  font-style: italic;
  margin-left: 14px;
}

.terminal-input-bar {
  background: #090e18;
  border-top: 1px solid rgba(56, 189, 248, 0.2);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
}

.terminal-input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ================= LIGHTBOX MODAL ================= */
.lightbox-container {
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #090e18;
  border: 1px solid var(--border-glow);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 36px rgba(0, 0, 0, 0.9);
}

.lightbox-header {
  padding: 10px 16px;
  background: #0c1424;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
}

.lightbox-image-box {
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: auto;
}

.lightbox-image-box img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

/* ================= TERMINAL QUICK CHIPS EXPANSION ================= */
.terminal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.75);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  max-height: 120px;
  overflow-y: auto;
}

.chips-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  margin-right: 4px;
}

.chip {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #e2e8f0;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chip:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
}

/* ================= INSTALLED APPS MODAL ================= */
.apps-window {
  max-width: 860px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.header-with-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.apps-modal-body {
  display: flex;
  flex-direction: column;
  padding: 18px 24px;
  overflow: hidden;
  height: 600px;
}

.apps-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.apps-toolbar input {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  padding: 8px 14px;
  color: #fff;
  font-size: 12.5px;
  outline: none;
}

.apps-toolbar input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.apps-count-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 4px;
  white-space: nowrap;
}

.apps-table-wrap {
  flex: 1;
  overflow-y: auto;
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 6px;
  background: rgba(5, 10, 18, 0.85);
}

.apps-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 250px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  gap: 12px;
}

.apps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.apps-table th {
  background: #0b1322;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  text-align: left;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  z-index: 2;
}

.apps-table td {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

.apps-table tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

.app-name-cell {
  font-weight: 600;
  color: #fff;
}

.app-ver-cell {
  font-family: var(--font-mono);
  color: #94a3b8;
}

.app-pub-cell {
  color: #64748b;
  font-size: 11px;
}

/* ================= WINGET SOFTWARE DEPLOYER MODAL ================= */
.winget-window {
  max-width: 840px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.winget-modal-body {
  padding: 18px 24px;
  overflow-y: auto;
  max-height: 70vh;
}

.winget-notice {
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid var(--accent-cyan);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 18px;
}

.winget-section-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin: 18px 0 10px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.winget-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.winget-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.winget-card:hover {
  border-color: var(--accent-purple);
  background: rgba(168, 85, 247, 0.08);
}

.w-icon {
  font-size: 20px;
}

.w-info {
  flex: 1;
  overflow: hidden;
}

.w-name {
  font-weight: 600;
  font-size: 12.5px;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.w-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.custom-winget-bar {
  display: flex;
  gap: 10px;
}

.custom-winget-bar input {
  flex: 1;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  padding: 9px 14px;
  color: #fff;
  font-size: 12.5px;
  outline: none;
}

.custom-winget-bar input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.35);
}

.winget-upgrade-all-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 6px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Card Button: Apps */
.btn-apps {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

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

/* ================= RESPONSIVE ================= */
@media (max-width: 1050px) {
  .pc-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 960px) {
  .hud-header {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
  }
  .hud-controls {
    max-width: 100%;
  }
  .hud-actions {
    justify-content: space-between;
  }
  .device-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
  }
  .dashboard-main {
    padding: 16px;
  }
}
