.adm { background: var(--paper); }
.adm__main { padding-block: 2.5rem 5rem; }
.adm__who { display: flex; align-items: center; gap: .6rem; font-size: var(--text-sm); }
.adm__who[hidden] { display: none; }
.adm__who #who-name { color: var(--muted); margin-right: .25rem; }
.adm h1 { font-size: var(--text-xl); }
.adm__head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

.auth { display: grid; place-items: center; min-height: 60vh; }
.auth[hidden] { display: none; }
.auth__card { width: min(100%, 420px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.5rem, 4vw, 2.25rem); box-shadow: var(--shadow); }
.auth__card h1 { margin-bottom: .5rem; }
.auth__card .muted { font-size: var(--text-sm); margin-bottom: 1.5rem; }
.field__err { color: var(--err); font-size: var(--text-sm); }
.field__err[hidden] { display: none; }
#auth-err, #g-err, #p-err { margin-bottom: 1rem; }
.field textarea { padding: .75rem 1rem; font: inherit; font-weight: 400; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); resize: vertical; }
.field textarea:focus { outline: none; border-color: var(--ink); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1.75rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: grid; gap: .1rem; }
.stat__n { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.1; }
.stat__l { font-size: var(--text-xs); color: var(--muted); }
.stat.warn .stat__n { color: #9a5b00; }
.stat.ok .stat__n { color: var(--ok); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.tab { background: none; border: 0; padding: .75rem 1rem; font-weight: 600; font-size: var(--text-sm); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabpanel[hidden] { display: none; }

.adm__filters { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.adm__filters .search { flex: 1 1 280px; width: auto; }
.adm__filters select { height: 46px; padding: 0 .9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font: inherit; font-size: var(--text-sm); color: var(--ink); }
.adm__count { font-size: var(--text-sm); margin-bottom: .75rem; }

.table-wrap { position: relative; overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--text-sm); min-width: 860px; }
.tbl th { text-align: left; font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .8rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl__id, .tbl__sub { display: block; font-size: var(--text-xs); color: var(--muted); margin-top: .15rem; }
.tbl__id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.tbl__act { white-space: nowrap; text-align: right; }
.tbl__act .btn + .btn { margin-left: .4rem; }
.tbl__empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem !important; }
.btn--danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); }
.btn--danger:hover { background: var(--err); color: #fff; border-color: var(--err); }
.pill { display: inline-block; font-size: var(--text-xs); font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--paper-2); }
.pill--ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill--warn { background: #fbe8c8; color: #8a5200; }
.pill--off { background: #eee; color: var(--muted); }

.bulk { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.bulk__card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; display: grid; gap: .75rem; align-content: start; }
.bulk__card h2 { font-size: 1.4rem; }
.bulk__card .muted { font-size: var(--text-sm); }
.bulk__card code { font-size: .9em; background: var(--paper-2); padding: .05rem .35rem; border-radius: 4px; word-break: break-all; }
.drop { display: grid; gap: .75rem; padding: 1rem; border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--paper); }
.drop input[type=file] { font: inherit; font-size: var(--text-sm); max-width: 100%; }
.seg { display: flex; gap: 1rem; flex-wrap: wrap; font-size: var(--text-sm); }
.seg label { display: inline-flex; gap: .4rem; align-items: center; cursor: pointer; }
.bulk__res { font-size: var(--text-sm); min-height: 1.5em; }
.progress { height: 6px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.progress[hidden] { display: none; }
.progress__bar { height: 100%; width: 0; background: var(--ink); transition: width .2s; }

.modal--wide { width: min(100% - 2rem, 680px); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 0 1rem; }
.files { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: .25rem 0 1rem; }
.filebox { display: grid; gap: .35rem; padding: 1rem; border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--paper); cursor: pointer; }
.filebox__t { font-weight: 600; font-size: var(--text-sm); }
.filebox__h, .filebox__s { font-size: var(--text-xs); color: var(--muted); }
.filebox__s { color: var(--ok); }
.filebox input { font: inherit; font-size: var(--text-xs); max-width: 100%; }
.checks-row { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: var(--text-sm); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.modal__foot { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
#p-guia { margin-bottom: .5rem; }
.foot__admin { color: var(--muted); }

@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .bulk { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .grid2, .grid3, .files { grid-template-columns: 1fr; }
  .adm__who .btn--ghost { display: none; }
  .adm__head .btn { width: 100%; }
  .adm__filters select { flex: 1 1 100%; }
}
.grid2 > *, .grid3 > *, .files > * { min-width: 0; }
.field input, .field textarea { width: 100%; box-sizing: border-box; }

/* Roles */
body:not(.rol-super) .solo-super { display: none !important; }
body:not(.rol-editor) .solo-editor { display: none !important; }
.editor-note { font-size: var(--text-sm); background: var(--hl-soft); border-radius: var(--radius); padding: .75rem 1rem; margin: -.75rem 0 1.25rem; }
#who-rol { margin-right: .25rem; }
.pill--rol { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }

/* Finanzas */
.stats--6 { grid-template-columns: repeat(6, 1fr); }
.stat.money .stat__n { color: var(--accent); }
.adm__note { font-size: var(--text-xs); margin: -1rem 0 1.5rem; }
.fin-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.25rem; margin-bottom: 2rem; }
.fin-grid--users { grid-template-columns: .8fr 1.2fr; }
.fin-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem; display: grid; gap: .9rem; align-content: start; min-width: 0; }
.fin-card h2, .fin-h { font-size: 1.35rem; }
.fin-h { margin-bottom: .9rem; }
.fin-card .muted { font-size: var(--text-sm); }
.fin-card .table-wrap { border: 0; border-radius: 0; background: transparent; }
.tbl--compact { min-width: 0; }
.tbl--compact td, .tbl--compact th { padding: .6rem .5rem; }
.tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: .55rem; }
.bar { display: grid; grid-template-columns: 4.5rem 1fr auto; gap: .6rem; align-items: center; font-size: var(--text-sm); }
.bar__track { display: block; height: 10px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--accent-2); border-radius: 99px; }
.bar__v { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.pill--bad { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.pw-row { display: flex; gap: .5rem; }
.pw-row input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tr--off td { color: var(--muted); }
@media (max-width: 960px) {
  .stats--6 { grid-template-columns: repeat(3, 1fr); }
  .fin-grid, .fin-grid--users { grid-template-columns: 1fr; }
}
@media (max-width: 600px) { .stats--6 { grid-template-columns: 1fr 1fr; } }
#u-body .tbl__act { white-space: normal; display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
#u-body .tbl__act .btn + .btn { margin-left: 0; }
