/* Estilos compartidos por todas las páginas. Paleta: verde pino sobre neutros verdosos; Archivo para títulos, IBM Plex para texto y datos. */
:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --ink: #1b2420;
  --muted: #5d6a64;
  --line: #d9dfdb;
  --accent: #2c5e4f;
  --accent-ink: #ffffff;
  --accent-soft: #e2ece7;
  --warn: #9a6512;
  --warn-soft: #f7ecd6;
  --danger: #a83434;
  --danger-soft: #f6e1e0;
  --ok: #2c6e3f;
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121715; --surface: #1a211e; --ink: #e5ebe7; --muted: #9aa7a1; --line: #2c3632;
  --accent: #6fb39c; --accent-ink: #0d1411; --accent-soft: #1f322b;
  --warn: #e0b061; --warn-soft: #362b17; --danger: #e57d7a; --danger-soft: #3a1f1f; --ok: #7fc58f;
  color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #121715; --surface: #1a211e; --ink: #e5ebe7; --muted: #9aa7a1; --line: #2c3632;
  --accent: #6fb39c; --accent-ink: #0d1411; --accent-soft: #1f322b;
  --warn: #e0b061; --warn-soft: #362b17; --danger: #e57d7a; --danger-soft: #3a1f1f; --ok: #7fc58f;
  color-scheme: dark }

* { box-sizing: border-box }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.45 }
.wrap { max-width: 1280px; margin: 0 auto; padding-block: 20px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 18px }
h1, h2 { font-family: var(--font-display); margin: 0; text-wrap: balance }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em }
h2 { font-size: 16px; font-weight: 700 }
.num, td.n { font-variant-numeric: tabular-nums }
.mono { font-family: var(--font-mono); font-size: 12.5px }

header.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px }
.title-block { display: flex; flex-direction: column; gap: 4px; min-width: 0 }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent) }
.dot.err { background: var(--danger) }
.actions { display: flex; flex-wrap: wrap; gap: 8px }

button, .btn { font: inherit; font-weight: 500; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); padding: 8px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap }
button:hover { border-color: var(--muted) }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)) }
button.danger.solid { background: var(--danger); color: var(--surface); border-color: var(--danger) }
button.ghost { background: transparent; border-color: transparent; padding: 6px 8px }
button.ghost:hover { background: var(--accent-soft) }
button:disabled { opacity: .5; cursor: not-allowed }
.sm { padding: 5px 9px; font-size: 13px }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden }
.kpi { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0 }
.kpi .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600 }
.kpi .value { font-family: var(--font-display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere }
.kpi .sub { font-size: 12px; color: var(--muted) }
.kpi.alert .value { color: var(--warn) }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) } }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start }
@media (max-width: 1000px) { .main { grid-template-columns: minmax(0, 1fr) } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0 }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line) }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
input[type=search], input[type=text], input[type=number], input[type=email], input[type=password], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0 }
input[type=search] { width: 220px; max-width: 100% }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden }
.seg button { border: 0; border-radius: 0; padding: 6px 10px; font-size: 13px }
.seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); font-weight: 600 }

.table-scroll { overflow-x: auto }
table { width: 100%; border-collapse: collapse; min-width: 820px }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 0 }
th.sortable { cursor: pointer; user-select: none }
th.sortable:hover { color: var(--ink) }
th .arrow { font-size: 10px }
th.n, td.n { text-align: right }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent) }
td .name { font-weight: 500 }
td .cat { color: var(--muted); font-size: 12px }
.chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap }
.chip.low { background: var(--warn-soft); color: var(--warn) }
.chip.out { background: var(--danger-soft); color: var(--danger) }
.chip.ok { background: var(--accent-soft); color: var(--accent) }
.row-actions { display: flex; gap: 2px; justify-content: flex-end }
.flash { animation: flash 1.2s ease-out }
@keyframes flash { from { background: var(--accent-soft) } to { background: transparent } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none } }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px }
.empty strong { color: var(--ink); font-size: 15px }

