:root {
  --bg-primary: #0b1120;
  --bg-secondary: #131c31;
  --bg-card: #18233c;
  --bg-card-hover: #1f2e4e;
  --border-color: #273553;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #0284c7;
  --accent-blue-hover: #0369a1;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: 24px;
}

/* Header */
.app-header {
  height: 60px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #0284c7, #10b981);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-amber);
}

.status-dot.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.status-dot.offline {
  background-color: var(--accent-red);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:active {
  transform: scale(0.92);
}

/* Container & Dashboard Grid */
.container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 20px;
  flex: 1;
}

.pwa-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 860px) {
  .pwa-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
  }
}

.pwa-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Cards */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.banner-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(135deg, rgba(24, 35, 60, 0.9), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.banner-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.banner-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.banner-ip {
  display: inline-block;
  margin-top: 6px;
  font-size: 11.5px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  font-family: monospace;
}

/* Sections */
.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.btn-text {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--accent-blue);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--accent-blue-hover);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--bg-card);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-success {
  background-color: var(--accent-green);
  color: #fff;
}

/* Task List */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  text-align: center;
}

.task-details {
  flex: 1;
  min-width: 0;
}

.task-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-params {
  font-size: 11.5px;
  color: var(--text-muted);
}

.task-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.task-actions .btn {
  flex: 1;
}

/* File List */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.file-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-download {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-download:active {
  transform: scale(0.95);
}

/* Console */
.log-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.log-console {
  background-color: #060911;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: 250px;
  max-height: 380px;
  overflow-y: auto;
  font-family: Consolas, Monaco, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  color: #38bdf8;
  flex: 1;
}

.log-entry {
  margin-bottom: 3px;
  word-break: break-all;
}

.log-entry.error { color: #f87171; }
.log-entry.success { color: #4ade80; }
.log-entry.warn { color: #fbbf24; }

/* Modal Canh Giữa Màn Hình */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;      /* Canh giữa theo chiều dọc */
  justify-content: center;  /* Canh giữa theo chiều ngang */
  z-index: 1000;
  backdrop-filter: blur(6px);
  padding: 16px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-sheet {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md); /* Bo tròn đều 4 góc */
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalCenterZoom 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes modalCenterZoom {
  from {
    opacity: 0;
    transform: scale(0.93);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.sheet-drag-handle {
  display: none;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
}

.sheet-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
}

.sheet-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sheet-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  background-color: var(--bg-secondary);
}

.sheet-footer .btn {
  flex: 1;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-label-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-blue);
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.radio-group {
  display: flex;
  gap: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  z-index: 2000;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.loading-state, .empty-state {
  text-align: center;
  padding: 24px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}
