/* =====================================================================
   More Requests - Sistema de diseno
   Parte 2: componentes
   ===================================================================== */

/* ---------- Botones ------------------------------------------------- */
.mr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 13.6px; font-weight: 600; letter-spacing: -0.005em;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition),
              box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
}
.mr-btn:active { transform: translateY(1px); }
.mr-btn:disabled, .mr-btn.is-disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.mr-btn--primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-700) 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(var(--brand-rgb), 0.35), 0 6px 16px -6px rgba(var(--brand-rgb), 0.6);
}
.mr-btn--primary:hover { background: linear-gradient(180deg, var(--brand-700) 0%, var(--brand-800) 100%); color: #fff; }

.mr-btn--secondary { background: var(--surface); border-color: var(--border); color: var(--text-soft); box-shadow: var(--shadow-xs); }
.mr-btn--secondary:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }

.mr-btn--ghost { background: transparent; color: var(--text-muted); }
.mr-btn--ghost:hover { background: var(--surface-3); color: var(--text); }

.mr-btn--success { background: var(--success); color: #fff; }
.mr-btn--success:hover { background: #059669; color: #fff; }
.mr-btn--danger { background: var(--danger); color: #fff; }
.mr-btn--danger:hover { background: #DC2626; color: #fff; }
.mr-btn--warning { background: var(--warning); color: #fff; }
.mr-btn--warning:hover { background: #D97706; color: #fff; }
.mr-btn--whatsapp { background: #25D366; color: #fff; }
.mr-btn--whatsapp:hover { background: #1DA851; color: #fff; }
.mr-btn--telegram { background: #229ED9; color: #fff; }
.mr-btn--telegram:hover { background: #1B87BB; color: #fff; }

.mr-btn--sm { height: 34px; padding: 0 12px; font-size: 12.8px; border-radius: var(--r-sm); }
.mr-btn--xs { height: 29px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); gap: 6px; }
.mr-btn--lg { height: 46px; padding: 0 22px; font-size: 15px; }
.mr-btn--block { width: 100%; }
.mr-btn--icon { width: 40px; padding: 0; }
.mr-btn--icon.mr-btn--sm { width: 34px; }
.mr-btn--icon.mr-btn--xs { width: 29px; }

.mr-btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tarjetas ------------------------------------------------ */
.mr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.mr-card__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  flex-wrap: wrap;
}
.mr-card__title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 9px; }
.mr-card__subtitle { font-size: 12.4px; color: var(--text-muted); margin-top: 2px; font-weight: 400; }
.mr-card__body { padding: 20px; }
.mr-card__body--flush { padding: 0; }
.mr-card__foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap;
}
.mr-card--accent { border-top: 3px solid var(--brand); }

/* Tarjetas de estadistica */
.mr-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.mr-stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mr-stat::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--stat-color, var(--brand));
}
.mr-stat__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mr-stat__label {
  font-size: 11.6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted);
}
.mr-stat__value { font-size: 30px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; margin-top: 6px; }
.mr-stat__hint { font-size: 12.2px; color: var(--text-muted); margin-top: 4px; }
.mr-stat__icon {
  width: 42px; height: 42px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(var(--stat-rgb, var(--brand-rgb)), 0.12);
  color: var(--stat-color, var(--brand));
}
.mr-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.2px; font-weight: 650; }
.mr-delta--up { color: var(--success); }
.mr-delta--down { color: var(--danger); }
.mr-delta--flat { color: var(--text-muted); }

/* ---------- Insignias ----------------------------------------------- */
.mr-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: var(--r-full);
  font-size: 11.8px; font-weight: 650; letter-spacing: 0.005em;
  background: var(--surface-3); color: var(--text-soft);
  white-space: nowrap;
}
.mr-badge--dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}
.mr-badge--lg { height: 28px; padding: 0 12px; font-size: 12.6px; }
.mr-badge--soft { background: rgba(var(--badge-rgb, var(--brand-rgb)), 0.12); color: var(--badge-color, var(--brand)); }
.mr-badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }
.mr-badge--solid { background: var(--badge-color, var(--brand)); color: #fff; }

.mr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-muted);
  font-size: 11.6px; font-weight: 600;
  font-family: var(--font-mono);
}

