/* LEOVIC - Apple Inspired Light Minimalist Stylesheet */

/* Variables & Apple Design System */
:root {
  --bg-primary: #f5f5f7; /* Apple light gray */
  --bg-secondary: #ffffff; /* Pure white */
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --border-color: #e8e8ed; /* Clean dividers */
  --border-hover: #d2d2d7;
  
  --text-primary: #1d1d1f; /* Apple deep dark */
  --text-secondary: #6e6e73; /* Apple secondary gray */
  --text-muted: #86868b;
  
  --accent-color: #0071e3; /* Apple Blue */
  --accent-light: #47a0ff;
  --accent-glow: rgba(0, 113, 227, 0.06);
  
  --emerald: #34c759; /* Apple Green */
  --emerald-glow: rgba(52, 199, 89, 0.08);
  --rose: #ff3b30; /* Apple Red */
  --rose-glow: rgba(255, 59, 48, 0.08);
  --cyan: #30b0c7; /* Apple Teal */
  --cyan-glow: rgba(48, 176, 199, 0.08);
  --amber: #ff9500; /* Apple Orange */
  --amber-glow: rgba(255, 149, 0, 0.08);
  
  --sidebar-width: 270px;
  --header-height: 70px;
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --border-radius: 16px;
  --border-radius-large: 22px;
  --font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
}

html {
  min-width: 320px;
}

/* Custom Minimalist Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* Global Utility: Hidden */
.hidden {
  display: none !important;
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  min-width: 0;
}

/* Auth / Login View */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--bg-primary);
  padding: 20px;
}

.auth-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-large);
  width: 100%;
  max-width: 420px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.logo-auth {
  margin: 0 auto 16px auto;
  width: 50px;
  height: 50px;
  border-radius: 14px;
}

.logo-auth i {
  width: 28px;
  height: 28px;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.auth-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.btn-auth {
  width: 100%;
  padding: 12px;
  margin-top: 16px;
}

/* Portal Wrapper */
.portal-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
}

.portal-header {
  height: 70px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-user-nav {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

.portal-main {
  flex-grow: 1;
  padding: 40px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 40px;
}

.portal-section-header {
  margin-bottom: 24px;
}

.portal-section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.portal-section-header p {
  font-size: 0.85rem;
  margin-top: 2px;
}

.portal-companies-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Portal Company Card */
.portal-company-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
  transition: var(--transition-smooth);
}


.portal-comp-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.25;
}

.portal-comp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.btn-portal-go {
  margin-top: 20px;
  width: 100%;
  font-size: 0.82rem;
  padding: 8px 12px;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 20px 14px;
}

.sidebar-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 10px 16px 10px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  gap: 10px;
}

.logo-icon {
  background: linear-gradient(135deg, #ff5e62, #ff9966); /* Rose petal gradient */
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(255, 94, 98, 0.2);
}

.logo-icon i {
  width: 20px;
  height: 20px;
}

.logo-text {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

/* Back to Portal sidebar button */
.sidebar-back-portal {
  margin-top: 14px;
  padding: 0 4px;
}

.btn-back-portal-action {
  width: 100%;
  font-size: 0.8rem;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #fafafa;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-back-portal-action:hover {
  background-color: #f5f5f7;
  border-color: var(--border-hover);
}

/* Active Company Display Card in Sidebar */
.sidebar-company-card {
  margin-top: 12px;
  background: var(--bg-primary);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.company-card-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.company-card-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.sidebar-company-card h3 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
  margin-top: 3px;
  max-width: 100%;
}

/* Navigation menu */
.sidebar-menu {
  margin-top: 16px;
  flex-grow: 1;
}

.sidebar-menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.menu-item i {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.menu-item:hover {
  color: var(--text-primary);
  background: #f5f5f7;
}

.menu-item:hover i {
  color: var(--text-primary);
}

.menu-item.active {
  color: var(--accent-color);
  background: rgba(0, 113, 227, 0.08);
  font-weight: 600;
}

.menu-item.active i {
  color: var(--accent-color);
}

/* User profile footer */
.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

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

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-color), #34c759);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.username {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  padding: 0 32px 32px 32px;
}

/* Top Header */
.top-header {
  min-height: var(--header-height);
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left,
.header-right,
.stat-widget-details {
  min-width: 0;
}

#page-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
  color: var(--text-primary);
}

#page-subtitle {
  font-size: 0.78rem;
  line-height: 1.35;
  margin-top: 3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.company-dropdown-container {
  position: relative;
}

.select-company {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 10px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  min-width: min(200px, 100%);
  max-width: 100%;
  transition: var(--transition-smooth);
}

.select-company:hover {
  border-color: var(--border-hover);
  background-color: #fafafa;
}

.date-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.date-badge i {
  color: var(--text-secondary);
  width: 14px;
  height: 14px;
}

/* Quick Metrics Bar */
.quick-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.stat-widget {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.015);
  transition: var(--transition-smooth);
  min-width: 0;
}


.stat-widget-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-widget-icon i {
  width: 17px;
  height: 17px;
}

.icon-blue {
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent-color);
}

.icon-emerald {
  background: rgba(52, 199, 89, 0.08);
  color: var(--emerald);
}

.icon-rose {
  background: rgba(255, 59, 48, 0.08);
  color: var(--rose);
}

.icon-cyan {
  background: rgba(48, 176, 199, 0.08);
  color: var(--cyan);
}

.stat-widget-details {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.stat-widget-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.25;
}

.stat-widget-details h4 {
  font-size: clamp(0.95rem, 1.12vw, 1.18rem);
  font-weight: 800;
  margin-top: 2px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

/* Soft Numbers style */
.soft-numbers {
  font-family: var(--font-family);
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Dynamic Section Container */
.content-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loader Styles */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  gap: 16px;
  color: var(--text-secondary);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  border-top-color: var(--accent-color);
  animation: spin 0.8s linear infinite;
}

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

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control, .form-select {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 8px 12px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-smooth);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.form-control::placeholder {
  color: #c7c7cc;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid-2-1 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
}

.grid-1-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 20px;
}

/* Card & Section Layouts */
h1, h2, h3, h4, h5, h6, .soft-numbers {
  letter-spacing: -0.015em;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01), 0 1px 2px rgba(0, 0, 0, 0.01);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}


.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 10px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  outline: none;
}

.btn:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--accent-color);
  color: white;
}

.btn-primary:hover {
  background-color: #0062c3;
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: #fafafa;
  border-color: var(--border-hover);
}

.btn-success {
  background-color: var(--emerald);
  color: white;
}

.btn-success:hover {
  background-color: #2baf4e;
}

.btn-danger {
  background-color: var(--rose);
  color: white;
}

