/* ========================= TARJETAS ========================= */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; min-width: 0; position: relative;
}
.card.p0 { padding: 0; }
.card.p-sm { padding: 18px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-title { font-size: 13.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .25px; color: var(--text); }
.card-sub { font-size: 12.5px; color: var(--text-2); margin-top: 4px; line-height: 1.45; }
.card-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-foot { border-top: 1px solid var(--border-2); margin: 18px -24px -24px; padding: 14px 24px; }
.section-title { font-size: 14px; font-weight: 600; margin: 4px 0 12px; }

/* ========================= BOTONES ========================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13.2px; font-weight: 500; white-space: nowrap; line-height: 1;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .05s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; box-shadow: 0 4px 12px rgba(var(--primary-rgb), .3); }
.btn-white { background: var(--card); color: var(--text-2); border-color: transparent; box-shadow: 0 1px 2px rgba(17,16,39,.04); }
.btn-white:hover { color: var(--primary); }
.btn-light { background: var(--primary-soft); color: var(--primary); }
.btn-light:hover { background: var(--primary); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.95); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); color: #fff; }
.btn-ghost { background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--primary-soft-2); color: var(--primary); }
.btn-sm { height: 31px; padding: 0 11px; font-size: 12.3px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 11.5px; border-radius: 5px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--primary-soft-2); color: var(--primary);
  display: inline-grid; place-items: center; flex: 0 0 auto;
}
.icon-btn:hover { background: var(--primary); color: #fff; }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.danger { background: var(--danger-soft); color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger); color: #fff; }
.btn-group { display: inline-flex; background: var(--card); border-radius: 8px; padding: 3px; gap: 2px; box-shadow: var(--shadow); }
.btn-group button { border: 0; background: none; height: 32px; padding: 0 12px; border-radius: 6px; font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.btn-group button:hover { color: var(--primary); }
.btn-group button.active { background: var(--primary); color: #fff; }
.btn-group button svg { width: 14px; height: 14px; }

/* ========================= FORMULARIOS ====================== */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .label { font-size: 12.3px; font-weight: 500; color: var(--text); }
.field label .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border); background: var(--card); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13.2px; outline: none; color: var(--text); min-height: 40px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238B8BAE'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input:focus, .select:focus, .textarea:focus { border-color: rgba(var(--primary-rgb), .6); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .1); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255,77,112,.1); }
.field-err { color: var(--danger); font-size: 11.5px; }
.hint { color: var(--text-2); font-size: 11.5px; }
.input-sm { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.search-box { position: relative; }
.search-box .input { padding-right: 36px; min-height: 38px; }
.search-box svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-2); pointer-events: none; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; flex: 0 0 auto; }
.radio-list { display: grid; gap: 8px; }

