[hidden] { display: none !important; }
:root {
  --bg: #f7f3ee; --card: #fff; --ink: #2b2118; --muted: #6f6257; --line: #e2d8cc;
  --brand: #6b4a2b; --brand-ink: #fff; --ok: #1f7a3a; --ko: #b3261e; --warn: #8a5a00; --chip: #efe6db; --aviso: #fff3cd; --aviso-ink: #5c4400;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #1b1713; --card: #25201b; --ink: #f1e9df; --muted: #b3a595; --line: #3a3129; --brand: #c08a57; --brand-ink: #1b1713; --ok: #5fcf7f; --ko: #ff8a80; --warn: #f0b44c; --chip: #332a22; --aviso: #3a3018; --aviso-ink: #f5e2a8; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #1b1713; --card: #25201b; --ink: #f1e9df; --muted: #b3a595; --line: #3a3129; --brand: #c08a57; --brand-ink: #1b1713; --ok: #5fcf7f; --ko: #ff8a80; --warn: #f0b44c; --chip: #332a22; --aviso: #3a3018; --aviso-ink: #f5e2a8; color-scheme: dark; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
a { color: var(--brand); }
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--brand); color: var(--brand-ink); }
header.top h1 { font-size: 1.15rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ver { font-size: .75rem; opacity: .8; }
.icon-btn { background: transparent; border: 0; color: inherit; font-size: 1.8rem; line-height: 1; min-height: 44px; min-width: 44px; padding: 0 8px; cursor: pointer; }
main { max-width: 960px; margin: 0 auto; padding: 12px 16px; outline: none; }
nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; text-decoration: none; color: var(--muted); font-size: .8rem; font-weight: 600; }
nav.bottom a span { font-size: 1.35rem; line-height: 1; }
nav.bottom a.on { color: var(--brand); }
nav.bottom a.plus span { background: var(--brand); color: var(--brand-ink); border-radius: 50%; width: 48px; height: 48px; display: grid; place-items: center; font-size: 1.6rem; }
h2 { font-size: 1.25rem; margin: 6px 0; } h3 { font-size: 1.05rem; margin: 16px 0 8px; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 12px 0; }
details.card > summary { font-weight: 700; cursor: pointer; min-height: 32px; list-style-position: outside; }
label { display: block; margin: 10px 0; font-size: .92rem; color: var(--muted); }
label > input, label > select, label > textarea, label > .ds { margin-top: 4px; }
input, select, textarea { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; min-height: 48px; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); flex: none; margin: 0; }
label.chk { display: flex; gap: 10px; align-items: center; color: var(--ink); min-height: 44px; margin: 4px 0; }
button, .filebtn { min-height: 48px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; }
button.primary, .filebtn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
button.danger { color: var(--ko); border-color: var(--ko); background: var(--card); }
button.small { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
button.link { border: 0; background: none; padding: 0; min-height: 40px; color: var(--brand); text-align: left; justify-content: flex-start; }
button:disabled { opacity: .45; cursor: not-allowed; }
.btnrow { display: flex; gap: 8px; margin: 10px 0; }
.btnrow.wrap { flex-wrap: wrap; }
.btnrow > * { flex: 1 1 auto; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.row > .short { flex: 0 1 100px; }
.searchbox { display: flex; gap: 8px; margin: 4px 0 10px; }
.searchbox input { flex: 1; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 8px -16px; padding: 0 16px 6px; scrollbar-width: thin; }
.tabs button { flex: 0 0 auto; border: 0; background: var(--chip); color: var(--muted); border-radius: 99px; min-height: 42px; padding: 6px 14px; }
.tabs button.on { background: var(--brand); color: var(--brand-ink); }
.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.filtros select, .filtros input { flex: 1 1 150px; width: auto; min-height: 44px; padding: 8px 10px; }
.filtros label.chk { margin: 0; flex: 0 0 auto; }
.filtros input[type=checkbox] { flex: none; width: 22px; min-height: 0; padding: 0; }
.list { display: flex; flex-direction: column; gap: 6px; }
.row-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; justify-content: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 60px; text-decoration: none; color: var(--ink); font-weight: 400; }
.row-item.static { cursor: default; }
.ri-main { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.ri-top { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ri-sub, .ri-extra { font-size: .85rem; color: var(--muted); }
.ri-extra { color: var(--warn); font-weight: 600; }
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--brand); }
.code.big { font-size: 1.3rem; font-weight: 700; }
.thumb { width: 56px; height: 56px; border-radius: 10px; background: var(--chip); flex: none; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: .75rem; font-weight: 700; }
.thumb img, .tile-img img, .hero-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tile { flex-direction: column; align-items: stretch; padding: 6px; font-weight: 400; text-align: left; }
.tile-img { aspect-ratio: 4/3; border-radius: 8px; background: var(--chip); overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.hero { display: flex; gap: 14px; align-items: center; }
.hero-img { width: 110px; height: 110px; border-radius: 14px; background: var(--chip); overflow: hidden; flex: none; display: grid; place-items: center; color: var(--muted); font-weight: 700; cursor: zoom-in; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; background: var(--chip); }
.badge.ko { background: var(--ko); color: #fff; }
dl.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 6px 12px; margin: 6px 0; }
dl.kv dt { color: var(--muted); font-size: .9rem; }
dl.kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
table.tec { width: 100%; border-collapse: collapse; }
table.tec th, table.tec td { text-align: left; vertical-align: top; padding: 8px 4px; border-bottom: 1px solid var(--line); }
table.tec th { width: 42%; font-weight: 600; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 8px 0; }
.ftile { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-weight: 400; text-align: left; min-width: 0; }
.ftile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; cursor: zoom-in; }
.fdoc { display: grid; place-items: center; aspect-ratio: 4/3; background: var(--chip); border-radius: 6px; font-weight: 700; color: var(--muted); }
.fname { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files { margin-top: 10px; }
.tecrow { border-top: 1px dashed var(--line); padding: 8px 0; }
.tecrow input, .tecrow select { margin: 4px 0; }
.ds { display: flex; gap: 8px; }
.ds select { flex: 0 1 45%; } .ds input { flex: 1; }
.savebar { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); display: flex; gap: 8px; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); z-index: 5; }
.savebar button { flex: 1; min-height: 52px; }
.aviso { background: var(--aviso); color: var(--aviso-ink); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.aviso p { margin: 4px 0; }
.aviso.ko { border-left: 5px solid var(--ko); }
.empty { text-align: center; padding: 24px 8px; color: var(--muted); }
.row-draft { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 6px 0; }
.row-draft .ri-main { align-items: flex-start; }
.res { border-radius: 10px; padding: 8px 10px; margin: 8px 0; border-left: 5px solid var(--line); background: var(--bg); }
.res.ko { border-left-color: var(--ko); } .res.warn { border-left-color: var(--warn); }
.res p { margin: 4px 0; }
ul.plain { list-style: none; padding: 0; } ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ol.timeline { padding-left: 20px; } ol.timeline li { margin: 6px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ko); display: inline-block; }
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); color: var(--ink); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet p { white-space: pre-wrap; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
.sheet .btnrow { flex-wrap: wrap; }
.bar { height: 12px; background: var(--chip); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.bar > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 60; background: #2b2118; color: #fff; padding: 12px 14px; border-radius: 12px; text-align: center; max-width: 560px; margin: 0 auto; }
.viewer { position: fixed; inset: 0; z-index: 55; background: #111; display: flex; flex-direction: column; }
.vbar { display: flex; gap: 6px; padding: 8px; background: #222; align-items: center; flex-wrap: wrap; padding-top: calc(8px + env(safe-area-inset-top)); }
.vbar button { background: #333; color: #fff; border-color: #555; min-height: 44px; }
.vbar .close { margin-left: auto; }
.vtitle { color: #ccc; font-size: .85rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vpane { flex: 1; overflow: auto; min-height: 0; }
.vpane.fit { display: grid; place-items: center; }
.vpane .vimg { display: block; }
.vmsg { margin: 0; padding: 8px 10px; font-size: .9rem; } .vmsg.warn { background: #fff3cd; color: #5c4400; } .vmsg.ko { background: #ffd9d6; color: #7a1410; }
@media (min-width: 900px) { main { padding: 16px 24px; } }

body.split main { max-width: 1400px; display: grid; grid-template-columns: minmax(340px, 38%) 1fr; gap: 20px; align-items: start; }
body.split .col-list { position: sticky; top: 64px; max-height: calc(100vh - 150px); overflow: auto; padding-right: 4px; }
body.split .col-list .tabs { margin: 0 0 8px; padding: 0 0 6px; flex-wrap: wrap; }
.row-item.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }
