/* PYTEC APP — main.css v2.0 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Barlow+Semi+Condensed:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:              #F5F5F7;
  --surface:         #FFFFFF;
  --sidebar-bg:      #E8E8ED;
  --sidebar-active:  #FFFFFF;
  --text:            #1D1D1F;
  --text-muted:      #86868B;
  --border:          #D2D2D7;
  --accent:          #E8610A;
  --accent-hover:    #C4520A;
  --primary:         #1B3F6B;
  --primary-dark:    #0F2235;
  --success:         #2E7D32;
  --success-bg:      #E8F5E9;
  --warning:         #F59E0B;
  --warning-bg:      #FFFBEB;
  --danger:          #C62828;
  --danger-bg:       #FFEBEE;
  --info:            #0277BD;
  --info-bg:         #E1F5FE;
  --sidebar-width:   260px;
  --topbar-height:   60px;
  --radius:          8px;
  --radius-lg:       12px;
  --radius-xl:       16px;
  --shadow-card:     0 1px 4px rgba(0,0,0,0.08);
  --shadow-sidebar:  0 4px 24px rgba(0,0,0,0.10);
  --shadow-active:   0 2px 8px rgba(0,0,0,0.12);
  --shadow-dropdown: 0 8px 32px rgba(0,0,0,0.14);
  --font-ui:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display:    'Barlow Semi Condensed', sans-serif;
  --font-mono:       'JetBrains Mono', monospace;
  --transition:      150ms cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent); }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ════ LAYOUT ════ */
.app-wrapper { display: flex; min-height: 100vh; background: var(--bg); }

/* SIDEBAR flotante con border-radius completo */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.sidebar-inner {
  background: var(--sidebar-bg);
  border-radius: var(--radius-xl);
  height: calc(100vh - 16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-brand {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.01em;
  line-height: 1;
}

.sidebar-brand-slug {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-empresa {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.sidebar-empresa-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-empresa-plan { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  scrollbar-width: thin;
}

.sidebar-section-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  padding: 8px 10px 3px;
}

.sidebar-nav a,
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), color var(--transition);
  margin-bottom: 2px;
}

.sidebar-nav a:hover,
.sidebar-nav-item:hover {
  background: rgba(255,255,255,0.65);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-nav a.active,
.sidebar-nav-item.active {
  background: var(--sidebar-active);
  color: var(--primary);
  box-shadow: var(--shadow-active);
  font-weight: 600;
  text-decoration: none;
}

.sidebar-nav-icon { font-size: 0.95rem; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}

.sidebar-user:hover { background: rgba(255,255,255,0.65); text-decoration: none; }

.sidebar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-display);
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role { font-size: 0.68rem; color: var(--text-muted); }

/* TOPBAR */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: rgba(245,245,247,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.775rem;
  color: var(--text-muted);
}

.topbar-breadcrumb a { color: var(--text-muted); }
.topbar-breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.topbar-breadcrumb-sep { opacity: 0.4; font-size: 0.7rem; }
.topbar-breadcrumb-current { color: var(--text); font-weight: 500; }

.topbar-spacer { flex: 1; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.topbar-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.topbar-weather {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  transition: opacity var(--transition);
}

.topbar-weather.loading { opacity: 0.35; }

.topbar-sep { width: 1px; height: 16px; background: var(--border); flex-shrink: 0; }

.topbar-actions { display: flex; align-items: center; gap: 2px; }

.topbar-btn {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1rem;
  transition: background var(--transition), color var(--transition);
}

.topbar-btn:hover { background: rgba(0,0,0,0.06); color: var(--text); }

.topbar-menu-btn {
  display: none;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text);
}

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-height));
  width: 100%;
}

.flash-container {
  position: fixed;
  top: calc(var(--topbar-height) + 12px);
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}

.flash-container > * { pointer-events: auto; }

/* ════ BANNER MOTIVACIONAL ════ */
.motivational-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 22px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.motivational-banner-emoji { font-size: 1.4rem; flex-shrink: 0; }

.motivational-banner-text {
  font-size: 0.875rem;
  color: var(--text);
  font-style: italic;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.motivational-banner-text strong { font-style: normal; font-weight: 700; color: var(--primary); }

.motivational-banner-day {
  font-size: 0.68rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ════ CARDS ════ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  border: 1px solid rgba(0,0,0,0.04);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.card-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; font-weight: 400; }
.card-actions  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.card-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px 18px;
  border: 1px solid rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.kpi-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.10); transform: translateY(-1px); }

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.kpi-icon--accent   { background: rgba(232,97,10,0.10); }
.kpi-icon--primary  { background: rgba(27,63,107,0.10); }
.kpi-icon--success  { background: var(--success-bg); }
.kpi-icon--warning  { background: var(--warning-bg); }
.kpi-icon--danger   { background: var(--danger-bg); }

