/* Grafito 2 (docs/design-reference.md): grafito, acentos menta y ámbar, foco con anillo. */
:root {
  --bg: #191b1d; --surface: #222528; --surface-2: #2a2d31; --line: #3a3e43; --text: #ecedee; --muted: #a9b0b8;
  --menta: #94d9b4; --ambar: #ead188; --coral: #f0a48f; --cielo: #8ec5ec; --lavanda: #b9a8ec; --grafito: #8b929a;
  --danger: #ed9e9e; --radius: 16px; --ring: 0 0 0 3px #191b1d, 0 0 0 5px var(--menta);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--menta); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--ring); }
h1:focus, h1:focus-visible { box-shadow: none; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 0 0 12px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 14px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 14px max(16px, calc((100vw - 1040px) / 2)); background: rgba(25, 27, 29, .86); backdrop-filter: blur(14px); border-bottom: 1px solid #2a2d31; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; font-size: 21px; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
nav a { color: var(--muted); padding: 7px 14px; border-radius: 999px; white-space: nowrap; font-weight: 550; }
nav a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
nav a[aria-current="page"] { color: #102018; background: var(--menta); }
.top > button { margin-left: auto; }

main { max-width: 1040px; margin: 0 auto; padding: 36px 16px 64px; }
.narrow { max-width: 440px; margin: 4vh auto 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card + .card, .stack > * + * { margin-top: 18px; }
.stack { max-width: 680px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }

label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; font-weight: 550; }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #1c1f21; color: var(--text); font: inherit;
}
input:focus, select:focus { border-color: var(--menta); outline: none; box-shadow: 0 0 0 3px rgba(148, 217, 180, .18); }
input[readonly] { color: var(--muted); }
.code-input { font: 600 26px/1.2 ui-monospace, "Cascadia Mono", monospace; letter-spacing: .14em; text-align: center; text-transform: uppercase; }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 12px; padding: 12px 18px; font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; transition: filter .15s, background .15s; }
button:hover, .button:hover { filter: brightness(1.08); text-decoration: none; }
button:disabled { opacity: .55; cursor: default; filter: none; }
.primary { background: var(--menta); color: #102018; }
.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.danger { background: transparent; color: var(--danger); border: 1px solid #5a3a3a; }
button.small, .button.small { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.block { width: 100%; margin-top: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 20px 0 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.google { background: #f3f0e8; color: #1f1f1f; width: 100%; margin-top: 18px; }
.google svg { flex: none; }
.error { color: var(--danger); min-height: 1.5em; margin: 12px 0 0; font-size: 15px; }
.note { font-size: 14px; color: var(--muted); margin-top: 18px; }

/* Perfiles */
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.profile { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 12px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: inherit; cursor: pointer; transition: transform .15s, border-color .15s; }
.profile:hover { transform: translateY(-2px); border-color: #50555b; filter: none; }
.profile .name { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile.add { color: var(--muted); border-style: dashed; background: transparent; }
.avatar { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; font: 700 36px/1 system-ui, sans-serif; color: #15181a; }
.avatar.sm { width: 40px; height: 40px; border-radius: 12px; font-size: 18px; }
.avatar.add { background: var(--surface-2); color: var(--muted); font-weight: 400; font-size: 42px; }
.menta { background: var(--menta); } .ambar { background: var(--ambar); } .coral { background: var(--coral); }
.cielo { background: var(--cielo); } .lavanda { background: var(--lavanda); } .grafito { background: var(--grafito); }
.badge { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.kids { color: #2a2410; background: var(--ambar); border-color: transparent; }
.badge.ok { color: #102018; background: var(--menta); border-color: transparent; }
.badge.off { color: var(--danger); border-color: #5a3a3a; background: transparent; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 14px; border: 2px solid transparent; padding: 0; }
.swatch[aria-checked="true"] { box-shadow: var(--ring); }
.switch { display: flex; align-items: center; gap: 12px; margin-top: 18px; color: var(--text); font-size: 15px; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--menta); }

/* Listas y tablas */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 180px; }
.list .meta { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); border-color: #555a60; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 0 10px 10px; }
.table td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.table select { width: auto; padding: 6px 10px; border-radius: 9px; }
.table .who b { display: block; font-weight: 600; }
.table .who span { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 0 -10px; }
.linkbox { display: flex; gap: 8px; margin-top: 14px; }
.linkbox input { font: 13px ui-monospace, monospace; }
.audit { font-size: 14px; }
.audit time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 20px; padding: 26px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 11, 12, .72); backdrop-filter: blur(3px); }
dialog .row.end { margin-top: 24px; }

#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #f3f0e8; color: #1b1d1f; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); z-index: 20; max-width: calc(100vw - 32px); }
.done { text-align: center; }
.done .check { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--menta); color: #102018; font-size: 34px; font-weight: 700; }

@media (max-width: 640px) {
  .top { gap: 10px; flex-wrap: wrap; }
  nav { order: 3; flex-basis: 100%; }
  main { padding-top: 24px; }
  h1 { font-size: 24px; }
  .card { padding: 20px; }
  .avatar { width: 72px; height: 72px; font-size: 30px; border-radius: 22px; }
  .profiles { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#invite-result:not(:empty) { margin-top: 26px; }

/* ---- 0017: fotos, perfil, biblioteca, dispositivos y administración ---- */
.avatar { position: relative; overflow: hidden; flex: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.xl { width: 132px; height: 132px; border-radius: 40px; font-size: 56px; }
a.profile { text-decoration: none; }
.back { display: inline-block; color: var(--muted); font-size: 15px; margin-bottom: 10px; }
.tip { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-top: 28px; }
.tip h2 { margin-bottom: 4px; }
.section-title { margin: 30px 0 12px; }
.profile-head { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.profile-head form { max-width: 460px; }
.profile-head form .error { margin-top: 8px; }
.profile-head form > .primary { margin-top: 18px; }
.delete-profile { margin: 18px 0 0 12px; }
.photo-edit { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.center-row { justify-content: center; }
.tabs .count { margin-left: 8px; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.media-list li { align-items: center; }
.poster { position: relative; width: 54px; height: 80px; border-radius: 10px; overflow: hidden; flex: none; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-weight: 700; font-size: 20px; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bar { height: 4px; border-radius: 4px; background: var(--surface-2); margin-top: 8px; max-width: 280px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--menta); border-radius: 4px; }
.empty { text-align: center; padding: 26px 12px; }
.empty b { font-size: 17px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-align: left; font: inherit; cursor: default; }
button.stat, a.stat { cursor: pointer; }
button.stat:hover, a.stat:hover { border-color: #50555b; text-decoration: none; filter: none; }
.stat b { font-size: 30px; line-height: 1.1; font-weight: 700; }
.stat span { font-weight: 600; font-size: 15px; }
.stat small { color: var(--muted); font-size: 13px; }
.ok-text { color: var(--menta); } .warn-text { color: var(--ambar); }
.panel-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.search { max-width: 380px; flex: 1; min-width: 200px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: #1c1f21; color: var(--text); font: inherit; }
.search:focus { border-color: var(--menta); outline: none; }
.tags { margin-top: 6px; gap: 8px; }
.device-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 22px; flex: none; }
.stale { color: var(--ambar); }
.device-ask { display: flex; align-items: center; gap: 14px; }
.device-ask h1 { margin: 0; }
dialog.wide { width: min(720px, calc(100vw - 32px)); }
.user-dialog h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; align-items: center; margin-top: 18px; font-size: 15px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.kv select { width: auto; padding: 6px 10px; border-radius: 9px; }
.mini-profiles { display: flex; gap: 14px; flex-wrap: wrap; }
.mini-profiles > div { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 6px 12px 6px 6px; }
.actions { margin-top: 22px; }
.invite-grid { display: grid; grid-template-columns: 1fr 200px; gap: 0 14px; max-width: 640px; }
.list li.device, .list li.user-row { align-items: center; }
@media (max-width: 640px) {
  .profile-head { flex-direction: column; align-items: stretch; }
  .photo-edit { align-self: center; }
  .avatar.xl { width: 112px; height: 112px; font-size: 46px; border-radius: 34px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat b { font-size: 24px; }
  .invite-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv > span:nth-child(odd) { margin-top: 10px; font-size: 13px; }
  .list li.device > .row, .list li.user-row > button { width: 100%; justify-content: flex-end; }
}
.kv > * { justify-self: start; }

/* ---- 0020: reportes de reproducción ---- */
textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #1c1f21; color: var(--text); font: inherit; resize: vertical; }
textarea:focus { border-color: var(--menta); outline: none; box-shadow: 0 0 0 3px rgba(148, 217, 180, .18); }
.badge.warn { color: #2a2410; background: var(--coral); border-color: transparent; }
.filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
label.inline { display: flex; flex-direction: column; gap: 4px; margin: 0; }
label.inline select { width: auto; min-width: 160px; padding: 8px 12px; border-radius: 10px; }
.chips { margin: 4px 0 10px; gap: 8px; }
.chip { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 550; gap: 8px; }
.chip b { color: var(--ambar); }
.chip.on { border-color: var(--menta); box-shadow: 0 0 0 1px var(--menta); }
.reports .title { display: block; margin-top: 6px; }
.reply { margin: 6px 0 0; padding: 8px 12px; border-left: 3px solid var(--menta); background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: 14px; }
.report-dialog .cause { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.report-dialog .cause p { margin: 4px 0 0; }
.report-dialog .kv { margin-top: 8px; font-size: 14px; }
.report-dialog .kv > span:nth-child(even) { word-break: break-word; }
.table.compact { font-size: 13px; margin-top: 12px; }
.table.compact td { padding: 8px 10px; }
.recheck:not(:empty) { margin-top: 8px; }

/* Correo (decisión 0022) */
.tabs.sub { margin-top: -4px; }
.tabs.sub button { padding: 6px 14px; font-size: 14px; }
.mail-preview iframe { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 12px; background: #eef0f1; margin-top: 14px; }
.mail-text { white-space: pre-wrap; word-break: break-word; font: 14px/1.6 ui-monospace, monospace; background: #1c1f21; border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-height: 420px; overflow: auto; margin-top: 18px; }
.table .mono, .table.dns td { font: 12px/1.5 ui-monospace, monospace; white-space: pre-wrap; word-break: break-all; }
.list li.unread .title { color: var(--menta); }
.meta.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