/* ========================= BADGES ========================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: 11.2px; font-weight: 600; white-space: nowrap; line-height: 1.5; letter-spacing: .1px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.badge.no-dot::before { display: none; }
.b-violet { background: var(--primary-soft); color: var(--primary); }
.b-green { background: var(--success-soft); color: #16A34A; }
.b-red { background: var(--danger-soft); color: #E8325A; }
.b-blue { background: var(--info-soft); color: #0B97C6; }
.b-yellow { background: var(--warning-soft); color: #C27F06; }
.b-gray { background: var(--muted-soft); color: #7A7A9C; }
.b-dark { background: #E3E3EE; color: #3B3A5E; }
.b-pink { background: #FDE7F3; color: #D23C8E; }
.b-teal { background: #E0F6F3; color: #0E9384; }
.status-txt { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; display: inline-flex; align-items: center; gap: 6px; }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 12.2px; font-weight: 500; }
.prio i { width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); display: inline-block; }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; border: 1px solid var(--border-2); }

/* ========================= AVATARES ======================== */
.avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; display: grid; place-items: center; font-weight: 600; color: #fff; font-size: 13px; position: relative; }
.avatar svg { width: 100%; height: 100%; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.xl { width: 64px; height: 64px; font-size: 20px; }
.av-stack { display: flex; }
.av-stack .avatar { border: 2px solid var(--card); margin-left: -8px; }
.av-stack .avatar:first-child { margin-left: 0; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person .p-name { font-weight: 500; color: var(--text); line-height: 1.3; }
.person .p-sub { font-size: 11.8px; color: var(--text-2); }
.icon-circle { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.icon-circle svg { width: 19px; height: 19px; }
.ic-violet { background: var(--primary-soft); color: var(--primary); }
.ic-pink { background: #FDE8F0; color: #F0457A; }
.ic-blue { background: var(--info-soft); color: var(--info); }
.ic-green { background: var(--success-soft); color: var(--success); }
.ic-yellow { background: var(--warning-soft); color: #E09B1B; }
.ic-red { background: var(--danger-soft); color: var(--danger); }

/* ========================= TABLAS ========================== */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border-2); border-radius: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.3px; }
.table th {
  text-align: left; font-size: 11.8px; font-weight: 700; text-transform: uppercase; letter-spacing: .25px;
  padding: 15px 16px; color: var(--text); border-bottom: 1px solid var(--border-2); white-space: nowrap; background: var(--card);
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--primary); }
.table th .sort-ind { opacity: .5; margin-left: 4px; font-size: 10px; }
.table td { padding: 16px; border-bottom: 1px solid var(--border-2); vertical-align: middle; color: var(--text); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table .code { font-weight: 700; color: var(--text); white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table.compact td { padding: 10px 14px; }
.table.compact th { padding: 11px 14px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.dir-ic { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.dir-ic svg { width: 14px; height: 14px; }
.table-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.table-toolbar .search-box { width: 240px; max-width: 100%; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager button { min-width: 32px; height: 32px; border: 1px solid var(--border); background: var(--card); border-radius: 6px; font-size: 12.5px; color: var(--text); padding: 0 8px; }
.pager button:hover { border-color: var(--primary); color: var(--primary); }
.pager button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button[disabled] { opacity: .4; pointer-events: none; }

/* ========================= KPIs ============================ */
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .2px; }
.kpi-sub { font-size: 12.3px; color: var(--text-2); }
.kpi-value { font-size: var(--fs-kpi); font-weight: 600; letter-spacing: -.3px; line-height: 1.25; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi-trend { font-size: 12px; margin-top: 4px; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend span { color: var(--text-2); }
.kpi-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }

/* Progreso */
.progress { height: 7px; background: var(--border-2); border-radius: 10px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 10px; background: var(--primary); transition: width .6s var(--ease); }
.progress.thin { height: 5px; }
.progress.thick { height: 10px; }

/* ========================= TABS ============================ */
.tabs {
  display: flex; gap: 4px; background: var(--primary-soft-2); border-radius: 4px; padding: 0 16px; overflow-x: auto;
  border: 1px solid var(--border-2);
}
.tabs button, .tabs a {
  border: 0; background: none; padding: 17px 16px; font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap;
  position: relative;
}
.tabs button:hover, .tabs a:hover { color: var(--primary); }
.tabs .active { color: var(--primary); }
.tabs .active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: var(--primary); border-radius: 2px; }
.tabs .count { display: inline-block; margin-left: 6px; background: var(--card); color: var(--text-2); font-size: 10.5px; padding: 1px 7px; border-radius: 10px; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.subtabs button { border: 1px solid var(--border); background: var(--card); border-radius: 20px; padding: 5px 13px; font-size: 12.3px; color: var(--text-2); }
.subtabs button.active, .subtabs button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft-2); }

/* ========================= LISTAS ========================== */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; color: var(--text); font-size: 13.6px; }
.list-item .li-sub { color: var(--text-2); font-size: 12.2px; }
.list-item .li-end { text-align: right; flex: 0 0 auto; }
.list-item.link { cursor: pointer; }
.list-item.link:hover .li-title { color: var(--primary); }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 9px 14px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; border-left: 2px dashed var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -26px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary-soft); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--primary); }
.tl-item .tl-title { font-weight: 600; font-size: 13px; }
.tl-item .tl-meta { font-size: 11.5px; color: var(--text-2); }
.tl-item .tl-text { font-size: 12.5px; color: var(--text); margin-top: 2px; }

/* Stepper */
.stepper { display: flex; gap: 0; overflow-x: auto; padding: 4px 2px 2px; }
.step { flex: 1; min-width: 92px; text-align: center; position: relative; font-size: 11.5px; color: var(--text-2); }
.step::before { content: ""; position: absolute; top: 13px; left: -50%; right: 50%; height: 2px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step .st-dot { width: 28px; height: 28px; border-radius: 50%; margin: 0 auto 6px; background: var(--card); border: 2px solid var(--border); display: grid; place-items: center; position: relative; z-index: 1; font-size: 11px; font-weight: 600; }
.step.done { color: var(--text); }
.step.done .st-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.done::before, .step.current::before { background: var(--primary); }
.step.current .st-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .15); }
.step.current { color: var(--primary); font-weight: 600; }
.step.cancel .st-dot { border-color: var(--danger); color: var(--danger); }

