/* ==========================================================================
   BI Connect - Components Stylesheet (High-Contrast & Dual-Theme)
   Power BI Yellow & Black Theme with Pristine Light Mode Visibility
   ========================================================================== */

/* Cards & Surface Panels */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-md);
}

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

.section-title h2 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.25;
}

.section-title p {
  font-size: 0.80rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.35;
}

/* Dashboard Mode Segmented Switcher */
.view-switcher-group {
  display: inline-flex;
  background-color: var(--bg-surface-subtle);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.view-switch-btn {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-switch-btn:hover {
  color: var(--text-main);
}

.view-switch-btn.active {
  background-color: #f2c811;
  color: #000000;
  box-shadow: 0 2px 8px rgba(242, 200, 17, 0.35);
}

/* Two-column Layout for Management Tabs */
.split-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .split-layout {
    grid-template-columns: 1fr;
  }
}

/* Form Styles */
.form-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.form-panel-header {
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.form-panel-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-panel-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

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

.form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: #f2c811;
  box-shadow: 0 0 0 3px rgba(242, 200, 17, 0.25);
}

.form-control::placeholder {
  color: var(--text-light);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .form-control {
  padding-right: 40px;
}

.input-icon-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.input-icon-btn:hover {
  color: var(--text-main);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background-color: #f2c811;
  color: #000000;
  border-color: #f2c811;
}

.btn-primary:hover {
  background-color: #eab308;
  border-color: #eab308;
  box-shadow: 0 4px 14px rgba(242, 200, 17, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--bg-surface-subtle);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-danger {
  background-color: var(--bg-danger);
  border-color: var(--border-danger);
  color: var(--color-danger);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-full {
  width: 100%;
}

/* KPI Cards Grid - Exactly 6 Cards in Single Line */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    overflow-x: auto;
    padding-bottom: 6px;
  }
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  min-height: 68px;
}

.kpi-card:hover {
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.kpi-card .kpi-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-card .kpi-value {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 1px 0;
  line-height: 1.2;
}

.kpi-card .kpi-sub {
  font-size: 0.62rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Paid Highlight Card */
.kpi-card.kpi-paid-highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-surface) 100%);
}

body.light-theme .kpi-card.kpi-paid-highlight {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
  border-color: #a7f3d0;
}

/* Profit Highlight Card */
.kpi-card.kpi-profit-highlight {
  border-color: var(--border-profit);
  background: linear-gradient(135deg, var(--bg-profit) 0%, var(--bg-surface) 100%);
  box-shadow: var(--shadow-xs);
}

body.light-theme .kpi-card.kpi-profit-highlight {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  border-color: #fde047;
}

.kpi-card.kpi-profit-highlight .kpi-value {
  color: var(--brand-yellow);
}

body.light-theme .kpi-card.kpi-profit-highlight .kpi-value {
  color: #b45309;
}

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

.kpi-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.kpi-icon-pill {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-surface-subtle);
  color: var(--text-main);
  font-size: 0.8rem;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
  margin-bottom: 2px;
}

.kpi-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Budget Progress Meter - Ultra Compact */
.budget-meter-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

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

.meter-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.meter-stats strong {
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 800;
}

.progress-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-fill {
  height: 100%;
  background-color: #f2c811;
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}

.progress-fill.warning { background-color: var(--color-pending); }
.progress-fill.danger { background-color: var(--color-danger); }

/* Charts Grid - Compact & Responsive */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.chart-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
}

.chart-header {
  margin-bottom: 8px;
}

.chart-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 220px;
}

/* =========================================================================
   ROLE-BASED PERMISSION RULES & USER PROFILE WIDGET
   ========================================================================= */
/* Role-Based Permissions & Isolation */
body.role-agente .role-hide-agent {
  display: none !important;
}

body.role-gerente .role-hide-manager {
  display: none !important;
}

body:not(.role-agente) .role-only-agent,
body:not(.role-agente) .role-only-agent-block,
body:not(.role-agente) .header-agent-pill.role-only-agent {
  display: none !important;
}

body.role-agente .role-only-agent,
body.role-agente .header-agent-pill.role-only-agent {
  display: flex !important;
}

body.role-agente .role-only-agent-block {
  display: block !important;
}

/* Cliente Role Isolation */
body.role-cliente .role-hide-cliente {
  display: none !important;
}

body.role-cliente .role-only-cliente {
  display: flex !important;
}

body:not(.role-cliente) .role-only-cliente {
  display: none !important;
}

/* Gerente Only */
body:not(.role-gerente) .role-gerente-only {
  display: none !important;
}

