/* DAELUS Gestión · estilos */
:root {
  --indigo: #1B2266; --indigo-2: #2E3B94; --indigo-3: #252E80;
  --orange: #FF6B35; --orange-d: #E85A24;
  --turq: #00A6B4; --coral: #FF4F6D; --amber: #FFB400; --violet: #7B4DFF;
  --marble: #F7F5F0; --ink: #1E2033; --muted: #6B6F85; --line: #E6E2D8;
  --ok: #2E9E5B; --warn: #9A6C00; --err: #D64545;
  --radius: 14px; --shadow: 0 1px 2px rgba(20, 24, 60, .06), 0 4px 14px rgba(20, 24, 60, .06);
  --font: 'Montserrat', 'Segoe UI', Arial, sans-serif; --brand: 'Cinzel', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--marble); line-height: 1.45; }
a { color: var(--indigo-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--indigo); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
h3 { font-size: 17px; font-weight: 700; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.red { color: var(--err); font-weight: 600; }
.green { color: var(--ok); font-weight: 600; }

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: 0 0 232px; background: var(--indigo); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; }
.brand svg { width: 30px; height: 39px; }
.brand-word { font-family: var(--brand); font-weight: 700; font-size: 22px; letter-spacing: 2px; }
.brand-sub { display: block; font-family: var(--font); font-size: 10px; letter-spacing: 3px; color: #FFB08F; font-weight: 700; margin-top: -2px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #D5D9F2; font-weight: 600; }
.nav a:hover { background: rgba(255, 255, 255, .07); text-decoration: none; color: #fff; }
.nav a.active { background: var(--orange); color: #fff; }
.nav svg { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { padding: 14px 22px 20px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 12px; color: #C9CEEA; }
.side-foot button { margin-top: 8px; }
main { flex: 1; min-width: 0; padding: 24px 32px 48px; }
.topbar { display: none; }
.view { max-width: 1240px; margin: 0 auto; }

/* ---------- Encabezados ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-block; margin-bottom: 6px; color: var(--muted); font-weight: 600; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Botones ---------- */
.btn { font-family: inherit; font-size: 13px; font-weight: 700; border: 1px solid transparent; border-radius: 10px; padding: 9px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--indigo); border-color: var(--line); text-decoration: none; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn.primary:hover { background: var(--orange-d); }
.btn.dark { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn.wa { background: #25A55F; color: #fff; border-color: #25A55F; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.icon-btn { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--marble); color: var(--ink); }
.linklike { border: 0; background: none; color: var(--indigo-2); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }

/* ---------- Tarjetas y KPIs ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.flat { box-shadow: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--indigo)); }
.kpi .label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-size: 24px; font-weight: 700; color: var(--indigo); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cols.even { grid-template-columns: 1fr 1fr; }

/* ---------- Tablas ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #FBFAF7; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; }
.tbl .code { font-weight: 700; color: var(--indigo); white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

/* ---------- Chips ---------- */
.chip { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 3px 9px; border-radius: 999px; color: var(--i, var(--c)); background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; }

/* ---------- Barras ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 90px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { background: var(--marble); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--c, var(--indigo)); border-radius: 999px; min-width: 2px; }
.meter { height: 12px; border-radius: 999px; background: var(--marble); overflow: hidden; margin: 8px 0 4px; }
.meter > div { height: 100%; background: var(--c, var(--turq)); }

/* ---------- Listas simples ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
.list li:last-child { border-bottom: 0; }
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 13px; border: 1px solid; }
.alert.warn { background: #FFF6DE; border-color: #F2D48A; color: #6B4E00; }
.alert.err { background: #FDECEC; border-color: #F2B5B5; color: #8A2222; }
.alert.info { background: #E6F6F7; border-color: #A6DDE2; color: #0B5A61; }

/* ---------- Barra de filtros ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 150px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 9px 14px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--indigo); color: #fff; }

/* ---------- Tablero (kanban) ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #EFECE4; border-radius: var(--radius); padding: 10px; min-height: 120px; }
.kcol-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; margin: 2px 4px 10px; color: var(--indigo); }
.kcard { background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer; border-left: 4px solid var(--c, var(--indigo)); }
.kcard:hover { outline: 2px solid color-mix(in srgb, var(--indigo) 20%, transparent); }
.kcard .t { font-weight: 700; color: var(--indigo); font-size: 13px; }
.kcard .m { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kcard .f { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 6px; }

/* ---------- Detalle ---------- */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.totals { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; justify-content: end; font-size: 13px; }
.totals .grand { font-size: 17px; font-weight: 700; color: var(--indigo); padding-top: 6px; border-top: 1px solid var(--line); }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.estado-box select { font: inherit; font-weight: 700; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); width: 100%; margin: 6px 0 10px; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 12px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea, .item-row input { font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus, .item-row input:focus, .toolbar input:focus, .toolbar select:focus { outline: 2px solid color-mix(in srgb, var(--orange) 45%, transparent); border-color: var(--orange); }
.field small { font-weight: 500; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink); margin: 8px 0 12px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--orange); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 0 12px; }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--orange-d); margin: 6px 0 8px; }
.items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.item-row { display: grid; grid-template-columns: 1fr 80px 110px 34px; gap: 8px; align-items: center; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.preset { font: inherit; font-size: 12px; font-weight: 600; border: 1px dashed var(--line); background: var(--marble); border-radius: 999px; padding: 5px 10px; cursor: pointer; color: var(--indigo); }
.preset:hover { border-color: var(--orange); color: var(--orange-d); }
.totals-preview { background: var(--marble); border-radius: 10px; padding: 10px 14px; margin: 4px 0 14px; font-size: 13px; text-align: right; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 18, 50, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 8px; }
.modal-body { padding: 8px 22px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px 20px; }

/* ---------- Avisos ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--indigo); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; max-width: 360px; transition: opacity .4s, transform .4s; }
.toast.error { background: var(--err); }
.toast.out { opacity: 0; transform: translateY(8px); }
.banner { background: #FFF1EA; border: 1px solid #FFD0BC; color: #8A3412; border-radius: 12px; padding: 10px 14px; margin: 0 auto 18px; max-width: 1240px; font-size: 13px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.err { background: #FDECEC; border-color: #F2B5B5; color: #8A2222; }

/* ---------- Ingreso ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--indigo); padding: 20px; }
.login-card { background: #fff; border-radius: 22px; padding: 34px 32px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login-card .brand { padding: 0 0 18px; color: var(--indigo); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; padding: 12px; }
.login-card .linklike { margin-top: 14px; font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) { .cols, .cols.even { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  #app { flex-direction: column; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; width: 100%; height: auto; flex-direction: row; z-index: 40; }
  .sidebar .brand, .side-foot { display: none; }
  .nav { flex-direction: row; padding: 6px; gap: 0; overflow-x: auto; }
  .nav a { flex-direction: column; gap: 3px; font-size: 10px; padding: 7px 10px; min-width: 64px; align-items: center; }
  main { padding: 0 14px 96px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; color: var(--indigo); }
  .topbar .brand { padding: 0; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr 64px 90px 30px; }
  .bar-row { grid-template-columns: 90px 1fr 80px; }
  .kv { grid-template-columns: 110px 1fr; }
  h1 { font-size: 20px; }
}
/* ---------- Líneas de negocio ---------- */
.lineas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.linea-card { margin-bottom: 0; border-top: 4px solid var(--c); display: flex; flex-direction: column; }
.linea-card .actions { margin-top: auto; padding-top: 4px; }
.lc-head { display: flex; gap: 12px; align-items: center; }
.lc-title { flex: 1; min-width: 0; }
.lc-logo svg { width: 32px; height: 42px; display: block; }
.lc-logo.lg svg { width: 44px; height: 57px; }
.lc-code { font-family: var(--brand); font-weight: 700; font-size: 18px; color: var(--indigo); letter-spacing: 1px; }
.lc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 10px; }
.lc-stat { background: var(--marble); border-radius: 10px; padding: 8px 10px; }
.lc-stat .k { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.lc-stat .v { font-weight: 700; color: var(--indigo); margin-top: 2px; font-variant-numeric: tabular-nums; }
.guide { margin: 0; padding-left: 20px; }
.guide li { margin-bottom: 7px; }
.preview-sub { display: flex; align-items: center; gap: 14px; background: var(--marble); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; }
.pv-code { font-weight: 700; letter-spacing: 5px; font-size: 15px; }
.pv-note { margin-left: auto; text-align: right; }
.color-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.color-row input[type=color] { width: 56px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--indigo); }
.cat-row { display: grid; grid-template-columns: 1fr 110px 34px; gap: 8px; align-items: center; }
.cat-row input { font: inherit; font-size: 14px; color: var(--ink); padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
.cat-row input:focus { outline: 2px solid color-mix(in srgb, var(--orange) 45%, transparent); border-color: var(--orange); }
.field input[readonly] { background: var(--marble); color: var(--muted); }
@media (max-width: 860px) { .cat-row { grid-template-columns: 1fr 90px 30px; } .lineas-grid { grid-template-columns: 1fr; } }
@media print { .sidebar, .actions, .toolbar, .banner, #toasts { display: none !important; } main { padding: 0; } .card { box-shadow: none; } }