.mr-priority { display: inline-flex; align-items: center; gap: 6px; font-size: 12.4px; font-weight: 600; }
.mr-priority__bar { width: 3px; height: 14px; border-radius: 2px; background: currentColor; }
.mr-priority--baja { color: var(--success); }
.mr-priority--media { color: #3B82F6; }
.mr-priority--alta { color: var(--warning); }
.mr-priority--critica { color: var(--danger); }

/* ---------- Formularios --------------------------------------------- */
.mr-field { margin-bottom: 17px; }
.mr-label {
  display: block; font-size: 12.9px; font-weight: 620; color: var(--text-soft);
  margin-bottom: 6px;
}
.mr-label .req { color: var(--danger); margin-left: 2px; }
.mr-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.45; }

.mr-input, .mr-select, .mr-textarea {
  width: 100%;
  min-height: 42px; padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  appearance: none;
}
.mr-input::placeholder, .mr-textarea::placeholder { color: var(--text-faint); }
.mr-input:hover, .mr-select:hover, .mr-textarea:hover { border-color: var(--text-faint); }
.mr-input:focus, .mr-select:focus, .mr-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(var(--brand-rgb), 0.15);
}
.mr-input:disabled, .mr-select:disabled, .mr-textarea:disabled { background: var(--surface-3); color: var(--text-muted); cursor: not-allowed; }
.mr-input.is-invalid, .mr-select.is-invalid, .mr-textarea.is-invalid { border-color: var(--danger); }
.mr-input.is-invalid:focus { box-shadow: 0 0 0 3.5px rgba(var(--danger-rgb), 0.15); }
.mr-textarea { min-height: 118px; resize: vertical; line-height: 1.6; }
.mr-select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 38px;
  cursor: pointer;
}
.mr-error { display: block; font-size: 12.2px; color: var(--danger); margin-top: 5px; font-weight: 550; }

.mr-input-group { position: relative; display: flex; align-items: center; }
.mr-input-group .mr-icon {
  position: absolute; left: 13px; color: var(--text-faint); pointer-events: none;
}
.mr-input-group .mr-input { padding-left: 40px; }
.mr-input-group__suffix {
  position: absolute; right: 6px;
  display: flex; align-items: center; gap: 2px;
}

.mr-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.mr-check input[type="checkbox"], .mr-check input[type="radio"] {
  width: 18px; height: 18px; flex: none; margin-top: 1px;
  accent-color: var(--brand); cursor: pointer;
  border-radius: var(--r-xs);
}
.mr-check__text { font-size: 13.4px; color: var(--text-soft); line-height: 1.45; }
.mr-check__text strong { display: block; font-weight: 620; color: var(--text); }
.mr-check__text span { color: var(--text-muted); font-size: 12.4px; }

.mr-switch { display: flex; align-items: center; gap: 11px; cursor: pointer; padding: 6px 0; }
.mr-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.mr-switch__track {
  width: 42px; height: 24px; flex: none; border-radius: var(--r-full);
  background: var(--border-strong); position: relative;
  transition: background var(--transition);
}
.mr-switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.mr-switch input:checked + .mr-switch__track { background: var(--brand); }
.mr-switch input:checked + .mr-switch__track::after { transform: translateX(18px); }
.mr-switch__label { font-size: 13.4px; color: var(--text-soft); }
.mr-switch__label strong { display: block; font-weight: 620; color: var(--text); font-size: 13.4px; }
.mr-switch__label span { font-size: 12.2px; color: var(--text-muted); }

.mr-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.mr-form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mr-form-grid .mr-field--full { grid-column: 1 / -1; }
@media (max-width: 760px) { .mr-form-grid, .mr-form-grid--3 { grid-template-columns: minmax(0, 1fr); } }

