/* ============================================================
   ERP Charly — app.css · Design system "Command Center"
   Capa custom (manejada a mano). Tokens + componentes.
   ============================================================ */

:root {
  --ink: #0E1420;
  --ink-2: #151C2C;
  --ink-3: #1F2937;
  --ink-muted: #94A3B8;
  --primary: #4F46E5;
  --primary-2: #6D28D9;
  --primary-soft: #EEF2FF;
  --canvas: #F6F7FB;
  --card: #FFFFFF;
  --success: #059669;
  --success-soft: #ECFDF5;
  --danger: #E11D48;
  --danger-soft: #FFF1F2;
  --warning: #D97706;
  --warning-soft: #FFFBEB;
  --info: #0284C7;
  --info-soft: #F0F9FF;
  --text-1: #0F172A;
  --text-2: #334155;
  --text-3: #64748B;
  --text-4: #94A3B8;
  --border: #E2E8F0;
  --border-soft: #F1F5F9;
  --table-hdr: #F8FAFC;
  --radius-card: 16px;
  --radius-ctl: 12px;
  --radius-modal: 20px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-raised: 0 20px 40px rgba(16, 24, 40, 0.12);
  --grad-primary: linear-gradient(135deg, #4F46E5, #6D28D9);
  --grad-active: linear-gradient(135deg, #4F46E5, #6D28D9);
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-2);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(79, 70, 229, 0.18); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.tnum { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

/* ============ Shell ============ */
.ec-shell { display: flex; min-height: 100vh; }

/* ============ Sidebar ============ */
.ec-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50;
  background: var(--ink); color: #E2E8F0;
  display: flex; flex-direction: column;
  transition: width 0.25s var(--ease);
}
.ec-sidebar__logo {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); flex-shrink: 0;
}
.ec-logo-mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--grad-primary);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
}
.ec-logo-text { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: -0.01em; line-height: 1.1; }
.ec-logo-text small { display: block; font-weight: 500; font-size: 10px; color: var(--ink-muted); letter-spacing: 0.08em; text-transform: uppercase; }

.ec-sidebar__nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 10px 16px; }
.ec-sidebar__nav::-webkit-scrollbar-thumb { background: #273244; }

.ec-nav-caption {
  padding: 14px 12px 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #64748B;
}

.ec-nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; margin: 2px 0; border: 0; background: transparent; cursor: pointer;
  color: #94A3B8; font-size: 13.5px; font-weight: 500; text-align: left; font-family: inherit;
  border-radius: 10px; text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.ec-nav-item svg { width: 19px; height: 19px; flex-shrink: 0; stroke-width: 1.6; }
.ec-nav-item .ec-nav-chev { margin-left: auto; transition: transform 0.2s var(--ease); }
.ec-nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #E2E8F0; }
.ec-nav-item.is-active {
  background: var(--grad-active); color: #fff; font-weight: 600;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
}
.ec-nav-item.is-open .ec-nav-chev { transform: rotate(180deg); }

.ec-nav-sub { overflow: hidden; max-height: 0; transition: max-height 0.28s var(--ease); }
.ec-nav-item.is-open + .ec-nav-sub { max-height: 600px; }
.ec-sub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 44px; margin: 1px 0; border-radius: 8px;
  color: #94A3B8; font-size: 13px; text-decoration: none; position: relative;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.ec-sub-item:hover { background: rgba(255, 255, 255, 0.05); color: #E2E8F0; }
.ec-sub-item.is-active { color: #fff; font-weight: 600; }
.ec-sub-item.is-active::before {
  content: ""; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 3px; background: var(--grad-active);
}

.ec-sidebar__footer {
  padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, 0.06); flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
}
.ec-sidebar__footer .ec-avatar { width: 32px; height: 32px; font-size: 12px; }
.ec-sf-name { font-size: 12.5px; font-weight: 600; color: #E2E8F0; line-height: 1.15; }
.ec-sf-role { font-size: 10.5px; color: var(--ink-muted); }

/* ============ Topbar ============ */
.ec-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.ec-topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
}
.ec-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-4); white-space: nowrap; }
.ec-breadcrumb a { color: var(--text-3); text-decoration: none; }
.ec-breadcrumb a:hover { color: var(--primary); }
.ec-breadcrumb .sep { color: #CBD5E1; }
.ec-breadcrumb .cur { color: var(--text-1); font-weight: 600; }

.ec-search {
  flex: 0 1 340px; display: flex; align-items: center; gap: 8px;
  background: #F1F5F9; border: 1px solid transparent; border-radius: var(--radius-ctl);
  padding: 7px 12px; color: var(--text-4);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.ec-search:focus-within { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
.ec-search svg { width: 16px; height: 16px; flex-shrink: 0; }
.ec-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; color: var(--text-1); font-family: inherit; }

.ec-topbar__spacer { flex: 1; }
.ec-icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--text-3); cursor: pointer;
  position: relative; transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.ec-icon-btn:hover { background: var(--border-soft); color: var(--text-1); }
.ec-icon-btn svg { width: 19px; height: 19px; stroke-width: 1.6; }
.ec-badge-dot {
  position: absolute; top: 8px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff; font-size: 9.5px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff;
}
.ec-avatar {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: var(--grad-primary); color: #fff; font-weight: 700; font-size: 13px;
  display: grid; place-items: center; letter-spacing: 0.02em;
}
.ec-user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; transition: background 0.15s var(--ease); }
.ec-user-chip:hover { background: var(--border-soft); }
.ec-user-chip .ec-uc-name { font-size: 13px; font-weight: 600; color: var(--text-1); line-height: 1.15; }
.ec-user-chip .ec-uc-role { font-size: 11px; color: var(--text-4); }