.btn-danger:hover {
  background-color: #eb2d23;
  transform: translateY(-0.5px);
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
}

.btn-icon-small {
  padding: 0 !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  border-radius: 6px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.btn-icon-small:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.btn-icon-small.text-rose,
.btn-action-delete {
  color: var(--rose) !important;
  background: rgba(255, 59, 48, 0.08) !important;
  border: 1px solid rgba(255, 59, 48, 0.2) !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  border-radius: 6px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 !important;
  transition: all 0.18s ease;
}

.btn-icon-small.text-rose:hover,
.btn-action-delete:hover {
  background: #ff3b30 !important;
  border-color: #ff3b30 !important;
  color: #ffffff !important;
  transform: scale(1.06);
}

.form-select-micro {
  font-size: 0.72rem;
  padding: 2px 6px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(45, 87, 44, 0.25);
  background: #fbfdfb;
  color: #2d572c;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  margin-left: 8px;
}

.form-select-micro:hover {
  border-color: #2d572c;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.btn-icon-small i, .btn-icon-small svg,
.btn-action-delete i, .btn-action-delete svg {
  width: 14px !important;
  height: 14px !important;
  stroke: currentColor !important;
  display: inline-block !important;
}

/* Badges / Labels */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-income, .badge-success {
  background-color: rgba(52, 199, 89, 0.08);
  color: #24b243;
  border: 1px solid rgba(52, 199, 89, 0.15);
}

.badge-expense, .badge-danger {
  background-color: rgba(255, 59, 48, 0.08);
  color: #eb2d23;
  border: 1px solid rgba(255, 59, 48, 0.15);
}

.badge-neutral {
  background-color: rgba(0, 0, 0, 0.03);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-usdt {
  background-color: rgba(48, 176, 199, 0.08);
  color: #259cb0;
  border: 1px solid rgba(48, 176, 199, 0.15);
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

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

th {
  position: sticky;
  top: -1px;
  z-index: 10;
  background-color: #fafafa;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.3px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

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

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

tr {
  transition: var(--transition-smooth);
}

tr:hover td {
  background-color: #fafafa;
}

.active-row-bg td {
  background-color: rgba(0, 113, 227, 0.02);
}

tfoot {
  position: sticky;
  bottom: -1px;
  z-index: 9;
}

tfoot td {
  background-color: #f8fafc;
  border-top: 2px solid var(--border-color);
  border-bottom: none;
  font-weight: 700;
}

/* Text alignment and styling */
.text-emerald { color: var(--emerald) !important; }
.text-rose { color: var(--rose) !important; }
.text-cyan { color: var(--cyan) !important; }
.text-amber { color: var(--amber) !important; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Dashboard Specific Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  min-height: 350px;
}

/* Modals Overlay & Body */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  z-index: 1000;
  opacity: 1;
  transition: var(--transition-smooth);
}

.modal-overlay.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-large);
  width: 94%;
  max-width: 580px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 22px;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.16);
  animation: modalScaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  margin: auto;
}

@keyframes modalScaleUp {
  from { transform: scale(0.96) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  position: sticky;
  top: -18px;
  background: var(--bg-secondary);
  z-index: 15;
  padding-top: 4px;
}

.modal-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.3rem;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 10px;
  padding-bottom: 4px;
  border-top: 1px solid var(--border-color);
  position: sticky;
  bottom: -18px;
  background: var(--bg-secondary);
  z-index: 15;
}

/* Accounts Tree Layout */
.accounts-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-type-section {
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
}

.account-type-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 4px;
}

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: var(--transition-smooth);
}

.account-row:hover {
  background-color: #fafafa;
  border-color: var(--border-hover);
}

.account-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-code {
  font-family: var(--font-family);
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: #f5f5f7;
  padding: 1px 5px;
  border-radius: 4px;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* USDT Log styles */
.usdt-balance-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(48, 176, 199, 0.05);
  border: 1px solid rgba(48, 176, 199, 0.15);
  border-radius: 12px;
  margin-bottom: 16px;
}

.usdt-balance-details {
  display: flex;
  flex-direction: column;
}

.usdt-balance-val {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--cyan);
  font-family: var(--font-family);
  letter-spacing: -0.5px;
}

/* Bank Accounts Section in Bank ledger tab */
.bank-accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.bank-account-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.005);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 96px;
}

.bank-account-card.active-bank {
  border-color: var(--accent-color);
  background-color: rgba(0, 113, 227, 0.02);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
}

.bank-account-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.bank-account-bal {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

/* Drop area for CSV Import simulation */
.import-zone {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  background: #fafafa;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.import-zone:hover {
  border-color: var(--accent-color);
  background: rgba(0, 113, 227, 0.02);
}

.import-zone i {
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
}

/* Reports Styles */
.report-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* Two-column workspace rendered by the CxC / CxP module. */
.portal-main-grid {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr) !important;
}

.report-tab-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.report-tab-btn:hover {
  background: #fafafa;
}

.report-tab-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* Premium Segmented Controls for Reports (Apple Style & Mobile Touch Scroll) */
.report-tabs-scroll-container {
  display: inline-flex;
  background: #eef1f5;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  gap: 4px;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.report-tabs-scroll-container::-webkit-scrollbar {
  display: none;
}

.report-tab-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.report-tab-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
}

.report-tab-pill.active {
  background: #ffffff;
  color: var(--accent-color);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.report-curr-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.report-curr-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
}

.report-curr-pill.active {
  background: var(--accent-color);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.25);
}

.report-view-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px 28px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.015);
  margin-bottom: 20px;
}

