/* ===== QUICKBOOKS-INSPIRED DESIGN SYSTEM (2026) ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --qb-green: #2CA01C;
  --qb-green-dark: #248A15;
  --qb-green-light: #4DB33D;
  --qb-green-pale: #E8F5E9;
  --qb-dark: #1A1A1A;
  --qb-gray-900: #2C2C2C;
  --qb-gray-700: #4A4A4A;
  --qb-gray-500: #6B6B6B;
  --qb-gray-400: #9E9E9E;
  --qb-gray-300: #D4D4D4;
  --qb-gray-200: #E8E8E8;
  --qb-gray-100: #F5F5F5;
  --qb-white: #FFFFFF;
  --qb-blue: #0077C5;
  --qb-orange: #F5A623;
  --qb-red: #D32F2F;
  --qb-teal: #00897B;
  --qb-success: #2CA01C;
  --qb-danger: #D32F2F;
  --qb-warning: #F5A623;
  --qb-info: #0077C5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.16);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-width: 260px;
  --sidebar-collapsed: 68px;
}

/* ===== DARK MODE ===== */
body.dark-mode {
  --qb-gray-900: #E8E8E8;
  --qb-gray-700: #C8C8C8;
  --qb-gray-500: #A0A0A0;
  --qb-gray-400: #7A7A7A;
  --qb-gray-300: #4A4A4A;
  --qb-gray-200: #333333;
  --qb-gray-100: #1E1E1E;
  --qb-white: #2A2A2A;
  --qb-green-pale: #1B3A1A;
  --qb-dark: #0F0F0F;
  background: #121212;
}
body.dark-mode .login-screen { background: linear-gradient(135deg, #1B3A1A, #0F0F0F); }
body.dark-mode .sidebar { background: #1A1A1A; border-right-color: #333; }
body.dark-mode .nav-btn.active { background: var(--qb-green); }
body.dark-mode .top-bar { background: #1A1A1A; border-bottom-color: #333; }
body.dark-mode .table-container,
body.dark-mode .form-card,
body.dark-mode .stat-card,
body.dark-mode .chart-card,
body.dark-mode .dashboard-section,
body.dark-mode .report-controls,
body.dark-mode .report-output { background: #1E1E1E; border-color: #333; }
body.dark-mode table thead { background: #262626; }
body.dark-mode table tbody tr:hover { background: #262626; }
body.dark-mode table td { border-bottom-color: #2A2A2A; }
body.dark-mode .payment-block,
body.dark-mode .journal-line,
body.dark-mode .journal-totals { background: #262626; border-color: #333; }
body.dark-mode input, body.dark-mode select, body.dark-mode textarea { background: #1A1A1A; color: #E8E8E8; border-color: #444; }
body.dark-mode .btn-secondary { background: #2A2A2A; color: #E8E8E8; border-color: #444; }
body.dark-mode .btn-secondary:hover { background: #333; }
body.dark-mode .search-input { background: #1A1A1A; color: #E8E8E8; border-color: #444; }
body.dark-mode .alert-item { background: #2A2410; }
body.dark-mode .alert-item.danger { background: #2A1010; }
body.dark-mode .account-group-header td { background: #262626 !important; color: #E8E8E8 !important; }
body.dark-mode .check-summary-item { background: #262626; border-color: #333; }
body.dark-mode .balance-summary-table .label-cell { background: #262626; color: #E8E8E8; }
body.dark-mode .financial-statement { background: #1E1E1E; border-color: #333; }
body.dark-mode .summary-header h1 { color: #E8E8E8; }
body.dark-mode .login-logo .logo-icon,
body.dark-mode .sidebar-logo { background: #2A2A2A; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }

/* ===== BASE ===== */
body {
  font-family: var(--font-family);
  background: var(--qb-gray-100);
  color: var(--qb-gray-900);
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }


.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; padding: 1rem;
}
.login-box {
  background: var(--qb-white);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-xl);
  text-align: center;
}
.login-logo { margin-bottom: 2rem; }

.login-logo .logo-icon {
  width: 130px;
  height: 130px;
  object-fit: contain;
  display: block;
  margin: 0 auto 1.25rem;
  border-radius: 24px;
  box-shadow:
    0 8px 24px rgba(111, 78, 55, 0.25),
    0 2px 6px rgba(0, 0, 0, 0.08);
  background: #fff;
  padding: 10px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease;
  border: 1px solid rgba(111, 78, 55, 0.08);
}
.login-logo .logo-icon:hover {
  transform: scale(1.06) rotate(-2deg);
  box-shadow:
    0 12px 32px rgba(111, 78, 55, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.1);
}

.login-logo h1 {
  font-size: 1.9rem;
  color: var(--qb-gray-900);
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.15;
}
.login-logo p {
  color: var(--qb-green);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 0.35rem;
}
.login-box h2 { font-size: 1.125rem; color: var(--qb-gray-700); margin-bottom: 1.75rem; font-weight: 500; }
.btn-block { width: 100%; }

/* ===== MAIN APP LAYOUT ===== */
.main-app {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--qb-white);
  border-right: 1px solid var(--qb-gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1100;
  transition: transform 0.3s ease, width 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--qb-gray-200);
  position: relative;
}

.sidebar-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 14px;
  flex-shrink: 0;
  background: #fff;
  padding: 4px;
  box-shadow:
    0 2px 8px rgba(111, 78, 55, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(111, 78, 55, 0.1);
  transition: transform 0.25s ease;
}
.sidebar-logo:hover {
  transform: scale(1.05);
}

.sidebar-brand h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--qb-gray-900);
  line-height: 1.2;
  letter-spacing: -0.4px;
}
.sidebar-brand p {
  font-size: 0.62rem;
  color: var(--qb-green);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 700;
  margin-top: 0.2rem;
}
.sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: transparent; border: none;
  cursor: pointer;
  color: var(--qb-gray-500);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  line-height: 0;
}
.sidebar-close-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.sidebar-close-btn:hover { background: var(--qb-gray-100); color: var(--qb-gray-900); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
}

.nav-group { margin-bottom: 0.25rem; }

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--qb-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  transition: all 0.15s ease;
}
.nav-group-header:hover { background: var(--qb-gray-100); color: var(--qb-gray-900); }
.nav-group-title { flex: 1; text-align: left; }
.nav-group-arrow { font-size: 0.75rem; transition: transform 0.2s ease; }

.nav-group.collapsed .nav-group-arrow { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

.nav-group-items {
  max-height: 1000px;
  overflow: hidden;
  opacity: 1;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  padding-left: 0.25rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.875rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--qb-gray-700);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  margin-bottom: 0.125rem;
}
.nav-btn:hover { background: var(--qb-gray-100); color: var(--qb-gray-900); }
.nav-btn.active {
  background: var(--qb-green);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(44, 160, 28, 0.3);
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1050;
  animation: fadeIn 0.2s ease;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body.sidebar-hidden .main-content { margin-left: 0; }
body.sidebar-hidden .sidebar { transform: translateX(-100%); }

/* ===== TOP BAR ===== */
.top-bar {
  background: var(--qb-white);
  border-bottom: 1px solid var(--qb-gray-200);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  gap: 1rem;
  flex-wrap: wrap;
}

.top-bar-left { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.top-bar-right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.breadcrumb {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem;
}
.breadcrumb-root { color: var(--qb-gray-500); font-weight: 600; }
.breadcrumb-sep { color: var(--qb-gray-400); }
.breadcrumb-current { color: var(--qb-gray-900); font-weight: 700; }

/* ===== PROFESSIONAL SVG ICON STYLES (2026) ===== */
.nav-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--qb-gray-500);
  transition: color 0.15s ease;
  flex-shrink: 0;
}
.nav-group-header:hover .nav-group-icon { color: var(--qb-gray-900); }
.nav-group-icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--qb-gray-500);
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.nav-btn:hover .nav-icon { color: var(--qb-gray-900); }
.nav-btn.active .nav-icon { color: white; }
.nav-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }

.stat-icon {
  font-size: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--qb-green-pale);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  color: var(--qb-green-dark);
  transition: all 0.2s ease;
}
.stat-icon svg { width: 24px; height: 24px; stroke: currentColor; fill: none; }
.stat-card:hover .stat-icon {
  background: var(--qb-green);
  color: white;
  transform: scale(1.05);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-200);
  border-radius: var(--radius-md);
  font-size: 0;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--qb-gray-700);
}
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.icon-btn:hover {
  background: var(--qb-gray-100);
  border-color: var(--qb-green);
  color: var(--qb-green);
}
.icon-btn.menu-toggle { display: none; }

.live-clock {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
  background: var(--qb-green-pale);
  color: var(--qb-green-dark);
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.75rem;
  border: 1px solid rgba(44, 160, 28, 0.2);
  letter-spacing: 0.3px;
}
.live-clock svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }

.user-info {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.85rem; color: var(--qb-gray-700);
  padding-left: 0.75rem;
  border-left: 1px solid var(--qb-gray-200);
}

.role-badge {
  background: var(--qb-green-pale);
  color: var(--qb-green-dark);
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-logout {
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-300);
  color: var(--qb-gray-700);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.btn-logout:hover { background: var(--qb-gray-100); border-color: var(--qb-gray-400); }

/* ===== CONTAINER / PAGES ===== */
.container {
  max-width: 100%;
  padding: 1.5rem 2rem 3rem;
  flex: 1;
}

.page { display: none; animation: fadeIn 0.2s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--qb-gray-900);
  margin-bottom: 1.5rem;
  letter-spacing: -0.5px;
}

.section-subtitle {
  font-size: 1rem; font-weight: 600;
  color: var(--qb-gray-900);
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--qb-gray-200);
}

/* ===== FORM CARD ===== */
.form-card {
  background: var(--qb-white);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  border: 1px solid var(--qb-gray-200);
}
.form-card h3 { margin-bottom: 1.25rem; font-size: 1.1rem; font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--qb-gray-700); margin-bottom: 0.375rem;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.625rem 0.875rem;
  border: 1px solid var(--qb-gray-300);
  border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.875rem;
  color: var(--qb-gray-900);
  background: var(--qb-white);
  transition: all 0.15s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--qb-green);
  box-shadow: 0 0 0 3px rgba(44, 160, 28, 0.1);
}
.form-group input[readonly] {
  background: var(--qb-gray-100);
  color: var(--qb-gray-500);
  cursor: not-allowed;
}

.radio-group { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.25rem 0; }
.radio-label {
  display: flex; align-items: center; gap: 0.375rem;
  font-size: 0.85rem; cursor: pointer;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--qb-gray-300);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  background: var(--qb-white);
}
.radio-label:hover { border-color: var(--qb-green); background: var(--qb-green-pale); }
.radio-label input[type="radio"] { width: auto; accent-color: var(--qb-green); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 0.625rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s ease; white-space: nowrap;
}
.btn-primary { background: var(--qb-green); color: white; border-color: var(--qb-green); }
.btn-primary:hover { background: var(--qb-green-dark); }
.btn-secondary { background: var(--qb-white); color: var(--qb-gray-700); border-color: var(--qb-gray-300); }
.btn-secondary:hover { background: var(--qb-gray-100); border-color: var(--qb-gray-400); }
.btn-add {
  background: var(--qb-white); color: var(--qb-green);
  border: 1px dashed var(--qb-green);
  margin: 0.5rem 0 1rem;
  padding: 0.5rem 1rem; font-size: 0.8rem;
}
.btn-add:hover { background: var(--qb-green-pale); border-style: solid; }
.btn-pdf { background: var(--qb-red); color: white; border-color: var(--qb-red); }
.btn-pdf:hover { background: #B71C1C; }
.btn-excel { background: var(--qb-green); color: white; border-color: var(--qb-green); }
.btn-excel:hover { background: var(--qb-green-dark); }
.btn-print { background: var(--qb-gray-700); color: white; border-color: var(--qb-gray-700); }
.btn-print:hover { background: var(--qb-gray-900); }
.btn-telegram { background: var(--qb-blue); color: white; border-color: var(--qb-blue); }
.btn-telegram:hover { background: #005A9E; }
.btn-danger { background: var(--qb-red); color: white; border-color: var(--qb-red); }
.btn-danger:hover { background: #B71C1C; }

.form-actions {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
  margin-top: 1.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--qb-gray-200);
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--qb-white);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--qb-gray-200);
  transition: all 0.15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-info h3 { font-size: 1.375rem; font-weight: 700; line-height: 1.2; }
.stat-info p { font-size: 0.75rem; color: var(--qb-gray-500); font-weight: 500; margin-top: 0.125rem; }

/* ===== CHARTS ===== */
.charts-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.25rem; margin-bottom: 1.25rem;
}
.chart-card {
  background: var(--qb-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--qb-gray-200);
}
.chart-card h3 { font-size: 0.95rem; margin-bottom: 1rem; font-weight: 600; }
.chart-card canvas { max-height: 260px; }

/* ===== DASHBOARD SECTIONS ===== */
.dashboard-section {
  background: var(--qb-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--qb-gray-200);
}
.dashboard-section h3 {
  font-size: 1rem; margin-bottom: 1rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 0.75rem;
}
.activity-list, .alert-list { max-height: 280px; overflow-y: auto; }
.activity-item, .alert-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--qb-gray-100);
  font-size: 0.85rem;
}
.activity-item:last-child, .alert-item:last-child { border-bottom: none; }
.activity-item .time { font-size: 0.75rem; color: var(--qb-gray-400); }
.alert-item {
  background: #FFF8E1;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--qb-warning);
}
.alert-item.danger { background: #FFEBEE; border-left-color: var(--qb-danger); }
.empty-msg { text-align: center; color: var(--qb-gray-400); padding: 2rem 1rem; font-size: 0.875rem; }

/* ===== TABLES ===== */
.table-container {
  background: var(--qb-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--qb-gray-200);
  overflow-x: auto;
}
.table-header-actions {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 1rem;
  flex-wrap: wrap; gap: 0.75rem;
}
.table-header-actions h3 { font-size: 1rem; margin: 0; font-weight: 600; }
.table-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.search-input {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--qb-gray-300);
  border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.8rem;
  min-width: 260px;
  background: var(--qb-white);
}
.search-input:focus { outline: none; border-color: var(--qb-green); box-shadow: 0 0 0 3px rgba(44, 160, 28, 0.1); }
.record-count { font-size: 0.8rem; color: var(--qb-gray-400); font-weight: 400; }
.table-scroll { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table thead { background: var(--qb-gray-100); border-bottom: 2px solid var(--qb-gray-200); }
table th {
  padding: 0.75rem 1rem; text-align: left;
  font-weight: 600; font-size: 0.75rem;
  color: var(--qb-gray-700);
  text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap;
}
table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--qb-gray-100); white-space: nowrap; }
table tbody tr:hover { background: var(--qb-gray-100); }
table tbody tr:last-child td { border-bottom: none; }
.total-row { background: var(--qb-gray-100); font-weight: 700; }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; }

