/* Birkka Xray — gris carbón de birkka.com.ar, ámbar como acento, papel apenas cálido.
   Tablero claro: resumen arriba, detalle abajo. Diseño en el lienzo "Birkka Xray — rediseño". */
:root {
  --ink: #262422;
  --ink-2: #4a4743;
  --muted: #67625c;
  --line: #e3dfd8;
  --paper: #f5f3ef;
  --surface: #ffffff;
  --amber: #dc9814;
  --amber-ink: #8a5a00;
  --amber-soft: #fbefd6;
  --up: #1e7a46;
  --up-soft: #e4f3ea;
  --down: #b3261e;
  --down-soft: #fbe6e4;
  --info: #2f5a8a;
  --info-soft: #e6eef7;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); }
a { color: var(--amber-ink); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; }
h1 { font-size: 36px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 22px; line-height: 1.25; font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
code { background: #ece8e1; padding: .1em .35em; border-radius: 4px; font-size: .88em; word-break: break-all; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lede { color: var(--ink-2); font-size: 16px; max-width: 720px; }
.pos { color: var(--up); }
.neg { color: var(--down); }
.flat { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
main.wrap { padding-top: 32px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 24px; }

/* Barra superior */
.topbar { background: var(--ink); color: #fff; }
.topbar-inner { min-height: 64px; display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--display); font-size: 18px; font-weight: 600; }
.brand:hover { color: #fff; }
.brand em { font-style: normal; color: var(--amber); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--amber); color: var(--ink); display: grid; place-items: center; font-weight: 700; }
.brand-mark.big { width: 56px; height: 56px; font-size: 28px; border-radius: 14px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.nav a { color: #d9d5ce; text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: #3a3734; color: #fff; }
.nav a.on { background: var(--amber); color: var(--ink); }
.topbar-side { display: flex; align-items: center; gap: 16px; font-size: 14px; color: #d9d5ce; }
.topbar-side a { color: #d9d5ce; }
.topbar-side a.on { color: var(--amber); }
.topbar-side form { margin: 0; }
.topbar-side .linkbtn { color: #d9d5ce; }

/* Encabezado de página */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.crumb { font-size: 14px; font-weight: 600; text-decoration: none; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }

/* Bloques */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.flush { padding: 0; overflow-x: auto; }
.card.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.card.dark .muted, .card.dark p { color: #d9d5ce; }
.card.dark a { color: var(--amber); }
.card.accent { border: 2px solid var(--amber); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .main { flex: 3 1 620px; min-width: 0; }
.split > .side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.split > .half { flex: 1 1 460px; min-width: 0; }
.banner { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 16px 20px; background: var(--amber-soft); border-radius: 12px; }
.banner strong { font-size: 16px; }

/* Tarjetas de "Lo que estás siguiendo" */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--ink-2); color: var(--ink); }
.tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tile-head span { font-size: 13px; color: var(--muted); }
.tile .big { font-family: var(--display); font-size: 40px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .go { color: var(--amber-ink); font-weight: 600; font-size: 14px; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.kpi > span:first-child { font-size: 13px; color: var(--muted); }
.kpi strong { font-family: var(--display); font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi em { font-style: normal; font-size: 13px; }

/* Estado de la actualización */
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 16px; }
.status form { margin: 0; }
.status-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--up); flex: none; }
.status-dot.off { background: var(--down); }
.status-dot.busy { background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
.status-text { display: flex; flex-direction: column; line-height: 1.3; }
.status-text strong { font-size: 14px; }
.status-text span { font-size: 13px; color: var(--muted); }
@keyframes pulse { 50% { opacity: .35; } }

/* Etiquetas */
.tag { display: inline-block; font-size: 12px; font-weight: 600; line-height: 20px; padding: 0 8px; border-radius: 999px; white-space: nowrap; background: #ece8e1; color: var(--ink-2); }
.tag.mine { background: var(--ink); color: #fff; }
.tag.soft { background: var(--paper); border: 1px solid var(--line); }
.tag.ok { background: var(--up-soft); color: var(--up); }
.tag.down { background: var(--down-soft); color: var(--down); }
.tag.up { background: var(--up-soft); color: var(--up); }
.tag.new { background: var(--amber-soft); color: var(--amber-ink); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.lg { font-size: 14px; line-height: 28px; padding: 0 12px; }
.pill { font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none; white-space: nowrap; cursor: pointer; }
.pill:hover { border-color: var(--ink-2); color: var(--ink); }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn.primary:hover { background: #c88a10; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #3a3734; color: #fff; }
.btn.danger { color: var(--down); }
.btn.sm { padding: 8px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--amber-ink); cursor: pointer; text-decoration: underline; }
.linkbtn.neg { color: var(--down); }
label { font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; }
input[type=text], input[type=url], input[type=password], input[type=search], textarea, select {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
}
select { width: auto; background: var(--surface); padding: 8px 10px; border-radius: 8px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--amber-soft); border-color: var(--amber); }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.segmented label { display: flex; align-items: center; gap: 6px; padding: 10px 14px; font-weight: 500; cursor: pointer; }
.segmented input { accent-color: var(--amber); margin: 0; }
.segmented label:has(input:checked) { background: var(--ink); color: #fff; }
.add-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.add-form .field { flex: 1 1 460px; }
.add-form .hint { flex: 1 1 100%; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 6px; }

/* Avisos */
.flash { padding: 12px 16px; border-radius: 10px; border: 1px solid; font-size: 14px; }
.flash-ok { background: var(--up-soft); border-color: #bfe3cd; color: #17653a; }
.flash-warn { background: var(--amber-soft); border-color: #f0d79c; color: #6b4600; }
.flash-error { background: var(--down-soft); border-color: #f5c2bc; color: #922b21; }

/* Tablas */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px; white-space: nowrap; }
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table .r { text-align: right; }
.table tbody tr:hover td { background: #fcfbf9; }
.table tr.mine td { background: #fbf6ea; }
.table tr.paused td { opacity: .6; }
.table.compact td { padding: 8px 12px; }
.table-note { padding: 12px 20px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.thumb { flex: none; width: 44px; height: 44px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); object-fit: contain; }
.thumb.lg { width: 88px; height: 88px; border-radius: 12px; background: var(--surface); }
.item-cell { display: flex; gap: 12px; align-items: center; min-width: 260px; }
.item-cell > span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.item-title { color: var(--ink); font-weight: 600; text-decoration: none; }
.item-title:hover { color: var(--amber-ink); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.pos-num { font-family: var(--display); font-size: 18px; font-weight: 700; }

/* "Qué cambió" */
.feed { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.feed li { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 20px; }
.feed li + li { border-top: 1px solid var(--line); }
.feed .what { display: flex; flex-direction: column; min-width: 0; }
.feed .what a { color: var(--ink); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .what span { font-size: 14px; color: var(--muted); }
.feed .value { display: flex; flex-direction: column; align-items: flex-end; }
.feed .value span { font-size: 13px; color: var(--muted); }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }

/* Primer uso y Cómo funciona */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; flex-direction: column; gap: 14px; }
.step-head { display: flex; gap: 16px; align-items: center; }
.step-head > span:last-child { display: flex; flex-direction: column; flex: 1 1 auto; }
.step-body { padding-left: 48px; }
.step-num { flex: none; width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; background: var(--paper); border: 1px solid var(--line); }
.step-num.done { background: var(--up); border-color: var(--up); color: #fff; }
.step-num.now { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.step-num.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.timeline li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
.timeline strong { color: var(--amber); }
.timeline span { color: #e7e3dc; }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 16px; }
.flow > section { flex: 1 1 320px; display: flex; flex-direction: column; gap: 16px; }
.flow .chev { display: grid; place-items: center; width: 24px; color: var(--muted); }
.box { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 10px; background: var(--paper); }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.glossary { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; }
.glossary dt { font-weight: 600; }
.glossary dd { margin: 2px 0 0; color: var(--ink-2); }
.facts { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* Gráficos */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--body); font-size: 12px; fill: var(--muted); }
.chart .grid { stroke: #ece8e1; stroke-width: 1; }
.chart .bar { fill: var(--amber); }
.chart .bar-before { fill: #cfc9bf; }
.chart .bar-missing { fill: #e3dfd8; }
.chart .marker { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .marker-label { fill: var(--ink); font-weight: 600; }
.chart .price-line { stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.chart .price-dot { fill: var(--ink); }
.chart .strip-rail { stroke: var(--line); stroke-width: 6; stroke-linecap: round; }
.chart .strip-dot { fill: var(--muted); fill-opacity: .55; }
.chart .strip-mark { fill: var(--amber); stroke: var(--ink); stroke-width: 2; }
.chart-empty { padding: 36px 12px; text-align: center; color: var(--muted); }
.spark { vertical-align: middle; margin-right: 8px; }
.spark polyline { stroke: var(--amber); }

/* Progreso de la actualización (Ajustes) */
.run-status { background: var(--amber-soft); border: 1px solid #f0d79c; border-radius: 10px; padding: 12px 14px; }
.run-status[hidden] { display: none; }
.run-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.bar-track { height: 8px; background: #fff; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 5%; background: var(--amber); border-radius: 999px; transition: width .4s ease; }
.bar-fill.indeterminate { width: 30% !important; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
.run-detail { margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Login */
.login { max-width: 400px; margin: 10vh auto 0; display: flex; flex-direction: column; gap: 20px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.login-brand h1 em { font-style: normal; color: var(--amber-ink); }
.danger-zone { display: flex; justify-content: flex-end; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .status-dot.busy, .bar-fill.indeterminate { animation: none; }
  .bar-fill { transition: none; }
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glossary { grid-template-columns: 1fr; }
  .feed li { grid-template-columns: minmax(0, 1fr) auto; }
  .feed li > .tag { grid-column: 1 / -1; justify-self: start; }
  .flow .chev { display: none; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  h1 { font-size: 28px; }
  .step-body { padding-left: 0; }
  .topbar-side span { display: none; }
}
