/* ============ RESET + BASE ============ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--tx);
  font: 400 var(--t-md) / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; text-align: inherit; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--tx-2); }
.faint { color: var(--tx-3); }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Íconos: un solo trazo y peso en toda la app */
.i {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block; vertical-align: -0.22em;
}
.i--sm { width: 16px; height: 16px; }
.i--lg { width: 24px; height: 24px; }

/* ============ SHELL ============ */
#shell { min-height: 100dvh; display: block; }
.col { min-width: 0; }

.side { display: none; }

.bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  min-height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) var(--sp-4) 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.bar__title { font-size: var(--t-xl); font-weight: 800; min-width: 0; }
.bar__end { display: flex; align-items: center; gap: var(--sp-1); }

#view {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) calc(var(--nav-h) + var(--safe-b) + 96px);
  outline: none;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(var(--tabs, 5), 1fr);
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--s1);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--tx-3); font-size: var(--t-xs); font-weight: 600; min-height: var(--tap);
  position: relative; text-decoration: none;
}
.tab:hover { color: var(--tx-2); }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; background: var(--accent); border-radius: 0 0 2px 2px;
}
.tab .i { width: 22px; height: 22px; }

.fab {
  position: fixed; right: var(--sp-4); bottom: calc(var(--nav-h) + var(--safe-b) + var(--sp-4)); z-index: 35;
  width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.2);
  transition: transform var(--dur-1) var(--ease);
}
.fab:active { transform: scale(0.94); }
.fab .i { width: 26px; height: 26px; stroke-width: 2.2; }
.fab--hidden { display: none; }

/* ============ ESCRITORIO ============ */
@media (min-width: 960px) {
  #shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; gap: var(--sp-4);
    position: sticky; top: 0; height: 100dvh;
    padding: var(--sp-5) var(--sp-4);
    background: var(--s1);
    border-right: 1px solid var(--line);
  }
  .tabbar, .fab { display: none; }
  .bar { padding-inline: var(--sp-8); }
  #view { padding: var(--sp-6) var(--sp-8) var(--sp-10); }
}

.brand { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-2); }
.brand__mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
}
.brand__mark .i { stroke-width: 2.4; }
.brand__txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand__txt strong { font-size: var(--t-md); font-weight: 800; }
.brand__txt span { font-size: var(--t-xs); color: var(--tx-3); }

.side__new { width: 100%; }
.side__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side__link {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 44px; padding: 0 var(--sp-3); border-radius: var(--r-md);
  color: var(--tx-2); font-weight: 600; text-decoration: none;
}
.side__link:hover { background: var(--s3); color: var(--tx); }
.side__link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-hi); }
.side__foot { border-top: 1px solid var(--line); padding-top: var(--sp-4); }

.who { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.who__txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who__txt strong { font-size: var(--t-sm); }
.who__txt span { font-size: var(--t-xs); color: var(--tx-3); }

/* Con movimiento reducido se quita el desplazamiento, no el cambio de estado (el color sigue avisando). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sheet[open], .toast, .fab, .btn, .chip, .row { animation: none !important; transform: none !important; }
}