.btn-sm {
  padding: 0.375rem 0.75rem; font-size: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer; font-weight: 600;
  transition: all 0.15s ease;
}
.btn-edit { background: var(--qb-blue); color: white; margin-right: 0.25rem; }
.btn-edit:hover { background: #005A9E; }
.btn-delete { background: var(--qb-white); color: var(--qb-red); border-color: var(--qb-red); }
.btn-delete:hover { background: var(--qb-red); color: white; }
.btn-restore { background: var(--qb-green); color: white; margin-right: 0.25rem; }
.btn-restore:hover { background: var(--qb-green-dark); }

/* ===== PAYMENT / REJECT BLOCKS ===== */
.payment-block {
  background: var(--qb-gray-100);
  border: 1px solid var(--qb-gray-200);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
  position: relative;
}
.payment-block h4 { font-size: 0.875rem; margin-bottom: 0.75rem; font-weight: 600; }
.payment-block .btn-remove {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: var(--qb-white); color: var(--qb-red);
  border: 1px solid var(--qb-red);
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
}
.payment-block .btn-remove:hover { background: var(--qb-red); color: white; }
.reject-block { background: #FFF8F0; border-left: 3px solid var(--qb-red); }
.reject-block h4 { color: var(--qb-red); }

/* ===== INVENTORY SUMMARY ===== */
.inventory-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}

/* ===== TABS ===== */
.tabs {
  display: flex; flex-wrap: wrap; gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--qb-gray-200);
}
.tab-btn {
  background: transparent; border: none;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer; font-family: inherit;
  font-size: 0.85rem; font-weight: 500;
  color: var(--qb-gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--qb-gray-900); }