.report-header-print {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.report-company-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.report-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.report-table {
  width: 100%;
  margin-bottom: 16px;
}

.report-row-category {
  font-weight: 700;
  font-size: 0.9rem;
  background-color: #fafafa;
  color: var(--text-primary);
}

.report-row-subcategory {
  padding-left: 24px;
  color: var(--text-secondary);
}

.report-row-total {
  font-weight: 700;
  border-top: 1.5px solid var(--border-color);
  border-bottom: 1.5px solid var(--border-color) !important;
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* Utilities */
.shadow-soft {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.015);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .portal-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 1200px) {
  .quick-stats-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .top-header {
    height: auto;
    align-items: flex-start;
    padding: 16px 0;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
  }

  .portal-main-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .sidebar-collapse-btn {
    display: none;
  }
  .main-content {
    padding: 16px;
    height: auto;
  }
  .report-view-container {
    padding: 14px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .report-header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .report-date-filters-group {
    width: 100%;
  }
  .report-filters-bottom-row {
    flex-direction: column;
    align-items: stretch;
  }
  .report-header-print {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }
  .report-header-right,
  .report-header-print .text-right {
    text-align: left !important;
    align-items: flex-start !important;
    width: 100%;
  }
  .quick-stats-bar {
    grid-template-columns: 1fr;
  }
  .top-header {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    gap: 12px;
    padding-bottom: 16px;
  }
  .header-right {
    width: 100%;
    justify-content: flex-start;
  }
  .select-company,
  .company-dropdown-container,
  .month-dropdown-container {
    width: 100%;
  }
  .date-badge {
    width: 100%;
  }
  .grid-2, .grid-3, .grid-2-1, .grid-1-2 {
    grid-template-columns: 1fr;
  }
  .portal-header {
    padding: 0 20px;
  }
  .portal-main {
    padding: 20px;
  }
  .portal-companies-grid {
    grid-template-columns: 1fr;
  }

  /* A saved desktop-collapsed sidebar must not create a narrow mobile header. */
  .sidebar.collapsed {
    width: 100% !important;
    flex-basis: auto;
    padding: 20px 14px !important;
  }
  .sidebar.collapsed .logo-text,
  .sidebar.collapsed .sidebar-back-portal span,
  .sidebar.collapsed .sidebar-company-card,
  .sidebar.collapsed .menu-item span,
  .sidebar.collapsed .user-profile .user-info {
    display: initial !important;
  }
  .sidebar.collapsed .sidebar-company-card {
    display: flex !important;
  }
  .sidebar.collapsed .sidebar-header {
    padding: 10px 10px 16px;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
  }
  .sidebar.collapsed .menu-item {
    justify-content: flex-start;
    padding: 9px 12px;
    gap: 12px;
  }
  .sidebar.collapsed .sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
  }
  .sidebar.collapsed .user-profile {
    justify-content: flex-start;
  }
}

/* Excel Style Table Horizontal Scroll & Column Resizing */
.table-excel {
  min-width: 1930px !important;
  table-layout: auto;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.table-excel th,
.table-excel thead th,
#bank-transactions-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 25 !important;
  background-color: #f8fafc !important;
  border-bottom: 2px solid var(--border-color) !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  user-select: none;
  overflow: visible !important;
}

#bank-transactions-table thead th:first-child {
  z-index: 26 !important;
}

.table-excel th,
.table-excel td {
  white-space: nowrap !important;
}

/* Apple-style Column Resizer Divider */
.table-excel th .th-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.table-excel th .th-resizer::after {
  content: '';
  display: block;
  width: 2px;
  height: 50%;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 1px;
  transition: background-color 0.15s ease, height 0.15s ease, width 0.15s ease;
}

.table-excel th .th-resizer:hover::after,
.table-excel th .th-resizer.is-resizing::after {
  width: 3px;
  height: 100%;
  background-color: #0071e3;
  box-shadow: 0 0 6px rgba(0, 113, 227, 0.6);
}

body.is-col-resizing,
body.is-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.table-container::-webkit-scrollbar {
  height: 10px !important; /* Thick scrollbar for easy grabbing */
}

.table-container::-webkit-scrollbar-track {
  background: #f1f1f1 !important;
  border-radius: 0 0 12px 12px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #c1c1c1 !important;
  border-radius: 10px !important;
  border: 2px solid #f1f1f1 !important;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 113, 227, 0.45) !important; /* Visual feedback in Apple Blue on hover */
}

/* Sidebar Collapse Styles */
.sidebar.collapsed {
  width: 78px !important;
  flex-basis: 78px;
  padding: 20px 8px !important;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-back-portal span,
.sidebar.collapsed .sidebar-company-card,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .user-profile .user-info {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  padding: 10px 0 16px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: none;
}

.sidebar.collapsed .logo {
  justify-content: center;
  max-width: 42px;
  overflow: hidden;
}

.sidebar.collapsed .logo img {
  max-width: 36px !important;
  height: 28px !important;
  object-fit: contain;
  object-position: left center;
}

.sidebar.collapsed .btn-back-portal-action {
  padding: 8px 0;
  justify-content: center;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  margin: 0 auto;
}

.sidebar.collapsed .btn-back-portal-action i {
  margin: 0;
}

.sidebar.collapsed .menu-item {
  justify-content: center;
  padding: 12px 0;
  border-radius: 12px;
  gap: 0;
}

.sidebar.collapsed .menu-item i {
  width: 20px;
  height: 20px;
}

.sidebar.collapsed .user-profile {
  justify-content: center;
}

.sidebar.collapsed .sidebar-footer {
  border-top: none;
  padding-top: 0;
}

.sidebar-collapse-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.sidebar-collapse-btn:hover {
  background-color: #f5f5f7;
  color: var(--text-primary);
}

/* Tooltips or simple titles for collapsed menu items */
.sidebar.collapsed .menu-item {
  position: relative;
}

/* Keep the mobile sidebar stable even if its desktop collapsed state is saved. */
@media (max-width: 768px) {
  .sidebar.collapsed {
    width: 100% !important;
    flex-basis: 100%;
    padding: 20px 14px !important;
  }

  .sidebar.collapsed .logo-text,
  .sidebar.collapsed .sidebar-back-portal span,
  .sidebar.collapsed .sidebar-company-card,
  .sidebar.collapsed .menu-item span,
  .sidebar.collapsed .user-profile .user-info {
    display: initial !important;
  }

  .sidebar.collapsed .sidebar-company-card {
    display: flex !important;
  }

  .sidebar.collapsed .sidebar-header {
    padding: 10px 10px 16px;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
  }

  .sidebar.collapsed .menu-item {
    justify-content: flex-start;
    padding: 9px 12px;
    gap: 12px;
  }

  .sidebar.collapsed .sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
  }

  .sidebar.collapsed .user-profile {
    justify-content: flex-start;
  }
}


/* ==========================================
   MOBILE OFF-CANVAS SIDEBAR & RESPONSIVE UX
   ========================================== */