/* Selector de tipo (tarjetas) */
.mr-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 13px; }
.mr-type-card {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 15px 16px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
  display: flex; gap: 13px; align-items: flex-start;
  text-align: left; width: 100%;
}
.mr-type-card:hover { border-color: var(--type-color, var(--brand)); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.mr-type-card.is-selected {
  border-color: var(--type-color, var(--brand));
  background: rgba(var(--type-rgb, var(--brand-rgb)), 0.06);
  box-shadow: 0 0 0 3px rgba(var(--type-rgb, var(--brand-rgb)), 0.14);
}
.mr-type-card__icon {
  width: 42px; height: 42px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(var(--type-rgb, var(--brand-rgb)), 0.13);
  color: var(--type-color, var(--brand));
}
.mr-type-card__body { min-width: 0; flex: 1; }
.mr-type-card__name { font-size: 13.9px; font-weight: 640; line-height: 1.35; color: var(--text); }
.mr-type-card__desc { font-size: 12.3px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }
.mr-type-card__meta { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }

.mr-radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 11px; }
.mr-radio-card {
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: 13px 15px; cursor: pointer; background: var(--surface);
  transition: all var(--transition); text-align: center;
}
.mr-radio-card:hover { border-color: var(--border-strong); }
.mr-radio-card.is-selected { border-color: var(--brand); background: rgba(var(--brand-rgb), 0.07); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.12); }
.mr-radio-card input { display: none; }
.mr-radio-card__label { font-size: 13.3px; font-weight: 620; }
.mr-radio-card__hint { font-size: 11.8px; color: var(--text-muted); margin-top: 3px; }

/* Zona de carga */
.mr-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-2);
}
.mr-dropzone:hover, .mr-dropzone.is-dragover { border-color: var(--brand); background: rgba(var(--brand-rgb), 0.05); }
.mr-dropzone__icon { color: var(--text-faint); margin: 0 auto 10px; }
.mr-dropzone strong { display: block; font-size: 13.6px; color: var(--text-soft); }
.mr-dropzone span { font-size: 12.2px; color: var(--text-muted); }

.mr-file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.mr-file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12.8px;
}
.mr-file-item__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.mr-file-item__size { color: var(--text-muted); font-size: 11.8px; flex: none; }

/* ---------- Tablas -------------------------------------------------- */
.mr-table-wrap { overflow-x: auto; }
.mr-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.4px; }
.mr-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  padding: 11px 14px;
  text-align: left;
  font-size: 11.4px; font-weight: 700; letter-spacing: 0.055em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mr-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: middle;
}
.mr-table tbody tr { transition: background var(--transition); }
.mr-table tbody tr:hover { background: var(--surface-2); }
.mr-table tbody tr:last-child td { border-bottom: 0; }
.mr-table td .mr-strong { color: var(--text); font-weight: 620; }
.mr-table--compact tbody td { padding: 9px 12px; }
.mr-table__actions { display: flex; gap: 5px; justify-content: flex-end; }
.mr-table__num { text-align: right; font-variant-numeric: tabular-nums; }

.mr-code-link {
  font-family: var(--font-mono); font-size: 12.2px; font-weight: 600;
  color: var(--brand); background: rgba(var(--brand-rgb), 0.1);
  padding: 3px 8px; border-radius: var(--r-xs); white-space: nowrap;
  display: inline-block;
}
.mr-code-link:hover { background: rgba(var(--brand-rgb), 0.18); }

.mr-empty { padding: 52px 24px; text-align: center; }
.mr-empty__icon {
  width: 60px; height: 60px; margin: 0 auto 16px;
  border-radius: var(--r-lg); display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-faint);
}
.mr-empty h3 { font-size: 16px; margin-bottom: 6px; }
.mr-empty p { color: var(--text-muted); font-size: 13.4px; max-width: 420px; margin: 0 auto 18px; }