.tab-btn.active { color: var(--qb-green); border-bottom-color: var(--qb-green); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== JOURNAL ===== */
.journal-line {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.75rem; margin-bottom: 0.75rem;
  align-items: end; padding: 0.75rem;
  background: var(--qb-gray-100);
  border-radius: var(--radius-md);
  border: 1px solid var(--qb-gray-200);
}
.journal-line select, .journal-line input {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--qb-gray-300);
  border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.85rem;
  background: var(--qb-white); width: 100%;
}
.journal-line .btn-delete {
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.journal-totals {
  display: flex; gap: 2rem;
  padding: 1rem 1.25rem;
  background: var(--qb-gray-100);
  border-radius: var(--radius-md);
  margin-top: 1rem;
  font-size: 0.9rem; font-weight: 600;
  flex-wrap: wrap;
  border: 1px solid var(--qb-gray-200);
}
.journal-totals .balanced { color: var(--qb-success); }
.journal-totals .unbalanced { color: var(--qb-danger); }

.account-group-header td {
  background: var(--qb-gray-100) !important;
  color: var(--qb-gray-900) !important;
  padding: 0.75rem 1rem !important;
  font-size: 0.8rem; letter-spacing: 0.5px;
  border-left: 3px solid var(--qb-green) !important;
}

/* ===== FINANCIAL STATEMENTS ===== */
.financial-statement {
  margin-bottom: 2rem; padding: 1.5rem;
  background: var(--qb-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--qb-gray-200);
}
.financial-statement .summary-header {
  text-align: center; margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--qb-gray-200);
}
.financial-statement .summary-header h1 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.financial-statement .summary-header h2 { color: var(--qb-green); font-size: 1rem; }
.financial-statement table tbody td { padding: 0.625rem 1rem; border-bottom: 1px solid var(--qb-gray-100); }
.financial-statement table tbody td.indent { padding-left: 2rem; }
.financial-statement table .total-line {
  font-weight: 700;
  border-top: 2px solid var(--qb-gray-900);
  border-bottom: 2px solid var(--qb-gray-900);
  background: var(--qb-gray-100);
}

/* ===== REPORTS ===== */
.report-controls {
  background: var(--qb-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--qb-gray-200);
  margin-bottom: 1.5rem;
}
.report-output {
  background: var(--qb-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--qb-gray-200);
  min-height: 200px;
}
.report-header { text-align: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid var(--qb-gray-200); }
.report-section { margin-bottom: 1.5rem; }
.report-section h3 { font-size: 0.95rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--qb-gray-200); font-weight: 600; }
.report-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.report-summary-item { background: var(--qb-gray-100); padding: 1rem; border-radius: var(--radius-md); border: 1px solid var(--qb-gray-200); text-align: center; }
.report-summary-item .label { font-size: 0.7rem; color: var(--qb-gray-500); text-transform: uppercase; font-weight: 600; }
.report-summary-item .value { font-size: 1.1rem; font-weight: 700; margin-top: 0.25rem; }

/* ===== SUMMARY ===== */
.summary-report { padding: 0.5rem; }
.summary-header { text-align: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid var(--qb-gray-200); }
.summary-header h1 { font-size: 1.375rem; letter-spacing: 1px; margin-bottom: 0.5rem; font-weight: 700; }
.summary-header h2 { color: var(--qb-green); font-size: 1rem; font-weight: 600; }
.summary-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.875rem; }
.summary-table thead th {
  background: var(--qb-gray-100);
  color: var(--qb-gray-700);
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom: 2px solid var(--qb-gray-200);
}
.summary-table tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--qb-gray-100); }
.summary-table .grand-total-row td {
  background: var(--qb-gray-100);
  font-weight: 700;
  border-top: 2px solid var(--qb-gray-900);
  font-size: 0.9rem;
}
.summary-signatures {
  display: flex; justify-content: space-between;
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid var(--qb-gray-200);
  flex-wrap: wrap; gap: 1rem;
}
.signature-block { flex: 1; min-width: 200px; font-size: 0.85rem; }
.signature-block p { margin: 0.375rem 0; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-pending { background: #FFF3CD; color: #856404; }
.badge-cleared { background: #D4EDDA; color: #155724; }
.badge-bounced { background: #F8D7DA; color: #721C24; }
.badge-partial { background: #CCE5FF; color: #004085; }
.badge-manager { background: var(--qb-green); color: white; }
.badge-sales { background: var(--qb-blue); color: white; }
.badge-purchase { background: var(--qb-teal); color: white; }
.badge-inventory { background: var(--qb-orange); color: white; }
.badge-milling { background: #8D6E63; color: white; }
.badge-accounting { background: var(--qb-red); color: white; }
.badge-vendor { background: #7E57C2; color: white; }
.badge-customer { background: var(--qb-gray-500); color: white; }
.badge-cupper { background: #6F4E37; color: white; }
.badge-warehouse { background: #00897B; color: white; }
.badge-quality { background: #0077C5; color: white; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  color: white; font-weight: 500; font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(200px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 9999; max-width: 400px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--qb-success); }
.toast.error { background: var(--qb-danger); }
.toast.info { background: var(--qb-info); }
.toast.warning { background: var(--qb-warning); color: var(--qb-gray-900); }

/* ===== UNDO SNACKBAR ===== */
.undo-snackbar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(200px);
  background: var(--qb-gray-900);
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-xl);
  z-index: 9998;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 90vw;
}
.undo-snackbar.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.undo-snackbar button {
  background: var(--qb-green);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}
.undo-snackbar button:hover { background: var(--qb-green-dark); }
.undo-snackbar .undo-close {
  background: transparent;
  color: var(--qb-gray-400);
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
}
.undo-snackbar .undo-close:hover { background: rgba(255,255,255,0.1); color: white; }

/* ===== TRASH / AUDIT ===== */
.trash-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

/* ===== REALTIME ===== */
#realtimeIndicator {
  position: fixed; bottom: 1.5rem; left: 1.5rem;
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-200);
  border-radius: 100px;
  padding: 0.4rem 0.9rem;
  font-size: 0.7rem; font-weight: 700;
  color: var(--qb-gray-700);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 0.5rem;
  z-index: 9998; cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
  user-select: none;
}
#realtimeIndicator:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--qb-green); }
#realtimeIndicator .live-dot {
  width: 8px; height: 8px; background: var(--qb-green);
  border-radius: 50%; display: inline-block;
  animation: pulseDot 2s infinite; flex-shrink: 0;
}
#realtimeIndicator.paused { opacity: 0.6; }
#realtimeIndicator.paused .live-dot { background: var(--qb-gray-400); animation: none; }

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(44, 160, 28, 0.7); }
  50% { opacity: 0.85; transform: scale(1.15); box-shadow: 0 0 0 6px rgba(44, 160, 28, 0); }
}

.stat-card.updated { animation: pulseStat 0.6s ease; }
@keyframes pulseStat {
  0% { background: var(--qb-white); }
  50% { background: var(--qb-green-pale); transform: scale(1.02); }
  100% { background: var(--qb-white); transform: scale(1); }
}

#refreshBtn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.live-data-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.65rem; font-weight: 700;
  color: var(--qb-green-dark);
  background: var(--qb-green-pale);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(44, 160, 28, 0.25);
}
.live-data-badge::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--qb-green);
  border-radius: 50%;
  animation: pulseDot 2s infinite;
}

