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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3250;
  --accent: #5b72f7;
  --accent-hover: #7389fa;
  --text: #e2e6ff;
  --text-muted: #6b7280;
  --ok: #22c55e;
  --err: #ef4444;
  --warn: #f59e0b;
  --info: #60a5fa;
  --radius: 8px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.6; }

/* NAV */
nav { display: flex; align-items: center; gap: 1rem; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 1.5rem; height: 52px; position: sticky; top: 0; z-index: 100; }
.nav-brand { font-weight: 700; font-size: 1rem; color: var(--accent); white-space: nowrap; margin-right: 1rem; }
nav ul { display: flex; list-style: none; gap: .25rem; flex: 1; }
nav a { display: block; padding: .4rem .75rem; border-radius: 6px; color: var(--text-muted); text-decoration: none; font-size: .85rem; }
nav a:hover, nav a.active { color: var(--text); background: var(--surface2); }
.nav-user { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.nav-user a { color: var(--text-muted); }

/* LAYOUT */
.page { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-title { font-size: 1.25rem; font-weight: 700; }

/* CARDS / TABLES */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.card-title { font-weight: 600; margin-bottom: 1rem; color: var(--text); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .85rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .85rem; }
th { color: var(--text-muted); font-weight: 500; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* FORMS */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: .35rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  width: 100%; padding: .5rem .75rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: .9rem; font-family: var(--font);
  transition: border .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 160px; resize: vertical; font-family: monospace; font-size: .85rem; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1rem; border-radius: 6px; border: none; cursor: pointer; font-size: .85rem; font-weight: 500; text-decoration: none; transition: background .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: #7f1d1d; color: #fca5a5; }
.btn-danger:hover { background: var(--err); color: #fff; }
.btn-ok { background: #14532d; color: #86efac; }
.btn-ok:hover { background: var(--ok); color: #fff; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

/* BADGES */
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-cola      { background: #1e293b; color: var(--text-muted); }
.badge-corriendo { background: #1e3a5f; color: var(--info); }
.badge-ok        { background: #14532d; color: var(--ok); }
.badge-error     { background: #450a0a; color: var(--err); }
.badge-cancelado { background: #1c1c1c; color: var(--text-muted); }

/* LOGS */
.log-box { background: #0a0c14; border: 1px solid var(--border); border-radius: 6px; padding: 1rem; font-family: monospace; font-size: .8rem; max-height: 400px; overflow-y: auto; white-space: pre-wrap; }
.log-info  { color: var(--text); }
.log-warn  { color: var(--warn); }
.log-error { color: var(--err); }

/* DASHBOARD GRID */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.site-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.site-card-name { font-weight: 600; font-size: 1rem; }
.site-card-slug { font-size: .75rem; color: var(--text-muted); font-family: monospace; }
.site-card-meta { font-size: .8rem; color: var(--text-muted); }
.site-card-actions { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }

/* LOGIN */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 380px; }
.login-title { font-size: 1.4rem; font-weight: 700; color: var(--accent); margin-bottom: 1.5rem; text-align: center; }

/* ALERTS */
.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .875rem; }
.alert-err  { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }
.alert-ok   { background: #14532d; color: #86efac; border: 1px solid #166534; }
.alert-info { background: #1e3a5f; color: #93c5fd; border: 1px solid #1d4ed8; }

/* PROMPT EDITOR GRID */
.prompt-grid { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; }
.prompt-list { list-style: none; }
.prompt-list li a { display: block; padding: .5rem .75rem; border-radius: 6px; color: var(--text-muted); text-decoration: none; font-size: .85rem; }
.prompt-list li a:hover, .prompt-list li a.active { background: var(--surface2); color: var(--text); }

/* MISC */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .8rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.flex { display: flex; gap: .75rem; align-items: center; }
.flex-end { justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* HTMX loading indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