.kpi-body { flex: 1; min-width: 0; }

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.kpi-value--accent   { color: var(--accent); }
.kpi-value--primary  { color: var(--primary); }
.kpi-value--success  { color: var(--success); }
.kpi-value--warning  { color: var(--warning); }
.kpi-value--danger   { color: var(--danger); }

.kpi-label { font-size: 0.73rem; color: var(--text-muted); margin-top: 3px; font-weight: 500; }

.kpi-delta { font-size: 0.68rem; margin-top: 4px; display: flex; align-items: center; gap: 3px; font-weight: 600; }
.kpi-delta--up   { color: var(--success); }
.kpi-delta--down { color: var(--danger); }
.kpi-delta--flat { color: var(--text-muted); }

/* Module Cards */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.module-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.04);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.module-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  transform: translateY(-2px);
  border-color: rgba(27,63,107,0.14);
  text-decoration: none;
  color: inherit;
}

.module-card:hover .module-name { color: var(--accent); }

.module-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.module-icon--primary { background: rgba(27,63,107,0.08); }
.module-icon--accent  { background: rgba(232,97,10,0.08); }
.module-icon--green   { background: rgba(46,125,50,0.08); }
.module-icon--purple  { background: rgba(91,58,154,0.08); }
.module-icon--teal    { background: rgba(10,91,107,0.08); }
.module-icon--orange  { background: rgba(230,81,0,0.08); }

.module-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.67rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.module-status--active   { background: var(--success-bg); color: var(--success); }
.module-status--inactive { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.module-status--trial    { background: var(--warning-bg); color: #92400E; }

.module-status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.module-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.01em;
  transition: color var(--transition);
}

.module-desc { font-size: 0.775rem; color: var(--text-muted); line-height: 1.45; }

.module-stat {
  font-size: 0.73rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.module-stat strong { color: var(--text); font-weight: 600; }

/* ════ TABLAS ════ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0,0,0,0.06);
}

table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }

thead th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr { transition: background var(--transition); }
tbody tr:nth-child(even) { background: rgba(0,0,0,0.016); }
tbody tr:hover { background: rgba(27,63,107,0.04); }

tbody td {
  padding: 11px 14px;
  color: var(--text);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

.td-muted   { color: var(--text-muted); }
.td-mono    { font-family: var(--font-mono); font-size: 0.78rem; }
.td-actions { display: flex; align-items: center; gap: 4px; }

/* ════ BADGES ════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.69rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.badge--accent   { background: rgba(232,97,10,0.12); color: var(--accent); }
.badge--primary  { background: rgba(27,63,107,0.10); color: var(--primary); }
.badge--success  { background: var(--success-bg); color: var(--success); }
.badge--warning  { background: var(--warning-bg); color: #92400E; }
.badge--danger   { background: var(--danger-bg); color: var(--danger); }
.badge--muted    { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge--info     { background: var(--info-bg); color: var(--info); }

/* ════ BOTONES ════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn:hover { text-decoration: none; }
.btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 2px 8px rgba(232,97,10,0.25); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: rgba(0,0,0,0.16); }

.btn-dark { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-dark:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; padding: 6px 10px; }
.btn-ghost:hover { background: rgba(0,0,0,0.06); color: var(--text); }

.btn-sm   { padding: 5px 11px; font-size: 0.75rem; }
.btn-lg   { padding: 11px 22px; font-size: 0.875rem; }
.btn-icon { padding: 7px; aspect-ratio: 1; border-radius: var(--radius); }

/* ════ FORMULARIOS ════ */
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }

.form-label { font-size: 0.775rem; font-weight: 600; color: var(--text); }
.form-label span { font-weight: 400; color: var(--text-muted); font-size: 0.7rem; }

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,63,107,0.10);
}

.form-control::placeholder { color: var(--text-muted); opacity: 1; }
textarea.form-control { min-height: 90px; resize: vertical; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2386868B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.form-hint  { font-size: 0.7rem; color: var(--text-muted); }
.form-error { font-size: 0.7rem; color: var(--danger); }
.form-control.is-invalid { border-color: var(--danger); }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.form-check-label { font-size: 0.8125rem; color: var(--text); cursor: pointer; }

.search-wrapper { position: relative; }
.search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-muted);
  pointer-events: none;
}
.search-wrapper input { padding-left: 30px; }