.sync-progress-bar {
  position: fixed; top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--qb-green), var(--qb-green-light), var(--qb-green));
  width: 0%; z-index: 10001;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(44, 160, 28, 0.6);
  pointer-events: none;
}
.sync-progress-bar.active { animation: syncProgress 1.2s ease-in-out; }
@keyframes syncProgress {
  0% { width: 0%; opacity: 1; }
  50% { width: 70%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

/* ===== SPECIAL TABLES ===== */
.export-retention-table, .local-sales-table, .summary-inventory-table, .check-payment-table {
  font-size: 0.72rem; border-collapse: collapse; width: 100%;
}
.export-retention-table { min-width: 1800px; }
.local-sales-table { min-width: 2400px; }
.summary-inventory-table { min-width: 2200px; }
.check-payment-table { min-width: 1600px; }
.export-retention-table thead th,
.local-sales-table thead th,
.summary-inventory-table thead th,
.check-payment-table thead th {
  background: var(--qb-gray-100);
  color: var(--qb-gray-700);
  padding: 0.5rem 0.4rem;
  text-align: center;
  font-size: 0.65rem;
  text-transform: uppercase;
  border: 1px solid var(--qb-gray-200);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 10;
  vertical-align: middle;
  font-weight: 600;
}
.export-retention-table tbody td,
.local-sales-table tbody td,
.summary-inventory-table tbody td,
.check-payment-table tbody td {
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--qb-gray-100);
  white-space: nowrap;
}
.check-payment-table tbody tr.check-row { background: #F0F8F0; }
.check-payment-table tbody tr.payment-row { background: #FFF8F0; }
.check-payment-table tbody td.positive-amount { color: var(--qb-success); }
.check-payment-table tbody td.negative-amount { color: var(--qb-danger); }

.check-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.5rem 0; }
.check-summary-item {
  background: var(--qb-gray-100); padding: 1rem;
  border-radius: var(--radius-md); text-align: center;
  border: 1px solid var(--qb-gray-200);
}
.check-summary-item .label { font-size: 0.7rem; color: var(--qb-gray-500); text-transform: uppercase; margin-bottom: 0.5rem; font-weight: 600; }
.check-summary-item .value { font-size: 1.2rem; font-weight: 700; }
.check-summary-item .value.positive { color: var(--qb-success); }
.check-summary-item .value.negative { color: var(--qb-danger); }
.check-summary-item.highlight { background: var(--qb-green); border-color: var(--qb-green-dark); }
.check-summary-item.highlight .label { color: rgba(255,255,255,0.8); }
.check-summary-item.highlight .value { color: white; }

.balance-summary-box { display: flex; justify-content: flex-end; margin-top: 2rem; }
.balance-summary-table {
  width: 400px; border-collapse: collapse; font-size: 0.875rem;
  box-shadow: var(--shadow-sm); border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--qb-gray-200);
}
.balance-summary-table td { padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--qb-gray-200); }
.balance-summary-table .label-cell { background: var(--qb-gray-100); font-weight: 600; }
.balance-summary-table .value-cell { text-align: right; font-weight: 600; }
.balance-summary-table .value-cell.positive { color: var(--qb-success); }
.balance-summary-table .value-cell.negative { color: var(--qb-danger); }
.balance-summary-table .total-row td { background: var(--qb-gray-900); color: white; border: none; }

/* ===== DIRECT COST ===== */
.direct-cost-table th, .direct-cost-table td { padding: 0.625rem 0.75rem; border: 1px solid var(--qb-gray-200); }
.direct-cost-table thead th { background: var(--qb-gray-100); text-align: center; font-size: 0.7rem; font-weight: 600; }
.direct-cost-table tbody td:nth-child(1) { text-align: center; font-weight: 600; }
.direct-cost-table tbody td:nth-child(5) { text-align: right; font-weight: 600; }
.direct-cost-table tfoot .grand-total-row td {
  background: var(--qb-gray-100); border-top: 2px solid var(--qb-gray-900);
  font-weight: 700; font-size: 0.95rem; padding: 0.875rem 0.75rem;
}

/* ===== SUMMARY SALES ===== */
.summary-sales-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.summary-sales-table thead th {
  background: var(--qb-gray-100); padding: 1rem;
  text-align: center; font-size: 0.8rem;
  text-transform: uppercase; font-weight: 600;
  border: 1px solid var(--qb-gray-200);
}
.summary-sales-table tbody td {
  padding: 1.25rem 1rem; text-align: right;
  font-weight: 700; font-size: 1.15rem;
  border: 1px solid var(--qb-gray-200);
}
.summary-sales-grandtotal-table { width: 100%; border-collapse: collapse; margin-bottom: 2.5rem; }
.summary-sales-grandtotal-table td {
  padding: 0.875rem 1rem; border: 1px solid var(--qb-gray-200);
  text-align: center; font-weight: 700; font-size: 1rem;
}
.summary-sales-grandtotal-table .gt-label { background: var(--qb-gray-100); text-align: left; padding-left: 1.25rem; text-transform: uppercase; font-size: 0.85rem; }
.summary-sales-grandtotal-table .gt-cur { background: var(--qb-gray-100); color: var(--qb-gray-500); width: 60px; }
.summary-sales-signatures { display: flex; justify-content: space-between; margin-top: 3.5rem; padding: 0 1rem; flex-wrap: wrap; gap: 2rem; }
.summary-sales-signatures .sig-block { font-size: 0.9rem; }
.summary-sales-signatures .sig-line { letter-spacing: 2px; color: var(--qb-gray-400); }

/* ===== DARK MODE ICON ADJUSTMENTS ===== */
body.dark-mode .nav-group-icon,
body.dark-mode .nav-icon { color: var(--qb-gray-400); }
body.dark-mode .nav-btn:hover .nav-icon { color: var(--qb-gray-900); }
body.dark-mode .nav-btn.active .nav-icon { color: white; }
body.dark-mode .stat-icon { background: #1B3A1A; color: var(--qb-green-light); }
body.dark-mode .stat-card:hover .stat-icon { background: var(--qb-green); color: white; }
body.dark-mode .icon-btn { background: #1A1A1A; border-color: #444; color: var(--qb-gray-400); }
body.dark-mode .icon-btn:hover { background: #2A2A2A; border-color: var(--qb-green); color: var(--qb-green); }
body.dark-mode .live-clock { background: #1B3A1A; color: var(--qb-green-light); border-color: rgba(44, 160, 28, 0.3); }

/* ===== IMPORT STATUS ENHANCEMENTS ===== */
#importStatus {
  min-height: 80px;
}

.import-success-box {
  padding: 1.25rem;
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--qb-green);
  animation: slideIn 0.4s ease;
}

.import-success-box h4 {
  margin: 0 0 0.875rem;
  color: var(--qb-green-dark);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.import-success-box ul {
  margin: 0;
  padding-left: 1.5rem;
  line-height: 1.9;
  color: var(--qb-gray-700);
  font-size: 0.9rem;
}

.import-success-box ul li strong {
  color: var(--qb-green-dark);
  font-weight: 700;
  margin-right: 0.25rem;
}

.import-error-box {
  padding: 1.25rem;
  background: #FFEBEE;
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--qb-red);
  color: var(--qb-red);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

#excelFileInput {
  width: 100%;
  padding: 1.25rem;
  border: 2px dashed var(--qb-green);
  background: var(--qb-green-pale);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--qb-gray-700);
  transition: all 0.2s ease;
}

#excelFileInput:hover {
  background: #D4EDDA;
  border-color: var(--qb-green-dark);
  transform: translateY(-1px);
}

#excelFileInput::file-selector-button {
  background: var(--qb-green);
  color: white;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  margin-right: 1rem;
  transition: background 0.15s ease;
}

#excelFileInput::file-selector-button:hover {
  background: var(--qb-green-dark);
}