/* ============ Notifications dropdown ============ */
.ec-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 360px; z-index: 60;
  background: #fff; border-radius: var(--radius-modal); box-shadow: var(--shadow-raised);
  border: 1px solid var(--border); overflow: hidden; display: none;
}
.ec-dropdown.open { display: block; animation: ec-pop 0.16s var(--ease); }
@keyframes ec-pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ec-dropdown__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.ec-dropdown__head h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--text-1); }
.ec-dropdown__body { max-height: 380px; overflow-y: auto; }
.ec-notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); position: relative; }
.ec-notif-item:hover { background: #FAFBFF; }
.ec-notif-item.unread { background: var(--primary-soft); }
.ec-notif-item.unread::before { content: ""; position: absolute; left: 6px; top: 18px; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.ec-notif-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.ec-notif-ic svg { width: 17px; height: 17px; }
.ec-notif-tx { font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.ec-notif-tx b { color: var(--text-1); font-weight: 600; }
.ec-notif-time { font-size: 11px; color: var(--text-4); margin-top: 2px; }
.ec-dropdown__foot { padding: 10px 16px; text-align: center; border-top: 1px solid var(--border-soft); }

/* ============ Main content ============ */
.ec-content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; }
.ec-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ec-page-title { font-size: 22px; font-weight: 700; color: var(--text-1); letter-spacing: -0.02em; margin: 0; }
.ec-page-sub { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.ec-page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ============ Buttons ============ */
.ec-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: var(--radius-ctl);
  font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap;
  transition: transform 0.12s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.ec-btn svg { width: 16px; height: 16px; stroke-width: 1.8; }
.ec-btn:active { transform: translateY(1px); }
.ec-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ec-btn--primary { background: var(--grad-primary); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3); }
.ec-btn--primary:hover { box-shadow: 0 8px 22px rgba(79, 70, 229, 0.42); filter: brightness(1.04); }
.ec-btn--secondary { background: #fff; border-color: var(--border); color: var(--text-2); }
.ec-btn--secondary:hover { border-color: #CBD5E1; background: var(--table-hdr); }
.ec-btn--ghost { background: transparent; color: var(--text-3); }
.ec-btn--ghost:hover { background: var(--border-soft); color: var(--text-1); }
.ec-btn--danger { background: #fff; border-color: #FECDD3; color: var(--danger); }
.ec-btn--danger:hover { background: var(--danger-soft); }
.ec-btn--sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.ec-btn--icon { width: 34px; height: 34px; padding: 0; border-radius: 9px; }
.ec-btn--icon svg { width: 15px; height: 15px; }
.ec-btn--block { width: 100%; }

/* ============ Cards ============ */
.ec-card { background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-card); border: 1px solid var(--border-soft); }
.ec-card + .ec-card { margin-top: 16px; }
.ec-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.ec-card__title { font-size: 15px; font-weight: 600; color: var(--text-1); margin: 0; display: flex; align-items: center; gap: 8px; }
.ec-card__title svg { width: 17px; height: 17px; color: var(--primary); }
.ec-card__sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.ec-card__body { padding: 20px; }
.ec-card__foot { padding: 14px 20px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: 10px; }

/* ============ KPI cards ============ */
.ec-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 20px; }
.ec-kpi { position: relative; background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); border: 1px solid var(--border-soft); padding: 18px 20px; overflow: hidden; }
.ec-kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--grad-primary); }
.ec-kpi--green::before { background: linear-gradient(90deg, #059669, #34D399); }
.ec-kpi--amber::before { background: linear-gradient(90deg, #D97706, #FBBF24); }
.ec-kpi--rose::before { background: linear-gradient(90deg, #E11D48, #FB7185); }
.ec-kpi--blue::before { background: linear-gradient(90deg, #0284C7, #38BDF8); }
.ec-kpi__top { display: flex; align-items: center; justify-content: space-between; }
.ec-kpi__label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.ec-kpi__chip { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.ec-kpi__chip svg { width: 20px; height: 20px; }
.ec-kpi__value { font-size: 28px; font-weight: 700; color: var(--text-1); letter-spacing: -0.02em; margin-top: 10px; line-height: 1.1; }
.ec-kpi__delta { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-top: 6px; font-weight: 600; }
.ec-kpi__delta.up { color: var(--success); }
.ec-kpi__delta.down { color: var(--danger); }
.ec-kpi__delta .ec-kpi__note { color: var(--text-4); font-weight: 500; }

/* ============ Filter bar ============ */
.ec-filterbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 16px 20px; }
.ec-filterbar .ec-field { margin: 0; }
.ec-filterbar .ec-btn { align-self: flex-end; }
.ec-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 14px; }
.ec-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  background: var(--primary-soft); color: var(--primary); border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}
.ec-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; padding: 2px; }
.ec-chip button svg { width: 12px; height: 12px; }

/* ============ Tables ============ */
.ec-table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius-card) var(--radius-card); }
.ec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ec-table th {
  text-align: left; padding: 11px 16px; background: var(--table-hdr);
  font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.ec-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); color: var(--text-2); vertical-align: middle; }
.ec-table tbody tr { transition: background 0.12s var(--ease); }
.ec-table tbody tr:hover { background: var(--table-hdr); }
.ec-table tbody tr:last-child td { border-bottom: 0; }
.ec-table td.amount, .ec-table th.amount { text-align: right; }
.ec-table td.amount { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.ec-table tfoot td { padding: 13px 16px; font-weight: 700; color: var(--text-1); background: var(--table-hdr); border-top: 1px solid var(--border); }
.ec-table__actions { display: flex; gap: 4px; justify-content: flex-end; }
.ec-row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.ec-ta-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; cursor: pointer;
  color: var(--text-4); display: grid; place-items: center; transition: all 0.12s var(--ease);
}
.ec-ta-btn svg { width: 15px; height: 15px; }
.ec-ta-btn:hover { background: var(--primary-soft); color: var(--primary); }
.ec-ta-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.ec-cell-main { font-weight: 600; color: var(--text-1); display: flex; align-items: center; gap: 10px; }
.ec-cell-sub { font-size: 11.5px; color: var(--text-4); font-weight: 400; }

/* ============ Badges ============ */
.ec-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.ec-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.ec-badge--amber { background: var(--warning-soft); color: #B45309; }
.ec-badge--green { background: var(--success-soft); color: var(--success); }
.ec-badge--rose { background: var(--danger-soft); color: var(--danger); }
.ec-badge--slate { background: #F1F5F9; color: var(--text-3); }
.ec-badge--indigo { background: var(--primary-soft); color: var(--primary); }
.ec-badge--blue { background: var(--info-soft); color: var(--info); }

/* ============ Forms ============ */
.ec-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.ec-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.ec-field--full { grid-column: 1 / -1; }
.ec-field--half { grid-column: span 1; }
.ec-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.ec-label .req { color: var(--danger); margin-left: 2px; }
.ec-input, .ec-select, .ec-textarea {
  width: 100%; height: 40px; padding: 0 12px; font-size: 13.5px; font-family: inherit;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-ctl);
  color: var(--text-1); outline: 0; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  appearance: none;
}
.ec-textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.ec-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; cursor: pointer; }
.ec-input::placeholder, .ec-textarea::placeholder { color: var(--text-4); }
.ec-input:focus, .ec-select:focus, .ec-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
.ec-input.is-invalid, .ec-select.is-invalid { border-color: var(--danger); }
.ec-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12); }
.ec-help { font-size: 11.5px; color: var(--danger); min-height: 0; }
.ec-help--muted { color: var(--text-4); }
.ec-input-group { position: relative; }
.ec-input-group svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-4); }
.ec-input-group .ec-input { padding-left: 36px; }
.ec-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.ec-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.ec-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.ec-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.ec-switch__track { width: 38px; height: 22px; border-radius: 999px; background: #CBD5E1; transition: background 0.15s var(--ease); position: relative; flex-shrink: 0; }
.ec-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25); transition: transform 0.15s var(--ease); }
.ec-switch input:checked + .ec-switch__track { background: var(--primary); }
.ec-switch input:checked + .ec-switch__track::after { transform: translateX(16px); }
.ec-switch input:focus-visible + .ec-switch__track { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ============ Stepper ============ */
.ec-stepper { display: flex; align-items: center; gap: 0; padding: 6px 4px 22px; }
.ec-step { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.ec-step__num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #E2E8F0; color: var(--text-3); font-size: 13px; font-weight: 700; flex-shrink: 0;
  transition: all 0.2s var(--ease);
}
.ec-step__label { font-size: 12.5px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.ec-step.is-active .ec-step__num { background: var(--grad-primary); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4); }
.ec-step.is-active .ec-step__label { color: var(--text-1); }
.ec-step.is-done .ec-step__num { background: var(--success); color: #fff; }
.ec-step__line { flex: 1; height: 2px; background: #E2E8F0; margin: 0 12px; min-width: 24px; border-radius: 2px; }
.ec-step.is-done + .ec-step__line { background: var(--success); }

/* ============ Tabs ============ */
.ec-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; }
.ec-tab {
  padding: 12px 14px; font-size: 13px; font-weight: 600; color: var(--text-3); cursor: pointer;
  border: 0; background: transparent; border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-family: inherit; display: inline-flex; align-items: center; gap: 7px;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.ec-tab:hover { color: var(--text-1); }
.ec-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============ Pagination ============ */
.ec-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }
.ec-pagination__info { font-size: 12.5px; color: var(--text-3); }
.ec-pagination__btns { display: flex; gap: 6px; align-items: center; }
.ec-page-btn {
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer;
  display: grid; place-items: center; transition: all 0.12s var(--ease);
}
.ec-page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.ec-page-btn.is-active { background: var(--grad-primary); color: #fff; border-color: transparent; }
.ec-page-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============ Empty state ============ */
.ec-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; gap: 6px; }
.ec-empty__ic { width: 64px; height: 64px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 8px; }
.ec-empty__ic svg { width: 28px; height: 28px; }
.ec-empty__title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.ec-empty__sub { font-size: 13px; color: var(--text-3); max-width: 380px; }

/* ============ Progress ============ */
.ec-progress { height: 6px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.ec-progress__bar { height: 100%; border-radius: 999px; background: var(--grad-primary); transition: width 0.4s var(--ease); }
.ec-progress__bar.green { background: linear-gradient(90deg, #059669, #34D399); }
.ec-progress__bar.amber { background: linear-gradient(90deg, #D97706, #FBBF24); }

/* ============ Chart card ============ */
.ec-chart { width: 100%; }
.ec-chart--sm { height: 260px; }
.ec-chart--md { height: 340px; }

/* ============ Login ============ */
.ec-login { display: flex; min-height: 100vh; }
.ec-login__brand {
  flex: 1.4; background: var(--ink); color: #E2E8F0; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; padding: 64px;
}
.ec-login__brand::before {
  content: ""; position: absolute; top: -30%; right: -20%; width: 70%; height: 90%;
  background: radial-gradient(closest-side, rgba(79, 70, 229, 0.35), transparent);
  pointer-events: none;
}
.ec-login__brand::after {
  content: ""; position: absolute; bottom: -35%; left: -15%; width: 60%; height: 80%;
  background: radial-gradient(closest-side, rgba(6, 182, 212, 0.18), transparent);
  pointer-events: none;
}
.ec-login__title { font-size: 34px; font-weight: 800; color: #fff; letter-spacing: -0.02em; margin: 28px 0 12px; line-height: 1.15; position: relative; }
.ec-login__tag { font-size: 15px; color: var(--ink-muted); margin-bottom: 36px; position: relative; }
.ec-login__bullets { display: flex; flex-direction: column; gap: 16px; position: relative; }
.ec-login__bullet { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: #CBD5E1; }
.ec-login__bullet svg { width: 18px; height: 18px; color: #818CF8; flex-shrink: 0; margin-top: 2px; }
.ec-login__form { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; background: #fff; }
.ec-login__card { width: 100%; max-width: 400px; }
.ec-login__form .ec-logo-mark { width: 48px; height: 48px; font-size: 18px; margin-bottom: 20px; }
.ec-login__h { font-size: 24px; font-weight: 800; color: var(--text-1); margin: 0; letter-spacing: -0.02em; }
.ec-login__p { font-size: 13.5px; color: var(--text-3); margin: 6px 0 28px; }
.ec-alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-ctl);
  font-size: 13px; margin-bottom: 16px;
}
.ec-alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.ec-alert--error { background: var(--danger-soft); color: #BE123C; }
.ec-alert--warn { background: var(--warning-soft); color: #B45309; }
.ec-alert--ok { background: var(--success-soft); color: var(--success); }
.ec-alert--info { background: var(--info-soft); color: var(--info); }

/* ============ Auth pages (recuperar/reset) ============ */
.ec-auth-box { width: 100%; max-width: 420px; margin: 0 auto; }

/* ============ Misc ============ */
.ec-section-title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin: 4px 0 14px; display: flex; align-items: center; gap: 8px; }
.ec-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.ec-hr { border: 0; border-top: 1px solid var(--border-soft); margin: 20px 0; }
.ec-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.ec-link:hover { text-decoration: underline; }
.ec-muted { color: var(--text-3); }
.ec-total-box { display: flex; flex-direction: column; gap: 6px; padding: 16px 20px; background: var(--table-hdr); border-radius: var(--radius-ctl); }
.ec-total-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.ec-total-row strong { color: var(--text-1); }
.ec-total-row.grand { font-size: 16px; font-weight: 800; color: var(--text-1); border-top: 1px solid var(--border); padding-top: 8px; }
.ec-total-row.grand .tnum { color: var(--primary); }
.ec-quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.ec-quick-tile {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff;
  border-radius: var(--radius-card); border: 1px solid var(--border-soft); box-shadow: var(--shadow-card);
  text-decoration: none; transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s var(--ease);
}
.ec-quick-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-raised); border-color: #C7D2FE; }
.ec-quick-tile__ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.ec-quick-tile__ic svg { width: 19px; height: 19px; }
.ec-quick-tile__tx { min-width: 0; }
.ec-quick-tile__name { font-size: 13px; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-quick-tile__cnt { font-size: 11px; color: var(--text-4); }
.ec-dot-list { display: flex; flex-direction: column; }
.ec-dot-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; }
.ec-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.ec-dot--red { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.ec-dot--amber { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.ec-dot--green { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.ec-dot--indigo { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ec-dot-row__tx { font-size: 12.5px; color: var(--text-2); }
.ec-dot-row__tx b { color: var(--text-1); font-weight: 600; }

/* ============ Responsive ============ */
@media (max-width: 1279px) {
  .ec-sidebar { width: 72px; }
  .ec-logo-text, .ec-nav-item span:not(.ec-nav-chev), .ec-nav-caption, .ec-sub-item, .ec-sidebar__footer .ec-sf-tx { display: none; }
  .ec-nav-item { justify-content: center; padding: 9px; }
  .ec-nav-item svg { margin: 0; }
  .ec-nav-item .ec-nav-chev { display: none; }
  .ec-nav-sub { display: none; }
  .ec-main { margin-left: 72px; }
}
@media (max-width: 767px) {
  .ec-content { padding: 16px; }
  .ec-topbar { padding: 0 14px; }
  .ec-search { flex: 0 0 38px; padding: 7px; }
  .ec-search input { display: none; }
  .ec-form-grid { grid-template-columns: 1fr; }
  .ec-kpis { grid-template-columns: 1fr 1fr; }
  .ec-user-chip .ec-uc-tx { display: none; }
  .ec-login__brand { display: none; }
  .ec-login__form { padding: 32px 24px; }
}

@media print {
  .ec-sidebar, .ec-topbar { display: none !important; }
  .ec-main { margin-left: 0; }
  .ec-content { padding: 0; }
  .ec-card { box-shadow: none; border: 1px solid #ddd; }
}