/* Top-Left Hamburger Menu Button (Hidden on Desktop, Visible on Mobile/Tablet) */
.btn-mobile-menu {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.btn-mobile-menu:hover {
  background: #f0f4f0;
  border-color: #2d572c;
  color: #2d572c;
}

.btn-mobile-menu i {
  width: 20px;
  height: 20px;
}

/* Backdrop for Mobile Drawer */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 900px) {
  .btn-mobile-menu {
    display: inline-flex !important;
  }

  .app-container {
    flex-direction: row;
  }

  /* Transform Sidebar into an Off-Canvas Slide-In Drawer */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 290px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    z-index: 999 !important;
    background: var(--bg-secondary) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15) !important;
    transform: translateX(-100%) !important;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    border-right: 1px solid var(--border-color) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .sidebar-collapse-btn {
    display: none !important;
  }

  .main-content {
    width: 100% !important;
    padding: 14px 16px !important;
    min-height: 100vh;
  }

  .top-header {
    padding: 8px 0 14px 0 !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .header-left {
    width: 100% !important;
  }

  .header-right {
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .month-dropdown-container,
  .company-dropdown-container {
    flex: 1 1 auto !important;
    min-width: 160px !important;
  }

  .date-badge {
    display: none !important; /* Save space on mobile */
  }

  .quick-stats-bar {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 10px !important;
  }

  .stat-widget {
    padding: 12px 14px !important;
  }

  .stat-widget-details h4 {
    font-size: 1.05rem !important;
  }

  .grid-2, .grid-3, .grid-4, .grid-1-2, .grid-2-1 {
    grid-template-columns: 1fr !important;
  }

  .table-container {
    border-radius: 8px !important;
    margin: 0 -4px !important;
  }
}

/* ==========================================
   PDF EXPORT & PRINTABLE EXECUTIVE STYLES
   ========================================== */

.btn-pdf {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(225, 29, 72, 0.4) !important;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.28) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-pdf:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%) !important;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.4) !important;
  transform: translateY(-1px);
}

.btn-pdf:active {
  transform: translateY(0);
}

/* PDF Floating Toast Notification */
.pdf-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #1e293b;
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 99999;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: pdfToastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pdf-toast.success {
  background: #064e3b;
  border-color: #10b981;
}

.pdf-toast.error {
  background: #7f1d1d;
  border-color: #ef4444;
}

@keyframes pdfToastSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Printable PDF Clean Container */
.pdf-export-container {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a1a;
  background: #ffffff;
  padding: 24px;
  max-width: 100%;
  box-sizing: border-box;
}

.pdf-header-wrapper {
  border-bottom: 2px solid #2d572c;
  padding-bottom: 14px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.pdf-logo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pdf-logo-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #2d572c;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
}

.pdf-company-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1b3d21;
  margin: 0;
  letter-spacing: -0.02em;
}

.pdf-company-subtitle {
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.pdf-doc-badge {
  text-align: right;
}

.pdf-doc-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #2d572c;
  margin: 0 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pdf-meta-pill {
  display: inline-block;
  background: #f1f5f9;
  color: #334155;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 4px;
}

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

.pdf-kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
}

.pdf-kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
}

.pdf-kpi-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

.pdf-signatures-container {
  display: flex;
  justify-content: space-around;
  margin-top: 36px;
  padding-top: 20px;
  page-break-inside: avoid;
}

.pdf-signature-box {
  width: 220px;
  text-align: center;
}

.pdf-signature-line {
  border-top: 1px solid #94a3b8;
  margin-bottom: 6px;
}

.pdf-signature-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e293b;
}

.pdf-signature-role {
  font-size: 0.68rem;
  color: #64748b;
}

.pdf-footer-note {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  color: #94a3b8;
  page-break-inside: avoid;
}

/* Clean table styling inside PDF */
.pdf-table-styled {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 0.8rem !important;
  margin-bottom: 16px !important;
}

.pdf-table-styled th {
  background: #2d572c !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  padding: 8px 10px !important;
  text-align: left !important;
  border: 1px solid #2d572c !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.pdf-table-styled th.text-right {
  text-align: right !important;
}

.pdf-table-styled td {
  padding: 6px 10px !important;
  border: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
}

.pdf-table-styled td.text-right {
  text-align: right !important;
  font-variant-numeric: tabular-nums !important;
}

.pdf-table-styled tr:nth-child(even) {
  background-color: #f8fafc !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.pdf-table-styled .row-category {
  background: #f1f5f9 !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.pdf-table-styled .row-total {
  background: #ecfdf5 !important;
  font-weight: 800 !important;
  border-top: 2px solid #10b981 !important;
  border-bottom: 2px solid #10b981 !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

@media print {
  body {
    background: #ffffff !important;
  }
  .sidebar, .top-header, .quick-stats-bar, .modal-overlay, .pdf-toast, .report-tabs, .report-curr-pill, .cf-width-toolbar, button {
    display: none !important;
  }
  .cf-report-adjustable {
    max-width: 100% !important;
  }
  .main-content, .content-container, .report-view-container {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
  }
}

/* Button for context-specific card/widget information */
.btn-widget-info {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.45;
  transition: opacity 0.2s ease, color 0.2s ease;
  vertical-align: middle;
  margin-left: 6px;
}

.btn-widget-info:hover {
  opacity: 1;
  color: var(--accent-color);
}

.btn-widget-info i {
  width: 14px;
  height: 14px;
  color: currentColor !important;
}

/* ============================================ */
/* PREMIUM VISUAL POLISH — LEOVIC ERP v2.0      */
/* ============================================ */

/* View Transition Animations */
.animate-view-enter {
  animation: viewFadeSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes viewFadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card Hover Elevation */
.card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.02);
  border-color: var(--border-hover);
}

/* Stat Widget Hover Polish */
.stat-widget:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Tabular Numeric Alignment */
.soft-numbers,
td.text-right,
th.text-right,
.stat-widget-details h4 {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Login Error Message Styling */
.login-error-msg {
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.2);
  color: var(--rose);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 6px;
  animation: shakeError 0.4s ease;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Skeleton Loading Placeholder */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skeletonShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Smooth Sidebar Transition */
.sidebar {
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              flex-basis 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.collapsed {
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              flex-basis 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Menu Item Active Pill Indicator */
.menu-item.active {
  position: relative;
}

.menu-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-color);
  border-radius: 0 3px 3px 0;
  animation: pillSlideIn 0.25s ease-out;
}

@keyframes pillSlideIn {
  from { height: 0; opacity: 0; }
  to { height: 60%; opacity: 1; }
}

/* Button Ripple Effect (Primary) */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.25) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.btn-primary:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* Portal Company Card Hover */
.portal-company-card {
  transition: var(--transition-smooth);
}

.portal-company-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--border-hover);
}

/* Table Row Hover Enhancement */
.report-table tbody tr:hover {
  background-color: rgba(0, 113, 227, 0.02);
}

table tbody tr {
  transition: background-color 0.15s ease;
}

/* Badge Pulse for Pending Items */
.badge-danger {
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(255, 59, 48, 0); }
}

/* Auth Card Premium Shadow */
.auth-card {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* Focus Ring for Inputs */
.form-control:focus,
.form-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
  outline: none;
}

/* Smooth Number Count Animation (utility class) */
.count-animate {
  animation: countFade 0.5s ease-out;
}

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

/* Bank Card Grid Polish */
.shadow-soft {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: var(--transition-smooth);
}

  color: var(--accent-color);
}

.btn-widget-info i {
  width: 14px;
  height: 14px;
  color: currentColor !important;
}