body.dark-mode .import-success-box {
  background: linear-gradient(135deg, #1B3A1A, #245022);
  color: var(--qb-gray-900);
}
body.dark-mode .import-success-box h4 { color: var(--qb-green-light); }
body.dark-mode .import-success-box ul { color: var(--qb-gray-700); }
body.dark-mode .import-success-box ul li strong { color: var(--qb-green-light); }
body.dark-mode #excelFileInput { background: #1B3A1A; color: var(--qb-gray-900); }
body.dark-mode #excelFileInput:hover { background: #245022; }

/* ===== DARK MODE BADGE ADJUSTMENTS ===== */
body.dark-mode .badge-cupper { background: #8D6E63; }
body.dark-mode .badge-warehouse { background: #00897B; }
body.dark-mode .badge-quality { background: #005A9E; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .check-summary-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .sidebar-close-btn { display: inline-flex; }
  .main-content { margin-left: 0 !important; }
  .icon-btn.menu-toggle { display: inline-flex; }
  .container { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-card { padding: 1.25rem; }
  .page-title { font-size: 1.25rem; }
  .toast { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }
  table { font-size: 0.75rem; }
  table th, table td { padding: 0.5rem 0.625rem; }
  .journal-line { grid-template-columns: 1fr; }
  .search-input { min-width: 100%; width: 100%; }
  .check-summary-grid { grid-template-columns: 1fr; }
  .balance-summary-table { width: 100%; }
  .user-info span:not(.role-badge) { display: none; }
  .breadcrumb { display: none; }
  .top-bar { padding: 0.6rem 1rem; }
  .undo-snackbar { left: 1rem; right: 1rem; transform: translateY(200px); max-width: none; }
  .undo-snackbar.show { transform: translateY(0); }
  #realtimeIndicator { bottom: 5rem; left: 1rem; padding: 0.3rem 0.7rem; font-size: 0.65rem; }
  .login-logo .logo-icon { width: 110px; height: 110px; }
  .nav-icon svg { width: 20px; height: 20px; }
  .stat-icon { width: 42px; height: 42px; }
  .stat-icon svg { width: 20px; height: 20px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .top-bar-right { gap: 0.5rem; }
  .live-clock { display: none; }
}

/* ===== PRINT ===== */
@media print {
  .sidebar, .top-bar, .no-print, .btn, .form-card, .form-actions,
  .toast, .undo-snackbar, #realtimeIndicator, .report-controls,
  .table-header-actions .no-print, .trash-toolbar,
  .nav-icon svg, .nav-group-icon svg, .stat-icon svg, .icon-btn svg, .live-clock svg {
    display: none !important;
  }
  .main-content { margin-left: 0 !important; }
  .container { max-width: 100%; padding: 0; }
  .page { display: none; }
  .page.active { display: block; }
  .table-container, .report-output, .financial-statement {
    box-shadow: none; border: none; padding: 0;
  }
  table { font-size: 8pt; }
  table thead { background: #E8E8E8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.print-header { display: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--qb-gray-100); }
::-webkit-scrollbar-thumb { background: var(--qb-gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--qb-gray-400); }

/* ===================================================================
   CHAT & NOTIFICATION SYSTEM
   =================================================================== */

.notification-bell {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--qb-red);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--qb-white);
  animation: pulseNotif 2s infinite;
}

@keyframes pulseNotif {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.notification-panel {
  position: fixed;
  top: 70px;
  right: 1.5rem;
  width: 360px;
  max-width: calc(100vw - 2rem);
  max-height: 500px;
  background: var(--qb-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--qb-gray-200);
  z-index: 9997;
  display: flex;
  flex-direction: column;
  transform: translateY(-10px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification-panel.show {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--qb-gray-200);
}

.notif-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.notif-close {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--qb-gray-500);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.notif-close:hover {
  background: var(--qb-gray-100);
  color: var(--qb-gray-900);
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
  padding: 0.5rem 0;
}

.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--qb-gray-100);
  cursor: pointer;
  transition: background 0.15s ease;
}

.notif-item:hover {
  background: var(--qb-gray-100);
}

.notif-item.unread {
  background: var(--qb-green-pale);
  border-left: 3px solid var(--qb-green);
}

.notif-item .notif-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.notif-item .notif-content {
  flex: 1;
  min-width: 0;
}

.notif-item .notif-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--qb-gray-900);
  margin-bottom: 0.125rem;
}

.notif-item .notif-text {
  font-size: 0.75rem;
  color: var(--qb-gray-600);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notif-item .notif-time {
  font-size: 0.65rem;
  color: var(--qb-gray-400);
  margin-top: 0.25rem;
}

.notif-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--qb-gray-200);
}

.notif-footer .btn {
  flex: 1;
  font-size: 0.75rem;
  padding: 0.5rem;
}

.chat-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--qb-green), var(--qb-green-dark));
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(44, 160, 28, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9996;
  transition: all 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chat-fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 24px rgba(44, 160, 28, 0.5);
}

.chat-fab:active {
  transform: scale(0.95);
}

.chat-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--qb-red);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid white;
  animation: pulseNotif 2s infinite;
}

.chat-panel {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 380px;
  max-width: calc(100vw - 2rem);
  height: 520px;
  max-height: calc(100vh - 8rem);
  background: var(--qb-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--qb-gray-200);
  z-index: 9995;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chat-panel.show {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  background: linear-gradient(135deg, var(--qb-green), var(--qb-green-dark));
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-info h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.chat-status {
  font-size: 0.7rem;
  opacity: 0.9;
  display: block;
  margin-top: 0.125rem;
}

.chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.chat-tabs {
  display: flex;
  border-bottom: 1px solid var(--qb-gray-200);
  background: var(--qb-gray-100);
}

.chat-tab {
  flex: 1;
  padding: 0.75rem 0.5rem;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--qb-gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.chat-tab:hover {
  color: var(--qb-gray-900);
  background: var(--qb-white);
}

.chat-tab.active {
  color: var(--qb-green);
  border-bottom-color: var(--qb-green);
  background: var(--qb-white);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--qb-gray-100);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-message {
  max-width: 85%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-lg);
  font-size: 0.8rem;
  line-height: 1.4;
  word-wrap: break-word;
  animation: messageSlide 0.25s ease;
}

@keyframes messageSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.own {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--qb-green), var(--qb-green-dark));
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.other {
  align-self: flex-start;
  background: var(--qb-white);
  color: var(--qb-gray-900);
  border: 1px solid var(--qb-gray-200);
  border-bottom-left-radius: 4px;
}

.chat-message .msg-author {
  font-size: 0.65rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  opacity: 0.85;
}

.chat-message .msg-time {
  font-size: 0.6rem;
  opacity: 0.7;
  margin-top: 0.25rem;
  text-align: right;
}

.chat-typing {
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
  color: var(--qb-gray-500);
  background: var(--qb-gray-100);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-style: italic;
}

.typing-dots {
  display: inline-flex;
  gap: 2px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  background: var(--qb-green);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--qb-white);
  border-top: 1px solid var(--qb-gray-200);
}

.chat-input-area input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--qb-gray-300);
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.8rem;
  outline: none;
  transition: all 0.15s ease;
}

.chat-input-area input:focus {
  border-color: var(--qb-green);
  box-shadow: 0 0 0 3px rgba(44, 160, 28, 0.1);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--qb-green);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.chat-send-btn:hover {
  background: var(--qb-green-dark);
  transform: scale(1.05);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

body.dark-mode .notification-panel,
body.dark-mode .chat-panel {
  background: #1E1E1E;
  border-color: #333;
}

body.dark-mode .notif-header,
body.dark-mode .notif-footer,
body.dark-mode .chat-tabs {
  border-color: #333;
  background: #262626;
}

body.dark-mode .notif-item.unread {
  background: #1B3A1A;
}

body.dark-mode .notif-item:hover {
  background: #262626;
}

body.dark-mode .notif-item .notif-title {
  color: #E8E8E8;
}

body.dark-mode .chat-messages {
  background: #121212;
}

body.dark-mode .chat-message.other {
  background: #262626;
  color: #E8E8E8;
  border-color: #333;
}

body.dark-mode .chat-input-area {
  background: #1E1E1E;
  border-color: #333;
}

body.dark-mode .chat-input-area input {
  background: #121212;
  color: #E8E8E8;
  border-color: #444;
}

body.dark-mode .chat-tab.active {
  background: #1E1E1E;
}

body.dark-mode .chat-tab:hover {
  background: #262626;
}

@media (max-width: 768px) {
  .notification-panel {
    top: 60px;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    max-width: none;
  }

  .chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .chat-panel.show {
    transform: translateY(0) scale(1);
  }

  .chat-fab {
    bottom: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
  }
}
/* ===================================================================
   CHAT v2.5 UPGRADES — Reply, Attachments, Voice, Emoji, Search
   =================================================================== */

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}
.chat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}
.chat-icon-btn svg { stroke: currentColor; }

/* The input-area icon buttons inherit white text but they're on white bg */
.chat-input-area .chat-icon-btn {
  background: var(--qb-gray-100);
  color: var(--qb-gray-600);
  border: 1px solid var(--qb-gray-200);
  width: 36px;
  height: 36px;
}
.chat-input-area .chat-icon-btn:hover {
  background: var(--qb-green-pale);
  color: var(--qb-green-dark);
  border-color: var(--qb-green);
}

/* ===== SEARCH BAR ===== */
.chat-search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--qb-gray-100);
  border-bottom: 1px solid var(--qb-gray-200);
  animation: slideDown 0.2s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-search-bar input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--qb-gray-300);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8rem;
  outline: none;
}
.chat-search-bar input:focus {
  border-color: var(--qb-green);
  box-shadow: 0 0 0 3px rgba(44, 160, 28, 0.1);
}
.chat-search-close {
  background: transparent;
  border: none;
  color: var(--qb-gray-500);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}
.chat-search-close:hover { background: var(--qb-gray-200); }

/* ===== REPLY PREVIEW ===== */
.chat-reply-preview,
.chat-attachment-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--qb-green-pale);
  border-top: 2px solid var(--qb-green);
  font-size: 0.75rem;
  animation: slideDown 0.2s ease;
}
.chat-attachment-preview {
  background: #FFF8E1;
  border-top-color: var(--qb-warning);
}
.reply-preview-content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  flex: 1;
  min-width: 0;
  border-left: 3px solid var(--qb-green);
  padding-left: 0.5rem;
}
.reply-label { color: var(--qb-green-dark); font-weight: 600; font-size: 0.7rem; }
.reply-text {
  color: var(--qb-gray-600);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}