/* ---------- Alertas ------------------------------------------------- */
.mr-alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 13.4px;
  margin-bottom: 14px;
  position: relative;
}
.mr-alert__icon { flex: none; margin-top: 1px; }
.mr-alert__body { flex: 1; min-width: 0; }
.mr-alert strong { display: block; font-weight: 640; margin-bottom: 2px; }
.mr-alert--success { background: rgba(var(--success-rgb), 0.1); border-color: rgba(var(--success-rgb), 0.28); color: #047857; }
.mr-alert--error   { background: rgba(var(--danger-rgb), 0.09); border-color: rgba(var(--danger-rgb), 0.28); color: #B91C1C; }
.mr-alert--warning { background: rgba(var(--warning-rgb), 0.11); border-color: rgba(var(--warning-rgb), 0.3); color: #B45309; }
.mr-alert--info    { background: rgba(var(--info-rgb), 0.1); border-color: rgba(var(--info-rgb), 0.28); color: #0369A1; }
[data-theme="dark"] .mr-alert--success { color: #6EE7B7; }
[data-theme="dark"] .mr-alert--error { color: #FCA5A5; }
[data-theme="dark"] .mr-alert--warning { color: #FCD34D; }
[data-theme="dark"] .mr-alert--info { color: #7DD3FC; }

.mr-flash-stack { position: fixed; top: 16px; right: 16px; z-index: 200; width: min(400px, calc(100vw - 32px)); }
.mr-flash-stack .mr-alert { box-shadow: var(--shadow-lg); background: var(--surface); animation: mr-slide-in 260ms ease; margin-bottom: 10px; }
.mr-flash-stack .mr-alert--success { background: var(--surface); border-left: 4px solid var(--success); color: var(--text-soft); }
.mr-flash-stack .mr-alert--error { background: var(--surface); border-left: 4px solid var(--danger); color: var(--text-soft); }
.mr-flash-stack .mr-alert--warning { background: var(--surface); border-left: 4px solid var(--warning); color: var(--text-soft); }
.mr-flash-stack .mr-alert--info { background: var(--surface); border-left: 4px solid var(--info); color: var(--text-soft); }

@keyframes mr-slide-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------- Menus desplegables -------------------------------------- */
.mr-dropdown { position: relative; }
.mr-dropdown__menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 224px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 90;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  max-height: min(70vh, 460px); overflow-y: auto;
}
.mr-dropdown.is-open .mr-dropdown__menu { opacity: 1; visibility: visible; transform: none; }
.mr-dropdown__item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--text-soft); font-size: 13.3px; font-weight: 520;
  cursor: pointer; width: 100%; border: 0; background: transparent; text-align: left;
  transition: background var(--transition), color var(--transition);
}
.mr-dropdown__item:hover { background: var(--surface-3); color: var(--text); }
.mr-dropdown__item--danger { color: var(--danger); }
.mr-dropdown__item--danger:hover { background: rgba(var(--danger-rgb), 0.1); }
.mr-dropdown__divider { height: 1px; background: var(--border); margin: 6px 4px; }
.mr-dropdown__head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.mr-dropdown__head strong { display: block; font-size: 13.6px; }
.mr-dropdown__head span { font-size: 12.2px; color: var(--text-muted); }

/* Panel de notificaciones */
.mr-notif-panel { width: min(380px, calc(100vw - 32px)); padding: 0; }
.mr-notif-panel__head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.mr-notif-panel__list { max-height: 380px; overflow-y: auto; }
.mr-notif-item {
  display: flex; gap: 11px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  text-decoration: none;
}
.mr-notif-item:hover { background: var(--surface-2); }
.mr-notif-item.is-unread { background: rgba(var(--brand-rgb), 0.045); }
.mr-notif-item__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; margin-top: 6px; }
.mr-notif-item__body { min-width: 0; flex: 1; }
.mr-notif-item__title { font-size: 13.1px; font-weight: 600; color: var(--text); line-height: 1.4; }
.mr-notif-item__text { font-size: 12.2px; color: var(--text-muted); margin-top: 2px; line-height: 1.45; }
.mr-notif-item__meta { font-size: 11.4px; color: var(--text-faint); margin-top: 5px; display: flex; gap: 8px; }
.mr-notif-panel__foot { padding: 11px 16px; border-top: 1px solid var(--border); text-align: center; }

/* ---------- Modal --------------------------------------------------- */
.mr-modal {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center; padding: var(--sp-4);
  background: rgba(8, 12, 24, 0.6);
  backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
  overflow-y: auto;
}
.mr-modal.is-open { opacity: 1; visibility: visible; }
.mr-modal__dialog {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: min(560px, 100%);
  border: 1px solid var(--border);
  transform: scale(0.96) translateY(10px);
  transition: transform var(--transition);
  margin: auto;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
}
.mr-modal.is-open .mr-modal__dialog { transform: none; }
.mr-modal__dialog--lg { width: min(760px, 100%); }
.mr-modal__dialog--xl { width: min(1000px, 100%); }
.mr-modal__head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}
.mr-modal__head h3 { font-size: 16.5px; }
.mr-modal__body { padding: 22px; overflow-y: auto; flex: 1; }
.mr-modal__foot {
  padding: 15px 22px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  background: var(--surface-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  flex-wrap: wrap;
}

/* ---------- Pestanas ------------------------------------------------ */
.mr-tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); overflow-x: auto; }
.mr-tab {
  padding: 11px 16px; font-size: 13.6px; font-weight: 580;
  color: var(--text-muted); border: 0; background: transparent; cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  display: inline-flex; align-items: center; gap: 7px;
}
.mr-tab:hover { color: var(--text); }
.mr-tab.is-active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }
.mr-tab-panel { display: none; }
.mr-tab-panel.is-active { display: block; animation: mr-fade 220ms ease; }
@keyframes mr-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Paginacion ---------------------------------------------- */
.mr-pagination { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.mr-page-link {
  min-width: 36px; height: 36px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft);
  font-size: 13.2px; font-weight: 580;
  transition: all var(--transition);
}
.mr-page-link:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }
.mr-page-link.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.mr-page-link.is-disabled { opacity: 0.45; pointer-events: none; }
.mr-page-info { font-size: 12.6px; color: var(--text-muted); }