/* Hide table columns for Agente (no financial values) */
body.role-agente th.col-cost,
body.role-agente td.col-cost,
body.role-agente th.col-budget,
body.role-agente td.col-budget,
body.role-agente th.col-repasse,
body.role-agente td.col-repasse,
body.role-agente th.col-balance,
body.role-agente td.col-balance,
body.role-agente th.col-status-pay,
body.role-agente td.col-status-pay {
  display: none !important;
}

/* Hide internal cost column for Cliente (only Repasse and Budget visible) */
body.role-cliente th.col-cost,
body.role-cliente td.col-cost,
body.role-cliente .card-cost-internal,
body.role-cliente .cost-internal-field {
  display: none !important;
}

/* User Profile Widget in Topbar */
.user-profile-widget {
  position: relative;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 4px 12px 4px 6px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.user-profile-btn:hover {
  border-color: var(--brand-yellow);
  background-color: var(--bg-surface);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #000;
  border: 1.5px solid var(--brand-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.user-profile-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-role-tag {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--brand-yellow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.light-theme .user-role-tag {
  color: #b45309;
}

.user-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.user-profile-widget.open .user-chevron {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  z-index: 100;
  display: none;
  animation: fadeIn 0.15s ease-in-out;
}

.user-profile-widget.open .user-profile-dropdown {
  display: block;
}

.dropdown-header {
  padding: 8px 10px 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.dropdown-current-user-info {
  padding: 6px 10px 10px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
}

.dropdown-current-user-info .user-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropdown-current-user-info .user-email {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.dropdown-current-user-info .user-comp {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--brand-yellow);
  margin-top: 4px;
}

.role-select-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  margin-bottom: 4px;
}

.role-select-item:hover {
  background-color: var(--bg-surface-subtle);
  border-color: var(--border-subtle);
}

.role-select-item.active {
  background-color: var(--brand-yellow-subtle);
  border-color: rgba(242, 200, 17, 0.4);
}

body.light-theme .role-select-item.active {
  background-color: #fef3c7;
  border-color: #fcd34d;
}

.role-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.role-desc {
  flex: 1;
}

.role-desc strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text-main);
}

.role-desc p {
  font-size: 0.70rem;
  color: var(--text-muted);
  margin-top: 1px;
  line-height: 1.2;
}

.role-check {
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--brand-yellow);
  display: none;
}

body.light-theme .role-check {
  color: #b45309;
}

.role-select-item.active .role-check {
  display: inline-block;
}

.dropdown-action-btns {
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* User Badges */
.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.user-role-badge.gerente {
  background: var(--brand-yellow-subtle);
  color: var(--brand-yellow);
  border: 1px solid rgba(242, 200, 17, 0.4);
}
body.light-theme .user-role-badge.gerente {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}

.user-role-badge.agente {
  background: rgba(6, 182, 212, 0.12);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.35);
}
body.light-theme .user-role-badge.agente {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}

.user-role-badge.cliente {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
body.light-theme .user-role-badge.cliente {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.user-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
}
.user-status-pill.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.user-status-pill.inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.quick-login-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.quick-login-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.quick-login-card:hover {
  border-color: var(--brand-yellow);
  background: var(--brand-yellow-subtle);
}
.quick-login-card .icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}
.quick-login-card .title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}
.quick-login-card .subtitle {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  border: 1px solid transparent;
}

.status-badge.paid {
  background-color: var(--bg-paid);
  color: var(--color-paid);
  border-color: var(--border-paid);
}

.status-badge.paid:hover {
  filter: brightness(0.95);
}

.status-badge.pending {
  background-color: var(--bg-pending);
  color: var(--color-pending);
  border-color: var(--border-pending);
}

.status-badge.pending:hover {
  filter: brightness(0.95);
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Toggle Checkbox for Payment */
.payment-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.payment-toggle input[type="checkbox"] {
  display: none;
}

.payment-toggle .toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  transition: var(--transition);
  background-color: var(--bg-pending);
  color: var(--color-pending);
  border: 1px solid var(--border-pending);
}

.payment-toggle input[type="checkbox"]:checked + .toggle-pill {
  background-color: var(--bg-paid);
  color: var(--color-paid);
  border-color: var(--border-paid);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}

.data-table th {
  background-color: var(--bg-surface-subtle);
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

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

.data-table tbody tr:hover {
  background-color: var(--bg-surface-subtle);
}

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

.price-tag {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--text-main);
}

/* Card Lists for BMs & Items */
.items-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.item-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
}