.reply-cancel, .attachment-cancel {
  background: transparent;
  border: none;
  color: var(--qb-gray-500);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.reply-cancel:hover, .attachment-cancel:hover {
  background: rgba(0,0,0,0.08);
  color: var(--qb-red);
}
.attachment-info { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.attachment-icon { font-size: 1.2rem; }
.attachment-details { display: flex; flex-direction: column; min-width: 0; }
.attachment-name {
  font-weight: 600;
  color: var(--qb-gray-900);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-size { font-size: 0.65rem; color: var(--qb-gray-500); }

/* ===== RECORDING INDICATOR ===== */
.chat-recording-indicator {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.875rem;
  background: #FFEBEE;
  border-top: 2px solid var(--qb-red);
  font-size: 0.8rem;
  animation: slideDown 0.2s ease;
}
.recording-dot {
  width: 10px;
  height: 10px;
  background: var(--qb-red);
  border-radius: 50%;
  animation: recPulse 1s infinite;
  flex-shrink: 0;
}
@keyframes recPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}
.recording-text { flex: 1; color: var(--qb-red); font-weight: 600; }
.recording-stop {
  background: var(--qb-red);
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.recording-stop:hover { background: #B71C1C; }
.recording-cancel {
  background: transparent;
  border: 1px solid var(--qb-red);
  color: var(--qb-red);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
}
.recording-cancel:hover { background: var(--qb-red); color: white; }

/* ===== EMOJI PICKER ===== */
.chat-emoji-picker {
  background: var(--qb-white);
  border-top: 1px solid var(--qb-gray-200);
  padding: 0.5rem;
  animation: slideDown 0.2s ease;
  max-height: 160px;
  overflow-y: auto;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
}
.emoji-grid button {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}
.emoji-grid button:hover {
  background: var(--qb-green-pale);
  transform: scale(1.2);
}

/* ===== MESSAGE ENHANCEMENTS ===== */
.chat-message {
  position: relative;
  transition: all 0.15s ease;
}
.chat-message:hover .msg-actions {
  opacity: 1;
  pointer-events: all;
}
.msg-actions {
  position: absolute;
  top: -8px;
  right: 4px;
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-200);
  border-radius: 100px;
  padding: 0.15rem;
  box-shadow: var(--shadow-sm);
}
.chat-message.own .msg-actions { right: auto; left: 4px; }
.msg-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: 50%;
  font-size: 0.75rem;
  line-height: 1;
  transition: background 0.15s ease;
  color: var(--qb-gray-500);
}
.msg-action-btn:hover { background: var(--qb-gray-100); color: var(--qb-green-dark); }

/* ===== REPLY QUOTE IN MESSAGE ===== */
.msg-reply-quote {
  background: rgba(0, 0, 0, 0.06);
  border-left: 3px solid currentColor;
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  opacity: 0.9;
  overflow: hidden;
}
.chat-message.own .msg-reply-quote {
  background: rgba(255, 255, 255, 0.15);
}
.msg-reply-quote .quote-author {
  font-weight: 700;
  display: block;
  margin-bottom: 0.1rem;
}
.msg-reply-quote .quote-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
}

/* ===== ATTACHMENT IN MESSAGE ===== */
.msg-attachment {
  margin-top: 0.35rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 100%;
}
.msg-attachment-image {
  display: block;
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.msg-attachment-image:hover { transform: scale(1.02); }
.msg-attachment-file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  font-size: 0.75rem;
  transition: background 0.15s ease;
}
.chat-message.own .msg-attachment-file {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}
.msg-attachment-file:hover { background: rgba(0, 0, 0, 0.12); }
.chat-message.own .msg-attachment-file:hover { background: rgba(255, 255, 255, 0.25); }
.msg-attachment-file .file-icon { font-size: 1.2rem; flex-shrink: 0; }
.msg-attachment-file .file-info { display: flex; flex-direction: column; min-width: 0; }
.msg-attachment-file .file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-attachment-file .file-size { font-size: 0.65rem; opacity: 0.75; }

/* ===== AUDIO PLAYER IN MESSAGE ===== */
.msg-audio {
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.5rem 0.75rem;
  border-radius: 100px;
  max-width: 100%;
}
.chat-message.own .msg-audio { background: rgba(255, 255, 255, 0.15); }
.msg-audio audio {
  flex: 1;
  height: 32px;
  min-width: 0;
}
.msg-audio .audio-icon { font-size: 1rem; flex-shrink: 0; }

/* ===== READ RECEIPT ===== */
.msg-read-status {
  font-size: 0.6rem;
  opacity: 0.75;
  margin-top: 0.15rem;
  text-align: right;
  font-style: italic;
}

/* ===== SEARCH HIGHLIGHT ===== */
.chat-message.search-match {
  box-shadow: 0 0 0 2px var(--qb-warning);
}
.chat-message.search-match .msg-text mark,
.chat-message mark {
  background: #FFF3CD;
  color: var(--qb-gray-900);
  padding: 0 2px;
  border-radius: 2px;
}

/* ===== IMAGE LIGHTBOX ===== */
.chat-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
  padding: 2rem;
}
.chat-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);
}
.chat-lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chat-lightbox-close:hover { background: rgba(255, 255, 255, 0.3); transform: rotate(90deg); }

/* ===== DARK MODE OVERRIDES ===== */
body.dark-mode .chat-search-bar { background: #262626; border-color: #333; }
body.dark-mode .chat-search-bar input { background: #121212; color: #E8E8E8; border-color: #444; }
body.dark-mode .chat-reply-preview { background: #1B3A1A; border-top-color: var(--qb-green); }
body.dark-mode .chat-attachment-preview { background: #2A2410; }
body.dark-mode .chat-recording-indicator { background: #2A1010; }
body.dark-mode .chat-emoji-picker { background: #1E1E1E; border-color: #333; }
body.dark-mode .emoji-grid button:hover { background: #1B3A1A; }
body.dark-mode .msg-actions { background: #262626; border-color: #444; }
body.dark-mode .msg-action-btn:hover { background: #333; color: var(--qb-green-light); }
body.dark-mode .chat-input-area .chat-icon-btn {
  background: #262626;
  color: var(--qb-gray-400);
  border-color: #444;
}
body.dark-mode .chat-input-area .chat-icon-btn:hover {
  background: #1B3A1A;
  color: var(--qb-green-light);
  border-color: var(--qb-green);
}
body.dark-mode .chat-message mark {
  background: #4A3A10;
  color: #FFE082;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .chat-input-area { padding: 0.5rem; gap: 0.35rem; }
  .chat-input-area .chat-icon-btn { width: 32px; height: 32px; }
  .chat-input-area input { font-size: 0.85rem; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .msg-actions { opacity: 1; pointer-events: all; position: static; margin-top: 0.25rem; align-self: flex-end; }
}

/* ===================================================================
   WITHHOLDING & VAT REPORT STYLES (v3.0)
   =================================================================== */

/* ---- KPI Stat Cards ---- */
.wh-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.wh-stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}
.wh-stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--qb-green);
}
.wh-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--qb-green-pale);
  color: var(--qb-green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.wh-stat-content h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--qb-gray-500);
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.wh-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--qb-gray-900);
  font-variant-numeric: tabular-nums;
}
.wh-stat-value small {
  font-size: 0.7rem;
  color: var(--qb-gray-500);
  font-weight: 500;
}

/* ---- Period Toolbar ---- */
.wh-period-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-200);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.wh-period-label {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--qb-gray-500);
}
.wh-period-filters {
  display: flex;
  gap: 0.375rem;
  background: var(--qb-gray-100);
  padding: 0.25rem;
  border-radius: var(--radius-md);
}
.wh-period-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--qb-gray-600);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.wh-period-btn:hover {
  background: var(--qb-white);
  color: var(--qb-gray-900);
}
.wh-period-btn.active {
  background: var(--qb-green);
  color: white;
  box-shadow: 0 2px 6px rgba(44, 160, 28, 0.3);
}
.wh-period-selectors {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.wh-period-selector {
  animation: fadeIn 0.2s ease;
}
.wh-date-input,
.wh-month-input,
.wh-year-input {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--qb-gray-300);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  background: var(--qb-white);
  color: var(--qb-gray-900);
  transition: all 0.15s ease;
  min-width: 160px;
}
.wh-date-input:focus,
.wh-month-input:focus,
.wh-year-input:focus {
  outline: none;
  border-color: var(--qb-green);
  box-shadow: 0 0 0 3px rgba(44, 160, 28, 0.12);
}

/* ---- Toolbar ---- */
.wh-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.wh-toolbar-left,
.wh-toolbar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.wh-search-input {
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--qb-gray-300);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  min-width: 280px;
  background: var(--qb-white);
  transition: all 0.15s ease;
}
.wh-search-input:focus {
  outline: none;
  border-color: var(--qb-green);
  box-shadow: 0 0 0 3px rgba(44, 160, 28, 0.12);
}
.wh-filter-select {
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--qb-gray-300);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  background: var(--qb-white);
  cursor: pointer;
  min-width: 170px;
}
.wh-filter-select:focus {
  outline: none;
  border-color: var(--qb-green);
  box-shadow: 0 0 0 3px rgba(44, 160, 28, 0.12);
}
.btn-import {
  background: var(--qb-blue);
  color: white;
  border-color: var(--qb-blue);
}
.btn-import:hover {
  background: #005A9E;
}

