/* =====================================================================
   auth.css: accounts. Sign-in and setup screens (.gate), form fields,
   avatar and account menu, Mi cuenta (.settings), Administrar cuentas
   (.users table / phone cards), Conectar una TV (.activate), and the
   account dialogs (.modal--account). Loaded after player.css.
   ===================================================================== */

/* ---------------------------------------------------------------- gate */
.gate {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 20px) var(--gutter) calc(var(--safe-b) + 24px);
  background:
    radial-gradient(1100px 640px at 12% 0%, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 62%),
    radial-gradient(900px 560px at 100% 100%, rgba(255, 255, 255, .05), rgba(255, 255, 255, 0) 66%),
    var(--bg);
}
/* Scrim over the poster wall: dark at the edges and behind the card. */
.gate::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 80% at 50% 50%, rgba(11, 11, 13, .55) 0, rgba(11, 11, 13, .88) 100%),
    linear-gradient(180deg, rgba(11, 11, 13, .75) 0, rgba(11, 11, 13, 0) 28%, rgba(11, 11, 13, 0) 68%, rgba(11, 11, 13, .9) 100%);
}
.gate__art { position: absolute; inset: 0; z-index: -2; overflow: hidden; opacity: 0; transition: opacity var(--dur-6) var(--ease-calm); }
.gate__art.is-ready { opacity: 1; }
.gate__wall {
  position: absolute; top: -18%; left: -18%; width: 136%;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  transform: rotate(-7deg); opacity: .5;
}
.gate__wall img { width: 100%; height: auto; border-radius: var(--radius-sm); background: var(--surface-1); }
.gate__wall img.is-broken { visibility: hidden; }
@media (min-width: 600px) { .gate__wall { grid-template-columns: repeat(6, 1fr); gap: 12px; } }
@media (min-width: 1120px) { .gate__wall { grid-template-columns: repeat(8, 1fr); gap: 14px; } }
@media (min-width: 1680px) { .gate__wall { grid-template-columns: repeat(10, 1fr); } }
html.is-tv .gate__wall { grid-template-columns: repeat(8, 1fr); }

.gate__head { display: flex; align-items: center; min-height: 44px; }
/* mipalco.tv lockup (865.9 × 152). The dark halo keeps it 3:1 or more wherever the crop puts a ribbon behind it. */
.gate__brand { position: relative; isolation: isolate; width: 194px; height: 34px; }
.gate .gate__brand .brand__lockup { width: 100%; height: 100%; }
/* Flat core up to 66 % so the mark, at the left end, is as covered as the word. */
.gate__brand::before {
  content: ""; position: absolute; inset: -36px -72px; z-index: -1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(11, 11, 13, .88) 0, rgba(11, 11, 13, .82) 66%, rgba(11, 11, 13, 0) 100%);
}
@media (max-width: 599px) { .gate__brand { width: 171px; height: 30px; } }
html.is-tv .gate__brand { width: calc(228px * var(--tvu)); height: calc(40px * var(--tvu)); }
/* min-height 0: the shell's `main { min-height: 100svh }` must not apply here, or the screen scrolls by a header height. */
.gate__main { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 32px 0 16px; }

