/* ---------------------------------------------------------------------
   DTF Gestión — misma base visual que IDDI Gestión: tinta grafito (#2b2b2b) sobre papel
   gris claro (#ebebeb), monocromo. Los únicos colores son los
   de estado (ok / atención / error). Números en monoespaciada porque acá
   los números (espesores, precios, stock) son el contenido.
   Tema oscuro: se activa con el botón ◐ o según el sistema.
------------------------------------------------------------------------ */
:root {
  --bg: #ebebeb;
  --panel: #f7f7f7;
  --panel-2: #efefef;
  --line: #d4d4d4;
  --text: #2b2b2b;
  --text-muted: #6b6b6b;
  --accent: #2b2b2b;
  --accent-ink: #f7f7f7;
  --ok: #1f8a5b;
  --warn: #b26b00;
  --danger: #c23b3b;

  --side-bg: #2b2b2b;
  --side-text: #ebebeb;
  --side-muted: #9a9a9a;
  --side-hover: #363636;

  --radius: 8px;
  --font-ui: "Segoe UI", -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-display: Bahnschrift, "Segoe UI", sans-serif;
  --font-mono: Consolas, "SFMono-Regular", "Liberation Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1d1d; --panel: #262626; --panel-2: #2e2e2e; --line: #3b3b3b;
    --text: #ebebeb; --text-muted: #9c9c9c; --accent: #ebebeb; --accent-ink: #1d1d1d;
    --ok: #4cc38a; --warn: #f0a83a; --danger: #ff6b6b;
    --side-bg: #141414; --side-text: #ebebeb; --side-muted: #8a8a8a; --side-hover: #242424;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1d1d; --panel: #262626; --panel-2: #2e2e2e; --line: #3b3b3b;
  --text: #ebebeb; --text-muted: #9c9c9c; --accent: #ebebeb; --accent-ink: #1d1d1d;
  --ok: #4cc38a; --warn: #f0a83a; --danger: #ff6b6b;
  --side-bg: #141414; --side-text: #ebebeb; --side-muted: #8a8a8a; --side-hover: #242424;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
.icon { display: inline-flex; flex-shrink: 0; }

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---------------- Barra superior ---------------- */
.topbar {
  height: 52px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: var(--side-bg); color: var(--side-text);
}
.tb-logo img { display: block; height: 30px; width: auto; filter: invert(93%); }
.tb-volver {
  color: var(--side-muted); font-size: 13px; padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--side-hover);
}
.tb-volver:hover { color: var(--side-text); border-color: var(--side-muted); }
body.en-inicio .tb-volver { display: none; }
.tb-titulo {
  margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 19px; letter-spacing: .6px;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-acciones { display: flex; gap: 8px; }
.tb-btn {
  background: transparent; color: var(--side-muted); border: 1px solid var(--side-hover);
  border-radius: 6px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; font-family: var(--font-ui);
}
.tb-btn:hover { color: var(--side-text); border-color: var(--side-muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); display: inline-block; }
.theme-btn {
  background: transparent; border: 1px solid var(--side-hover); color: var(--side-muted);
  border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 14px;
}
.theme-btn:hover { color: var(--side-text); border-color: var(--side-muted); }

/* ---------------- Main ---------------- */
.main { min-width: 0; flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.content { padding: 18px 28px 28px; width: 100%; overflow-y: auto; flex: 1; }

.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; min-height: 36px; }
.view-header .sub, .hero .sub { color: var(--text-muted); font-size: 12.5px; }

/* ---------------- Panel de inicio (sin scroll) ---------------- */
.panel-inicio { display: flex; flex-direction: column; height: 100%; min-height: 560px; }
.pi-cabecera { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 4px; }
.pi-cabecera h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 24px; letter-spacing: .4px; }
.pi-cabecera .sub { color: var(--text-muted); font-size: 13px; }
.pi-resumen { display: flex; gap: 18px; color: var(--text-muted); font-size: 13px; }
.pi-resumen b { color: var(--text); font-family: var(--font-mono); }
.panel-inicio .section-title { margin: 16px 0 10px; }
.pi-grid { display: grid; gap: 12px; }
.pi-gestion { grid-template-columns: repeat(5, minmax(0, 1fr)); flex: 1.5; min-height: 150px; }
.pi-herr { grid-template-columns: repeat(5, minmax(0, 1fr)); flex: 1; min-height: 110px; }
.pi-sistema { grid-template-columns: repeat(5, minmax(0, 1fr)); flex: .8; min-height: 90px; }
.pi-tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
  transition: border-color .15s ease, transform .15s ease;
}
.pi-tile:hover { border-color: var(--text); transform: translateY(-1px); }
.pi-tile .pi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: auto; padding-bottom: 8px; }
.pi-tile strong { font-size: 16px; font-weight: 600; }
.pi-tile small { color: var(--text-muted); font-size: 12px; }
.pi-valor { font-family: var(--font-mono); font-size: 18px; font-weight: 600; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-detalle { color: var(--text-muted); font-size: 12px; }
.pi-tile.aviso { border-color: var(--warn); }
.pi-tile.aviso .pi-detalle { color: var(--warn); }
.pi-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-muted); }
.pi-tile.aviso .pi-badge { border-color: var(--warn); color: var(--warn); }
.pi-herr .pi-tile, .pi-sistema .pi-tile { padding: 12px 16px; }

.btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-ui);
}
.btn:hover { opacity: 0.88; }
.btn.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: var(--text-muted); opacity: 1; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.small { padding: 5px 10px; font-size: 12px; }

/* ---------------- Inicio ---------------- */
.hero { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.hero-mark { width: 54px; height: auto; }
:root[data-theme="dark"] .hero-mark { filter: invert(93%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-mark { filter: invert(93%); } }
.hero h1 { font-size: 26px; }
.hero-text { flex: 1; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* "Hoy": dos columnas de paneles con filas accionables */
.hoy-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
.hoy-col { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1050px) { .hoy-grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.hoy-grid .panel, .hoy-col .panel { margin-bottom: 0; }
.panel > header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel > header h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 14px; letter-spacing: .4px; }
.panel-body { padding: 14px 16px; }
.panel-body p { margin: 0 0 10px; }
.ver-todo { font-size: 12px; color: var(--text-muted); }
.ver-todo:hover { color: var(--text); }
.fila { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.fila:last-child { border-bottom: none; }
.fila:hover { background: var(--panel-2); }
.fila-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fila-main small { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-acc { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.vacio { color: var(--text-muted); padding: 16px; font-size: 13px; }
.num { font-family: var(--font-mono); white-space: nowrap; }
.muted { color: var(--text-muted); }
.alerta, small.alerta { color: var(--danger) !important; }
.card .detail { color: var(--text-muted); font-size: 11.5px; margin-top: 6px; }
.card.destacado { border-color: var(--text); }
.spacer { flex: 1; }

/* chips (filtros y opciones rápidas) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chips.filtros { margin: 0 0 14px; }
.chip {
  background: var(--panel); border: 1px solid var(--line); color: var(--text-muted);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; font-family: var(--font-ui);
}
.chip:hover { color: var(--text); border-color: var(--text-muted); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.buscador {
  background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius);
  padding: 8px 12px; width: 280px; font-family: var(--font-ui); font-size: 13px;
}
.buscador:focus { outline: 1px solid var(--text); border-color: var(--text); }
label.inline { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
label.inline input { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 6px 8px; font-family: var(--font-ui); }

/* tablas con filas clicables y columna de acciones */
tr.clic { cursor: pointer; }
td.acciones { white-space: nowrap; text-align: right; }
td.acciones > * + * { margin-left: 6px; }
table.mini { margin-bottom: 4px; }
table.mini td { padding: 7px 10px; font-size: 12.5px; }

/* Pedidos: tablero */
.tablero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 900px) { .tablero { grid-template-columns: 1fr; } }
.columna { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.columna > header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 4px; }
.columna h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; }
.contador { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.tarjeta { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.tarjeta:hover { border-color: var(--text-muted); }
.tarjeta p { margin: 0; color: var(--text-muted); font-size: 12.5px; }
.tarjeta-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; font-size: 11px; }
.tarjeta-plata { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 12.5px; margin-top: 4px; }
.tarjeta-acc { display: flex; gap: 6px; margin-top: 6px; }
.tarjeta[draggable="true"] { cursor: grab; }
.tarjeta.arrastrando { opacity: .45; }
.columna.soltar { border-color: var(--text); border-style: dashed; background: var(--panel); }

/* Pedidos: letra un poco más grande, resumen de plata e historial en colores */
.vista-pedidos tbody td { font-size: 15px; padding: 12px 14px; }
.vista-pedidos thead th { font-size: 12px; }
.vista-pedidos .tarjeta strong { font-size: 15.5px; }
.vista-pedidos .tarjeta p { font-size: 14px; }
.vista-pedidos .tarjeta-plata { font-size: 14px; }
.vista-pedidos .tarjeta-top { font-size: 12px; }
.vista-pedidos .columna h3 { font-size: 14px; }
.vista-pedidos .chip { font-size: 14px; padding: 6px 14px; }
.vista-pedidos .controles.compacto .control { font-size: 12.5px; padding: 3px 7px 3px 4px; }
.vista-pedidos .controles.compacto .control .check { width: 15px; height: 15px; font-size: 10px; }
.vista-pedidos .section-title { font-size: 12.5px; }

.ped-resumen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 900px) { .ped-resumen { grid-template-columns: 1fr; } }
.ped-kpi {
  display: flex; align-items: baseline; gap: 10px; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 8px; padding: 12px 16px; color: var(--text); font-family: var(--font-ui);
}
.ped-kpi:hover { border-color: var(--text-muted); }
.ped-kpi b { font-family: var(--font-mono); font-size: 21px; font-weight: 600; white-space: nowrap; }
.ped-kpi span { color: var(--text-muted); font-size: 14px; }
.ped-kpi.rojo { border-left-color: var(--danger); }
.ped-kpi.rojo b { color: var(--danger); }
.ped-kpi.verde { border-left-color: var(--ok); }
.ped-kpi.verde b { color: var(--ok); }
.ped-kpi.ambar { border-left-color: var(--warn); }
.ped-kpi.ambar b { color: var(--warn); }

.punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.punto.rojo { background: var(--danger); }
.punto.verde { background: var(--ok); }
tr.fila-debe { background: color-mix(in srgb, var(--danger) 13%, var(--panel)); }
tr.fila-debe:hover { background: color-mix(in srgb, var(--danger) 20%, var(--panel)); }
tr.fila-debe td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
tr.fila-pagada { background: color-mix(in srgb, var(--ok) 12%, var(--panel)); }
tr.fila-pagada:hover { background: color-mix(in srgb, var(--ok) 19%, var(--panel)); }
tr.fila-pagada td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
tr.fila-cancelada td { color: var(--text-muted); text-decoration: line-through; }
tr.fila-cancelada td:last-child, tr.fila-cancelada td:nth-child(4) { text-decoration: none; }
.saldo-cobrar { display: inline-flex; align-items: center; gap: 10px; }
.btn.small.cobrar { font-family: var(--font-ui); }

.section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 11.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 30px 0 12px;
  display: flex; align-items: center; gap: 12px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s ease, transform .15s ease;
}
.tile .icon { margin-bottom: 12px; color: var(--text); }
.tile strong { font-size: 14.5px; font-weight: 600; }
.tile small { color: var(--text-muted); font-size: 12px; line-height: 1.35; }
.tile:hover { border-color: var(--text); transform: translateY(-1px); }
.tiles.compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tiles.compact .tile { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
.tiles.compact .tile .icon { margin: 0; }
.tiles.compact .tile div { display: flex; flex-direction: column; min-width: 0; }

/* ---------------- Cards / grid ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: block;
}
a.card:hover { border-color: var(--text-muted); }
.card .kpi { font-family: var(--font-mono); font-size: 24px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cards.reporte { grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); }
.cards.reporte .kpi { font-size: 20px; }
.card .label { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.card.warn { border-color: var(--warn); }
.card.warn .kpi { color: var(--warn); }


/* ---------------- Table ---------------- */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 600;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { font-family: var(--font-mono); text-align: right; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); color: var(--text-muted); }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.danger { color: var(--danger); border-color: var(--danger); }
.tag.accent { color: var(--text); border-color: var(--text); }

/* ---------------- Forms / modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  width: 100%; max-width: 860px; padding: 22px 24px; box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  position: relative;
}
.modal-cerrar {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1; cursor: pointer;
}
.modal-cerrar:hover { border-color: var(--text); }
.modal h2 { padding-right: 44px; }
.modal h2 { margin: 0 0 16px 0; font-size: 17px; font-family: var(--font-display); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 8px 10px; border-radius: 6px; font-family: var(--font-ui); font-size: 13.5px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 1px solid var(--text); border-color: var(--text); }
.field textarea { resize: vertical; min-height: 60px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.modal.wide { max-width: 980px; }
.modal h2 .tag { vertical-align: middle; margin-left: 6px; }
.modal .sub { color: var(--text-muted); font-size: 12.5px; }
.form-sub { font-family: var(--font-display); font-weight: 400; font-size: 12px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--text-muted); margin: 20px 0 8px; }
.hint { color: var(--text-muted); font-size: 11px; display: block; margin-top: 3px; min-height: 13px; }
.field { margin-bottom: 10px; }
.form-grid .field { margin-bottom: 0; }

/* ítems del presupuesto: una línea por ítem, como planilla */
.items { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px 10px; }
.item-head, .item { display: grid; grid-template-columns: minmax(0, 1fr) 80px 120px 120px 130px 28px; gap: 8px; align-items: center; }
.item-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); padding: 0 2px 6px; }
.item { margin-bottom: 6px; }
.item input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 7px 9px; border-radius: 6px; font-family: var(--font-ui); font-size: 13.5px;
}
.item input[type=number] { font-family: var(--font-mono); text-align: right; }
.item input:focus { outline: 1px solid var(--text); border-color: var(--text); }
.item .num { text-align: right; font-size: 13px; }
.items > .btn { margin-top: 4px; }
.totals-bar { display: flex; justify-content: flex-end; align-items: flex-end; gap: 28px; margin: 12px 0 16px; font-family: var(--font-mono); }
.totals-bar .t-label { color: var(--text-muted); font-size: 11px; display: block; font-family: var(--font-ui); }
.totals-bar .t-val { font-size: 16px; }
.precio-final {
  width: 170px; font-family: var(--font-mono); font-size: 18px; font-weight: 600; text-align: right;
  background: var(--bg); border: 1px solid var(--text); color: var(--text); padding: 6px 10px; border-radius: 6px;
}
.modal-actions { align-items: center; }