/* ---- Table ---- */
.wh-table-container {
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-200);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.wh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 1400px;
}
.wh-table thead th {
  background: linear-gradient(135deg, #6F4E37, #4A3424);
  color: white;
  padding: 0.7rem 0.65rem;
  text-align: left;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid #4A3424;
  vertical-align: middle;
  position: sticky;
  top: 0;
  z-index: 5;
}
.wh-table tbody td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--qb-gray-100);
  white-space: nowrap;
  color: var(--qb-gray-800);
}
.wh-table tbody tr:nth-child(even) {
  background: #FBF9F7;
}
.wh-table tbody tr:hover {
  background: var(--qb-green-pale);
}
.wh-table tbody tr.wh-coffee-row td {
  background: #FEF9E7;
}
.wh-table tbody tr.wh-coffee-row:hover td {
  background: #FFF3C4;
}
.wh-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.wh-table .wh-total-row td {
  background: linear-gradient(135deg, #F5F0EB, #EDE4DA) !important;
  font-weight: 800;
  border-top: 2px solid #6F4E37;
  border-bottom: 2px solid #6F4E37;
  color: #4A3424;
  font-size: 0.82rem;
  padding: 0.85rem 0.7rem;
}

/* ---- Signatures ---- */
.wh-signatures {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-200);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}
.wh-sig-block {
  flex: 1;
  min-width: 220px;
  font-size: 0.85rem;
  color: var(--qb-gray-700);
}
.wh-sig-block p {
  margin: 0.35rem 0;
}

/* ---- Modal ---- */
.wh-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.wh-modal.show {
  opacity: 1;
  pointer-events: all;
}
.wh-modal-content {
  background: var(--qb-white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.wh-modal.show .wh-modal-content {
  transform: scale(1) translateY(0);
}
.wh-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--qb-gray-200);
  position: sticky;
  top: 0;
  background: var(--qb-white);
  z-index: 2;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.wh-modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--qb-gray-900);
  margin: 0;
}
.wh-modal-close {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--qb-gray-500);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.wh-modal-close:hover {
  background: var(--qb-gray-100);
  color: var(--qb-red);
}
.wh-modal-body {
  padding: 1.5rem;
}
.wh-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--qb-gray-200);
  background: var(--qb-gray-100);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  position: sticky;
  bottom: 0;
}

/* ---- Dark Mode ---- */
body.dark-mode .wh-stat-card,
body.dark-mode .wh-period-toolbar,
body.dark-mode .wh-table-container,
body.dark-mode .wh-signatures,
body.dark-mode .wh-modal-content {
  background: #1E1E1E;
  border-color: #333;
}
body.dark-mode .wh-period-filters {
  background: #262626;
}
body.dark-mode .wh-period-btn:hover {
  background: #333;
  color: #E8E8E8;
}
body.dark-mode .wh-table tbody tr:nth-child(even) {
  background: #262626;
}
body.dark-mode .wh-table tbody td {
  color: #E8E8E8;
  border-color: #2A2A2A;
}
body.dark-mode .wh-table tbody tr.wh-coffee-row td {
  background: #2A2410;
}
body.dark-mode .wh-table .wh-total-row td {
  background: #262626 !important;
  color: #E8E8E8;
}
body.dark-mode .wh-modal-header {
  background: #1E1E1E;
  border-color: #333;
}
body.dark-mode .wh-modal-footer {
  background: #262626;
  border-color: #333;
}
body.dark-mode .wh-date-input,
body.dark-mode .wh-month-input,
body.dark-mode .wh-year-input,
body.dark-mode .wh-search-input,
body.dark-mode .wh-filter-select {
  background: #121212;
  color: #E8E8E8;
  border-color: #444;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .wh-stats-grid { grid-template-columns: 1fr 1fr; }
  .wh-period-toolbar { flex-direction: column; align-items: stretch; }
  .wh-period-filters { justify-content: center; }
  .wh-period-selectors { justify-content: stretch; }
  .wh-period-selector { flex: 1; }
  .wh-date-input,
  .wh-month-input,
  .wh-year-input { width: 100%; min-width: 0; }
  .wh-toolbar { flex-direction: column; align-items: stretch; }
  .wh-toolbar-left,
  .wh-toolbar-right { width: 100%; }
  .wh-search-input { min-width: 0; width: 100%; }
  .wh-filter-select { width: 100%; }
}
@media (max-width: 480px) {
  .wh-stats-grid { grid-template-columns: 1fr; }
  .wh-modal-content { max-height: 95vh; }
}

/* ===================================================================
   ACCOUNTING EXPORT TOOLBAR
   =================================================================== */
.acct-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-200);
  border-left: 4px solid var(--qb-green);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.acct-toolbar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--qb-gray-900);
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.acct-toolbar-title::before {
  content: '📒';
  font-size: 1.05rem;
}
.acct-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

body.dark-mode .acct-toolbar {
  background: #1E1E1E;
  border-color: #333;
  border-left-color: var(--qb-green);
}
body.dark-mode .acct-toolbar-title { color: #E8E8E8; }

@media (max-width: 600px) {
  .acct-toolbar { flex-direction: column; align-items: stretch; }
  .acct-toolbar-actions { justify-content: stretch; }
  .acct-toolbar-actions .btn { flex: 1; }
}

/* ===================================================================
   EXPENSE ↔ PAYMENT/CHECK LINKING STYLES
   =================================================================== */

/* ---- Linked expense info in payment/check tables ---- */
.linked-expense {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.625rem;
  background: var(--qb-green-pale);
  color: var(--qb-green-dark);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid rgba(44, 160, 28, 0.25);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.linked-expense:hover {
  background: var(--qb-green);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(44, 160, 28, 0.3);
}
.linked-expense::before {
  content: '🔗';
  font-size: 0.75rem;
}
.linked-expense.no-link {
  background: var(--qb-gray-100);
  color: var(--qb-gray-400);
  border-color: var(--qb-gray-200);
  cursor: default;
}
.linked-expense.no-link::before { content: '—'; }
.linked-expense.no-link:hover {
  background: var(--qb-gray-100);
  color: var(--qb-gray-400);
  transform: none;
  box-shadow: none;
}

/* ---- Expense status badges ---- */
.badge-paid {
  background: #D4EDDA;
  color: #155724;
  border: 1px solid #B7DFC2;
}
.badge-partial-payment {
  background: #CCE5FF;
  color: #004085;
  border: 1px solid #A5C9EE;
}
.badge-unpaid {
  background: #FFF3CD;
  color: #856404;
  border: 1px solid #F0DFA0;
}

/* ---- Paid amount styling in expense table ---- */
.paid-amount {
  color: var(--qb-green-dark);
  font-weight: 700;
}
.paid-amount.partial {
  color: var(--qb-orange);
}
.paid-amount.zero {
  color: var(--qb-gray-400);
  font-weight: 500;
}

/* ---- View payments button ---- */
.btn-view {
  background: var(--qb-teal);
  color: white;
  margin-right: 0.25rem;
  padding: 0.375rem 0.6rem;
  font-size: 0.7rem;
}
.btn-view:hover {
  background: #00695C;
}

/* ---- Expense selector in payment/check forms ---- */
#payExpenseId,
#checkExpenseId {
  background: var(--qb-green-pale);
  border-color: rgba(44, 160, 28, 0.3);
  font-weight: 500;
  cursor: pointer;
}
#payExpenseId:focus,
#checkExpenseId:focus {
  background: var(--qb-white);
  border-color: var(--qb-green);
  box-shadow: 0 0 0 3px rgba(44, 160, 28, 0.12);
}

