:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3250;
  --primary: #0066cc;
  --primary-hover: #0052a3;
  --danger: #e30613;
  --danger-hover: #b8050f;
  --success: #22c55e;
  --warning: #f59e0b;
  --text: #e8eaf0;
  --text-muted: #8892b0;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1rem;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center; margin-bottom: 2rem;
}
.login-logo h1 { font-size: 1.25rem; color: var(--text); }
.login-logo p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }

/* Layout */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; height: 100vh; overflow-y: auto;
}
.sidebar-logo {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 0.9rem;
  color: var(--text);
}
.sidebar-logo span { color: var(--primary); }
.sidebar-nav { flex: 1; padding: 0.75rem 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: var(--text-muted);
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--text); background: var(--surface2);
  border-left-color: var(--primary);
  text-decoration: none;
}
.sidebar-nav a .icon { font-size: 1rem; width: 1rem; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.user-info { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.user-name { color: var(--text); font-weight: 600; }

/* Main content */
.main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 1.1rem; font-weight: 600; }
.page-content { padding: 2rem; flex: 1; }

/* Cards / Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-card .stat-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); margin-top: 0.25rem; }

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.table-header h2 { font-size: 0.95rem; font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 0.75rem 1rem;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.td-actions { display: flex; gap: 0.5rem; }

/* Badges */
.badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 999px; font-size: 0.7rem; font-weight: 600;
}
.badge-blue { background: rgba(0,102,204,0.2); color: #60a5fa; }
.badge-green { background: rgba(34,197,94,0.2); color: #4ade80; }
.badge-yellow { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge-red { background: rgba(227,6,19,0.2); color: #f87171; }
.badge-gray { background: rgba(136,146,176,0.2); color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  border: none; transition: all 0.15s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); text-decoration: none; color: #fff; }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; text-decoration: none; color: #fff; }

/* Forms */
.form-grid { display: grid; gap: 1rem; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="url"],
select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
}
textarea { resize: vertical; min-height: 120px; font-family: inherit; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem; border-radius: var(--radius);
  font-size: 0.875rem; margin-bottom: 1rem;
}
.alert-error { background: rgba(227,6,19,0.15); border: 1px solid rgba(227,6,19,0.3); color: #f87171; }
.alert-success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.alert.hidden { display: none; }

/* Photo preview */
.foto-preview {
  width: 80px; height: 80px; border-radius: var(--radius);
  object-fit: cover; border: 2px solid var(--border);
}

/* Deploy button area */
.deploy-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex; align-items: center; justify-content: space-between;
}
.deploy-info h3 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.deploy-info p { font-size: 0.82rem; color: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; }
  .main { margin-left: 0; }
  .form-grid-2 { grid-template-columns: 1fr; }
}