.gate__card {
  width: 100%; max-width: 448px; padding: 44px 48px 40px;
  border-radius: var(--radius-xl); background: rgba(11, 11, 13, .8);
  box-shadow: var(--shadow-3);
  animation: gate-in var(--dur-5) var(--ease-calm);
}
@keyframes gate-in { from { opacity: 0; transform: translateY(12px); } }
.gate__title { font-size: clamp(28px, 2.4vw, 34px); line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
.gate__lead { margin-top: 10px; color: var(--text-2); font-size: 15px; line-height: 1.5; }
.gate__form { margin-top: 28px; }
.gate__submit { margin-top: 6px; }
.gate__notes { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 14px; line-height: 1.45; }
.gate__notes p { display: flex; gap: 10px; align-items: flex-start; }
.gate__notes .icon { width: 18px; height: 18px; margin-top: 1px; }

/* Sign in with the phone: the code this screen shows, and the switch between both ways. */
.gate__or { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; color: var(--text-3); font-size: 13px; }
.gate__or::before, .gate__or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.gate__steps { margin-top: 18px; padding-left: 1.4em; display: grid; gap: 6px; color: var(--text-2); font-size: 15px; line-height: 1.5; }
.gate__steps strong { color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
.gate__code {
  margin-top: 16px; padding: 16px 12px; border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: rgba(26, 26, 30, .92); text-align: center;
  font: 700 clamp(32px, 4.4vw, 42px)/1.1 ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; letter-spacing: .12em;
}
.gate__code.is-dead { opacity: .4; text-decoration: line-through; }
.gate__status { margin: 10px 0 14px; min-height: 1.45em; color: var(--text-3); font-size: 14px; line-height: 1.45; text-align: center; }
.gate__alt { margin-top: 10px; }
.gate__submit + .gate__alt { margin-top: 10px; }

/* Fields stay solid over the posters. */
.gate .input { background: rgba(26, 26, 30, .92); }
.gate .input:focus { background: #222227; }
/* Main button: the deep brand gradient (white text 4.65:1 or more, tokens.css). TVs keep their white focus. */
.gate .gate__submit { background: var(--brand-gradient-action); color: #fff; }
.gate .gate__submit > .spinner { border-color: rgba(255, 255, 255, .3); border-top-color: #fff; }
@media (hover: hover) and (pointer: fine) { html:not(.is-tv) .gate .gate__submit:hover { background: var(--brand-gradient-action); filter: brightness(.9); } }
/* Phones: no box, the form sits on the page (more room, no box inside a box), over a darker scrim. */
@media (max-width: 599px) {
  .gate__main { align-items: flex-start; padding-top: 24px; }
  .gate__card { max-width: none; padding: 0; background: none; box-shadow: none; }
  .gate__wall { opacity: .3; }
  .gate::before { background: linear-gradient(180deg, rgba(11, 11, 13, .8) 0, rgba(11, 11, 13, .9) 40%, rgba(11, 11, 13, .96) 100%); }
}
html.is-tv .gate { padding: calc(40px * var(--tvu)) var(--gutter); }
html.is-tv .gate__card { max-width: calc(620px * var(--tvu)); padding: calc(56px * var(--tvu)) calc(64px * var(--tvu)); }
html.is-tv .gate__title { font-size: calc(44px * var(--tvu)); }
html.is-tv .gate__lead, html.is-tv .gate__notes { font-size: var(--fs-callout); }
html.is-tv .gate__notes .icon { width: calc(24px * var(--tvu)); height: calc(24px * var(--tvu)); }
/* TV: a remote cannot scroll to text with nothing to focus, so the whole card (footnotes too) fits on
   the screen: the brand sits in the corner instead of above it, and the spacing scales with the screen. */
html.is-tv .gate__head { position: absolute; top: calc(40px * var(--tvu)); left: var(--gutter); }
html.is-tv .gate__main { padding: 0; }
html.is-tv .gate__notes { margin-top: calc(28px * var(--tvu)); padding-top: calc(20px * var(--tvu)); }
html.is-tv .gate__steps, html.is-tv .gate__status { font-size: var(--fs-callout); }
html.is-tv .gate__code { font-size: calc(60px * var(--tvu)); padding: calc(20px * var(--tvu)) 12px; }

/* No session check possible (offline at boot). */
.boot-error { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: var(--gutter); }

/* ---------------------------------------------------------------- form */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.form-field__label { color: var(--text); font-size: 14px; font-weight: 600; }
.form-field__hint { color: var(--text-3); font-size: 13px; line-height: 1.45; }
.form-field__error { color: var(--danger); font-size: 13px; font-weight: 500; line-height: 1.4; }
.form-field__error:empty { display: none; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input {
  width: 100%; height: 52px; padding: 0 16px; margin: 0;
  border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--fill-1);
  color: var(--text); font: 400 var(--fs-input)/1.2 var(--font);
  transition: border-color var(--dur-2), background-color var(--dur-2);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--text-3); }
@media (hover: hover) and (pointer: fine) { .input:hover { border-color: rgba(255, 255, 255, .28); } }
.input:focus { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-halo); border-color: var(--text-2); background: var(--fill-2); }
.input[aria-invalid="true"] { border-color: var(--danger); }
/* Autofill keeps the dark field. */
.input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: inset 0 0 0 40px #1f1f24; caret-color: var(--text); }
.input:-webkit-autofill:focus { box-shadow: inset 0 0 0 40px #26262c, 0 0 0 2px var(--focus-halo); }
.input-wrap--reveal .input { padding-right: 56px; }
.reveal {
  position: absolute; top: 50%; right: 4px; width: 44px; height: 44px; margin-top: -22px;
  display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--text-2);
}
.reveal:focus-visible { outline-offset: -4px; box-shadow: none; }
@media (hover: hover) and (pointer: fine) { .reveal:hover { color: var(--text); } }
html.is-tv .input { height: calc(68px * var(--tvu)); padding: 0 calc(22px * var(--tvu)); }
html.is-tv .input-wrap--reveal .input { padding-right: calc(80px * var(--tvu)); }
html.is-tv .reveal { width: var(--control); height: var(--control); margin-top: calc(var(--control) / -2); right: calc(6px * var(--tvu)); }
html.is-tv .reveal .icon { width: calc(26px * var(--tvu)); height: calc(26px * var(--tvu)); }
html.is-tv .reveal:focus-visible { background: var(--inverse); color: var(--on-inverse); outline-offset: 0; }
html.is-tv .form-field__label { font-size: var(--fs-callout); }
html.is-tv .form-field__hint, html.is-tv .form-field__error { font-size: calc(18px * var(--tvu)); }

/* Error / info / success line (aria-live host stays in the DOM, the box only when there is a message). */
.form-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; line-height: 1.45; }
.form-alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.form-alert--error { background: rgba(255, 107, 97, .13); color: #ffd4d0; box-shadow: inset 0 0 0 1px rgba(255, 107, 97, .35); }
.form-alert--error .icon { color: var(--danger); }
.form-alert--success { background: rgba(95, 211, 141, .12); color: #d3f5e0; box-shadow: inset 0 0 0 1px rgba(95, 211, 141, .3); }
.form-alert--success .icon { color: var(--success); }
.form-alert--info { background: var(--fill-1); color: var(--text-soft); box-shadow: inset 0 0 0 1px var(--line-strong); }
html.is-tv .form-alert { font-size: var(--fs-callout); }

/* Checkbox ("Recordarme"). */
.check { display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; min-height: 44px; color: var(--text-2); font-size: 15px; cursor: pointer; user-select: none; }
.check input {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 22px; height: 22px; margin: 0;
  border-radius: 6px; border: 2px solid var(--line-control); background: transparent; cursor: pointer;
  transition: background-color var(--dur-2), border-color var(--dur-2);
}
.check input:checked { background: var(--inverse); border-color: var(--inverse); }
.check input:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px;
  border: solid var(--on-inverse); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 3px var(--focus-halo); }
html.is-tv .check { font-size: var(--fs-callout); gap: calc(16px * var(--tvu)); }
html.is-tv .check input { transform: scale(1.3); margin: 0 calc(4px * var(--tvu)); }

/* A request running: the spinner replaces the label, the button keeps its focus. */
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-disabled="true"] { opacity: .5; cursor: default; }
.btn--danger { background: var(--danger); color: #0b0b0d; }
.btn--danger-ghost { color: var(--danger); background: rgba(255, 107, 97, .1); }
.btn--danger > .spinner { border-color: rgba(11, 11, 13, .2); border-top-color: #0b0b0d; }
@media (hover: hover) and (pointer: fine) {
  .btn--danger:hover { background: #ff8178; }
  .btn--danger-ghost:hover { background: rgba(255, 107, 97, .18); }
}
html.is-tv .btn--danger-ghost:focus-visible { background: var(--danger); color: #0b0b0d; }

/* ------------------------------------------------------- avatar, badge */
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(145deg, #3a3a42, #232328); color: var(--text);
  font: 700 14px/1 var(--font); letter-spacing: .02em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.avatar--lg { width: 52px; height: 52px; font-size: 19px; }
.avatar--xl { width: 76px; height: 76px; font-size: 28px; }
html.is-tv .avatar { width: calc(44px * var(--tvu)); height: calc(44px * var(--tvu)); font-size: calc(17px * var(--tvu)); }
html.is-tv .avatar--lg { width: calc(64px * var(--tvu)); height: calc(64px * var(--tvu)); font-size: calc(24px * var(--tvu)); }
html.is-tv .avatar--xl { width: calc(96px * var(--tvu)); height: calc(96px * var(--tvu)); font-size: calc(36px * var(--tvu)); }

.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--radius-pill);
  background: var(--fill-2); color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.badge--admin { background: var(--inverse); color: var(--on-inverse); }
.badge--ok { background: rgba(95, 211, 141, .14); color: var(--success); }
.badge--off { background: rgba(255, 107, 97, .14); color: var(--danger); }
html.is-tv .badge { height: calc(32px * var(--tvu)); padding: 0 calc(14px * var(--tvu)); font-size: calc(17px * var(--tvu)); }

/* --------------------------------------------------------- account menu */
.account { position: relative; flex: none; }
.account__button {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  transition: transform var(--dur-1) var(--ease-std);
}
.account__button:active { transform: scale(.94); }
.account__button .avatar { width: 34px; height: 34px; font-size: 13px; transition: box-shadow var(--dur-2); }
.account__button[aria-expanded="true"] .avatar, .account__button.is-current .avatar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 0 0 2px var(--text-2); }
@media (hover: hover) and (pointer: fine) { .account__button:hover .avatar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 0 0 2px var(--text-3); } }
.account__button:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
html.is-tv .account__button { width: var(--control); height: var(--control); }
html.is-tv .account__button .avatar { width: calc(44px * var(--tvu)); height: calc(44px * var(--tvu)); font-size: calc(17px * var(--tvu)); }
html.is-tv .account__button:focus-visible { transform: scale(1.08); }

.account-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: var(--z-header);
  width: min(304px, calc(100vw - 2 * var(--gutter))); padding: 8px;
  border-radius: var(--radius-lg); background: var(--overlay); box-shadow: var(--shadow-3);
  transform-origin: top right; animation: account-menu-in 200ms var(--ease-calm);
}
@keyframes account-menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.account-menu__who { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.account-menu__id { min-width: 0; }
.account-menu__name { font-weight: 600; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.account-menu__email { color: var(--text-3); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.account-menu__item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px;
  border-radius: var(--radius-sm); color: var(--text-2); font-size: 15px; font-weight: 500; text-align: left;
  transition: background-color var(--dur-2), color var(--dur-2);
}
.account-menu__item .icon { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) { .account-menu__item:hover { background: var(--fill-1); color: var(--text); } }
.account-menu__item:focus-visible { outline-offset: -2px; box-shadow: none; background: var(--fill-1); color: var(--text); }
.account-menu__item[aria-busy="true"] { cursor: progress; }
.account-menu__sep { height: 1px; margin: 6px 4px; background: var(--line); }
html.is-tv .account-menu { width: calc(420px * var(--tvu)); padding: calc(10px * var(--tvu)); }
html.is-tv .account-menu__name { font-size: var(--fs-callout); }
html.is-tv .account-menu__email { font-size: calc(17px * var(--tvu)); }
html.is-tv .account-menu__item { min-height: var(--control); font-size: var(--fs-callout); padding: 0 calc(16px * var(--tvu)); }
html.is-tv .account-menu__item .icon { width: calc(26px * var(--tvu)); height: calc(26px * var(--tvu)); }
html.is-tv .account-menu__item:focus-visible { background: var(--inverse); color: var(--on-inverse); outline: none; }

/* ------------------------------------------------------------ settings */
/* Mi cuenta, and the loading state shared by the account pages. */
.settings { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.settings__head { display: flex; align-items: center; gap: 20px; margin-bottom: 12px; }
.settings__id { min-width: 0; }
.settings__h1 { font-size: var(--fs-title-1); line-height: var(--lh-title-1); letter-spacing: var(--ls-title-1); font-weight: 700; }
.settings__name { margin-top: 6px; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.settings__email { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text-2); font-size: 15px; overflow-wrap: anywhere; }
.settings__section { padding: 24px; border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: inset 0 0 0 1px var(--line); }
.settings__section--row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.settings__section--row .settings__text { margin-bottom: 0; }
.settings__title { font-size: var(--fs-title-3); line-height: var(--lh-title-3); font-weight: 600; }
.settings__text { margin: 6px 0 18px; color: var(--text-2); font-size: 15px; line-height: 1.5; max-width: 60ch; }
.settings__form { max-width: 440px; }
.settings__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.settings__actions:not(:empty) { margin-top: 4px; }
.settings__devices + .settings__actions .btn:not([hidden]) { margin-top: 16px; }
.settings__footer { display: flex; justify-content: flex-start; padding-top: 4px; }
.settings__loading { display: flex; justify-content: center; padding: 24px 0; }
@media (max-width: 599px) {
  .settings__head { gap: 16px; }
  .settings__section { padding: 20px 16px; }
  .settings__form { max-width: none; }
  .settings__actions .btn, .settings__footer .btn, .settings__section--row .btn { width: 100%; }
}
html.is-tv .settings { max-width: calc(1040px * var(--tvu)); gap: calc(28px * var(--tvu)); }
html.is-tv .settings__section { padding: calc(32px * var(--tvu)); }
html.is-tv .settings__name { font-size: var(--fs-headline); }
html.is-tv .settings__email, html.is-tv .settings__text { font-size: var(--fs-callout); }
html.is-tv .settings__form { max-width: calc(620px * var(--tvu)); }

/* Devices (Mi cuenta and the account dialog). */
.devices { list-style: none; margin: 0; padding: 0; }
.device { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.device:first-child { border-top: 0; padding-top: 4px; }
.device__icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--text-2); }
.device__body { flex: 1; min-width: 0; }
.device__label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.device__meta { margin-top: 2px; color: var(--text-3); font-size: 13px; line-height: 1.4; }
.device__action { flex: none; }
.devices__empty { color: var(--text-3); font-size: 15px; }
@media (max-width: 599px) {
  .device { flex-wrap: wrap; }
  .device__body { flex-basis: calc(100% - 58px); }
  .device__action { margin-left: 58px; }
}
html.is-tv .device { gap: calc(20px * var(--tvu)); padding: calc(18px * var(--tvu)) 0; }
html.is-tv .device__icon { width: calc(56px * var(--tvu)); height: calc(56px * var(--tvu)); }
html.is-tv .device__icon .icon { width: calc(26px * var(--tvu)); height: calc(26px * var(--tvu)); }
/* TV: the button under its label, as on phones, so Up / Down with the remote walk the buttons in
   order (beside the label they sat far right, and the left column's controls were always nearer). */
html.is-tv .device { flex-wrap: wrap; }
html.is-tv .device__body { flex-basis: calc(100% - 76px * var(--tvu)); }
html.is-tv .device__action { margin-left: calc(76px * var(--tvu)); }
html.is-tv .device__label { font-size: var(--fs-callout); }
html.is-tv .device__meta, html.is-tv .devices__empty { font-size: calc(18px * var(--tvu)); }

/* ---------------------------------------------------------------- admin */
.admin { max-width: 1180px; margin: 0 auto; }
.admin__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.admin__titles { margin-bottom: 0; }
.admin__lead { margin: 10px 0 28px; color: var(--text-2); font-size: 15px; line-height: 1.5; max-width: 70ch; }
html.is-tv .admin { max-width: none; }
html.is-tv .admin__lead { font-size: var(--fs-callout); }

.users { width: 100%; border-collapse: collapse; }
.users th { padding: 0 16px 12px; border-bottom: 1px solid var(--line-strong); color: var(--text-3); font-size: 13px; font-weight: 600; text-align: left; white-space: nowrap; }
.users td { padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 14px; vertical-align: middle; }
.users th:first-child, .users td:first-child { padding-left: 0; }
.users th:last-child, .users td:last-child { padding-right: 0; text-align: right; }
.users tr.is-disabled .user-cell { opacity: .55; }
/* "hace 2 horas" -> "Hace 2 horas" in the table; on phone cards the label before it takes the capital. */
.users__meta::first-letter { text-transform: uppercase; }
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-cell__text { min-width: 0; }
.user-cell__name { color: var(--text); font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.user-cell__me { color: var(--text-3); font-weight: 500; }
.user-cell__email { color: var(--text-3); font-size: 13px; overflow-wrap: anywhere; }
@media (hover: hover) and (pointer: fine) { .users tbody tr:hover td { background: rgba(255, 255, 255, .025); } }
html.is-tv .users th { font-size: calc(18px * var(--tvu)); padding-bottom: calc(16px * var(--tvu)); }
html.is-tv .users td { font-size: var(--fs-callout); padding-top: calc(18px * var(--tvu)); padding-bottom: calc(18px * var(--tvu)); }
html.is-tv .user-cell__name { font-size: var(--fs-callout); }
html.is-tv .user-cell__email { font-size: calc(18px * var(--tvu)); }

/* Phones and tablets in portrait: each account is a card (same markup). */
@media (max-width: 860px) {
  .users, .users tbody { display: block; }
  .users thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .users tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 12px; padding: 16px;
    border-radius: var(--radius-lg); background: var(--surface-1); box-shadow: inset 0 0 0 1px var(--line);
  }
  .users td { display: block; padding: 0; border: 0; }
  .users td:first-child, .users td:last-child { padding: 0; text-align: left; }
  .users__account { flex: 0 0 100%; margin-bottom: 8px; }
  .users__meta { flex: 0 0 100%; font-size: 14px; }
  .users__meta::before { content: attr(data-label) ": "; color: var(--text-3); }
  .users__actions { flex: 0 0 100%; margin-top: 10px; }
  .users__actions .btn { width: 100%; }
  .users tr.is-disabled { box-shadow: inset 0 0 0 1px rgba(255, 107, 97, .25); }
}

/* --------------------------------------------------------------- dialogs */
.modal__box--wide { width: min(560px, calc(100vw - 32px)); }
.modal--account .modal__box { max-height: calc(100vh - 32px); max-height: calc(100svh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.modal--account .modal__head h2 { overflow-wrap: anywhere; }
/* Title and the new password's intro take the focus only for screen readers and phones (dialog.js): no ring. */
.modal--account .modal__head h2:focus, .secret__intro:focus { outline: none; box-shadow: none; }
.modal__text { color: var(--text-2); font-size: 15px; line-height: 1.55; }
.modal__text + .modal__text { margin-top: 8px; }
.modal__body > .form-alert-host:not(:empty) { margin-top: 16px; }
.modal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.form .modal__actions { margin-top: 6px; }
.modal__actions--start { justify-content: flex-start; margin-top: 0; }
.modal__section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.modal__section-title { margin-bottom: 12px; font-size: 16px; font-weight: 600; }
.modal__section .modal__text { margin-bottom: 14px; }
.modal__section .devices + .modal__actions .btn:not([hidden]), .modal__section > div + .modal__actions .btn:not([hidden]) { margin-top: 12px; }
@media (max-width: 599px) {
  .modal--account .modal__box { padding: 22px 18px; }
  .modal__actions { flex-direction: column-reverse; }
  .modal__actions .btn { width: 100%; }
  .modal__actions--start { flex-direction: column; }
}
html.is-tv .modal__box--wide { width: calc(820px * var(--tvu)); }
html.is-tv .modal--account .modal__head h2 { font-size: var(--fs-title-3); }
html.is-tv .modal__text { font-size: var(--fs-callout); }
html.is-tv .modal__section-title { font-size: var(--fs-headline); }

.account-summary { display: flex; align-items: center; gap: 16px; }
.account-summary__text { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.account-summary__email { color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
.account-summary__badges { display: flex; flex-wrap: wrap; gap: 6px; }
.account-summary__meta { color: var(--text-3); font-size: 13px; }
html.is-tv .account-summary__email { font-size: var(--fs-callout); }
html.is-tv .account-summary__meta { font-size: calc(18px * var(--tvu)); }

.password-choice { display: flex; flex-direction: column; gap: 16px; }
.form .segmented { align-self: flex-start; }

/* A generated password, shown once. */
.secret { margin: 18px 0 0; padding: 16px 18px; border-radius: var(--radius); background: var(--surface-3); display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; }
.secret dt { color: var(--text-3); font-size: 13px; font-weight: 600; }
.secret dd { margin: 0; min-width: 0; }
.secret__email { color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
.secret__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.secret__value {
  font: 600 22px/1.25 ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; letter-spacing: .06em;
  color: var(--text); user-select: all; -webkit-user-select: all; overflow-wrap: anywhere;
}
.secret__note { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; color: var(--text-3); font-size: 13px; line-height: 1.45; }
.secret__note .icon { width: 16px; height: 16px; margin-top: 1px; }
@media (max-width: 599px) { .secret { grid-template-columns: 1fr; gap: 4px; } .secret dd + dt { margin-top: 8px; } }
html.is-tv .secret dt, html.is-tv .secret__note { font-size: calc(18px * var(--tvu)); }
html.is-tv .secret__email { font-size: var(--fs-callout); }
html.is-tv .secret__value { font-size: calc(32px * var(--tvu)); }

/* ------------------------------------------------------------- activar */
.activate { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; }
.activate__icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--surface-2); color: var(--text); }
.activate__icon .icon { width: 30px; height: 30px; }
.activate__title { margin-top: 18px; font-size: var(--fs-title-1); line-height: var(--lh-title-1); letter-spacing: var(--ls-title-1); font-weight: 700; }
.activate__body { width: 100%; margin-top: 12px; }
.activate__lead { color: var(--text-2); font-size: 15px; line-height: 1.55; }
.activate__form { text-align: left; }
.activate__form .activate__lead { text-align: center; margin-bottom: 4px; }
.input--code {
  height: 72px; text-align: center; text-transform: uppercase;
  font: 700 30px/1 ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; letter-spacing: .16em;
}
.input--code::placeholder { color: var(--decor); letter-spacing: .16em; }
.activate__confirm, .activate__result { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 12px; }
.activate__code {
  padding: 10px 20px; border-radius: var(--radius); background: var(--surface-2);
  font: 700 26px/1 ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; letter-spacing: .14em;
}
.activate__question { font-size: var(--fs-title-3); line-height: var(--lh-title-3); font-weight: 600; overflow-wrap: anywhere; }
.activate__question:focus { outline: none; }
.activate__text { color: var(--text-2); font-size: 15px; line-height: 1.55; max-width: 46ch; }
.activate__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 12px; }
.activate__confirm .form-alert-host { width: 100%; text-align: left; }
.activate__warning { width: 100%; margin-top: 4px; text-align: left; }
.activate__badge { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 107, 97, .14); color: var(--danger); }
.activate__result.is-ok .activate__badge { background: rgba(95, 211, 141, .16); color: var(--success); }
.activate__badge .icon { width: 28px; height: 28px; stroke-width: 2.2; }
@media (max-width: 599px) {
  .activate__actions { flex-direction: column; width: 100%; }
  .activate__actions .btn { width: 100%; }
  .input--code { font-size: 24px; letter-spacing: .1em; }
}
html.is-tv .activate { max-width: calc(760px * var(--tvu)); }
html.is-tv .activate__icon { width: calc(88px * var(--tvu)); height: calc(88px * var(--tvu)); }
html.is-tv .activate__icon .icon { width: calc(40px * var(--tvu)); height: calc(40px * var(--tvu)); }
html.is-tv .activate__lead, html.is-tv .activate__text { font-size: var(--fs-callout); }
html.is-tv .input--code { height: calc(96px * var(--tvu)); font-size: calc(44px * var(--tvu)); }
html.is-tv .activate__code { font-size: calc(36px * var(--tvu)); }