/* ============================================ */
/* PREMIUM VISUAL POLISH — LEOVIC ERP v2.0      */
/* ============================================ */

/* View Transition Animations */
.animate-view-enter {
  animation: viewFadeSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes viewFadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card Hover Elevation */
.card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.02);
  border-color: var(--border-hover);
}

/* Stat Widget Hover Polish */
.stat-widget:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Tabular Numeric Alignment */
.soft-numbers,
td.text-right,
th.text-right,
.stat-widget-details h4 {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Login Error Message Styling */
.login-error-msg {
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.2);
  color: var(--rose);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 6px;
  animation: shakeError 0.4s ease;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Skeleton Loading Placeholder */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skeletonShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Smooth Sidebar Transition */
.sidebar {
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              flex-basis 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.collapsed {
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              flex-basis 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Menu Item Active Pill Indicator */
.menu-item.active {
  position: relative;
}

.menu-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-color);
  border-radius: 0 3px 3px 0;
  animation: pillSlideIn 0.25s ease-out;
}

@keyframes pillSlideIn {
  from { height: 0; opacity: 0; }
  to { height: 60%; opacity: 1; }
}

/* Button Ripple Effect (Primary) */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.25) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.btn-primary:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* Portal Company Card Hover */
.portal-company-card {
  transition: var(--transition-smooth);
}

.portal-company-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--border-hover);
}

/* Table Row Hover Enhancement */
.report-table tbody tr:hover {
  background-color: rgba(0, 113, 227, 0.02);
}

table tbody tr {
  transition: background-color 0.15s ease;
}

/* Badge Pulse for Pending Items */
.badge-danger {
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(255, 59, 48, 0); }
}

/* Auth Card Premium Shadow */
.auth-card {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* Focus Ring for Inputs */
.form-control:focus,
.form-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
  outline: none;
}

/* Smooth Number Count Animation (utility class) */
.count-animate {
  animation: countFade 0.5s ease-out;
}

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

/* Bank Card Grid Polish */
.shadow-soft {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: var(--transition-smooth);
}

.shadow-soft:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.03);
}

/* Disabled Button State */
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Global Auth & Route Guard Loader */
.global-auth-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(245, 245, 247, 0.86);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 1;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.global-auth-loader.hidden {
  display: none !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-loader-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px 48px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-loader-logo {
  margin-bottom: 24px;
}

.auth-loader-logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.auth-loader-spinner {
  width: 38px;
  height: 38px;
  border: 3.5px solid rgba(45, 87, 44, 0.15);
  border-top-color: #2d572c;
  border-radius: 50%;
  animation: authSpinner 0.8s linear infinite;
  margin-bottom: 20px;
}

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

.auth-loader-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.015em;
}

.auth-loader-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Login Password Toggle Button */
#btn-toggle-password:hover {
  color: var(--text-primary) !important;
  background-color: rgba(0, 0, 0, 0.05) !important;
}

/* Bulk Selection & General Modifications */
.bank-bulk-actions-bar {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
  padding: 10px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  animation: fadeIn 0.2s ease-out;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.table-excel tbody tr.row-selected,
.table-excel tbody tr.row-selected td {
  background-color: rgba(0, 113, 227, 0.085) !important;
}

.bulk-field-group {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  transition: all 0.2s ease;
}

.bulk-field-group.active-field {
  background: #ffffff;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.1);
}

.bulk-field-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  margin-bottom: 8px;
}

.bulk-field-toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

/* ========================================================
   Monthly Comparison View (MoM) - Apple Style Accounting ERP
   ======================================================== */
.comparison-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.comparison-kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.comparison-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

.comp-kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.comp-kpi-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comp-kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  color: var(--text-secondary);
}

.comp-kpi-val {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 6px;
}

.comp-kpi-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

/* Variation Badges */
.badge-diff-emerald {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.badge-diff-rose {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.badge-diff-neutral {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Visual Comparison Progress Rows */
.comp-visual-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.comp-visual-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.comp-visual-row:last-child {
  margin-bottom: 0;
}

.comp-visual-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
}

.comp-visual-track {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  display: flex;
}

.comp-visual-bar-prev {
  height: 100%;
  background: #94a3b8;
  border-radius: 6px 0 0 6px;
  transition: width 0.4s ease;
}

.comp-visual-bar-curr {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

/* Comparison Chart & Scope Pills (Apple ERP Style) */
.comp-chart-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.comp-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.comp-scope-pills {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
  border: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.comp-scope-pill {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  user-select: none;
  font-family: inherit;
}

.comp-scope-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.7);
}

.comp-scope-pill.active {
  background: #ffffff;
  color: #1e40af;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.comp-filter-active-bar {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
}

.filter-active-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.72rem;
  border: 1px solid #bae6fd;
}

.comparison-kpi-card {
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.comparison-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}

.comparison-kpi-card.active-kpi {
  box-shadow: 0 0 0 2px #2563eb, 0 4px 14px rgba(37, 99, 235, 0.15);
}

/* Comparison Detail Drilldown */
.comp-acc-row {
  transition: background-color 0.15s ease;
}

.comp-acc-row:hover {
  background-color: #f8fafc !important;
}

.comp-acc-row:hover .btn-comp-chevron {
  color: var(--accent-color);
}

.btn-comp-chevron {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.btn-comp-chevron:hover {
  background: rgba(0, 0, 0, 0.05);
}

.comp-detail-row {
  animation: fadeInDown 0.2s ease-out;
}

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

/* Chart Type Selector Pills */
.comp-chart-type-pills {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
  border: 1px solid #e2e8f0;
}

.comp-chart-type-pill {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  user-select: none;
  font-family: inherit;
}

.comp-chart-type-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
}

.comp-chart-type-pill.active {
  background: #ffffff;
  color: #2563eb;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.comp-insight-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

.comp-insight-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Excel-Style Comparison Rows: Leve Color vs Sin Color */
.comp-row-with-data {
  background-color: #f4fbf6 !important;
  border-left: 3.5px solid #10b981 !important;
  transition: all 0.15s ease;
}

.comp-row-with-data:hover {
  background-color: #eaf8ee !important;
}

.comp-row-no-data {
  background-color: #ffffff !important;
  border-left: 3.5px solid transparent !important;
  color: #64748b;
  transition: all 0.15s ease;
}

.comp-row-no-data:hover {
  background-color: #f8fafc !important;
}

/* Amount cell highlights: Leve Color vs Sin Color */
.comp-cell-amount-active {
  background-color: #dcfce7;
  color: #15803d;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: 6px;
  display: inline-block;
  letter-spacing: -0.01em;
  border: 1px solid #bbf7d0;
}

.comp-cell-amount-zero {
  color: #94a3b8;
  font-weight: 400;
  padding: 2.5px 4px;
  display: inline-block;
}

/* Excel Peach Total Highlight (Matching Client Fiscal Spreadsheets) */
.comp-row-total-peach {
  background-color: #ffedd5 !important;
  border-top: 2px solid #fb923c !important;
  border-bottom: 2px solid #fb923c !important;
  color: #9a3412 !important;
}

.comp-row-total-peach td {
  color: #9a3412 !important;
  font-weight: 800 !important;
}

/* Excel Sub-Concept Detailed Comparison Table */
.comp-concept-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.comp-concept-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 8px 12px;
  font-size: 0.74rem;
  border-bottom: 1.5px solid #cbd5e1;
}

.comp-concept-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #f1f5f9;
}