/* ========================= EMPTY / ALERT =================== */
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty .empty-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 12px; }
.empty .empty-ic svg { width: 26px; height: 26px; }
.empty b { display: block; color: var(--text); font-size: 14.5px; margin-bottom: 4px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; font-size: 12.8px; line-height: 1.45; }
.alert svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.alert.info { background: var(--info-soft); color: #0A6E90; }
.alert.warn { background: var(--warning-soft); color: #8C5A00; }
.alert.danger { background: var(--danger-soft); color: #B21E42; }
.alert.success { background: var(--success-soft); color: #11743A; }
.alert.violet { background: var(--primary-soft-2); color: var(--primary-hover); border: 1px dashed rgba(var(--primary-rgb), .35); }
[data-theme="dark"] .alert.info, [data-theme="dark"] .alert.warn, [data-theme="dark"] .alert.danger, [data-theme="dark"] .alert.success { color: var(--text); }

/* ========================= MODAL =========================== */
.modal-back {
  position: fixed; inset: 0; background: rgba(17,16,39,.5); z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; overflow-y: auto; animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border-radius: 12px; width: 100%; max-width: 620px; box-shadow: var(--shadow-lg);
  animation: modalIn .22s var(--ease); display: flex; flex-direction: column; max-height: none;
}
.modal.sm { max-width: 440px; }
.modal.lg { max-width: 880px; }
.modal.xl { max-width: 1120px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border-2); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border-2); flex-wrap: wrap; }
.modal-close { border: 0; background: var(--surface-2); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.modal-close:hover { background: var(--danger-soft); color: var(--danger); }

/* ========================= TOAST =========================== */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 13px 14px; display: flex; gap: 12px; align-items: flex-start;
  border-left: 4px solid var(--primary); animation: toastIn .25s var(--ease); font-size: 13px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
.toast .t-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 28px; }
.toast .t-ic svg { width: 15px; height: 15px; }
.toast b { display: block; font-size: 13.3px; }
.toast .t-close { margin-left: auto; border: 0; background: none; color: var(--text-2); padding: 0 2px; font-size: 18px; line-height: 1; }
.toast.out { animation: toastOut .2s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ========================= VARIOS ========================== */
.divider { height: 1px; background: var(--border-2); margin: 16px 0; }
.dashed-box { border: 1.5px dashed var(--border); border-radius: 10px; padding: 16px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.metric-mini { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; }
.metric-mini .mm-label { font-size: 11.5px; color: var(--text-2); }
.metric-mini .mm-value { font-size: 17px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.demo-note { font-size: 11.5px; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; }
.demo-note svg { width: 13px; height: 13px; }
.pill-toggle { display: inline-flex; gap: 4px; }
.pill-toggle button { border: 0; border-radius: 5px; padding: 5px 11px; font-size: 12px; background: none; color: var(--text); font-weight: 500; }
.pill-toggle button.active { background: var(--primary); color: #fff; }
.chart-box { width: 100%; position: relative; }
.chart-tip {
  position: absolute; pointer-events: none; background: #1B1A3A; color: #fff; border-radius: 7px; padding: 8px 10px; font-size: 11.5px;
  box-shadow: var(--shadow-lg); z-index: 5; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -10px; line-height: 1.5;
}
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.legend { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; font-size: 12.5px; font-weight: 500; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.legend i.dash { background: none !important; border: 2px dashed; width: 11px; height: 11px; }
kbd { background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; font-family: inherit; }