.log { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow-y: auto }
.log li { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: baseline }
.log li:last-child { border-bottom: 0 }
.log .q { font-family: var(--font-mono); font-weight: 500; font-size: 13px }
.log .q.in { color: var(--ok) } .log .q.out { color: var(--danger) } .log .q.imp { color: var(--accent) }
.log .what { min-width: 0; overflow-wrap: anywhere }
.log .when { color: var(--muted); font-size: 12px; white-space: nowrap }
.log .meta { grid-column: 2 / 4; color: var(--muted); font-size: 12px }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-weight: 500; max-width: calc(100% - 32px); z-index: 50 }
.toast.err { background: var(--danger); color: var(--surface) }

dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 0; width: min(520px, calc(100% - 32px)) }
dialog::backdrop { background: rgb(10 15 13 / .45) }
dialog form { display: flex; flex-direction: column; gap: 14px; padding: 18px }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px }
@media (max-width: 480px) { .grid2 { grid-template-columns: minmax(0, 1fr) } }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; min-width: 0 }
label.f input, label.f select, label.f textarea { color: var(--ink); width: 100% }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center }
.dlg-foot .right { display: flex; gap: 8px; margin-left: auto }
.hint { font-size: 12.5px; color: var(--muted); margin: 0 }
.err-msg { color: var(--danger); font-size: 13px; margin: 0 }
.preview { border: 1px solid var(--line); border-radius: 6px; max-height: 220px; overflow: auto }
.preview table { min-width: 560px; font-size: 12.5px }
.preview th, .preview td { padding: 6px 8px }
.stats { display: flex; flex-wrap: wrap; gap: 8px }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s }
.ro-chip { background: var(--warn-soft); color: var(--warn) }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }

/* ---------- comunes a todas las páginas ---------- */
[hidden] { display: none !important }
body { margin: 0 }
a { color: var(--accent) }
a:hover { text-decoration-thickness: 2px }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; flex: none }
.brand-mark::before { content: ""; width: 12px; height: 12px; border: 2px solid var(--accent-ink); border-radius: 2px; box-shadow: 4px -4px 0 -2px var(--accent-ink) }
a.btn { text-decoration: none }
a.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.btn.lg { padding: 12px 18px; font-size: 15px; font-weight: 600 }

/* barra de la app */
.appbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line) }
.appbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13.5px }
.appbar nav a { color: var(--ink); text-decoration: none; font-weight: 500 }
.appbar nav a[aria-current="page"] { color: var(--accent); font-weight: 600 }
.appbar .quien { color: var(--muted) }
.linklike { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 500; cursor: pointer; font-size: 13.5px }
.linklike:hover { color: var(--accent) }

.aviso { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; border-radius: 8px; font-size: 13.5px }
.aviso.info { background: var(--accent-soft); color: var(--ink) }
.aviso.alerta { background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent) }
.aviso strong { font-weight: 600 }

/* formularios de página (registro, entrar, cuenta) */
.form { display: flex; flex-direction: column; gap: 14px }
.form .err-msg, .form .ok-msg { margin: 0 }
.ok-msg { color: var(--ok); font-size: 13px }
.auth { min-height: 100%; display: grid; place-items: center; padding-block: 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 22px }
.auth-card .panel { padding: 22px }
.auth-card h1 { font-size: 24px }
.auth-card .sub { color: var(--muted); margin: 6px 0 0 }
.auth-foot { font-size: 13.5px; color: var(--muted); text-align: center }

.sections { display: flex; flex-direction: column; gap: 18px; max-width: 860px }
.section { padding: 18px; display: flex; flex-direction: column; gap: 14px }
.section > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px }
.section > header p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; font-size: 14px }
.kv dt { color: var(--muted) }
.kv dd { margin: 0; font-weight: 500 }
.secret { font-family: var(--font-mono); font-size: 13px; background: var(--bg); border: 1px dashed var(--line); padding: 10px 12px; border-radius: 6px; overflow-wrap: anywhere }
pre.code { font-family: var(--font-mono); font-size: 12.5px; background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: 6px; overflow-x: auto; margin: 0 }
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px }
.list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line) }
.list li:last-child { border-bottom: 0 }
.list .who { display: flex; flex-direction: column; min-width: 0 }
.list .who small { color: var(--muted); overflow-wrap: anywhere }