.comp-concept-row-active {
  background-color: #fcfdfd;
}

.comp-concept-row-active:hover {
  background-color: #f0fdf4;
}

.comp-concept-row-zero {
  background-color: #ffffff;
}

.comp-concept-row-zero:hover {
  background-color: #fafbfc;
}

/* ========================================================
   ROLE, USER & PERMISSIONS MANAGEMENT CONSOLE (Apple ERP)
   ======================================================== */
.permission-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.permission-status-pill.pill-superadmin {
  background: linear-gradient(135deg, #ecfdf5 0%, #dcfce7 100%);
  color: #14532d;
  border-color: #86efac;
}

.permission-status-pill.pill-write {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.permission-status-pill.pill-read {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.role-badge-superadmin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #14532d 0%, #2d572c 100%);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(45, 87, 44, 0.25);
}

.role-badge-analyst {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.role-badge-client {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.perm-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 8px;
  border-radius: 6px;
  font-size: 0.69rem;
  font-weight: 600;
  white-space: nowrap;
}

.perm-chip-write {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.perm-chip-read {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.perm-chip-none {
  background: #f8fafc;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  text-decoration: line-through;
}

.perm-segmented-control {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  gap: 3px;
}

.perm-seg-btn {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.perm-seg-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
}

.perm-seg-btn.active-write {
  background: #ecfdf5;
  color: #047857;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(4, 120, 87, 0.15);
  border: 1px solid #a7f3d0;
}

.perm-seg-btn.active-read {
  background: #fffbeb;
  color: #b45309;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(180, 83, 9, 0.15);
  border: 1px solid #fde68a;
}

.perm-seg-btn.active-none {
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(185, 28, 28, 0.15);
  border: 1px solid #fecaca;
}

.read-only-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.06);
}

.users-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.user-company-check-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-company-check-card:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.user-company-check-card.selected,
.user-company-check-card.checked {
  border-color: #2d572c;
  background: #f0fdf4;
}

.user-company-selector-grid,
.user-company-Selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.users-kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.users-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.users-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================================
   LOGIN VALIDATION LOADER & PROGRESS BAR POLISH
   ============================================================ */
.auth-loader-progress-track {
  width: 100%;
  height: 5px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
  position: relative;
}

.auth-loader-progress-bar {
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, #2d572c 0%, #16a34a 50%, #2d572c 100%);
  border-radius: 999px;
  animation: authProgressIndeterminate 1.35s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes authProgressIndeterminate {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(240%); }
}

.auth-loader-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 0.72rem;
  font-weight: 600;
}

.btn-inline-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authSpinner 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* ============================================================
   APPLE-STYLE BANK VIEW TOOLBAR & FILTER PANEL
   ============================================================ */
.bank-actions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 16px;
  margin-top: 16px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.bank-actions-group,
.bank-actions-group-left,
.bank-actions-group-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bank-filter-panel {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bank-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.bank-filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.bank-filter-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bank-filter-item .form-control,
.bank-filter-item .form-select {
  height: 33px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 7px;
  padding: 3px 9px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  width: 100%;
}
.bank-filter-item .form-control:focus,
.bank-filter-item .form-select:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.bank-quick-pills-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.analyst-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-size: 0.71rem;
  font-weight: 600;
  max-width: 165px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analyst-pill-badge.superadmin {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

/* Column Header & Filter Popover Styles */
.th-content-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}
.th-content-wrapper.text-right {
  justify-content: flex-end;
}
.th-content-wrapper.text-center {
  justify-content: center;
}
.th-col-title {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.th-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.th-filter-btn:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}
.th-filter-btn.is-active {
  background: #0071e3 !important;
  color: #ffffff !important;
  border-color: #005bb5 !important;
  box-shadow: 0 1px 4px rgba(0, 113, 227, 0.4);
}

/* Floating Popovers (Column visibility & Column filter) */
.bank-popover-dropdown {
  position: absolute;
  z-index: 1050;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.14), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  padding: 14px;
  min-width: 280px;
  animation: bankPopoverFadeIn 0.15s ease-out;
}

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

.bank-col-checkbox-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
  max-height: 290px;
  overflow-y: auto;
  padding: 8px 2px;
}

.bank-col-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.12s ease;
}
.bank-col-checkbox-item:hover {
  background: #f1f5f9;
}
.bank-col-checkbox-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent-color);
}

.bank-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  transition: background 0.15s;
}
.bank-filter-chip button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #1e40af;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
}
.bank-filter-chip button:hover {
  color: #b91c1c;
}

/* Excel Table Sorting & Popover Menus */
.th-sortable {
  cursor: pointer;
  user-select: none;
}
.th-sortable:hover .th-col-title {
  color: var(--accent-color);
}
.th-sortable.is-sorted .th-col-title {
  color: #0071e3;
  font-weight: 700;
}
.th-sort-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  margin-left: 4px;
  color: #0071e3;
  font-weight: 800;
  vertical-align: middle;
}
.th-sort-arrow.is-desc {
  color: #c2410c;
}

.excel-menu-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.excel-menu-section-title {
  font-size: 0.67rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}
.excel-menu-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}
.excel-menu-btn:hover {
  background: #f1f5f9;
  color: #0071e3;
}
.excel-menu-btn.is-active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  font-weight: 700;
}
.excel-check {
  font-size: 0.85rem;
  font-weight: 800;
  color: #2563eb;
}
.excel-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 9px 0;
}
.bank-quick-month-btn {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.bank-quick-month-btn:hover {
  transform: translateY(-1px);
}




/* ============================================================
   VISUAL POLISH v3 — Portal cards, KPI bar, bank cards, toolbar
   ============================================================ */

/* ---------- 1. Portal company cards (Superadmin) ---------- */
.portal-companies-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  align-items: stretch;
}

.pcc-card {
  padding: 16px;
  gap: 14px;
  min-height: 0;
  container-type: inline-size;
}

