/* Panel de administración · estilo shadcn/ui (tema "neutral", variante new-york), solo modo claro: mismos tokens, radios y estados.
   Sin dependencias externas: la política CSP del panel solo permite recursos propios. */
:root {
  --background: hsl(0 0% 100%);
  --foreground: hsl(240 10% 3.9%);
  --card: hsl(0 0% 100%);
  --card-foreground: hsl(240 10% 3.9%);
  --muted: hsl(240 4.8% 95.9%);
  --muted-foreground: hsl(240 3.8% 46.1%);
  --accent: hsl(240 4.8% 95.9%);
  --primary: hsl(240 5.9% 10%);
  --primary-foreground: hsl(0 0% 98%);
  --secondary: hsl(240 4.8% 95.9%);
  --secondary-foreground: hsl(240 5.9% 10%);
  --destructive: hsl(0 72.2% 50.6%);
  --destructive-foreground: hsl(0 0% 98%);
  --success: hsl(142 71% 29%);
  --warning: hsl(32 95% 35%);
  --border: hsl(240 5.9% 90%);
  --input: hsl(240 5.9% 90%);
  --ring: hsl(240 5.9% 10%);
  --radius: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; border-color: var(--border); }
html, body { margin: 0; }
body { background: var(--background); color: var(--foreground); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
code, .mono { font-family: var(--mono); font-size: 0.85em; }

/* ---------- cabecera ---------- */
.site-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--background) 92%, transparent); backdrop-filter: blur(8px); }
.site-header .inner { max-width: 1280px; margin: 0 auto; height: 56px; padding: 0 24px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.brand .logo { width: 24px; height: 24px; border-radius: 6px; background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; font: 700 12px var(--mono); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 12px; border-radius: calc(var(--radius) - 2px); color: var(--muted-foreground); text-decoration: none; font-weight: 500; transition: color .15s, background .15s; }
.nav a:hover { color: var(--foreground); background: var(--accent); }
.nav a[aria-current="page"] { color: var(--foreground); background: var(--secondary); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--muted-foreground); font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 999px; background: var(--muted); color: var(--foreground); display: grid; place-items: center; font-weight: 600; font-size: 12px; text-transform: uppercase; }

/* ---------- página ---------- */
main { max-width: 1280px; margin: 0 auto; padding: 32px 24px 64px; display: grid; gap: 24px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted-foreground); }

/* ---------- card ---------- */
.card { background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-sm); min-width: 0; }
.card-header { padding: 20px 24px 0; }
.card-header h2, .card-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.card-description { color: var(--muted-foreground); margin: 4px 0 0; font-size: 13px; }
.card-content { padding: 20px 24px 24px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat .card-content { padding: 20px 24px; display: grid; gap: 4px; }
.stat .label { color: var(--muted-foreground); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--muted-foreground); font-size: 12px; }

/* ---------- formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 16px; align-items: end; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; }
.input, input[type=text], input[type=password], input[type=number], input[type=month], input[type=search], input:not([type]) {
  height: 36px; width: 100%; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--input); background: transparent; color: var(--foreground);
  padding: 4px 12px; font: inherit; box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s; }
input::placeholder { color: var(--muted-foreground); }
input:focus-visible, button:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--ring); border-color: var(--ring); }
input.sm { height: 30px; padding: 2px 8px; font-size: 13px; }
input.num { width: 72px; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: calc(var(--radius) - 2px);
  font: 500 14px var(--font); border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, color .15s, opacity .15s; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-xs { height: 22px; padding: 0 6px; font-size: 12px; border-radius: 4px; }
.edit-form { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.edit-form input { min-width: 180px; }
[hidden] { display: none !important; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow); }
.btn-primary:hover { opacity: .9; }
.btn-outline { background: var(--background); border-color: var(--input); color: var(--foreground); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--accent); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { opacity: .85; }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--accent); }
.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); box-shadow: var(--shadow-sm); }
.btn-destructive:hover { opacity: .9; }
.btn-link-destructive { background: transparent; color: var(--destructive); }
.btn-link-destructive:hover { background: color-mix(in srgb, var(--destructive) 10%, transparent); }
form.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: calc(var(--radius) - 2px); padding: 1px 8px; font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge-default { background: var(--primary); color: var(--primary-foreground); }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-outline { border-color: var(--border); color: var(--foreground); }
.badge-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.badge-destructive { background: color-mix(in srgb, var(--destructive) 14%, transparent); color: var(--destructive); }
.badge-warning { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }

/* ---------- alertas ---------- */
.alert { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; display: grid; gap: 2px; background: var(--card); }
.alert-title { font-weight: 600; }
.alert-ok { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }
.alert-ok .alert-title { color: var(--success); }
.alert-error { border-color: color-mix(in srgb, var(--destructive) 50%, var(--border)); }
.alert-error .alert-title { color: var(--destructive); }
.secret { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.secret code { flex: 1; min-width: 0; padding: 10px 12px; border: 1px dashed var(--border); border-radius: calc(var(--radius) - 2px); background: var(--muted); word-break: break-all; user-select: all; font-size: 14px; }

/* ---------- tablas (DataTable) ---------- */
.dt-toolbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 24px 0; }
.dt-toolbar .search { max-width: 320px; }
.dt-count { color: var(--muted-foreground); font-size: 13px; }
.dt-wrap { overflow-x: auto; margin: 12px 0 0; border-top: 1px solid var(--border); }
table.dt { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.dt th, table.dt td { padding: 10px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.dt th:first-child, table.dt td:first-child { padding-left: 24px; }
table.dt th:last-child, table.dt td:last-child { padding-right: 24px; }
table.dt thead th { color: var(--muted-foreground); font-weight: 500; height: 40px; }
table.dt thead tr.filters th { padding-top: 0; padding-bottom: 10px; }
table.dt thead tr.filters input { min-width: 64px; }
table.dt th, table.dt td { padding-left: 12px; padding-right: 12px; }
table.dt td.n, table.dt th.n { text-align: right; }
table.dt tbody tr { transition: background .1s; }
table.dt tbody tr:hover { background: color-mix(in srgb, var(--muted) 55%, transparent); }
table.dt tbody tr:last-child td { border-bottom: 0; }
.sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border-radius: 4px; padding: 2px 4px; margin: 0 -4px; color: inherit; font-weight: 500; }
.sort-btn:hover { background: var(--accent); color: var(--foreground); }
.sort-btn svg { width: 14px; height: 14px; opacity: .55; }
th[aria-sort="ascending"] .sort-btn, th[aria-sort="descending"] .sort-btn { color: var(--foreground); }
th[aria-sort="ascending"] .sort-btn svg, th[aria-sort="descending"] .sort-btn svg { opacity: 1; }
.cell-sub { color: var(--muted-foreground); font-size: 12px; }
.empty { text-align: center; color: var(--muted-foreground); padding: 32px 16px !important; }
.muted { color: var(--muted-foreground); }
.footnote { color: var(--muted-foreground); font-size: 12.5px; padding: 12px 24px 16px; margin: 0; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { width: 100%; max-width: 380px; }
.login .brand { justify-content: center; margin-bottom: 16px; font-size: 15px; }

@media (max-width: 720px) {
  .site-header .inner { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 8px 16px; }
  main { padding: 20px 16px 48px; }
  .dt-toolbar, .card-header, .card-content { padding-left: 16px; padding-right: 16px; }
  table.dt th:first-child, table.dt td:first-child { padding-left: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
