:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --radius: 8px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }

/* Top bar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.topbar-left svg { color: var(--primary); flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* Main */
.main { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 8px; align-items: center; }

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
  tbody tr:last-child td { border-bottom: none; }
  tbody tr:hover { background: #fafafa; }

/* Progress bar */
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #60a5fa); transition: width 0.2s ease; border-radius: 3px; }
.progress-micro { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.progress-micro .progress-fill { background: var(--primary); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-linux { background: #dbeafe; color: #1e40af; }
.badge-windows { background: #e0e7ff; color: #3730a3; }
.badge-arch { background: #f3f4f6; color: #374151; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-user { background: #dbeafe; color: #1e40af; }
.badge-blocked { background: #fee2e2; color: #991b1b; }
.badge-active { background: #dcfce7; color: #166534; }

/* Buttons */
button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-icon { padding: 6px; background: none; color: var(--text-secondary); }
.btn-icon:hover { color: var(--text); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Password */
.pwd-wrapper { position: relative; }
.pwd-wrapper input { padding-right: 70px; }
.pwd-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 0.75rem; color: var(--primary);
  cursor: pointer; padding: 2px 6px; font-family: inherit;
}
.pwd-hint { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

/* Form elements */
input, textarea, select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
textarea { resize: vertical; min-height: 60px; }
label { font-size: 0.875rem; font-weight: 500; margin-bottom: 4px; display: block; }
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal h2 { margin-bottom: 20px; font-size: 1.1rem; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state p { margin-bottom: 12px; }

/* Toast */
.toast-container {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  font-size: 0.875rem;
  animation: slideIn 0.2s ease-out;
  max-width: 360px;
}
.toast-error { border-left: 4px solid var(--danger); }
.toast-success { border-left: 4px solid #16a34a; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: rgba(37,99,235,0.05); }
.drop-zone p { color: var(--text-secondary); font-size: 0.875rem; }
#file-info { margin-top: 6px; font-size: 0.8rem; color: var(--text-secondary); }

/* Admin */
.admin-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.admin-header h2 { margin: 0; flex: 1; }

/* Welcome */
.welcome {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 56px);
  padding: 24px;
}
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.welcome-card h1 { margin-bottom: 8px; }
.welcome-card p { color: var(--text-secondary); margin-bottom: 12px; line-height: 1.6; }
.welcome-card .btn { margin-top: 16px; }

/* Responsive */
@media (max-width: 768px) {
  .topbar { padding: 0 12px; }
  .main { padding: 12px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left { flex-wrap: wrap; flex-direction: column; align-items: stretch; }
  .toolbar-left select, .toolbar-left button { width: 100%; }
  .toolbar-right { width: 100%; justify-content: flex-end; }
  thead th, tbody td { padding: 8px 10px; }
  .form-row { flex-direction: column; }
}
