/* ==========================================================================
   SIGAP Vijes - components.css
   Buttons, badges, cards, KPI tiles, tables, forms, modals, tabs, charts.
   ========================================================================== */

/* ------------------------------ Buttons --------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border: 1px solid #d3dae3; border-radius: 7px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: #c3ccd7; }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-danger { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.btn-danger:hover { background: #981f18; border-color: #981f18; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #2a1c00; }
.btn-amber:hover { background: #e39712; border-color: #e39712; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 15px; }
.btn-icon { width: 34px; padding: 0; }
.btn-count { background: var(--primary); color: #fff; border-radius: 9px; min-width: 18px; height: 18px; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.btn-block { width: 100%; }

/* ------------------------------- Badges --------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 11px; font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; }
.badge-verde { background: var(--verde-bg); color: var(--verde); }
.badge-amarillo { background: var(--amarillo-bg); color: var(--amarillo); }
.badge-rojo { background: var(--rojo-bg); color: var(--rojo); }
.badge-azul { background: var(--azul-bg); color: var(--azul); }
.badge-gris { background: var(--gris-bg); color: var(--gris); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; margin-left: 6px; vertical-align: 1px; }
.tags .tag { margin: 0 4px 2px 0; }
.tag-demo { background: var(--amber-50); color: var(--amarillo); border: 1px dashed var(--amarillo-line); letter-spacing: .4px; }

/* ------------------------------- Cards ---------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-title { font-family: var(--font-head); font-size: 16px; font-weight: 600; line-height: 1.3; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-actions { display: flex; gap: 4px; align-items: center; flex: none; margin: -4px -8px 0 0; }
.card-body { padding: 18px 20px 20px; }
.card-body.is-flush { padding: 0; }
.card-head + .card-body { padding-top: 14px; }
.card-head + .card-body.is-flush { padding-top: 0; margin-top: 14px; border-top: 1px solid var(--line-2); }
/* A table placed straight in a card runs edge to edge, like in a flush card. */
.card-body:not(.is-flush) > .table-wrap { margin-left: -20px; margin-right: -20px; }
.card-body:not(.is-flush) > .table-wrap:last-child { margin-bottom: -20px; }
.card-head + .card-body:not(.is-flush) > .table-wrap:first-child { border-top: 1px solid var(--line-2); }
.card-body:not(.is-flush) > .table-wrap .table th:first-child, .card-body:not(.is-flush) > .table-wrap .table td:first-child { padding-left: 20px; }
.card-body:not(.is-flush) > .table-wrap .table th:last-child, .card-body:not(.is-flush) > .table-wrap .table td:last-child { padding-right: 20px; }
.card-body:not(.is-flush) > .table-wrap:last-child .table tfoot td:first-child { border-bottom-left-radius: var(--radius); }
.card-body:not(.is-flush) > .table-wrap:last-child .table tfoot td:last-child { border-bottom-right-radius: var(--radius); }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 13px; border-radius: 6px; border: 1px solid; margin-bottom: 14px; line-height: 1.45; }
.callout .icon { margin-top: 1px; }
.callout-azul { background: var(--azul-bg); border-color: var(--azul-line); color: #123e66; }
.callout-amarillo { background: var(--amarillo-bg); border-color: var(--amarillo-line); color: #5f3e00; }
.callout-rojo { background: var(--rojo-bg); border-color: var(--rojo-line); color: #7d1a14; }
.callout-verde { background: var(--verde-bg); border-color: var(--verde-line); color: #0f5230; }
.callout-gris { background: var(--gris-bg); border-color: var(--gris-line); color: var(--ink-2); }
.note { display: flex; gap: 7px; align-items: flex-start; color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.note .icon { margin-top: 1px; }

/* -------------------------------- KPI -----------------------------------
   An indicator is a cell: label, figure, and one line of context. It lives in
   a band (.grid-kpi) with its neighbours. A neutral or "all good" figure has
   no decoration at all; only what needs attention gets a mark and a pill.   */
.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; background: var(--surface); padding: 16px 20px 15px; text-decoration: none; color: var(--ink); min-width: 0; }
:not(.grid-kpi) > .kpi { border: 1px solid var(--line); border-radius: var(--radius); }
a.kpi:hover { background: #f8fafc; }
a.kpi:hover .kpi-label { color: var(--primary); }
a.kpi:focus-visible { outline-offset: -2px; }
/* The side mark always comes with a pill that says what is wrong. */
.kpi-amarillo.has-mark { box-shadow: inset 3px 0 0 #dba200; }
.kpi-rojo.has-mark { box-shadow: inset 3px 0 0 var(--rojo); }
.kpi-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; min-height: 32px; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; line-height: 1.3; }
.kpi-go { color: var(--primary); display: inline-flex; opacity: 0; margin-top: 1px; }
a.kpi:hover .kpi-go, a.kpi:focus-visible .kpi-go { opacity: 1; }
.kpi-value { font-family: var(--font-head); font-size: 29px; font-weight: 600; line-height: 1.1; letter-spacing: .1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi-unit { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-unit-pre { margin-right: 3px; }
.kpi-unit-post { margin-left: 4px; }
.kpi-value.is-text { font-size: 18px; line-height: 1.5; white-space: normal; }
.kpi-value.is-zero, .kpi-value.is-none { color: var(--ink-3); }
.kpi-value.is-zero .kpi-unit, .kpi-value.is-none .kpi-unit { color: var(--ink-3); }
.kpi-meter { height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; margin: 4px 0 2px; max-width: 220px; }
.kpi-meter > span { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.kpi-meter-verde > span { background: var(--verde); }
.kpi-meter-amarillo > span { background: #dba200; }
.kpi-meter-rojo > span { background: var(--rojo); }
.kpi-foot { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; min-height: 20px; margin-top: 2px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.kpi-foot .badge { font-size: 12px; padding: 0 8px 0 6px; }
.kpi-ok { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.kpi-ok .icon { color: var(--verde); }
.kpi-fill { pointer-events: none; }
.grid-kpi.is-tight > .kpi { padding: 14px 14px 13px 20px; }
.grid-kpi.is-tight .kpi-value { font-size: 25px; }
.grid-kpi.is-tight .kpi-unit { font-size: 13.5px; }

/* Panel: a card whose body is an indicator band. */
.panel-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; }
.panel-row > .card { margin-top: 0; }
.panel { display: flex; flex-direction: column; }
.card-head + .grid-kpi.is-flush { margin-top: 14px; }
.panel > .grid-kpi { flex: 1; }
.panel-empty { display: flex; align-items: center; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; flex: 1; margin-top: 14px; padding: 16px 20px 18px; border-top: 1px solid var(--line-2); color: var(--ink-2); }
.panel-empty p { max-width: 62ch; }
.panel-empty .btn-row { margin-top: 0; }

/* ------------------------------- Empty ---------------------------------- */
.empty { text-align: center; padding: 38px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.empty.is-compact { padding: 22px 16px; gap: 4px; }
.empty.is-compact .empty-icon { width: 38px; height: 38px; margin-bottom: 6px; }
.empty.is-compact .empty-icon .icon { width: 20px; height: 20px; }
.empty.is-compact .empty-title { font-size: 15px; }
.empty.is-compact .empty-text { font-size: 13px; }
.empty-title { font-family: var(--font-head); font-size: 17px; font-weight: 600; }
.empty-text { color: var(--muted); max-width: 56ch; }
.empty .btn { margin-top: 8px; }
.loading { display: flex; align-items: center; gap: 10px; padding: 30px; color: var(--muted); justify-content: center; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------ Progress -------------------------------- */
.progress-wrap { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.progress { flex: 1; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line-2); }
.progress-bar { height: 100%; border-radius: 4px; background: var(--primary); }
.progress-verde .progress-bar { background: var(--verde); }
.progress-amarillo .progress-bar { background: #dba200; }
.progress-rojo .progress-bar { background: var(--rojo); }
.progress-gris .progress-bar { background: #8a96a5; }
.progress-text { font-size: 12.5px; font-weight: 600; min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* -------------------------- Description lists --------------------------- */
.dl { display: grid; gap: 12px 22px; }
.dl-1 { grid-template-columns: minmax(0, 1fr); }
.dl-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dl-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dl-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dl-item { min-width: 0; }
.dl-span { grid-column: 1 / -1; }
.dl dt { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 1px; }
.dl dd { font-size: 14px; overflow-wrap: anywhere; }
.dl dd.is-empty { color: #9aa6b4; font-style: italic; font-size: 13px; }

/* ------------------------------- Tables --------------------------------- */
.table-wrap { overflow-x: auto; }
.table { font-size: 13.5px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface); padding: 10px 14px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
/* Edge-to-edge tables line up with the card heading above them. */
.is-flush .table th:first-child, .is-flush .table td:first-child, .list-card .table th:first-child, .list-card .table td:first-child { padding-left: 20px; }
.is-flush .table th:last-child, .is-flush .table td:last-child, .list-card .table th:last-child, .list-card .table td:last-child { padding-right: 20px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:hover td { background: #f6f9fc; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); padding: 10px 14px; }
.table td.num { font-variant-numeric: tabular-nums; }
.table caption { text-align: left; font-weight: 700; padding: 6px 0; }
.table-sm { font-size: 13px; }
.table-sm th, .table-sm td { padding: 7px 12px; }
.table-empty { padding: 10px 2px; }
.table th.num, .table td.num { text-align: right; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; padding-right: 8px !important; }
.table .col-main { font-weight: 600; }
.table tr.row-rojo td:first-child { box-shadow: inset 3px 0 0 var(--rojo); }
.table tr.row-amarillo td:first-child { box-shadow: inset 3px 0 0 #dba200; }
.table tr.row-gris td { color: var(--muted); }
.table-main td { white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.table-main td .progress-wrap { min-width: 120px; }
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.th-sort:hover { color: var(--primary); }
.row-actions { display: inline-flex; gap: 2px; }
.row-actions .btn-icon, .col-actions .btn-icon { width: 30px; height: 30px; }

/* ------------------------------- Lists ---------------------------------- */
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.list-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); }
.list-search-wrap { position: relative; display: flex; align-items: center; }
.list-search-wrap .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.list-search-wrap .list-search { width: 290px; padding-left: 32px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.chip:hover { background: var(--surface-2); }
.chip.is-active { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.chip-count { background: var(--line-2); color: var(--ink-2); border-radius: 9px; padding: 0 6px; font-size: 11.5px; min-width: 20px; text-align: center; }
.chip.is-active .chip-count { background: rgba(255, 255, 255, .22); color: #fff; }
.chip-rojo:not(.is-active) { border-color: var(--rojo-line); color: var(--rojo); }
.chip-rojo:not(.is-active) .chip-count { background: var(--rojo-bg); color: var(--rojo); }
.chip-amarillo:not(.is-active) { border-color: var(--amarillo-line); color: var(--amarillo); }
.chip-amarillo:not(.is-active) .chip-count { background: var(--amarillo-bg); color: var(--amarillo); }
.filter-panel { padding: 14px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.filter-actions { margin-top: 8px; display: flex; justify-content: flex-end; }
.list-results .empty { padding: 44px 20px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line-2); flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.pager-controls { display: flex; align-items: center; gap: 6px; }
.pager-controls select.input { height: 30px; width: auto; padding: 0 26px 0 8px; font-size: 13px; }
.pager-page { padding: 0 6px; font-variant-numeric: tabular-nums; }
.docs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }

/* -------------------------------- Forms --------------------------------- */
.input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #c3cdd8; border-radius: 6px; background: #fff; font-size: 14px; min-width: 0; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.4; }
select.input { padding-right: 28px; }
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(27, 90, 148, .16); }
.input[type="file"] { padding: 6px; height: auto; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: 1 / -1; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-help { font-size: 12px; color: var(--muted); line-height: 1.35; }
.field-error { font-size: 12.5px; color: var(--rojo); font-weight: 600; }
.field-error:empty { display: none; }
.field-auto { font-weight: 600; font-size: 10.5px; color: var(--primary); background: var(--primary-50); border-radius: 3px; padding: 0 5px; margin-left: 6px; }
.has-error .input { border-color: var(--rojo); background: #fffafa; }
.req { color: var(--rojo); font-weight: 700; }
.form-section { margin-bottom: 20px; }
.form-section legend { font-family: var(--font-head); font-size: 15.5px; font-weight: 600; padding: 0 0 5px; margin-bottom: 11px; border-bottom: 2px solid var(--line-2); width: 100%; color: var(--navy-2); }
.form-errors { display: flex; gap: 10px; background: var(--rojo-bg); border: 1px solid var(--rojo-line); color: #7d1a14; border-radius: 6px; padding: 10px 13px; margin-bottom: 14px; }
.form-errors ul { list-style: disc; padding-left: 18px; margin-top: 3px; }
.form-req-note { font-size: 12px; color: var(--muted); }
.form-output { display: flex; align-items: center; min-height: 36px; padding: 0 10px; background: var(--surface-2); border: 1px dashed #c3cdd8; border-radius: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.input-affix { display: flex; align-items: stretch; }
.input-affix .input { border-radius: 6px 0 0 6px; }
.input-affix .affix { display: flex; align-items: center; padding: 0 9px; border: 1px solid #c3cdd8; border-left: 0; border-radius: 0 6px 6px 0; background: var(--surface-2); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.input-affix.is-prefix .affix { border-left: 1px solid #c3cdd8; border-right: 0; border-radius: 6px 0 0 6px; }
.input-affix.is-prefix .input { border-radius: 0 6px 6px 0; }
.input-money { text-align: right; font-variant-numeric: tabular-nums; }
.input-pair { display: grid; grid-template-columns: 1.5fr 1fr; gap: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.inline-field { display: inline-flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.inline-field .input { min-width: 150px; height: 34px; font-weight: 400; font-size: 13.5px; color: var(--ink); }
.inline-range { display: inline-flex; gap: 10px; }

.combo { position: relative; }
.combo .input { padding-right: 30px; }
.combo-clear { position: absolute; right: 4px; top: 5px; width: 26px; height: 26px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.combo-clear:hover { background: var(--line-2); }
.combo-list { display: none; position: absolute; left: 0; right: 0; top: 38px; max-height: 240px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow-2); z-index: 30; padding: 4px; }
.combo-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13.5px; }
.combo-item:hover, .combo-item.is-active { background: var(--primary-50); }
.combo-empty { padding: 7px 8px; color: var(--muted); font-size: 12.5px; }

.lines { border: 1px solid var(--line); border-radius: 6px; }
.lines-table td { padding: 5px 6px; border-bottom: 1px solid var(--line-2); }
.lines-table .input { height: 32px; font-size: 13px; }
.lines-table .input-affix .affix { padding: 0 6px; }
.lines-x { width: 36px; text-align: center; }
.lines-foot { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--surface-2); border-top: 1px solid var(--line-2); border-radius: 0 0 6px 6px; }
.lines-total { font-variant-numeric: tabular-nums; }
.lines-view + .lines-view { margin-top: 14px; }

/* ------------------------------- Modals --------------------------------- */
body.modal-open { overflow: hidden; }
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 34, 56, .5); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow: auto; }
.modal { background: #fff; border-radius: 10px; box-shadow: var(--shadow-2); width: 100%; display: flex; flex-direction: column; max-height: 100%; }
.modal-sm { max-width: 470px; }
.modal-md { max-width: 660px; }
.modal-lg { max-width: 940px; }
.modal-xl { max-width: 1180px; }
.modal-head { display: flex; justify-content: space-between; gap: 14px; padding: 15px 18px 12px; border-bottom: 1px solid var(--line-2); align-items: flex-start; flex: none; }
.modal-title { font-family: var(--font-head); font-size: 19px; font-weight: 600; }
.modal-sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.modal-body { padding: 16px 18px; overflow: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 10px 10px; flex: none; flex-wrap: wrap; }
.modal-intro { margin-bottom: 14px; color: var(--ink-2); }
.confirm-msg { margin-bottom: 12px; font-size: 14.5px; }
.modal-sm .form-grid, .modal-md .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-sm .field-span-3, .modal-md .field-span-3 { grid-column: 1 / -1; }

.popmenu { position: fixed; z-index: 300; min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow-2); padding: 5px; }
.popmenu-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 5px; cursor: pointer; font-size: 13.5px; }
.popmenu-item:hover, .popmenu-item:focus { background: var(--primary-50); outline: none; }
.popmenu-item.is-danger { color: var(--rojo); }
.popmenu-item:disabled { opacity: .45; cursor: not-allowed; }
.popmenu-sep { height: 1px; background: var(--line-2); margin: 4px 0; }

#toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 400; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast { display: flex; align-items: flex-start; gap: 10px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: 7px; box-shadow: var(--shadow-2); padding: 11px 10px 11px 12px; font-size: 13.5px; }
.toast-msg { flex: 1; }
.toast-verde { border-left-color: var(--verde); } .toast-verde > .icon { color: var(--verde); }
.toast-rojo { border-left-color: var(--rojo); } .toast-rojo > .icon { color: var(--rojo); }
.toast-amarillo { border-left-color: #dba200; } .toast-amarillo > .icon { color: var(--amarillo); }
.toast-azul > .icon { color: var(--primary); }
.toast-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 3px; }

/* -------------------------------- Tabs ---------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 13px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; margin-bottom: -1px; }
.tab:hover { color: var(--primary); background: var(--primary-50); border-radius: 5px 5px 0 0; }
.tab.is-active { color: var(--navy); border-bottom-color: var(--amber); }
.tab-count { background: var(--line-2); border-radius: 9px; padding: 0 6px; font-size: 11.5px; }
.tab-panel { padding-top: 16px; }

/* ------------------------------ Stepper --------------------------------- */
.stepper { display: flex; gap: 0; align-items: flex-start; overflow-x: auto; padding: 4px 0; }
.step { flex: 1; min-width: 120px; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 0 6px; }
.step::before { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.step:first-child::before { display: none; }
.step.is-done::before, .step.is-current::before { background: var(--verde); }
.step-dot { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--line); z-index: 1; display: flex; align-items: center; justify-content: center; color: #fff; }
.step.is-done .step-dot { background: var(--verde); border-color: var(--verde); }
.step.is-current .step-dot { border-color: var(--amber); box-shadow: 0 0 0 4px var(--amber-50); }
.step-body { display: flex; flex-direction: column; gap: 1px; }
.step-label { font-weight: 600; font-size: 13px; }
.step-detail { font-size: 12px; color: var(--muted); }
.step:not(.is-done):not(.is-current) .step-label { color: var(--muted); }

/* ------------------------------- Charts --------------------------------- */
.chart { width: 100%; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-donut { width: 168px; height: 168px; flex: none; }
.chart-grid { stroke: #edf0f4; stroke-width: 1; }
.chart-axis { stroke: #c9d1da; stroke-width: 1; }
.chart-tick { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart-hover { fill: #f2f5f9; }
.chart-cross { stroke: #8f9cab; stroke-width: 1; }
.chart-hit { outline: none; }
.chart-hit.is-clickable, .chart-seg.is-clickable { cursor: pointer; }
.chart-hit:focus-visible { stroke: var(--amber-600); stroke-width: 2; }
.chart-seg:hover { opacity: .85; }
.chart-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; background: var(--surface-2); border-radius: 6px; border: 1px dashed var(--line); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; font-size: 12.5px; color: var(--ink-2); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-key { display: inline-block; flex: none; }
.chart-key-bar { width: 10px; height: 10px; border-radius: 2px; }
.chart-key-line { width: 14px; height: 3px; border-radius: 2px; }
.chart-tip { position: fixed; z-index: 500; display: none; pointer-events: none; background: #14202e; color: #fff; border-radius: 6px; padding: 7px 10px; font-size: 12.5px; box-shadow: var(--shadow-2); max-width: 300px; }
.chart-tip-title { font-weight: 600; color: #b9c9da; margin-bottom: 3px; }
.chart-tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.chart-tip-row span:last-child { color: #c6d2df; }
.chart-tip-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.chart-donut-value { font-family: var(--font-head); font-size: 21px; font-weight: 600; fill: var(--ink); }
.chart-donut-label { font-size: 11px; fill: var(--muted); }
.donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.donut-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 42px; gap: 8px; align-items: center; padding: 2px 4px; border-radius: 4px; }
.donut-legend li.is-clickable { cursor: pointer; }
.donut-legend li.is-clickable:hover { background: var(--primary-50); }
.donut-legend-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.donut-legend-pct { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) var(--hbar-val, auto); gap: 10px; align-items: center; font-size: 13px; background: none; border: 0; padding: 2px 4px; text-align: left; border-radius: 4px; width: 100%; }
button.hbar { cursor: pointer; }
button.hbar:hover { background: var(--primary-50); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar-track { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 5px; }
.hbar-value { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.chart-card .card-body { min-height: 120px; }
.chart-figure { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chart-figure-value { font-family: var(--font-head); font-size: 24px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chart-figure-label { font-size: 12.5px; color: var(--muted); }

/* ----------------------------- Attachments ------------------------------ */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo-group + .photo-group { margin-top: 16px; }
.photo-group-title { font-family: var(--font-head); font-size: 14.5px; font-weight: 600; margin-bottom: 8px; }
.photo { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.photo-thumb { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 4 / 3; background: var(--line-2); border: 0; cursor: pointer; color: var(--muted); padding: 0; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo figcaption { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 6px; padding: 6px 8px; font-size: 12.5px; align-items: center; }
.photo-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo figcaption .muted { grid-column: 1; font-size: 11.5px; }
.photo figcaption .btn-icon { grid-row: 1 / span 2; grid-column: 2; }
.viewer { display: flex; justify-content: center; background: #1b2633; border-radius: 6px; min-height: 300px; }
.viewer img { max-height: 70vh; object-fit: contain; }
.viewer iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.viewer-desc { margin-top: 10px; color: var(--ink-2); }

.import-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.import-map { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.import-map .input { height: 30px; font-size: 13px; }