/* ---------- Barra de filtros ---------------------------------------- */
.mr-filters {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 15px 18px; margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-xs);
}
.mr-filters__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; align-items: end;
}
.mr-filters__actions { display: flex; gap: 8px; align-items: end; }
.mr-filters__toggle { display: none; }
@media (max-width: 900px) { .mr-filters__grid { grid-template-columns: minmax(0, 1fr); } }

.mr-quick-ranges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.mr-quick-range {
  padding: 6px 12px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12.4px; font-weight: 580; color: var(--text-muted); cursor: pointer;
  transition: all var(--transition);
}
.mr-quick-range:hover { border-color: var(--brand); color: var(--brand); }
.mr-quick-range.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Graficas ------------------------------------------------ */
.mr-chart { position: relative; width: 100%; }
.mr-chart--sm { height: 220px; }
.mr-chart--md { height: 280px; }
.mr-chart--lg { height: 330px; }
.mr-chart--xl { height: 380px; }
.mr-chart canvas { max-width: 100%; }

.mr-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; justify-content: center; }
.mr-legend__item { display: flex; align-items: center; gap: 7px; font-size: 12.4px; color: var(--text-muted); }
.mr-legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.mr-heatmap { display: grid; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.mr-heatmap__row { display: grid; grid-template-columns: 42px repeat(24, minmax(20px, 1fr)); gap: 3px; align-items: center; }
.mr-heatmap__label { font-size: 11.4px; color: var(--text-muted); font-weight: 600; }
.mr-heatmap__cell {
  height: 22px; border-radius: 4px; background: var(--surface-3);
  display: grid; place-items: center; font-size: 9.5px; color: transparent;
  transition: transform var(--transition);
}
.mr-heatmap__cell:hover { transform: scale(1.16); outline: 2px solid var(--brand); z-index: 2; }
.mr-heatmap__hours { display: grid; grid-template-columns: 42px repeat(24, minmax(20px, 1fr)); gap: 3px; margin-bottom: 4px; }
.mr-heatmap__hour { font-size: 9.8px; color: var(--text-faint); text-align: center; }

/* ---------- Linea de tiempo ----------------------------------------- */
.mr-timeline { position: relative; padding-left: 30px; }
.mr-timeline::before {
  content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.mr-timeline__item { position: relative; padding-bottom: 20px; }
.mr-timeline__item:last-child { padding-bottom: 0; }
.mr-timeline__dot {
  position: absolute; left: -30px; top: 0;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--tl-color, var(--brand));
  color: var(--tl-color, var(--brand));
}
.mr-timeline__head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.mr-timeline__title { font-size: 13.4px; font-weight: 620; color: var(--text); }
.mr-timeline__time { font-size: 11.8px; color: var(--text-faint); margin-left: auto; white-space: nowrap; }
.mr-timeline__body { font-size: 12.9px; color: var(--text-muted); margin-top: 4px; line-height: 1.55; }
.mr-timeline__body strong { color: var(--text-soft); font-weight: 600; }
.mr-timeline__note {
  margin-top: 8px; padding: 10px 13px; border-radius: var(--r-md);
  background: var(--surface-2); border-left: 3px solid var(--border-strong);
  font-size: 13px; color: var(--text-soft); line-height: 1.6;
}
.mr-timeline__note--internal { background: rgba(var(--purple-rgb), 0.07); border-left-color: var(--purple); }

.mr-diff { display: inline-flex; align-items: center; gap: 7px; font-size: 12.6px; flex-wrap: wrap; }
.mr-diff__old { color: var(--danger); text-decoration: line-through; opacity: 0.8; }
.mr-diff__new { color: var(--success); font-weight: 600; }

/* ---------- Detalle de ticket --------------------------------------- */
.mr-ticket-head {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px 24px; margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.mr-ticket-head::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 5px;
  background: var(--ticket-color, var(--brand));
}
.mr-ticket-head__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.mr-ticket-head h1 { font-size: 21px; line-height: 1.3; }
.mr-ticket-head__meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 11px; }