/* Orden de trabajo (pedido): renglones como la planilla */
.items.orden .item-head, .items.orden .item {
  grid-template-columns: 22px 64px minmax(0, 1fr) 110px 120px minmax(0, .7fr) 28px;
}
.items.orden input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); justify-self: center; }
.items.orden .item.listo input:not([type=checkbox]) { color: var(--text-muted); text-decoration: line-through; }
.orden-cabecera { grid-template-columns: 1.4fr 1fr; }
.orden-pie { display: flex; justify-content: space-between; gap: 20px; margin: 14px 0; align-items: flex-start; flex-wrap: wrap; }
.orden-pie-izq { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 300px; }
.orden-pie-izq .field input { max-width: 200px; }
.a-cuenta { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.a-cuenta .chips { margin: 0; }
.orden-totales { min-width: 260px; font-family: var(--font-mono); }
.orden-totales div { display: flex; justify-content: space-between; gap: 18px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.orden-totales div:first-child { border-top: 2px solid var(--text); }
.orden-totales span { font-family: var(--font-display); letter-spacing: 1.4px; font-size: 12px; color: var(--text-muted); }
.orden-totales b { font-size: 16px; }
.orden-totales .pendiente b { color: var(--danger); font-size: 18px; }

/* Casillas de control: Construido · Entregado · Pago · Facturado */
.controles { display: flex; gap: 6px; flex-wrap: wrap; }
.control {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px 5px 6px; cursor: pointer; color: var(--text-muted); font-size: 12.5px; font-family: var(--font-ui);
}
.control:hover { border-color: var(--text-muted); color: var(--text); }
.control .check {
  width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.control.on { color: var(--text); border-color: var(--text); }
.control.on .check { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.controles.compacto { gap: 3px; flex-wrap: nowrap; }
.controles.compacto .control { padding: 2px 6px 2px 3px; font-size: 11px; gap: 3px; }
.controles.compacto .control .check { width: 13px; height: 13px; font-size: 9px; }

/* Reportes: gráfico de barras (paleta de datos validada; la marca es monocroma,
   los datos usan los 2 primeros colores categóricos para distinguir series) */
:root { --serie-1: #2a78d6; --serie-2: #eb6834; --grilla: #e1e0d9; --eje: #c3c2b7; --tick: #898781; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --serie-1: #3987e5; --serie-2: #d95926; --grilla: #2c2c2a; --eje: #383835; }
}
:root[data-theme="dark"] { --serie-1: #3987e5; --serie-2: #d95926; --grilla: #2c2c2a; --eje: #383835; }
.viz-wrap { position: relative; }
svg.viz { width: 100%; height: auto; display: block; }
svg.viz .grilla { stroke: var(--grilla); stroke-width: 1; }
svg.viz .eje { stroke: var(--eje); stroke-width: 1; }
svg.viz .tick { fill: var(--tick); font-size: 11px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
svg.viz .bar.s1 { fill: var(--serie-1); }
svg.viz .bar.s2 { fill: var(--serie-2); }
svg.viz .hit { fill: transparent; cursor: default; }
svg.viz .hit.on { fill: var(--text); fill-opacity: .05; }
.viz-tip {
  position: absolute; top: 8px; transform: translateX(-50%); min-width: 170px; pointer-events: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12); font-size: 12.5px; display: flex; flex-direction: column; gap: 3px;
}
.viz-tip[style*="right"] { transform: none; }
.viz-tip strong { text-transform: capitalize; margin-bottom: 2px; }
.viz-tip b { font-family: var(--font-mono); font-weight: 600; margin-left: auto; padding-left: 10px; }
.viz-tip div { display: flex; align-items: center; gap: 6px; }
.leyenda { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.s1 { background: var(--serie-1); }
.sw.s2 { background: var(--serie-2); }
tr.total td { border-top: 2px solid var(--text); font-weight: 600; }
.sel-anio { width: auto; }
table.mini.medios { width: auto; min-width: 420px; margin-bottom: 8px; }
.acciones-pie { justify-content: flex-end; margin: 4px 0 30px; }

/* guía cuando no hay datos */
.empty.guia { grid-column: 1 / -1; text-align: left; display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.empty.guia a { text-decoration: underline; }

/* ficha de cliente */
.datos-cliente { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 18px; margin-bottom: 12px; }
/* otros CUIT del mismo cliente: razón social + CUIT por renglón */
.otros-cuit { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.fila-otro-cuit { display: grid; grid-template-columns: 2fr 1fr auto; gap: 6px; width: 100%; }
.dato { display: flex; flex-direction: column; }
.dato span { font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); }
.dato strong { font-weight: 500; }
.notas-cliente { background: var(--panel-2); border-radius: 6px; padding: 8px 12px; white-space: pre-wrap; }
.form-grid .form-sub.full { margin: 10px 0 0; }
.form-grid .form-sub.full:first-child { margin-top: 0; }

/* progreso de renglones en la tarjeta */
.progreso { display: flex; align-items: center; gap: 8px; }
.progreso .barra { flex: 1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progreso .barra div { height: 100%; background: var(--text); }
.progreso small { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

.empty { color: var(--text-muted); padding: 30px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 6px; font-size: 13px; opacity: 0; transform: translateY(8px);
  transition: all 0.2s ease; pointer-events: none; z-index: 60;
}
.toast.show { opacity: 1; transform: translateY(0); }

.icon-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 4px; }
.icon-btn:hover { color: var(--danger); }

