:root {
  --mono: "Courier New", ui-monospace, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --border: #334155;
  --ink: #e2e8f0;
  --ink-strong: #f1f5f9;
  --ink-soft: #94a3b8;
  --ink-faint: #475569;
  --blue: #3b82f6;
  --blue-strong: #1d4ed8;
  --green: #34d399;
  --red: #f87171;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

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

/* ── Topbar ─────────────────────────────────────────────── */
.topbar { border-bottom: 1px solid var(--border); background: var(--surface); }
.topbar-inner {
  max-width: 900px; margin: 0 auto; padding: 0.9rem 1.25rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.brand { color: var(--ink-strong); font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.brand:hover { text-decoration: none; }
.brand-logo { font-size: 1.1rem; }
.topnav { display: flex; gap: 1.1rem; flex: 1; }
.topnav a { color: var(--ink-soft); font-size: .88rem; font-weight: 600; padding: .3rem 0; border-bottom: 2px solid transparent; }
.topnav a:hover { color: var(--ink-strong); text-decoration: none; }
.topnav a.active { color: var(--ink-strong); border-bottom-color: var(--blue); }
.logout-form { display: flex; align-items: center; gap: .7rem; }
.usuario-actual { font-size: .8rem; color: var(--ink-faint); }

/* ── Layout ─────────────────────────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.container-narrow { max-width: 500px; }
.center-vertical { padding-top: 4rem; }

.header { text-align: center; margin-bottom: 2rem; }
.header .logo {
  width: 56px; height: 56px; background: linear-gradient(135deg, var(--blue), var(--blue-strong));
  border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.6rem; margin-bottom: .8rem;
}
.header h1 { font-size: 1.4rem; font-weight: 700; color: var(--ink-strong); }
.header p { font-size: .85rem; color: var(--ink-soft); margin-top: .3rem; }

.page-title { font-size: 1.3rem; font-weight: 700; color: var(--ink-strong); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ── Card ───────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.6rem; }
.card-title { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin-bottom: 1rem; }

/* ── Forms ──────────────────────────────────────────────── */
label { font-size: .85rem; color: #cbd5e1; margin-bottom: .4rem; display: block; }
input[type="text"], input[type="password"], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--ink-strong); font-family: var(--sans); font-size: .95rem; padding: .6rem .9rem;
  outline: none; transition: border-color .15s;
}
textarea { font-family: var(--sans); resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
.hint { font-size: .78rem; color: var(--ink-faint); margin-top: .4rem; }

.search-row { display: flex; gap: .5rem; margin-bottom: 1.2rem; }
.search-row input { flex: 1; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  border: none; cursor: pointer; border-radius: 8px; font-size: .875rem; font-weight: 600;
  padding: .6rem 1.1rem; transition: opacity .15s, transform .1s;
  display: inline-flex; align-items: center; gap: .4rem; font-family: var(--sans);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { opacity: .88; text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; }
.btn-icon-text { color: var(--ink-soft); font-size: .82rem; }
.btn-danger-ghost { background: transparent; color: var(--red); border: 1px solid #7f1d1d; }
.btn-danger-ghost:hover { background: #7f1d1d22; text-decoration: none; }

.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.row-actions form { display: inline; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert { border-radius: 8px; padding: .6rem .9rem; font-size: .85rem; font-weight: 600; }
.alert-error { background: #2d0b0b; color: var(--red); border: 1px solid #7f1d1d; }
.alert-good { background: #052e16; color: #4ade80; border: 1px solid #14532d; }
.alert-warn { background: #2d240b; color: #facc15; border: 1px solid #7f6c1d; }

/* ── Result box (licencia generada) ────────────────────── */
.result-box { background: var(--bg); border: 1px solid #1e3a5f; border-radius: 10px; padding: 1rem; margin-top: 1.2rem; }
.result-label { font-size: .75rem; color: var(--blue); font-weight: 600; margin-bottom: .5rem; }
.result-key {
  font-family: var(--mono); font-size: 1.05rem; font-weight: 700; color: var(--green);
  letter-spacing: .5px; word-break: break-all; line-height: 1.5;
}

/* ── Table ──────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: .7rem 1.1rem; border-top: 1px solid var(--border); }
thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); border-top: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
.text-right { text-align: right; }
.mono { font-family: var(--mono); font-size: .82rem; color: var(--ink-soft); }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-faint); font-size: .88rem; }

.kv { display: flex; gap: .6rem; padding: .4rem 0; font-size: .88rem; }
.kv span:first-child { width: 130px; flex-shrink: 0; color: var(--ink-faint); }

.badge { font-size: .7rem; font-weight: 700; padding: .2rem .55rem; border-radius: 20px; text-transform: capitalize; }
.badge-good { background: #052e16; color: #4ade80; }
.badge-warn { background: #2d0b0b; color: var(--red); }

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.image-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }

input[type="file"] { width: 100%; color: var(--ink-soft); font-size: .85rem; }