.item-card:hover {
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.item-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.item-card-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.item-card-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.item-card-row strong {
  color: var(--text-main);
  font-weight: 700;
}

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

/* Sub-tabs Bar */
.subtabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  overflow-x: auto;
}

.subtab-btn {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.subtab-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-subtle);
}

.subtab-btn.active {
  background-color: var(--brand-yellow-subtle);
  color: var(--brand-yellow);
  border-color: var(--brand-yellow-border);
}

body.light-theme .subtab-btn.active {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.show {
  display: flex;
  animation: fadeIn 0.15s ease-out;
}

.modal-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  padding: 26px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px;
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 0.84rem;
}

/* Pending Highlight Card */
.kpi-card.kpi-pending-highlight {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-surface) 100%);
}

body.light-theme .kpi-card.kpi-pending-highlight {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  border-color: #fde68a;
}

/* ==========================================================================
   HOLLYWOOD-GRADE CINEMATIC LOGIN SCREEN
   ========================================================================== */
.login-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  background-color: rgba(6, 8, 13, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.7s ease;
}

.login-screen-overlay.login-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ==========================================================================
   UNIVERSAL BACKGROUND EFFECT: CONSTELLATION PARTICLES & GOLDEN GLOW
   ========================================================================== */
.universal-bg-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

body.light-theme .universal-bg-effect {
  opacity: 0.18;
}

.universal-canvas,
.login-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.universal-ambient-glow,
.login-ambient-glow {
  position: absolute;
  top: 45%;
  left: 55%;
  width: 750px;
  height: 750px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(242, 200, 17, 0.12) 0%, rgba(217, 119, 6, 0.04) 45%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
  animation: pulseGlow 7s ease-in-out infinite alternate;
}

.universal-grid-cyber,
.login-grid-cyber {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(242, 200, 17, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 200, 17, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

@keyframes pulseGlow {
  0% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.7;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 1;
  }
}

.login-card-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  padding: 20px;
  box-sizing: border-box;
}

.login-cyber-card {
  position: relative;
  background: rgba(12, 16, 26, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(242, 200, 17, 0.25);
  border-radius: 20px;
  padding: 36px 32px 32px 32px;
  box-shadow: 
    0 0 50px rgba(0, 0, 0, 0.8),
    0 0 30px rgba(242, 200, 17, 0.1),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.card-glow-border {
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #f2c811, #fbbf24, #f2c811, transparent);
  box-shadow: 0 0 15px #f2c811;
}

.login-brand-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(242, 200, 17, 0.1);
  border: 1px solid rgba(242, 200, 17, 0.3);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #f2c811;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.login-brand-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: radarBlink 2s infinite;
}

@keyframes radarBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

.login-brand-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0 0 6px 0;
}

.login-brand-title .brand-symbol {
  color: #f2c811;
  filter: drop-shadow(0 0 12px rgba(242, 200, 17, 0.6));
}

.login-brand-title .brand-accent {
  color: #f2c811;
  text-shadow: 0 0 20px rgba(242, 200, 17, 0.5);
}

.login-brand-sub {
  font-size: 0.82rem;
  color: #94a3b8;
  margin: 0;
  letter-spacing: 0.02em;
}

