/* miscosas — cartón. Un solo acento (rojo pin) reservado a ubicación y avisos. */
@font-face { font-family: "DM Sans"; src: url("/fonts/dm-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #F6EEE1; --card: #FFFBF3; --line: #E2D3BA;
  --ink: #2B1D12; --ink2: #6B5644;
  --kraft: #C79A6B; --kraft-l: #E6D2B3; --kraft-d: #8A5F38;
  --pin: #C4421F; --on-pin: #FFFFFF; --warn: #F0D98C; --ok: #CBD9B8;
  --t-sage: #CBD9B8; --t-mustard: #F0D98C; --t-sky: #C9DCE3; --t-rose: #EBC9C0; --t-sand: #E6D2B3; --t-lilac: #D9CFE6;
  --t-mint: #BFE3D0; --t-peach: #F6CFA8; --t-periwinkle: #C6CFF2; --t-stone: #D8D0C2;
  --shadow: 0 1px 2px rgba(43,29,18,.06);
  --radius: 18px;
  --nav-h: 76px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-title: "Bricolage Grotesque", "DM Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1E1710; --card: #2A2118; --line: #3D3023;
    --ink: #F3E8D6; --ink2: #BFAE96;
    --pin: #C4421F; --warn: #5A4B22; --ok: #3E4A33;
    --t-sage: #3E4A33; --t-mustard: #5A4B22; --t-sky: #2F4650; --t-rose: #5A3A33; --t-sand: #4A3826; --t-lilac: #433A55;
    --t-mint: #2F4D40; --t-peach: #5E4128; --t-periwinkle: #343E66; --t-stone: #45403A;
    --kraft-l: #4A3826;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.35; }
body { overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { margin: 0; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--kraft-d); outline-offset: 2px; }
@media (prefers-color-scheme: dark) { :focus-visible { outline-color: var(--kraft); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

#app { height: 100dvh; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; position: relative; }
.view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: calc(16px + env(safe-area-inset-top)) 20px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.view--plain { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.view--bar { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.title { font-family: var(--font-title); font-weight: 700; font-size: 32px; line-height: 1.05; letter-spacing: -.8px; overflow-wrap: anywhere; }
.title--sm { font-size: 24px; letter-spacing: -.5px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-title); font-weight: 700; font-size: 20px; letter-spacing: -.5px; }
.brand svg { width: 30px; height: 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }

.sync-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: var(--warn); font-size: 12px; font-weight: 500; white-space: nowrap; border: 0; }
.sync-pill[data-state="ok"] { background: transparent; color: var(--ink2); padding-right: 0; }
.sync-pill svg { width: 14px; height: 14px; }
.sync-pill[data-state="error"] { background: var(--pin); color: var(--on-pin); }

.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--ink2); }
.crumbs a { text-decoration: none; padding: 6px 2px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs svg { width: 12px; height: 12px; }
.crumbs--path { font-size: 15px; font-weight: 500; color: var(--ink); }
.crumbs--path a:last-child { font-weight: 700; }

.iconbtn { width: 44px; height: 44px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn--on { background: var(--kraft); border-color: var(--ink); }
.iconbtn--on svg { stroke: #2B1D12; }
.iconbtn--round { border-radius: 50%; border-color: var(--ink); }
.iconbtn--ghost { border-color: transparent; background: transparent; }

.searchbar { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); }
.searchbar:focus-within { border-color: var(--ink); }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; }
.searchbar svg { width: 18px; height: 18px; color: var(--ink2); flex-shrink: 0; }
.searchbar--big { height: 52px; border: 2px solid var(--ink); border-radius: 16px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1.5px solid transparent; background: var(--t-sand); font-size: 13px; font-weight: 500; white-space: nowrap; flex-shrink: 0; min-height: 34px; }
.chip--ghost { background: var(--card); border-color: var(--line); }
.chip--dash { background: transparent; border: 1.5px dashed var(--ink2); color: var(--ink2); }
.chip--on { background: var(--ink); color: var(--paper); }
.chip--c0 { background: var(--t-sage); } .chip--c1 { background: var(--t-mustard); } .chip--c2 { background: var(--t-sky); }
.chip--c3 { background: var(--t-rose); } .chip--c4 { background: var(--t-sand); } .chip--c5 { background: var(--t-lilac); }
.chip--c6 { background: var(--t-mint); } .chip--c7 { background: var(--t-peach); } .chip--c8 { background: var(--t-periwinkle); } .chip--c9 { background: var(--t-stone); }
.chip--on.chip--c0, .chip--on.chip--c1, .chip--on.chip--c2, .chip--on.chip--c3, .chip--on.chip--c4, .chip--on.chip--c5,
.chip--on.chip--c6, .chip--on.chip--c7, .chip--on.chip--c8, .chip--on.chip--c9 { outline: 2px solid var(--ink); }
.chip svg { width: 12px; height: 12px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 700; }
.badge--pin { background: var(--pin); color: var(--on-pin); }
.badge--warn { background: var(--warn); color: var(--ink); }
.status { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--ok); font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.status--baja { background: var(--t-sky); }

/* Selector de opciones: la elegida es oscura, con ✓ y relieve; las demás, apagadas. */
.seg { display: flex; padding: 4px; border-radius: 16px; background: var(--kraft-l); gap: 4px; }
.seg button { flex: 1; min-height: 42px; border-radius: 12px; border: 2px solid transparent; background: transparent; font-size: 14px; font-weight: 500; color: var(--ink2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button:hover { color: var(--ink); background: rgba(255,255,255,.35); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.28); }
.seg button[aria-pressed="true"]::before { content: "✓"; font-weight: 700; }
@media (prefers-color-scheme: dark) {
  .seg button:hover { background: rgba(255,255,255,.08); }
  .seg button[aria-pressed="true"] { background: var(--kraft); color: #2B1D12; }
}

/* Cuadrícula: --cols lo cambia el pellizco (1 = lista) */
.grid { --cols: 2; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 12px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.grid[data-cols="3"] { gap: 10px; } .grid[data-cols="4"], .grid[data-cols="5"], .grid[data-cols="6"] { gap: 6px; }
.tile { position: relative; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; padding: 0; text-align: left; box-shadow: var(--shadow); }
.tile:active { transform: scale(.98); }
.tile__photo { aspect-ratio: 4 / 3; background: var(--t-sand); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.tile__photo img { width: 100%; height: 100%; object-fit: cover; }
.tile__photo > svg { width: 38%; height: 38%; max-width: 44px; max-height: 44px; opacity: .85; }
.tile__body { padding: 9px 12px 11px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tile__name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__meta { font-size: 12px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .badge, .tile .tag-corner { position: absolute; top: 8px; right: 8px; }
.tile .tag-corner { left: 8px; right: auto; }
.grid[data-cols="4"] .tile, .grid[data-cols="5"] .tile, .grid[data-cols="6"] .tile { border-radius: 10px; border-width: 1px; }
.grid[data-cols="4"] .tile__photo, .grid[data-cols="5"] .tile__photo, .grid[data-cols="6"] .tile__photo { aspect-ratio: 1 / 1; }
.grid[data-cols="4"] .tile__body, .grid[data-cols="5"] .tile__body, .grid[data-cols="6"] .tile__body { display: none; }
.grid[data-cols="4"] .tile .badge, .grid[data-cols="5"] .tile .badge, .grid[data-cols="6"] .tile .badge { top: auto; right: 4px; bottom: 4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.grid[data-cols="4"] .tile .tag-corner, .grid[data-cols="5"] .tile .tag-corner, .grid[data-cols="6"] .tile .tag-corner { display: none; }
.grid[data-cols="1"] { gap: 0; }
.grid[data-cols="1"] .tile { flex-direction: row; align-items: center; border-radius: 0; border-width: 0 0 1.5px; background: transparent; box-shadow: none; padding: 10px 0; gap: 12px; }
.grid[data-cols="1"] .tile__photo { width: 60px; height: 60px; aspect-ratio: auto; border-radius: 14px; flex-shrink: 0; }
.grid[data-cols="1"] .tile__body { padding: 0; flex: 1; }
.grid[data-cols="1"] .tile .badge { position: static; }
.tile[aria-selected="true"] { outline: 3px solid var(--ink); outline-offset: -3px; }
.tile__check { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--paper); display: none; align-items: center; justify-content: center; }
.tile__check svg { width: 14px; height: 14px; }
.grid[data-selecting="1"] .tile__check { display: flex; }
.tile[aria-selected="false"] .tile__check { background: var(--card); border: 2px solid var(--ink); color: transparent; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 8px; gap: 8px; }
.group-head a { font-size: 15px; font-weight: 700; text-decoration: none; }
.group-head a:hover { text-decoration: underline; }
.has-photo > svg { display: none; }
body.selecting .nav { display: none; }
.zoom-hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom)); padding: 9px 16px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 700; pointer-events: none; z-index: 30; opacity: 0; transition: opacity .2s; }
.zoom-hint.show { opacity: 1; }

/* Listas y fichas */
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.card--info { background: var(--t-sky); border-color: transparent; flex-direction: row; align-items: center; }
.card--warn { background: var(--warn); border-color: transparent; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; color: var(--ink2); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.eyebrow svg { width: 20px; height: 20px; }
.pin-ico { color: var(--pin); }
.rows { display: flex; flex-direction: column; }
.rowitem { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1.5px solid var(--line); text-decoration: none; color: inherit; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.rowitem:last-child { border-bottom: 0; }
.thumb { width: 60px; height: 60px; border-radius: 14px; background: var(--t-sand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 28px; height: 28px; opacity: .85; }
.thumb--sm { width: 52px; height: 52px; border-radius: 12px; }
.path { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink2); }
.path svg { width: 12px; height: 12px; color: var(--pin); flex-shrink: 0; }
mark { background: var(--warn); color: inherit; border-radius: 4px; padding: 0 2px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kv > div { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.kv .k { font-size: 12px; color: var(--ink2); }
.kv .v { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.hero { position: relative; margin: calc(-16px - env(safe-area-inset-top)) -20px 0; background: var(--t-sand); aspect-ratio: 16 / 10; max-height: 340px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero > svg { width: 84px; height: 84px; opacity: .75; }
.hero .iconbtn { position: absolute; top: calc(16px + env(safe-area-inset-top)); background: var(--card); border-color: var(--ink); }
.hero .iconbtn.left { left: 16px; } .hero .iconbtn.right { right: 16px; }
.hero .count { position: absolute; right: 16px; bottom: 12px; padding: 4px 10px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.strip .thumb { cursor: pointer; border: 2px solid transparent; padding: 0; }
.strip .thumb[aria-current="true"] { border-color: var(--ink); }
.history { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.history .when { color: var(--ink2); font-size: 12px; }

/* Botones */
.btn { min-height: 52px; padding: 0 20px; border-radius: 16px; border: 2px solid var(--ink); background: var(--kraft); color: #2B1D12; font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--link { border: 0; background: transparent; min-height: 44px; color: var(--ink); }
.btn--danger { background: var(--pin); border-color: var(--pin); color: var(--on-pin); }
.btn--sm { min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 12px; }
.btn--block { width: 100%; }
.btn svg { width: 20px; height: 20px; }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; max-width: 720px; margin: 0 auto; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1.5px solid var(--line); display: flex; gap: 10px; z-index: 20; }
.actionbar .btn { flex: 1; }
.actionbar--col { flex-direction: column; gap: 4px; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span.label { font-size: 13px; font-weight: 700; }
.input, .select, .textarea { width: 100%; min-height: 50px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-size: 17px; outline: 0; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); }
.textarea { padding: 12px 16px; min-height: 110px; resize: vertical; }
.input--err { border-color: var(--pin); }
.hint { font-size: 12px; color: var(--ink2); }
.err { font-size: 13px; color: var(--pin); font-weight: 700; }
@media (prefers-color-scheme: dark) { .err { color: #F08C6E; } }
.pair { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--line); }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--kraft-l); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.stepper button svg { width: 20px; height: 20px; }
.stepper output { min-width: 44px; text-align: center; font-size: 18px; font-weight: 700; }
.locbtn { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); width: 100%; text-align: left; }
.locbtn svg { width: 22px; height: 22px; color: var(--pin); flex-shrink: 0; }
.photoadd { display: flex; gap: 10px; }
.photoadd .shot { width: 150px; height: 150px; border-radius: 20px; background: var(--t-sage); border: 2px solid var(--ink); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; }
.photoadd .shot img { width: 100%; height: 100%; object-fit: cover; }
.photoadd .shot svg { width: 56px; height: 56px; opacity: .8; }
.photoadd .more { flex: 1; border-radius: 20px; border: 2px dashed var(--kraft-d); background: var(--kraft-l); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 700; padding: 0 6px; text-align: center; }
.photoadd .more svg { width: 30px; height: 30px; }
.disclosure { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); width: 100%; text-align: left; font-weight: 700; }
.disclosure svg { width: 18px; height: 18px; }

/* Navegación inferior */
.nav { position: fixed; left: 0; right: 0; bottom: 0; max-width: 720px; margin: 0 auto; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); background: var(--card); border-top: 1.5px solid var(--line); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; z-index: 25; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; font-size: 11px; font-weight: 500; color: var(--ink2); position: relative; padding: 6px 0; }
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.nav a[aria-current="page"] svg { stroke-width: 2.4; }
.nav .add { display: flex; justify-content: center; }
.nav .add span { width: 58px; height: 58px; border-radius: 50%; background: var(--kraft); border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; margin-top: -26px; color: #2B1D12; }
.nav .add svg { width: 28px; height: 28px; stroke-width: 2.6; color: #2B1D12; }
.nav .badge { position: absolute; top: -2px; right: 18%; }

/* Hojas modales y avisos */
.backdrop { position: fixed; inset: 0; background: rgba(20,12,6,.5); z-index: 80; /* por encima de los avisos: un aviso no debe tapar los botones de una hoja */ display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 720px; max-height: 86dvh; background: var(--paper); border-radius: 24px 24px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; animation: rise .2s; }
.sheet h2 { font-family: var(--font-title); font-size: 22px; letter-spacing: -.4px; }
.sheet__grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); align-self: center; flex-shrink: 0; }
.sheet .rows { max-height: 46dvh; overflow-y: auto; }
.sheet__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet__actions .btn { flex: 1; min-width: 130px; }
.viewer { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .iconbtn { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; background: var(--card); border-color: var(--ink); }
.viewer .bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.viewer .bar .btn { flex: 1; }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 70; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 14px; font-size: 14px; display: flex; align-items: center; gap: 14px; pointer-events: auto; max-width: 560px; animation: rise .2s; }
.toast button { background: transparent; border: 0; color: var(--warn); font-weight: 700; padding: 6px 4px; min-height: 36px; }
@media (prefers-color-scheme: dark) { .toast button { color: var(--kraft); } }
.empty { text-align: center; padding: 36px 12px; color: var(--ink2); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty svg { width: 64px; height: 64px; opacity: .8; }

.center-page { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 28px 24px; max-width: 420px; margin: 0 auto; }
.center-page .logo { width: 96px; height: 96px; }
.seq-bar { display: flex; gap: 8px; flex-wrap: wrap; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Lector de códigos ---------- */
.scanner { position: relative; background: #000; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner__aim { position: absolute; left: 12%; right: 12%; top: 32%; bottom: 32%; border: 3px solid var(--kraft); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; }
.scanner__msg { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 8px 12px; background: rgba(0,0,0,.65); color: #fff; font-size: 13px; text-align: center; }

/* ---------- Color de etiquetas ---------- */
.swatches { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.swatch { aspect-ratio: 1 / 1; border-radius: 16px; border: 2px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--ink); padding: 4px; position: relative; }
.swatch[aria-pressed="true"] { border-color: var(--ink); border-width: 3px; font-weight: 700; }
.swatch svg { width: 22px; height: 22px; }
.dot { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); }

/* ---------- Arrastrar para mover ---------- */
.grid .tile { cursor: pointer; }
.tile.lifted { transform: scale(1.06); box-shadow: 0 10px 24px rgba(0,0,0,.28); z-index: 2; }
.tile.dragging-src { opacity: .35; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.drag-ghost { position: fixed; left: 0; top: 0; width: 72px; height: 72px; z-index: 90; pointer-events: none; border-radius: 16px; overflow: visible; box-shadow: 0 12px 28px rgba(0,0,0,.35); will-change: transform; }
.drag-ghost__photo { width: 72px; height: 72px; border-radius: 16px; overflow: hidden; display: flex; align-items: center; justify-content: center; border: 2px solid var(--ink); background: var(--t-sand); }
.drag-ghost__photo img { width: 100%; height: 100%; object-fit: cover; }
.drag-ghost__photo > svg { width: 36px; height: 36px; }
.drag-ghost__count { position: absolute; top: -8px; right: -8px; }
.drop-ok { outline: 3px solid var(--pin) !important; outline-offset: -3px; }
.crumbs .drop-ok { background: var(--kraft); color: #2B1D12; border-radius: 8px; outline-offset: 0; padding: 6px 8px; }
.nav a.drop-ok { background: var(--kraft); color: #2B1D12; border-radius: 12px; }
.nav__brand, .nav__addtxt { display: none; }

/* ---------- Pantallas anchas (ordenador): barra lateral, contenido centrado, cuadrícula adaptable ---------- */
@media (min-width: 860px) {
  #app { max-width: none; display: grid; grid-template-columns: 240px minmax(0, 1fr); align-items: stretch; }
  .nav, .nav[hidden], body.selecting .nav { position: sticky; top: 0; left: auto; right: auto; bottom: auto; margin: 0; max-width: none; width: auto;
    grid-column: 1; grid-row: 1; height: 100dvh; display: flex !important; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px;
    padding: 20px 14px; border-top: 0; border-right: 1.5px solid var(--line); overflow-y: auto; }
  .nav__brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-family: var(--font-title); font-weight: 700; font-size: 22px; letter-spacing: -.5px; }
  .nav__brand svg { width: 34px; height: 34px; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; font-size: 15px; }
  .nav a:hover { background: var(--kraft-l); color: var(--ink); }
  .nav a[aria-current="page"] { background: var(--kraft-l); }
  .nav a svg { width: 22px; height: 22px; flex-shrink: 0; }
  .nav .add { order: -1; justify-content: stretch; padding: 0; margin: 0 0 14px; }
  .nav .add:hover { background: transparent; }
  .nav .add span { width: 100%; height: 48px; margin: 0; border-radius: 14px; gap: 8px; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
  .nav .add svg { width: 22px; height: 22px; }
  .nav__addtxt { display: inline; }
  .nav .badge { position: static; margin-left: auto; }

  #screen, #screen > .view { grid-column: 2; grid-row: 1; }
  #screen { display: contents; }
  .view { padding: 28px 40px 48px; height: 100dvh; }
  .view--plain, .view--bar { padding-bottom: 120px; }
  .view > * { max-width: 1120px; margin-left: auto; margin-right: auto; width: 100%; }
  .view .brand { display: none; }
  .title { font-size: 38px; }
  .title--sm { font-size: 28px; }

  /* Cuadrícula: tantas columnas como quepan; el nivel de zoom elige el tamaño de la ficha */
  .grid { grid-template-columns: repeat(auto-fill, minmax(var(--min, 220px), 1fr)); }
  .grid[data-cols="2"] { --min: 230px; } .grid[data-cols="3"] { --min: 180px; } .grid[data-cols="4"] { --min: 132px; }
  .grid[data-cols="5"] { --min: 108px; } .grid[data-cols="6"] { --min: 90px; }
  .grid[data-cols="1"] { grid-template-columns: 1fr; }

  /* La ficha: la foto es una tarjeta, no una franja a todo el ancho */
  .hero { margin: 0 auto; width: 100%; border-radius: 22px; max-height: 300px; aspect-ratio: 16 / 6; }
  .topbar .sync-pill { margin-left: auto; }
  .hero .iconbtn { top: 16px; }

  /* Barras de acción, avisos y diálogos alineados con el contenido */
  .actionbar { left: 240px; right: 0; max-width: none; margin: 0; padding: 14px max(40px, calc((100% - 1120px) / 2)) 18px; }
  .actionbar .btn { max-width: 360px; }
  .actionbar--col .btn { max-width: none; }
  .toasts { left: 240px; bottom: 28px; }
  .zoom-hint { left: calc(50% + 120px); bottom: 28px; }
  .backdrop { align-items: center; padding: 24px; }
  .sheet { max-width: 560px; border-radius: 24px; max-height: 84dvh; }
  .center-page { max-width: 440px; grid-column: 1 / -1; width: 100%; }
  .photoadd .shot { width: 190px; height: 190px; }
  .kv { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1500px) {
  .view > * { max-width: 1280px; }
  .actionbar { padding-inline: max(40px, calc((100% - 1280px) / 2)); }
}