.mr-meta-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.mr-meta-item__label {
  font-size: 10.8px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 4px;
}
.mr-meta-item__value { font-size: 13.6px; color: var(--text); font-weight: 550; display: flex; align-items: center; gap: 8px; }
.mr-meta-item__value small { font-size: 11.8px; color: var(--text-muted); font-weight: 400; }

.mr-progress { height: 7px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.mr-progress__bar { height: 100%; border-radius: var(--r-full); background: var(--brand); transition: width var(--transition-slow); }
.mr-progress__bar--success { background: var(--success); }
.mr-progress__bar--warning { background: var(--warning); }
.mr-progress__bar--danger { background: var(--danger); }

.mr-sla { display: flex; align-items: center; gap: 10px; }
.mr-sla__text { font-size: 12.6px; font-weight: 600; }
.mr-sla--ok .mr-sla__text { color: var(--success); }
.mr-sla--warn .mr-sla__text { color: var(--warning); }
.mr-sla--late .mr-sla__text { color: var(--danger); }

.mr-attachment {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface-2);
  transition: all var(--transition);
}
.mr-attachment:hover { border-color: var(--brand); background: var(--surface); }
.mr-attachment__icon {
  width: 36px; height: 36px; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted);
}
.mr-attachment__meta { min-width: 0; flex: 1; }
.mr-attachment__name { font-size: 13px; font-weight: 580; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-attachment__sub { font-size: 11.6px; color: var(--text-muted); }

.mr-comment { display: flex; gap: 13px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.mr-comment:last-child { border-bottom: 0; }
.mr-comment--internal { background: rgba(var(--purple-rgb), 0.045); margin: 0 -20px; padding: 16px 20px; border-radius: var(--r-md); }
.mr-comment__body { flex: 1; min-width: 0; }
.mr-comment__head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 6px; }
.mr-comment__author { font-size: 13.4px; font-weight: 640; }
.mr-comment__time { font-size: 11.8px; color: var(--text-faint); }
.mr-comment__text { font-size: 13.6px; color: var(--text-soft); line-height: 1.65; white-space: pre-wrap; word-wrap: break-word; }

/* ---------- Varios -------------------------------------------------- */
.mr-divider { height: 1px; background: var(--border); margin: var(--sp-5) 0; }
.mr-divider--text { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 12.2px; }
.mr-divider--text::before, .mr-divider--text::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.mr-kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13.2px; }
.mr-kv:last-child { border-bottom: 0; }
.mr-kv__k { color: var(--text-muted); }
.mr-kv__v { color: var(--text); font-weight: 580; text-align: right; }

