:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --ink: #14201d;
  --muted: #5a6b66;
  --line: #dfe7e4;
  --brand: #0d7c66;
  --brand-hover: #0a6553;
  --brand-ink: #ffffff;
  --brand-soft: #e2f3ee;
  --warn: #9a5b00;
  --warn-bg: #fff3d9;
  --warn-line: #f2d59a;
  --err: #a52a0d;
  --err-bg: #fdeae4;
  --err-line: #f3bcae;
  --shadow: 0 1px 2px rgb(16 40 34 / .06), 0 8px 24px rgb(16 40 34 / .06);
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1412; --surface: #152020; --ink: #e7f0ed; --muted: #95aaa3; --line: #243430;
    --brand: #2fc4a0; --brand-hover: #55d6b6; --brand-ink: #04211a; --brand-soft: #123329;
    --warn: #f0c26a; --warn-bg: #2b2412; --warn-line: #574a20;
    --err: #ff9f86; --err-bg: #2f1a15; --err-line: #64342a;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5;
  color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column;
}
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Cabecera ---------- */
.hero {
  background: linear-gradient(135deg, #072f28 0%, #0b5a4a 55%, #0d7c66 100%);
  color: #fff; padding: 18px 0 84px; margin-bottom: -56px; position: relative; overflow: hidden;
}
.hero::after { /* mosaico decorativo de "fotos de carné" */
  content: ""; position: absolute; inset: -20px -40px -20px auto; width: min(520px, 60%);
  background: url("/avatar.svg") 0 0 / 96px 120px; opacity: .12; transform: rotate(7deg);
  mask-image: linear-gradient(to left, #000 30%, transparent 100%); pointer-events: none;
}
.topbar { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.userchip .who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.userchip .who small { color: rgb(255 255 255 / .7); }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700;
}
.hero .avatar { background: rgb(255 255 255 / .2); color: #fff; }
.hero h1 { position: relative; z-index: 1; margin: 34px 0 6px; font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.15; letter-spacing: -.02em; }
.hero p { position: relative; z-index: 1; margin: 0; color: rgb(255 255 255 / .8); max-width: 60ch; }
main { flex: 1; position: relative; z-index: 2; padding-bottom: 48px; }
.foot { padding: 18px 0 26px; text-align: center; color: var(--muted); font-size: .82rem; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap;
  padding: 10px 20px; border-radius: 999px; border: 1px solid transparent;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: transparent; color: var(--err); border-color: var(--err-line); }
.btn-danger:hover:not(:disabled) { background: var(--err-bg); }
.btn-sm { padding: 6px 14px; font-size: .88rem; }
.btn-ghost { background: transparent; color: #fff; border-color: rgb(255 255 255 / .4); padding: 7px 16px; font-size: .9rem; }
.btn-ghost:hover { background: rgb(255 255 255 / .12); border-color: #fff; }
.navlink { position: relative; color: #fff; text-decoration: none; font-weight: 600; font-size: .92rem; padding: 7px 14px; border-radius: 999px; }
.navlink:hover { background: rgb(255 255 255 / .12); }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 99px; background: #f5a524; color: #2a1c00; font-size: .75rem; font-weight: 750;
}

/* ---------- Herramientas ---------- */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.tool {
  display: flex; flex-direction: column; gap: 10px; padding: 22px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.tool:hover { transform: translateY(-3px); border-color: var(--brand); }
.tool .ico { width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.tool .ico svg { width: 26px; height: 26px; }
.tool h2 { margin: 4px 0 0; font-size: 1.15rem; }
.tool p { margin: 0; color: var(--muted); font-size: .94rem; }
.tool .go { margin-top: auto; color: var(--brand); font-weight: 650; font-size: .92rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* ---------- Login ---------- */
body.login-page { background: linear-gradient(135deg, #072f28 0%, #0b5a4a 55%, #0d7c66 100%); align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: min(420px, 100%); text-align: center; padding: 34px 28px 28px; }
.login .logo { width: 72px; height: 72px; margin-bottom: 6px; }
.login h1 { margin: 6px 0 4px; font-size: 1.6rem; letter-spacing: -.01em; }
.login .g-btn { display: flex; justify-content: center; margin: 24px 0 6px; min-height: 44px; }
.notice { margin: 18px 0 0; padding: 14px 16px; border-radius: 12px; border: 1px solid; text-align: left; font-size: .95rem; }
.notice h2 { margin: 0 0 4px; font-size: 1.02rem; }
.notice p { margin: 0; }
.notice.ok { background: var(--brand-soft); border-color: var(--brand); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.notice.err { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }

/* ---------- Administración ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  font: inherit; font-weight: 650; font-size: .94rem; cursor: pointer; padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.tab:hover { border-color: var(--brand); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tab .count { background: var(--brand-soft); color: var(--brand); }
.tab[aria-selected="true"] .count { background: rgb(255 255 255 / .25); color: inherit; }

.users { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.user {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.user .avatar { width: 44px; height: 44px; }
.user .data { flex: 1; min-width: 200px; }
.user .name { font-weight: 650; overflow-wrap: anywhere; }
.user .mail { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.user .meta { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.user .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; background: var(--brand-soft); color: var(--brand); vertical-align: 2px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .92rem; box-shadow: var(--shadow);
}

@media (max-width: 560px) {
  .userchip .who { display: none; }
  .user .actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