/* Very narrow cards: collapse "Accesos" to icon-only so nothing overlaps */
@container (max-width: 196px) {
  .pcc-btn-access span { display: none; }
  .pcc-btn-access { width: 30px; padding: 0; }
}

.pcc-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.pcc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pcc-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2d572c 0%, #3f7a3d 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(45, 87, 44, 0.22);
}

.pcc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pcc-btn-access,
.pcc-btn-icon {
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.pcc-btn-access {
  gap: 5px;
  padding: 0 9px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #6d28d9;
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.pcc-btn-access:hover {
  background: #ede9fe;
  border-color: #c4b5fd;
}

.pcc-btn-icon {
  width: 30px;
  padding: 0;
}

.pcc-btn-icon:hover {
  background: #f5f5f7;
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.pcc-btn-danger {
  color: #e11d48;
  background: rgba(225, 29, 72, 0.05);
  border-color: rgba(225, 29, 72, 0.22);
}

.pcc-btn-danger:hover {
  background: #e11d48;
  border-color: #e11d48;
  color: #ffffff;
}

.pcc-btn-access i,
.pcc-btn-access svg,
.pcc-btn-icon i,
.pcc-btn-icon svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.pcc-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  min-height: calc(1.3em * 2);
}

.pcc-balance-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  min-width: 0;
}

.pcc-currency {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.pcc-balance-label {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pcc-balance-value {
  grid-column: 1 / -1;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  white-space: nowrap;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcc-balance-value.is-positive { color: #15803d; }
.pcc-balance-value.is-negative { color: #e11d48; }

.pcc-clients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.pcc-client-chip,
.pcc-client-empty {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.71rem;
  font-weight: 500;
  max-width: 100%;
  min-width: 0;
}

.pcc-client-chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.pcc-client-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pcc-client-empty {
  color: var(--text-muted);
}

.pcc-client-chip i,
.pcc-client-chip svg,
.pcc-client-empty i,
.pcc-client-empty svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.pcc-card .btn-portal-go {
  margin-top: 0;
  height: 38px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 2. Quick stats (KPI) bar ---------- */
/* The React root renders ONE wrapper div inside the grid section: make it span
   the full row so the KPI cards use the entire available width. */
.quick-stats-bar > .quick-stats-bar-react {
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)) !important;
}

.quick-stats-bar-react .stat-widget-label {
  white-space: normal;
  padding-top: 2px;
}

.quick-stats-bar-react .stat-widget > div:first-child {
  align-items: flex-start !important;
}

.quick-stats-bar-react .stat-widget-icon {
  width: 30px !important;
  height: 30px !important;
}

.quick-stats-bar-react .btn-widget-info {
  margin-left: 0;
}

/* ---------- 3. Bank account cards ---------- */
.bac-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-bottom: 6px;
}

.bac-title-wrap {
  min-width: 0;
  flex: 1;
}

.bac-label {
  display: block;
  font-size: 0.65rem !important;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.04em;
}

.bac-name {
  margin: 2px 0 0;
  font-size: 0.84rem !important;
  line-height: 1.3;
  letter-spacing: -0.015em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.bac-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.bank-account-card:hover .bac-actions,
.bank-account-card.active-bank .bac-actions,
.bac-actions:focus-within {
  opacity: 1;
}

.bac-icon-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: #b45309;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.bac-icon-btn:hover {
  background: #fffbeb;
  border-color: #fcd34d;
}

.bac-icon-danger {
  color: #e11d48;
}

.bac-icon-danger:hover {
  background: #e11d48;
  border-color: #e11d48;
  color: #ffffff;
}

.bac-icon-btn i,
.bac-icon-btn svg {
  width: 13px;
  height: 13px;
}

/* ---------- 4. Bank actions toolbar ---------- */
.bank-actions-toolbar {
  gap: 10px 16px;
  padding: 12px 14px;
}

.bank-actions-toolbar .bank-actions-group {
  gap: 8px;
}

.bank-tb-btn {
  height: 36px !important;
  padding: 0 13px !important;
  border-radius: 9px !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.bank-tb-btn.btn-primary {
  font-weight: 600 !important;
}

.bank-tb-btn i,
.bank-tb-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.bank-tb-green {
  color: #166534 !important;
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
}

.bank-tb-green:hover {
  background: #dcfce7 !important;
  border-color: #86efac !important;
}

.bank-tb-amber {
  color: #b45309 !important;
  background: #fffbeb !important;
  border-color: #fde68a !important;
}

.bank-tb-amber:hover {
  background: #fef3c7 !important;
}

.bank-tb-danger {
  color: #e11d48 !important;
  background: rgba(225, 29, 72, 0.05) !important;
  border-color: rgba(225, 29, 72, 0.22) !important;
}

.bank-tb-danger:hover {
  background: #e11d48 !important;
  border-color: #e11d48 !important;
  color: #ffffff !important;
}

.bank-tb-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f59e0b;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.bank-tb-divider {
  width: 1px;
  height: 22px;
  background: var(--border-color);
  margin: 0 2px;
}

@media (max-width: 1100px) {
  .bank-tb-icon-only span { display: none; }
  .bank-tb-icon-only { padding: 0 10px !important; }
}

@media (max-width: 640px) {
  .bank-tb-divider { display: none; }
  .bank-actions-toolbar .bank-actions-group { width: 100%; }
  .pcc-card { padding: 16px; }
}

/* ---------- 5. Portal Dual-Balance Box (Bs. sin convertir vs USDT) ---------- */
.pcc-balances-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 12px;
  transition: var(--transition-smooth);
}

.pcc-balance-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.pcc-balance-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-shrink: 0;
}

.pcc-currency-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 5px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  line-height: 1.2;
  flex-shrink: 0;
}

.pcc-currency-badge.badge-usdt {
  background: #0e7490;
  color: #ffffff;
  border-color: #0e7490;
}

.pcc-balance-label-txt {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pcc-balance-val-right {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  white-space: nowrap;
  text-align: right;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcc-balance-val-right.is-positive {
  color: #15803d;
}

.pcc-balance-val-right.is-positive-usdt {
  color: #0891b2;
}

.pcc-balance-val-right.is-negative {
  color: #e11d48;
}

.pcc-divider-micro {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 1px 0;
}

/* Fallback / Alternate grid styles */
.pcc-balances-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}

.pcc-balance-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  min-width: 0;
  transition: var(--transition-smooth);
}

.pcc-box-usdt {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.pcc-balance-header {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.pcc-balance-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcc-balance-number {
  font-size: 0.90rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  white-space: nowrap;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.pcc-balance-number.is-positive {
  color: #15803d;
}

.pcc-balance-number.is-positive-usdt {
  color: #0891b2;
}

.pcc-balance-number.is-negative {
  color: #e11d48;
}

/* Audit Log Table and Pagination Footer */
#audit-pagination-footer {
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.02);
}

/* ========================================================
   Bank & Cash Audit Review Marking (Revisado / Auditoría)
   ======================================================== */
.tx-audit-toggle {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1),
              background-color 0.16s ease,
              border-color 0.16s ease,
              color 0.16s ease,
              box-shadow 0.16s ease;
}

.tx-audit-toggle:hover:not(:disabled) {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  transform: scale(1.07);
}

.tx-audit-toggle.is-reviewed {
  background: #059669;
  border-color: #047857;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.32);
  animation: auditPop 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.tx-audit-toggle.is-reviewed:hover:not(:disabled) {
  background: #047857;
  border-color: #065f46;
  color: #ffffff;
}

.tx-audit-toggle.is-readonly,
.tx-audit-toggle:disabled {
  cursor: default;
  opacity: 0.85;
}

@keyframes auditPop {
  0% { transform: scale(0.84); }
  55% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Full-row highlight for audited/reviewed rows */
.table-excel tbody tr.row-audited td {
  background-color: #e6f7ee !important;
  border-bottom-color: rgba(5, 150, 105, 0.22) !important;
  transition: background-color 0.16s ease;
}

.table-excel tbody tr.row-audited td:first-child {
  box-shadow: inset 4px 0 0 #059669;
}

.table-excel tbody tr.row-audited:hover td {
  background-color: #d4f3e3 !important;
}

.table-excel tbody tr.row-audited td.col-saldo {
  background-color: #dcf5e8 !important;
}

.table-excel tbody tr.row-audited .select-reconcile {
  background-color: rgba(255, 255, 255, 0.9);
  border-color: rgba(5, 150, 105, 0.35);
}

/* Combined audited + bulk-selected state */
.table-excel tbody tr.row-audited.row-selected td {
  background-color: #d8eff4 !important;
  border-bottom-color: rgba(0, 113, 227, 0.28) !important;
}

.table-excel tbody tr.row-audited.row-selected td:first-child {
  box-shadow: inset 4px 0 0 #0071e3;
}

/* Live audit progress pill in ledger summary strip */
.bank-audit-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
}

.bank-audit-progress-pill.is-complete {
  background: #ecfdf5;
  color: #065f46;
  border-color: #6ee7b7;
}

.bank-audit-pending-tag {
  font-size: 0.67rem;
  font-weight: 700;
  color: #4338ca;
  background: #eef2ff;
  padding: 1px 6px;
  border-radius: 999px;
}

.bank-audit-progress-track {
  display: inline-block;
  width: 48px;
  height: 5px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  flex-shrink: 0;
}

.bank-audit-progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #059669;
  transition: width 0.25s ease;
}

/* Compact audit pill inside top Bank / Caja cards */
.bac-audit-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.bac-audit-pill.is-partial {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.bac-audit-pill.is-complete {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

/* Quick audit filter toggle buttons in toolbar */
.bank-audit-filter-btn {
  font-size: 0.72rem;
  font-weight: 700;
  height: 32px;
  padding: 0 9px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.bank-audit-filter-btn.is-active-reviewed {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #6ee7b7 !important;
}

.bank-audit-filter-btn.is-active-pending {
  background: #eef2ff !important;
  color: #3730a3 !important;
  border-color: #c7d2fe !important;
}

/* ========================================================
   Cash Flow Visual Width & Compactness Header Bar
   ======================================================== */
.cf-width-toolbar {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 11px;
  padding: 9px 14px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.cf-width-label-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cf-width-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.cf-width-visual-tag {
  font-size: 0.68rem;
  font-weight: 600;
  color: #166534;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 2px 8px;
}

.cf-width-slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  justify-content: center;
  max-width: 320px;
}

.cf-width-slider {
  accent-color: #2d572c;
  width: 170px;
  max-width: 100%;
  cursor: pointer;
}

.cf-width-badge {
  min-width: 44px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1b3d21;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 2px 8px;
}

.cf-width-presets {
  display: inline-flex;
  align-items: center;
  background: #eef1f5;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  gap: 3px;
}

.cf-width-preset-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cf-width-preset-btn:hover {
  color: var(--text-primary);
}

.cf-width-preset-btn.is-active {
  background: #ffffff;
  color: #1b3d21;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.cf-report-adjustable {
  width: 100%;
  margin: 0 auto;
  transition: max-width 0.16s ease;
}

.cf-report-adjustable.cf-report-cash #report-excel-table th,
.cf-report-adjustable.cf-report-cash #report-excel-table td:not(:nth-child(3)):not(:nth-child(4)):not(:nth-child(5)) {
  white-space: nowrap;
}

.cf-report-adjustable.cf-report-cash #report-excel-table td:nth-child(3),
.cf-report-adjustable.cf-report-cash #report-excel-table td:nth-child(4),
.cf-report-adjustable.cf-report-cash #report-excel-table td:nth-child(5) {
  white-space: normal;
  word-break: break-word;
}

.cf-centro-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.cf-report-adjustable.is-compact-table #report-excel-table {
  font-size: 0.79rem !important;
}

.cf-report-adjustable.is-compact-table #report-excel-table th,
.cf-report-adjustable.is-compact-table #report-excel-table td {
  padding: 6px 8px !important;
}

.cf-report-adjustable.cf-report-weekly.is-compact-table #report-excel-table th:last-child {
  width: 170px !important;
}

@media (max-width: 640px) {
  .cf-width-toolbar {
    display: none !important;
  }
  .cf-report-adjustable {
    max-width: 100% !important;
  }
}

/* ========================================================
   CxC Tax Retentions (Retención IVA & ISLR)
   ======================================================== */
.cxcp-ret-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.cxcp-ret-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cxcp-ret-head span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cxcp-ret-head i,
.cxcp-ret-head svg {
  width: 13px;
  height: 13px;
  color: var(--accent-color);
}

.cxcp-ret-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cxcp-ret-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.cxcp-ret-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.cxcp-ret-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.cxcp-ret-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cxcp-ret-unit {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
}

.cxcp-ret-input-wrap .form-control {
  height: 34px;
  font-size: 0.8rem;
  padding: 4px 8px;
}

.cxcp-ret-input-wrap .form-control:disabled {
  background: #eef2f6;
  color: var(--text-muted);
  cursor: not-allowed;
}

.cxcp-ret-preview {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cxcp-ret-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.cxcp-ret-preview-net {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px solid var(--border-color);
}

.cxcp-ret-summary-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  font-size: 0.74rem;
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .cxcp-ret-grid {
    grid-template-columns: 1fr;
  }
}