.mr-mono { font-family: var(--font-mono); font-size: 12.4px; }
.mr-muted { color: var(--text-muted); }
.mr-faint { color: var(--text-faint); }
.mr-strong { font-weight: 640; color: var(--text); }
.mr-small { font-size: 12.2px; }
.mr-xs { font-size: 11.4px; }
.mr-nowrap { white-space: nowrap; }
.mr-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mr-center { text-align: center; }
.mr-right { text-align: right; }
.mr-mt-0 { margin-top: 0; }
.mr-mt-2 { margin-top: var(--sp-2); }
.mr-mt-3 { margin-top: var(--sp-3); }
.mr-mt-4 { margin-top: var(--sp-4); }
.mr-mt-5 { margin-top: var(--sp-5); }
.mr-mt-6 { margin-top: var(--sp-6); }
.mr-mb-0 { margin-bottom: 0; }
.mr-mb-2 { margin-bottom: var(--sp-2); }
.mr-mb-3 { margin-bottom: var(--sp-3); }
.mr-mb-4 { margin-bottom: var(--sp-4); }
.mr-mb-5 { margin-bottom: var(--sp-5); }
.mr-hidden { display: none !important; }
.mr-scroll-y { overflow-y: auto; }
.mr-max-h-300 { max-height: 300px; }
.mr-max-h-420 { max-height: 420px; }

.mr-tooltip { position: relative; }
.mr-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: #0F172A; color: #fff; padding: 6px 10px; border-radius: var(--r-sm);
  font-size: 11.8px; white-space: nowrap; z-index: 100; box-shadow: var(--shadow-md);
  pointer-events: none;
}
/* En la barra superior no hay espacio arriba: el tooltip se abre hacia abajo
   y alineado a la derecha del boton para no salirse de la pantalla. */
.mr-topbar .mr-tooltip:hover::after,
.mr-tooltip--bottom:hover::after {
  bottom: auto; top: calc(100% + 8px);
  left: auto; right: 0; transform: none;
}
/* En pantallas tactiles no hay "pasar el mouse": el tooltip quedaba pegado
   tras tocar el boton. Ahi no se muestra (el boton ya tiene aria-label). */
@media (hover: none) {
  .mr-tooltip:hover::after { display: none; }
}

.mr-pulse { animation: mr-pulse 2s infinite; }
@keyframes mr-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.mr-spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: mr-spin 700ms linear infinite;
  display: inline-block;
}
.mr-spinner--dark { border-color: var(--border-strong); border-top-color: var(--brand); }
@keyframes mr-spin { to { transform: rotate(360deg); } }

.mr-loading-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--r-lg);
}
[data-theme="dark"] .mr-loading-overlay { background: rgba(16, 24, 48, 0.72); }

.mr-copy-btn { cursor: pointer; }

/* Barra de desplazamiento horizontal para tablas anchas */
.mr-table-wrap { scrollbar-width: thin; }

/* ---------- Impresion ----------------------------------------------- */
@media print {
  .mr-sidebar, .mr-topbar, .mr-filters, .mr-page-head__actions,
  .mr-flash-stack, .mr-no-print, .mr-btn { display: none !important; }
  .mr-main { margin-left: 0; }
  .mr-content { padding: 0; }
  .mr-card { box-shadow: none; border-color: #D1D5DB; break-inside: avoid; }
  body { background: #fff; font-size: 12px; }
  .mr-grid--sidebar, .mr-grid--2, .mr-grid--3 { grid-template-columns: 1fr !important; }
}