/* Form Styles */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.login-input-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.login-input-wrapper .input-icon-svg {
  position: absolute;
  left: 14px;
  color: #64748b;
  pointer-events: none;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.login-input-wrapper input {
  width: 100%;
  height: 48px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0 42px 0 42px;
  color: #ffffff;
  font-size: 0.92rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.login-input-wrapper input:focus {
  outline: none;
  border-color: #f2c811;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 3px rgba(242, 200, 17, 0.2), 0 0 16px rgba(242, 200, 17, 0.15);
}

.login-input-wrapper:focus-within .input-icon-svg {
  color: #f2c811;
  transform: scale(1.1);
}

.btn-toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.btn-toggle-pw:hover {
  color: #f2c811;
}

.login-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.3;
}

.login-alert.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.login-alert.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.login-btn-submit {
  position: relative;
  overflow: hidden;
  height: 48px;
  background: linear-gradient(135deg, #f2c811 0%, #fbbf24 50%, #d97706 100%);
  border: none;
  border-radius: 10px;
  color: #0b0f19;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 4px 20px rgba(242, 200, 17, 0.35);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(242, 200, 17, 0.55);
}

.login-btn-submit:active {
  transform: translateY(1px);
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-25deg);
  animation: buttonShine 3.5s infinite;
}

@keyframes buttonShine {
  0% { left: -100%; }
  25%, 100% { left: 160%; }
}

.login-card-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.72rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.login-card-footer i {
  color: #10b981;
}

/* Hollywood Shake Animation on invalid login */
@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.login-shake {
  animation: cardShake 0.45s ease-in-out;
}

/* Hyperdrive Warp Exit Animation */
@keyframes warpExit {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  40% {
    transform: scale(0.96);
    opacity: 1;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
    filter: blur(12px);
  }
}

.warp-exit {
  animation: warpExit 0.65s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

/* ==========================================================================
   Weekly Pending Costs Report (Design Compacto & Executivo)
   ========================================================================== */
.pending-report-sheet {
  background: #ffffff;
  color: #1e293b;
  border-radius: var(--radius-md);
  padding: 24px 28px;
  max-width: 920px;
  margin: 0 auto 30px auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-family: var(--font-body);
  font-size: 0.84rem;
}

.pending-report-sheet .report-header {
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.pending-report-sheet .report-company-info h2 {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #0f172a;
  margin: 4px 0 2px 0;
  line-height: 1.25;
}

.pending-report-sheet .report-company-info p {
  font-size: 0.78rem !important;
  color: #64748b;
  margin: 0 0 2px 0;
  line-height: 1.35;
}

.pending-report-sheet .report-meta {
  text-align: right;
}

.pending-report-sheet .report-meta p {
  font-size: 0.76rem !important;
  color: #64748b;
  margin: 2px 0;
}

.pending-report-sheet .report-badge {
  font-size: 0.7rem !important;
  font-weight: 700;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  letter-spacing: 0.02em;
}

/* KPI Summary Cards */
.pending-report-sheet .report-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  gap: 10px !important;
  margin-bottom: 16px !important;
}

.pending-report-sheet .report-card {
  padding: 8px 12px !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  border: 1px solid #e2e8f0;
}

.pending-report-sheet .report-card-label {
  font-size: 0.64rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
  line-height: 1.2;
}

.pending-report-sheet .report-card-value {
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  line-height: 1.2;
}

/* Weekly Cards */
.pending-report-sheet .weekly-pending-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pending-report-sheet .weekly-pending-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.pending-report-sheet .week-card-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 14px !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pending-report-sheet .week-card-header h4 {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  color: #0f172a;
  margin: 0;
}

.pending-report-sheet .week-subtotal-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 4px 10px !important;
  border-radius: 6px !important;
}

.pending-report-sheet .week-subtotal-box .subtotal-label {
  font-size: 0.62rem !important;
  color: #b45309;
  text-transform: uppercase;
  font-weight: 700;
  display: block;
}

.pending-report-sheet .week-subtotal-box strong {
  font-size: 0.95rem !important;
  color: #b45309;
  line-height: 1.1;
}

/* Table */
.pending-report-sheet .report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem !important;
  margin-bottom: 0 !important;
}

.pending-report-sheet .report-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 0.72rem !important;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 7px 10px !important;
  border-bottom: 1px solid #e2e8f0;
}

.pending-report-sheet .report-table td {
  padding: 6px 10px !important;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  font-size: 0.8rem !important;
  color: #1e293b;
}

.pending-report-sheet .report-table tr:hover td {
  background-color: #f8fafc;
}

.pending-report-sheet .report-table tfoot td {
  background: #fcfcfd;
  border-top: 1px solid #e2e8f0;
  padding: 7px 10px !important;
  font-weight: 700;
  font-size: 0.82rem !important;
}

.pending-report-sheet .report-tag-pending {
  font-size: 0.68rem !important;
  padding: 2px 7px !important;
  font-weight: 700;
  border-radius: 4px;
}

/* Grand Total Box */
.pending-report-sheet .grand-total-box {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 16px !important;
  margin: 16px 0 12px 0 !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pending-report-sheet .grand-total-box h3 {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: #78350f;
  margin: 2px 0 0 0 !important;
}

.pending-report-sheet .grand-total-box .total-value {
  font-size: 1.35rem !important;
  font-weight: 800 !important;
  color: #b45309;
}

/* Banner notes & footers */
.pending-report-sheet .report-note-banner {
  padding: 8px 14px !important;
  margin-bottom: 14px !important;
  font-size: 0.78rem !important;
  line-height: 1.4;
}

.pending-report-sheet .report-footer-note {
  margin-top: 16px !important;
  padding-top: 10px !important;
  font-size: 0.72rem !important;
  color: #94a3b8;
}

@media (max-width: 768px) {
  .pending-report-sheet {
    padding: 16px 12px;
    font-size: 0.8rem;
  }
}