#payExpenseType,
#checkExpenseType {
  background: var(--qb-gray-100);
  color: var(--qb-green-dark);
  font-weight: 600;
  border-color: var(--qb-gray-200);
}

/* ---- Expense link indicator in table rows ---- */
tr.has-linked-expense {
  background: linear-gradient(to right, rgba(44, 160, 28, 0.04), transparent 40%);
}
tr.has-linked-expense:hover {
  background: linear-gradient(to right, rgba(44, 160, 28, 0.08), rgba(44, 160, 28, 0.02));
}

/* ---- Expense payment history popup ---- */
.expense-payment-history {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  color: #2C1810;
}
.expense-payment-history h2 {
  color: #4A3424;
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.5px;
}
.expense-payment-history .expense-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: #F5F0EB;
  border-radius: 10px;
  border-left: 4px solid #6F4E37;
}
.expense-payment-history .expense-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.expense-payment-history .expense-meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6B6B6B;
  font-weight: 600;
}
.expense-payment-history .expense-meta-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #4A3424;
}
.expense-payment-history table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  overflow: hidden;
}
.expense-payment-history thead th {
  background: linear-gradient(135deg, #6F4E37, #4A3424);
  color: white;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.expense-payment-history tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #E8E0D8;
}
.expense-payment-history tbody tr:nth-child(even) {
  background: #FBF9F7;
}
.expense-payment-history tbody tr:hover {
  background: #F5F0EB;
}
.expense-payment-history .amount-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #4A3424;
}
.expense-payment-history .total-row {
  background: #F5F0EB !important;
  font-weight: 700;
  border-top: 2px solid #6F4E37;
  border-bottom: 2px solid #6F4E37;
}
.expense-payment-history .total-row td {
  padding: 0.875rem 1rem;
  color: #4A3424;
  font-size: 0.95rem;
}
.expense-payment-history .type-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.expense-payment-history .type-badge.payment {
  background: #CCE5FF;
  color: #004085;
}
.expense-payment-history .type-badge.check {
  background: #D4EDDA;
  color: #155724;
}
.expense-payment-history .status-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: #F5F0EB;
  border-radius: 8px;
  font-size: 0.9rem;
  border-left: 4px solid #2CA01C;
}
.expense-payment-history .status-summary strong {
  color: #2CA01C;
  font-size: 1.1rem;
}

/* ---- Dark mode adjustments ---- */
body.dark-mode #payExpenseId,
body.dark-mode #checkExpenseId {
  background: #1B3A1A;
  border-color: rgba(44, 160, 28, 0.4);
  color: #E8E8E8;
}
body.dark-mode #payExpenseId:focus,
body.dark-mode #checkExpenseId:focus {
  background: #121212;
  border-color: var(--qb-green);
}
body.dark-mode #payExpenseType,
body.dark-mode #checkExpenseType {
  background: #262626;
  color: var(--qb-green-light);
  border-color: #444;
}
body.dark-mode .linked-expense {
  background: #1B3A1A;
  color: var(--qb-green-light);
  border-color: rgba(44, 160, 28, 0.4);
}
body.dark-mode .linked-expense:hover {
  background: var(--qb-green);
  color: white;
}
body.dark-mode .linked-expense.no-link {
  background: #262626;
  color: #666;
  border-color: #333;
}
body.dark-mode tr.has-linked-expense {
  background: linear-gradient(to right, rgba(44, 160, 28, 0.08), transparent 40%);
}
body.dark-mode .expense-payment-history {
  background: #1E1E1E;
  color: #E8E8E8;
}
body.dark-mode .expense-payment-history h2 {
  color: #E8E8E8;
}
body.dark-mode .expense-payment-history .expense-meta {
  background: #262626;
  border-left-color: var(--qb-green);
}
body.dark-mode .expense-payment-history .expense-meta-label {
  color: #A0A0A0;
}
body.dark-mode .expense-payment-history .expense-meta-value {
  color: #E8E8E8;
}
body.dark-mode .expense-payment-history tbody td {
  border-bottom-color: #333;
  color: #E8E8E8;
}
body.dark-mode .expense-payment-history tbody tr:nth-child(even) {
  background: #262626;
}
body.dark-mode .expense-payment-history tbody tr:hover {
  background: #2A2A2A;
}
body.dark-mode .expense-payment-history .amount-cell,
body.dark-mode .expense-payment-history .total-row td {
  color: #E8E8E8;
}
body.dark-mode .expense-payment-history .total-row {
  background: #262626 !important;
  border-top-color: var(--qb-green);
  border-bottom-color: var(--qb-green);
}
body.dark-mode .expense-payment-history .status-summary {
  background: #262626;
  border-left-color: var(--qb-green);
}

/* ===== AUTO FINANCIAL STATEMENTS ===== */
.fs-period-inputs {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-left: auto;
}
.financial-statement {
  background: var(--qb-white);
  border: 1px solid var(--qb-gray-200);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}
.financial-statement .fs-header {
  text-align: center;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 3px double #6F4E37;
}
.financial-statement .fs-header h1 {
  font-size: 1.35rem;
  color: #4A3424;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin: 0 0 0.35rem;
}
.financial-statement .fs-header h2 {
  font-size: 1rem;
  color: var(--qb-green);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
}
.financial-statement .fs-header .fs-period {
  font-size: 0.8rem;
  color: var(--qb-gray-500);
  margin-top: 0.5rem;
}
.financial-statement table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.financial-statement table th {
  background: linear-gradient(135deg, #6F4E37, #4A3424);
  color: white;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.financial-statement table th.num-head {
  text-align: right;
  width: 200px;
}
.financial-statement table td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--qb-gray-100);
}
.financial-statement table td.num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.financial-statement .fs-section-header {
  background: #EFE7DD !important;
  font-weight: 800;
  color: #4A3424;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.75rem 1rem !important;
  border-left: 4px solid #6F4E37;
}
.financial-statement .fs-subtotal {
  background: #F5F0EB;
  font-weight: 700;
  border-top: 2px solid #6F4E37;
  border-bottom: 2px solid #6F4E37;
  color: #4A3424;
}
.financial-statement .fs-subtotal td {
  padding: 0.875rem 1rem;
  font-size: 0.92rem;
}
.financial-statement .fs-grand-total {
  background: linear-gradient(135deg, #6F4E37, #4A3424);
  color: white;
  font-weight: 800;
}
.financial-statement .fs-grand-total td {
  padding: 1rem;
  font-size: 1rem;
  border: none;
}
.financial-statement .fs-indent {
  padding-left: 2.5rem !important;
  color: var(--qb-gray-700);
}
.financial-statement .fs-code {
  display: inline-block;
  min-width: 55px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 0.75rem;
  color: var(--qb-gray-500);
  font-weight: 600;
  margin-right: 0.5rem;
}
.financial-statement .fs-balanced {
  text-align: center;
  color: var(--qb-success);
  font-weight: 700;
  margin-top: 1rem;
  padding: 0.75rem;
  background: #D4EDDA;
  border-radius: var(--radius-md);
}
.financial-statement .fs-unbalanced {
  text-align: center;
  color: var(--qb-danger);
  font-weight: 700;
  margin-top: 1rem;
  padding: 0.75rem;
  background: #F8D7DA;
  border-radius: var(--radius-md);
}
.financial-statement .fs-empty {
  text-align: center;
  color: var(--qb-gray-400);
  padding: 1.5rem;
  font-style: italic;
}

body.dark-mode .financial-statement {
  background: #1E1E1E;
  border-color: #333;
}
body.dark-mode .financial-statement .fs-header h1 { color: #E8E8E8; }
body.dark-mode .financial-statement table td { border-bottom-color: #2A2A2A; color: #E8E8E8; }
body.dark-mode .financial-statement .fs-section-header {
  background: #262626 !important;
  color: #E8E8E8 !important;
  border-left-color: var(--qb-green);
}
body.dark-mode .financial-statement .fs-subtotal {
  background: #262626;
  color: #E8E8E8;
  border-top-color: var(--qb-green);
  border-bottom-color: var(--qb-green);
}
body.dark-mode .financial-statement .fs-balanced { background: #1B3A1A; color: #4DB33D; }
body.dark-mode .financial-statement .fs-unbalanced { background: #2A1010; color: #F8D7DA; }

@media (max-width: 768px) {
  .financial-statement { padding: 1rem; }
  .financial-statement table { font-size: 0.75rem; }
  .financial-statement table td, .financial-statement table th { padding: 0.5rem 0.6rem; }
  .fs-period-inputs { width: 100%; margin-left: 0; }
}