/* Musvisto · App shell and shared components. Every screen reuses these blocks:
   one component per kind of thing, the same size everywhere. Area styles go in css/<area>.css. */
:root { --radius: 18px; --gap: 12px; --nav-h: 64px; --top-h: 56px; --big: 19px; }
[hidden] { display: none !important; }
h2 { margin: 0 0 8px; font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: clamp(22px, 6vw, 28px); font-weight: 600; line-height: 1.15; text-wrap: balance; }
h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.j { text-align: justify; hyphens: auto; }
a { color: var(--accent); }

.shell { min-height: 100dvh; padding-top: calc(var(--top-h) + env(safe-area-inset-top)); padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
.shell.bare { padding-top: env(safe-area-inset-top); padding-bottom: 24px; }
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 20; height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0; display: flex; align-items: center; gap: 8px;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
}
.group-switch { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.group-switch .label { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.crest { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; background: var(--accent); overflow: hidden; }
.crest img { width: 100%; height: 100%; object-fit: cover; }
.crest.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 28px; }
.badge { flex: none; padding: 3px 10px; border-radius: 980px; background: var(--stone); color: #5b4b1f; font-size: 13px; font-weight: 600; }
.syncdot { flex: none; min-width: 0; font-size: 13px; color: var(--ink-soft); }

.bottomnav {
  position: fixed; inset: auto 0 0; z-index: 20; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 44px; color: var(--ink-soft); text-decoration: none; font-size: 12px; font-weight: 600; }
.bottomnav a span { max-width: 100%; overflow: hidden; text-overflow: clip; white-space: nowrap; font-size: clamp(10px, 2.9vw, 12px); }
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a[aria-current="page"] { color: var(--accent); }

.view { width: 100%; max-width: 720px; margin: 0 auto; padding: 8px 16px 24px; text-align: left; }
.view > header { margin: 8px 0 16px; }
.view > header p { margin: 0; color: var(--ink-soft); }
.section { margin: 24px 0 0; }
.section > h3 { color: var(--ink-soft); font-size: 14px; font-weight: 600; margin-bottom: 8px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: var(--gap); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; height: 96px; padding: 14px; border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; overflow: hidden; }
.tile b { font-size: 26px; font-family: "Bricolage Grotesque", system-ui, sans-serif; line-height: 1; }
.tile span { font-size: 14px; color: var(--ink-soft); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.button { display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.button.big { width: 100%; min-height: 64px; font-size: var(--big); border-radius: 20px; }
.button.wide { width: 100%; }
.button.secondary { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.button.danger { background: var(--warn); color: #fff; }
.button.small { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.button[disabled] { opacity: 0.45; cursor: not-allowed; }
.row-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-top: 16px; }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.list-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; color: var(--ink); text-decoration: none; }
.list-row .main { min-width: 0; }
.list-row .main b { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.list-row .main small { color: var(--ink-soft); font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.list-row .end { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }

.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: block; object-fit: cover; background: var(--stone); }
.avatar.md { width: 56px; height: 56px; }
.avatar.lg { width: 96px; height: 96px; }

.field { display: block; margin: 0 0 16px; }
.field > span { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 600; }
.field input:not([type=radio]):not([type=checkbox]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 17px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field small { display: block; margin-top: 6px; color: var(--ink-soft); font-size: 14px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.file-pick { position: relative; display: inline-flex; align-items: center; gap: 12px; overflow: hidden; }
.file-pick input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; font-variant-numeric: tabular-nums; table-layout: fixed; }
.table th, .table td { padding: 10px 4px; border-bottom: 1px solid var(--line); text-align: center; font-size: clamp(14px, 3.8vw, 16px); }
.table th { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.table th.name, .table td.name { text-align: left; padding-left: 12px; }
.table td.name b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.legend { margin: 8px 4px 0; font-size: 13px; color: var(--ink-soft); }

.empty { padding: 32px 16px; text-align: center; color: var(--ink-soft); background: var(--surface); border-radius: var(--radius); }
.notice { padding: 12px 16px; border-radius: 14px; background: var(--stone); color: #4a3e1a; font-size: 15px; }
:root[data-tema="oscuro"] .notice { background: #2a2717; color: #efe6c7; }
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) .notice { background: #2a2717; color: #efe6c7; } }

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / 0.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; max-height: 88dvh; overflow: auto; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--canvas); text-align: left; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); z-index: 50; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--canvas); font-size: 15px; }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 980px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.pair-a { color: var(--accent); }
.pair-b { color: var(--pair-b); }
.nb { white-space: nowrap; }
