/* Kapyderm QR - base: tokens de marca, reset, estructura general.
   Paleta tomada de kapyderm.com: marino #252a5d, azul #2964ac, celeste #82cdff, fondo #f7f6f2. */

:root {
  --navy: #252a5d;
  --navy-deep: #0f1447;
  --blue: #2964ac;
  --sky: #82cdff;
  --sky-soft: #e8f4fd;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --ink: #1b1c1a;
  --muted: #666670;
  --line: rgba(37, 42, 93, 0.1);
  --line-strong: rgba(37, 42, 93, 0.2);
  --ok: #1b6e45;
  --ok-bg: #e2f3ea;
  --warn: #86560a;
  --warn-bg: #fbefd2;
  --danger: #b3261e;
  --danger-bg: #fde8e6;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --r-card: 22px;
  --r-ctl: 14px;
  --r-pill: 999px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --shadow-card: 0 1px 2px rgba(15, 20, 71, 0.04), 0 10px 28px -14px rgba(15, 20, 71, 0.16);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 62px;
  --actionbar-h: 76px;
  --gutter: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: none;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
}
body.no-tabs { padding-bottom: calc(var(--actionbar-h) + var(--safe-b) + 12px); }
body.sheet-lock { overflow: hidden; }

h1, h2, h3, p { margin: 0; }
img, svg { display: block; max-width: 100%; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, [role="button"], label { touch-action: manipulation; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }

.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.desk-only { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Barra superior (material translucido) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-t);
  background: rgba(247, 246, 242, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto; padding: 4px var(--gutter); min-height: 52px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); }
.brand img { height: 34px; width: auto; }
.brand-tag {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.14em;
  padding: 3px 7px 3px 9px; border-radius: var(--r-pill);
  background: var(--navy); color: #fff;
}
.topnav { display: none; align-items: center; gap: 4px; }
.topnav a, .topnav-btn {
  min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center;
  border: 0; background: none; border-radius: var(--r-pill);
  font-size: 0.9375rem; font-weight: 600; color: var(--muted);
  transition: background-color 150ms ease, color 150ms ease;
}
.topnav a.is-current { color: var(--navy); background: rgba(37, 42, 93, 0.07); }
.topnav form { margin: 0; }

/* ---------- Barra de pestanas inferior (movil) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(6px + var(--safe-b));
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--line);
}
.tab-form { margin: 0; display: contents; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 48px; border: 0; background: none; color: var(--muted);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transition: transform 120ms var(--ease-out), color 150ms ease;
}
.tab:active { transform: scale(0.94); }
.tab.is-current { color: var(--navy); }
.tab-plus {
  width: 36px; height: 36px; margin-top: -2px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--navy));
  box-shadow: 0 6px 14px -6px rgba(37, 42, 93, 0.6);
}
.tab-new { color: var(--navy); }

/* ---------- Pagina ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 14px var(--gutter) 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 10px 0 16px; }
.page-title {
  font-size: 2.125rem; line-height: 1.08; font-weight: 700; letter-spacing: -0.024em; color: var(--ink);
  overflow-wrap: anywhere;
}
.page-sub { margin-top: 4px; color: var(--muted); font-size: 0.9375rem; }
.page-head-actions { display: flex; gap: 8px; align-items: center; }

@media (min-width: 900px) {
  :root { --gutter: 32px; }
  body, body.no-tabs { padding-bottom: 48px; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  .topbar-inner { min-height: 60px; }
  .brand img { height: 40px; }
  .page { padding-top: 28px; }
  .page-title { font-size: 2.5rem; }
  .desk-only { display: inline-flex !important; }
  div.desk-only, ul.desk-only { display: grid !important; }
  .mobile-only { display: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
