/* ORD-717: Administración (pestañas, lista de personas, ficha lateral, alta en 3 pasos) y formularios de contraseña.
   Usa las variables de styles.css (--iris, --amber, --verdant, --line…). */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ghost-button.outline { border: 1px solid var(--line); padding: 9px 14px; }
.ghost-button.small { padding: 6px 12px; font-size: 12px; }
.ghost-button:disabled, .primary-button:disabled { cursor: not-allowed; opacity: .45; }
.danger-text { color: var(--amber); }
.checkbox-row { display: inline-flex; align-items: center; gap: 8px; color: var(--mist); font-size: 13px; }
.checkbox-row input { width: 16px; height: 16px; margin: 0; flex: none; }
.field-label { display: grid; gap: 6px; color: var(--mist); font-size: 12px; }

/* Campos de contraseña con «Ver» */
.password-field { position: relative; min-width: 0; }
.password-field input { padding-right: 84px; }
.reveal-password { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); border: 0; border-radius: 8px; padding: 6px 10px; background: rgba(255,255,255,.06); color: var(--mist); font-size: 12px; }
.reveal-password:hover { color: var(--white); }
.account-form { max-width: 460px; }
.account-form h3 { margin-bottom: 8px; }

/* Pestañas de Administración */
.admin-tabs { position: sticky; top: 0; z-index: 3; display: flex; gap: 4px; overflow-x: auto; margin-bottom: 24px; border-bottom: 1px solid var(--line); background: #000; }
.admin-tab { flex: none; border: 0; border-bottom: 2px solid transparent; background: none; padding: 12px 14px; color: var(--ash); font-size: 14px; font-weight: 600; }
.admin-tab small { margin-left: 4px; color: var(--ash); font-weight: 400; }
.admin-tab:hover { color: var(--white); }
.admin-tab.active { border-color: var(--iris); color: var(--white); }
.admin-panel { min-width: 0; }

/* Personas */
.attention-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.attention-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #0b0b10; color: var(--white); text-align: left; transition: border-color .15s ease; }
.attention-card:hover { border-color: rgba(255,255,255,.28); }
.attention-card.active { border-color: var(--iris); box-shadow: inset 0 0 0 1px var(--iris); }
.attention-card b { display: block; font-size: 24px; font-weight: 600; }
.attention-card.warn b { color: var(--amber); }
.attention-card.warn b:empty::before, .attention-card b:empty::before { content: "–"; }
.attention-card span { color: var(--mist); font-size: 12px; }
.admin-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.admin-toolbar input, .admin-toolbar select { width: auto; flex: 0 1 220px; padding: 10px 12px; }
.admin-toolbar .toolbar-search { flex: 1 1 260px; }
.admin-toolbar .primary-button { margin: 0 0 0 auto; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; padding: 8px 12px; border: 1px solid rgba(128,82,255,.4); border-radius: 12px; background: rgba(128,82,255,.08); font-size: 13px; }
.people-table tbody tr { cursor: pointer; }
.people-table tbody tr:hover { background: rgba(255,255,255,.03); }
.people-table tbody tr.selected { background: rgba(128,82,255,.1); }
.people-table td { vertical-align: middle; }
.people-table .pick { width: 32px; }
.people-table .pick input { width: 16px; height: 16px; accent-color: var(--iris); }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell small { display: block; color: var(--ash); }
.avatar { display: grid; flex: none; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; }
.avatar.large { width: 46px; height: 46px; font-size: 15px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.pill.warn { background: rgba(255,184,41,.12); color: var(--amber); }
.pill.plain { background: rgba(255,255,255,.07); color: var(--mist); }

/* Ficha y alta: panel lateral */
.admin-scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.6); }
.admin-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 21; display: flex; flex-direction: column; width: min(560px, 100%); border-left: 1px solid var(--line); background: #0b0b10; }
.drawer-head { display: flex; gap: 12px; align-items: flex-start; padding: 20px 22px 0; }
.drawer-head h2 { margin: 0; font-size: 22px; }
.drawer-head p { margin: 2px 0 6px; }
.drawer-close { flex: none; width: 34px; height: 34px; margin-left: auto; border: 1px solid var(--line); border-radius: 10px; background: none; color: var(--mist); }
.drawer-alert { margin: 14px 22px 0; padding: 10px 12px; border: 1px solid rgba(255,184,41,.3); border-radius: 12px; background: rgba(255,184,41,.08); color: #ffd27a; font-size: 13px; }
.drawer-tabs { display: flex; gap: 2px; margin-top: 14px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.drawer-tab { border: 0; border-bottom: 2px solid transparent; background: none; padding: 10px; color: var(--ash); font-weight: 600; }
.drawer-tab.active { border-color: var(--iris); color: var(--white); }
.drawer-body { flex: 1; overflow: auto; padding: 18px 22px 24px; }
.drawer-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 22px; border-top: 1px solid var(--line); background: #111118; }
.drawer-foot .primary-button { margin: 0; }
.drawer-foot .note { margin-right: auto; color: var(--ash); font-size: 12px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fact { padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: #111118; }
.fact span { display: block; color: var(--ash); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.drawer-section { margin-top: 22px; }
.drawer-section h3 { margin: 0 0 10px; color: var(--ash); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.inline-edit { display: flex; gap: 8px; }
.inline-edit input { flex: 1; }
.state-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.state-row strong { display: block; font-weight: 600; }
.state-row small { color: var(--ash); }
.state-row .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.danger-zone { margin-top: 26px; padding: 4px 14px; border: 1px solid rgba(255,184,41,.3); border-radius: 14px; }
.danger-zone h3 { margin: 12px 0 0; color: var(--amber); }
.danger-zone .state-row:last-child { border-bottom: 0; }
.system-card { margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #111118; }
.system-card header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.system-card header small { display: block; color: var(--ash); }
.system-card .system-fields { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.system-card.off .system-fields { display: none; }
.system-card.blocked { opacity: .55; }
.switch { position: relative; flex: none; width: 42px; height: 24px; border: 0; border-radius: 999px; background: rgba(255,255,255,.16); transition: background .15s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s ease; }
.switch[aria-checked="true"] { background: var(--iris); }
.switch[aria-checked="true"]::after { left: 21px; }
.switch:disabled { cursor: not-allowed; }
.temporary-password { margin-top: 16px; padding: 14px; border: 1px solid rgba(255,184,41,.45); border-radius: 12px; }
.temporary-password code { display: block; margin: 8px 0; font-size: 20px; letter-spacing: .06em; color: var(--white); user-select: all; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-bottom: 16px; }
.timeline li::before { content: ""; position: absolute; top: 14px; bottom: 0; left: 6px; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline i { display: block; width: 13px; height: 13px; margin-top: 4px; border-radius: 50%; background: var(--iris); }
.timeline i.admin { background: var(--amber); }
.timeline i.denied { background: #555; }
.timeline small { display: block; color: var(--ash); }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.done { background: var(--iris); }
#new-person-form { display: grid; gap: 12px; }

/* Confirmación con motivo */
.admin-modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.65); }
.admin-modal.hidden { display: none; }
.admin-modal-box { display: grid; gap: 12px; width: min(460px, 100%); padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #111118; }
.admin-modal-box h3 { margin: 0; font-size: 19px; }
.admin-modal-box p { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .primary-button { margin: 0; }
.primary-button.danger { background: #b4471f; }
.primary-button.danger:hover { background: #c95427; }
.confirm-step { display: grid; gap: 10px; }
.confirm-step h4 { margin: 0; color: var(--white); font-size: 14px; }
.secret-value { display: block; padding: 12px; border: 1px solid rgba(255,184,41,.45); border-radius: 12px; color: var(--white); font-size: 22px; letter-spacing: .06em; text-align: center; user-select: all; }
.segmented { display: flex; gap: 6px; margin: 0; padding: 0; border: 0; }
.segmented label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--mist); cursor: pointer; }
.segmented label:has(input:checked) { border-color: var(--iris); background: rgba(128,82,255,.12); color: var(--white); }
.segmented input { width: auto; accent-color: var(--iris); }

/* Perfiles y actividad */
.profile-help { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.profile-help > div { padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 12px; }
.profile-help p { margin: 4px 0 0; }
.audit-code { display: block; color: var(--ash); font-size: 11px; }

@media (max-width: 900px) {
  .attention-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .people-table .optional { display: none; }
  .profile-help { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .people-table thead { display: none; }
  .people-table, .people-table tbody, .people-table tr, .people-table td { display: block; width: 100%; }
  .people-table tr { margin-bottom: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; }
  .people-table td { border: 0; padding: 6px 8px; }
  .people-table .pick { display: none; }
  .facts { grid-template-columns: 1fr; }
  .admin-toolbar .primary-button { margin-left: 0; }
}
