:root {
  --bg: #0d0f11;
  --bg-soft: #121518;
  --panel: #171a1e;
  --panel-2: #1d2126;
  --line: #2a3036;
  --line-soft: #22272c;
  --text: #f5f7f8;
  --muted: #9da6ad;
  --red: #c91524;
  --red-strong: #e01f31;
  --red-soft: rgba(201, 21, 36, .14);
  --green: #32c46c;
  --green-soft: rgba(50, 196, 108, .12);
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 100% 0%, rgba(201,21,36,.10), transparent 34rem),
    linear-gradient(180deg, #0b0d0f 0%, var(--bg) 55%, #0a0c0e 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
.hidden { display: none !important; }

.app-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 0 18px; border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__logo { width: 48px; height: 54px; flex: 0 0 auto; filter: drop-shadow(0 8px 18px rgba(0,0,0,.28)); }
.brand__copy { min-width: 0; display: grid; }
.brand__copy strong { font-size: 1.05rem; letter-spacing: .01em; }
.brand__copy small { color: var(--muted); margin-top: 2px; }
.brand__eyebrow, .section-kicker {
  color: #d56b74; font-size: .69rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
}
.section-kicker--light { color: #ffafb6; }

.content { padding: 34px 0 28px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.75rem, 4vw, 2.4rem); line-height: 1.1; }
h2 { margin-bottom: 8px; font-size: 1.18rem; }
.muted { color: var(--muted); }

.panel {
  background: linear-gradient(180deg, rgba(27,31,35,.96), rgba(21,24,28,.96));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  box-shadow: 0 14px 38px rgba(0,0,0,.15);
}
.panel--login { max-width: 520px; margin: 4vh auto 0; }
.panel--login > p { color: var(--muted); line-height: 1.55; }
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span { color: #cdd2d6; font-size: .82rem; font-weight: 700; }
.field input, .field textarea, .search-input {
  width: 100%; min-height: 46px; border: 1px solid #343b42; border-radius: 12px;
  background: #111417; color: var(--text); padding: 11px 13px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field textarea:focus, .search-input:focus {
  border-color: #8c333c; box-shadow: 0 0 0 3px rgba(201,21,36,.12);
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  border: 1px solid transparent; border-radius: 12px; min-height: 46px; padding: 11px 16px;
  color: var(--text); font-weight: 800; letter-spacing: .025em; transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn--primary { background: linear-gradient(180deg, #d31a2a, #b8101f); border-color: #e22d3d; box-shadow: 0 9px 24px rgba(201,21,36,.16); }
.btn--primary:hover:not(:disabled) { background: linear-gradient(180deg, #e01f31, #c31323); }
.btn--secondary { background: #24292f; border-color: #3a4148; }
.btn--secondary:hover { background: #2c3238; }
.btn--ghost { background: transparent; border-color: #343a40; color: #d7dbde; }
.btn--ghost:hover { border-color: #555e66; background: rgba(255,255,255,.035); }
.btn--compact { min-height: 40px; padding: 8px 13px; font-size: .82rem; }
.btn--wide { width: 100%; }
.btn--confirm { background: linear-gradient(180deg, #2baf61, #228d4e); border-color: #42cc76; box-shadow: 0 12px 28px rgba(33,141,78,.18); }
.btn--confirm:not(:disabled):hover { background: linear-gradient(180deg, #36bf6d, #279b57); }

.form-message { min-height: 20px; margin: 10px 0 0; color: #f0a9b0; font-size: .86rem; }
.text-action { color: #b6bec4; background: none; border: 0; padding: 12px 2px; text-decoration: underline; text-underline-offset: 4px; }
.text-action:hover { color: #fff; }
.text-action--top { padding-top: 0; }

.welcome-row, .admin-heading {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px;
}
.remembered-badge, .status-chip, .mini-counter {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 10px; background: #14171a; color: #bdc5ca; font-size: .76rem; white-space: nowrap;
}
.remembered-badge span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(50,196,108,.08); }

.class-card {
  position: relative; overflow: hidden; border: 1px solid #563139; border-radius: 22px; padding: 24px;
  background:
    linear-gradient(115deg, rgba(201,21,36,.22), rgba(201,21,36,.04) 48%, rgba(255,255,255,.02)),
    #181b1f;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.class-card::after {
  content: ""; position: absolute; width: 230px; height: 230px; right: -105px; top: -105px;
  border: 34px solid rgba(255,255,255,.025); transform: rotate(14deg); border-radius: 48px;
}
.class-card__top { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.class-card h2 { font-size: clamp(1.55rem, 5vw, 2.35rem); margin: 6px 0 6px; }
.class-card p { color: #d3d7da; margin: 0; }
.status-chip { position: relative; z-index: 1; border-color: #6d3940; background: rgba(201,21,36,.13); color: #ffc5ca; font-weight: 800; }
.status-chip.status-chip--active { border-color: rgba(50,196,108,.42); background: var(--green-soft); color: #a4efbf; }
.announcement { position: relative; z-index: 1; margin-top: 22px; border-left: 3px solid var(--red); background: rgba(8,10,12,.38); padding: 13px 15px; border-radius: 0 10px 10px 0; color: #dfe3e5; }
.attendance-panel { display: grid; gap: 18px; }
.attendance-feedback { min-height: 22px; color: #9de1b6; font-size: .9rem; }

.stats-grid { display: grid; grid-template-columns: minmax(180px,.75fr) minmax(0,2.25fr); gap: 14px; margin-bottom: 14px; }
.stat-card {
  min-height: 134px; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  background: linear-gradient(180deg,#1b1f23,#15181b); display: flex; flex-direction: column; justify-content: center;
}
.stat-card__label { color: #d56b74; font-size: .69rem; font-weight: 800; letter-spacing: .15em; }
.stat-card strong { display: block; font-size: 2.65rem; margin: 4px 0; }
.stat-card small { color: var(--muted); }
.stat-card--wide strong { font-size: 1.25rem; }

.admin-grid { display: grid; grid-template-columns: minmax(300px,.85fr) minmax(0,1.55fr); gap: 14px; }
.panel-title { margin-bottom: 18px; }
.panel-title h2 { margin: 4px 0 0; }
.panel-title--row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.search-input { max-width: 190px; min-height: 40px; padding: 8px 11px; }
.attendees-list { display: grid; }
.attendee-row {
  display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) auto; gap: 12px; align-items: center;
  border-top: 1px solid var(--line-soft); padding: 13px 2px;
}
.attendee-row:first-child { border-top: 0; }
.attendee-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attendee-row span { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attendee-time { color: #d9dde0 !important; font-variant-numeric: tabular-nums; }
.empty-state { color: var(--muted); padding: 22px 4px 8px; text-align: center; }
.people-panel { margin-top: 14px; }
.people-form { display: grid; grid-template-columns: .75fr 1.25fr 1.25fr auto; gap: 12px; align-items: end; }

.footer { display: flex; align-items: center; justify-content: center; gap: 8px; color: #6f787f; font-size: .75rem; padding: 18px 0 28px; }
.footer__dot { color: #7d2931; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 18px); z-index: 50;
  max-width: calc(100% - 28px); background: #23282d; border: 1px solid #41484f; color: #fff;
  padding: 11px 15px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .2s ease;
  box-shadow: 0 12px 34px rgba(0,0,0,.38); font-size: .88rem;
}
.toast.toast--show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 780px) {
  .app-shell { width: min(100% - 20px, 1180px); }
  .topbar { padding-top: 14px; }
  .content { padding-top: 24px; }
  .brand__copy small { display: none; }
  .welcome-row, .admin-heading { align-items: flex-start; }
  .remembered-badge { display: none; }
  .class-card { padding: 20px; }
  .class-card__top { display: grid; }
  .status-chip { width: fit-content; }
  .stats-grid, .admin-grid { grid-template-columns: 1fr; }
  .people-form { grid-template-columns: 1fr 1fr; }
  .people-form .field:nth-child(3) { grid-column: 1 / -1; }
  .people-form .btn { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .brand__logo { width: 42px; height: 48px; }
  .brand__copy strong { font-size: .95rem; }
  .brand__eyebrow { font-size: .61rem; }
  .panel { padding: 18px; border-radius: 16px; }
  .field-grid, .people-form { grid-template-columns: 1fr; }
  .people-form .field:nth-child(3), .people-form .btn { grid-column: auto; }
  .panel-title--row { align-items: flex-start; flex-direction: column; }
  .search-input { max-width: none; }
  .attendee-row { grid-template-columns: minmax(0,1fr) auto; }
  .attendee-row .attendee-office { grid-column: 1 / -1; grid-row: 2; }
  .footer { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* V1.2 · Alertas en vivo */
.alert-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid #353c43;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(31,35,40,.95), rgba(21,24,28,.95));
}
.alert-settings--admin { margin-bottom: 14px; }
.alert-settings__copy { display: flex; align-items: center; gap: 12px; min-width: 0; }
.alert-settings__icon {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--red-soft); border: 1px solid #5d3037; font-size: 1rem;
}
.alert-settings__copy div { min-width: 0; display: grid; gap: 3px; }
.alert-settings__copy strong { font-size: .9rem; }
.alert-settings__copy small { color: var(--muted); line-height: 1.35; }

@media (max-width: 620px) {
  .alert-settings { align-items: stretch; flex-direction: column; }
  .alert-settings .btn { width: 100%; }
}

/* V1.3 · Alta automática por legajo */
.field input[readonly] {
  color: #d9dde0;
  background: #191d21;
  border-color: #30373d;
  cursor: default;
}
