:root {
  --bg-main: #0f1115;
  --bg-sidebar: #161920;
  --bg-card: #1c2029;
  --bg-input: #111318;
  --border: #2a2f3d;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
}

/* Brand & Logo */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  text-decoration: none;
}

.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  padding: 2px;
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  z-index: 900;
}

.burger-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 18px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 950;
}

.overlay.open {
  display: block;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* Lang Switch */
.lang-switch {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.15s;
}

.lang-btn:hover {
  color: var(--text-main);
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Navigation Groups */
.nav-group {
  margin-bottom: 8px;
}

.nav-group-header {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-radius: 6px;
}

.nav-group-header:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.nav-group-arrow {
  font-size: 10px;
  transition: transform 0.2s;
}

.nav-group.collapsed .nav-group-arrow {
  transform: rotate(-90deg);
}

.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 4px;
}

.nav-group.collapsed .nav-group-items {
  display: none;
}

.nav-link {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 13.5px;
  transition: 0.15s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 28px 34px;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
}

h1 {
  font-size: 24px;
  margin: 0 0 6px 0;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 22px 0;
}

/* Cards & UI Elements */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-success {
  background: var(--success);
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.file-box {
  background: var(--bg-input);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 13.5px;
}

progress {
  width: 100%;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  appearance: none;
  margin-top: 6px;
}

progress::-webkit-progress-bar {
  background: var(--bg-input);
}

progress::-webkit-progress-value {
  background: var(--success);
}

#log {
  background: #0b0c0e;
  color: #94a3b8;
  font-family: monospace;
  font-size: 12.5px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  height: 190px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.steps-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.65;
}

.steps-list b {
  color: var(--text-main);
}

.alert-warn {
  display: none;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

/* Admin Forms & Tables */
.admin-input, .admin-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13.5px;
  margin-bottom: 10px;
  font-family: inherit;
}

.admin-textarea {
  font-family: monospace;
  min-height: 180px;
  resize: vertical;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.admin-table th, .admin-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.admin-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.drag-row {
  cursor: grab;
}

.drag-row.dragging {
  opacity: 0.45;
  background: rgba(59, 130, 246, 0.12);
}

@media (max-width: 820px) {
  body {
    flex-direction: column;
    padding-top: 54px;
  }
  .mobile-header {
    display: flex;
  }
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    transition: left 0.22s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .main-content {
    padding: 18px 16px;
  }
}
