/* =========================================================================
   SISTEMA DE GASTOS CORPORATIVOS & CONCILIACIÓN — IVAD HOME & GOODS
   DISEÑO OFICIAL BASADO EN GUÍA EJECUTIVA DE CONTROL DE TARJETAS
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #edf2f7;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --indigo: #4f46e5;
  --indigo-soft: #eef2ff;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --warning: #c2410c;
  --warning-bg: #fff7ed;
  --info: #1d4ed8;
  --info-bg: #eff6ff;
  --purple: #6d28d9;
  --purple-bg: #f5f3ff;
  --danger: #dc2626;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-subtle: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}

/* TOP NAVBAR */
.top-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo-img {
  height: 38px;
  width: auto;
}

.brand-text {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-weight: 400;
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 64px;
}

.nav-tab-item {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-tab-item:hover {
  color: var(--text-main);
}

.nav-tab-item.active {
  color: var(--indigo);
  font-weight: 600;
  border-bottom: 2px solid var(--indigo);
}

.user-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dept-selector {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.notification-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  position: relative;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.notification-btn:hover {
  background: var(--bg);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 8px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.user-details {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

.user-role {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* MAIN CONTAINER */
.dashboard-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 32px 32px 64px 32px;
}

/* TITLE ACTION BAR */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 20px;
}

.header-info h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.header-info .header-subtitle {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.header-info p {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 680px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  border: 1px solid transparent;
  font-family: inherit;
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
  box-shadow: var(--shadow-subtle);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-primary {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
  background: #1e293b;
}

/* METRICS ROW (4 CARDS) */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.metric-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric-subdate {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.orange { background: #f97316; }
.status-dot.red { background: #ef4444; }

.metric-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.metric-footnote {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* MIDDLE TWO-COLUMN ROW */
.split-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 20px;
  margin-bottom: 28px;
}

.card-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-subtle);
}

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

.panel-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.panel-header .view-all {
  font-size: 13px;
  font-weight: 600;
  color: var(--indigo);
  text-decoration: none;
  cursor: pointer;
}

.panel-header .view-all:hover {
  text-decoration: underline;
}

.panel-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 20px;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.provider-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.provider-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.provider-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.security-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* CORREOS RECIBIDOS LIST */
.emails-list {
  display: flex;
  flex-direction: column;
}

.email-item {
  display: grid;
  grid-template-columns: 140px 120px 1fr 110px 90px 100px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.email-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.email-date {
  color: var(--text-muted);
  font-size: 12px;
}

.email-bank {
  font-weight: 500;
  color: var(--text-main);
}

.email-merchant {
  font-weight: 600;
  color: var(--text-main);
}

.email-amount {
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
  padding-right: 12px;
}

.email-card {
  color: var(--text-muted);
  font-family: monospace;
  font-size: 12px;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-conciliado {
  background: var(--success-bg);
  color: var(--success);
}

.badge-pendiente {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-revision {
  background: var(--info-bg);
  color: var(--info);
}

.badge-aprobado {
  background: var(--purple-bg);
  color: var(--purple);
}

/* TABLE SECTION: ÚLTIMOS GASTOS */
.table-section {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
}

.table-section-header {
  padding: 20px 24px 16px 24px;
}

.table-section-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.custom-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.custom-data-table th {
  background: #ffffff;
  padding: 12px 24px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border);
}

.custom-data-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.custom-data-table tr:hover td {
  background: #fbfcfe;
}

.merchant-name {
  font-weight: 600;
  color: var(--text-main);
}

.amount-cell {
  font-weight: 700;
  color: var(--text-main);
}

.action-menu-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-menu-btn:hover {
  background: var(--bg);
  color: var(--text-main);
}

/* TABLE FOOTER */
.table-footer {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.15s;
}

.page-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.page-btn.active {
  border-color: var(--indigo);
  color: var(--indigo);
  background: var(--indigo-soft);
}

/* BOTTOM FOOTER */
.app-footer {
  max-width: 1380px;
  margin: 32px auto 0 auto;
  padding: 0 32px 32px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.app-footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* MODAL OVERLAYS */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-main);
  background: #ffffff;
  outline: none;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* TOAST */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
}