/* ════ ALERTS ════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  line-height: 1.5;
  border: 1px solid transparent;
  margin-bottom: 12px;
}

.alert-icon  { flex-shrink: 0; font-size: 1rem; }
.alert-body  { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 2px; }

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.4;
  font-size: 1rem;
  line-height: 1;
  color: inherit;
  flex-shrink: 0;
  padding: 0 0 0 8px;
}
.alert-close:hover { opacity: 0.9; }

.alert--success { background: var(--success-bg); color: var(--success); border-color: rgba(46,125,50,0.2); }
.alert--warning { background: var(--warning-bg); color: #92400E; border-color: rgba(245,158,11,0.25); }
.alert--danger  { background: var(--danger-bg);  color: var(--danger); border-color: rgba(198,40,40,0.2); }
.alert--info    { background: var(--info-bg);    color: var(--info);  border-color: rgba(2,119,189,0.2); }

/* Flash toasts */
.flash-toast {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  padding: 12px 16px;
  border-left: 3px solid;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  animation: toastIn 0.25s ease;
  min-width: 240px;
}

.flash-toast--success { border-color: var(--success); }
.flash-toast--danger  { border-color: var(--danger); }
.flash-toast--warning { border-color: var(--warning); }
.flash-toast--info    { border-color: var(--info); }

@keyframes toastIn  { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(10px); } }

.flash-toast.dismissing { animation: toastOut 0.2s ease forwards; }

/* ════ PAGINACIÓN ════ */
.pagination { display: flex; align-items: center; gap: 3px; padding: 12px 0 4px; flex-wrap: wrap; }
.pagination-info { font-size: 0.73rem; color: var(--text-muted); margin-right: auto; }

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 6px;
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}

.page-link:hover { background: var(--surface); color: var(--primary); border-color: var(--border); text-decoration: none; }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.page-link.disabled { opacity: 0.28; cursor: not-allowed; pointer-events: none; }

/* ════ EMPTY STATES ════ */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; gap: 10px; }
.empty-state-icon { font-size: 2.8rem; opacity: 0.22; line-height: 1; }
.empty-state-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; color: var(--text); }
.empty-state-desc { font-size: 0.8125rem; color: var(--text-muted); max-width: 300px; line-height: 1.55; }

/* ════ DROPDOWNS ════ */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  border: 1px solid rgba(0,0,0,0.08);
  min-width: 168px;
  padding: 5px;
  z-index: 300;
  display: none;
  animation: dropIn 0.15s ease;
}

.dropdown-menu.open { display: block; }

@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}

.dropdown-item:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.dropdown-item--danger { color: var(--danger); }
.dropdown-item--danger:hover { background: var(--danger-bg); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ════ MODALES ════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  animation: fadeInBg 0.15s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-width: 460px;
  width: 100%;
  animation: modalIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.modal-lg { max-width: 700px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--text); }

.modal-close {
  width: 26px; height: 26px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}

.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 18px 22px; }
.modal-footer { padding: 12px 22px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

@keyframes fadeInBg { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn  { from { transform: scale(0.93); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ════ TABS ════ */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }

.tab-item {
  padding: 9px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ════ UTILIDADES ════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.page-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

.section-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.grid   { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.text-muted   { color: var(--text-muted); }
.text-accent  { color: var(--accent); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

.font-mono    { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }
.text-sm  { font-size: 0.75rem; }
.text-xs  { font-size: 0.69rem; }
.text-lg  { font-size: 0.95rem; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider  { height: 1px; background: var(--border); margin: 14px 0; }
.sep      { width: 1px; height: 16px; background: var(--border); flex-shrink: 0; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, var(--border) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
  color: transparent !important;
}

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ════ RESPONSIVE ════ */
@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(calc(-100% - 8px));
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    width: 268px;
    padding: 8px;
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.28);
    z-index: 190;
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.open { display: block; }

  .topbar { left: 0; }
  .topbar-menu-btn { display: flex; }
  .main-content { margin-left: 0; padding: 16px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .kpi-grid    { grid-template-columns: repeat(2, 1fr); }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-date { display: none; }
  .topbar-sep  { display: none; }
}

@media (max-width: 520px) {
  .kpi-grid    { grid-template-columns: 1fr 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .topbar-meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
