/*
  =========================================
  MitraBooks ERP - Theme Enhancement CSS
  =========================================
  Enhances app-shell.css with theme tokens for dark/light mode support.
  PWA-safe: zero external dependencies, works with existing HTML structure.
*/

/* ============================================
   THEME AWARE OVERRIDES FOR EXISTING CLASSES
   ============================================ */

/* Dark theme (default) - override app-shell.css hardcoded colors */
html[data-theme="dark"] {
  --bg: var(--bg-primary, #090c14);
  --panel: var(--bg-secondary, #0f1424);
  --panel-2: var(--bg-card, rgba(18, 25, 47, 0.65));
  --text: var(--text-primary, #f8fafc);
  --muted: var(--text-secondary, #94a3b8);
  --border: var(--border-color, rgba(255, 255, 255, 0.08));
  --accent: var(--accent-color, #3b82f6);
  --success: var(--success-color, #10b981);
  --warning: var(--warning-color, #f59e0b);
  --danger: var(--danger-color, #ef4444);
}

/* Light theme - override for light mode */
html[data-theme="light"] {
  --bg: var(--bg-primary, #f8fafc);
  --panel: var(--bg-secondary, #ffffff);
  --panel-2: var(--bg-card, rgba(255, 255, 255, 0.85));
  --text: var(--text-primary, #0f172a);
  --muted: var(--text-secondary, #475569);
  --border: var(--border-color, rgba(0, 0, 0, 0.08));
  --accent: var(--accent-color, #2563eb);
  --success: var(--success-color, #059669);
  --warning: var(--warning-color, #d97706);
  --danger: var(--danger-color, #dc2626);
}

body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   ENHANCE EXISTING SIDEBAR
   ============================================ */

.sidebar {
  transition: background-color 0.3s ease, color 0.3s ease;
}

html[data-theme="dark"] .sidebar {
  background: var(--bg-sidebar, #0a0d18) !important;
  border-color: var(--border-color, rgba(255, 255, 255, 0.08)) !important;
}

html[data-theme="light"] .sidebar {
  background: var(--bg-secondary, #ffffff) !important;
  border-color: var(--border-color, rgba(0, 0, 0, 0.08)) !important;
}

/* ============================================
   ENHANCE BRAND SECTION
   ============================================ */

.brand {
  position: relative;
}

html[data-theme="dark"] .brand {
  color: #e2e8f0;
}

html[data-theme="dark"] .brand h1 {
  color: #e2e8f0;
}

html[data-theme="dark"] .brand p {
  color: #94a3b8;
}

/* ============================================
   ENHANCE NAVIGATION
   ============================================ */

.nav a,
.nav button {
  transition: var(--transition-smooth, all 0.25s ease);
}

html[data-theme="dark"] .nav a,
html[data-theme="dark"] .nav button {
  color: #94a3b8;
}

html[data-theme="dark"] .nav a:hover,
html[data-theme="dark"] .nav button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
}

html[data-theme="dark"] .nav a.active,
html[data-theme="dark"] .nav button.active {
  background: rgba(var(--accent-rgb, 59, 130, 246), 0.1);
  color: var(--accent-color, #3b82f6);
}

html[data-theme="light"] .nav a:hover,
html[data-theme="light"] .nav button:hover {
  background: rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .nav a.active,
html[data-theme="light"] .nav button.active {
  color: var(--accent-color, #2563eb);
}

/* ============================================
   ENHANCE TOPBAR/HEADER
   ============================================ */

.topbar {
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

html[data-theme="dark"] .topbar {
  background: var(--bg-secondary, #0f1424) !important;
  border-color: var(--border-color, rgba(255, 255, 255, 0.08)) !important;
}

html[data-theme="light"] .topbar {
  background: var(--bg-secondary, #ffffff) !important;
  border-color: var(--border-color, rgba(0, 0, 0, 0.08)) !important;
}

/* ============================================
   ENHANCE BUTTONS
   ============================================ */

.secondary {
  transition: var(--transition-smooth, all 0.25s ease);
}

html[data-theme="dark"] .secondary {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #94a3b8 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .secondary:hover {
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* ============================================
   HEALTH/PILL WIDGET
   ============================================ */

.pill {
  transition: var(--transition-smooth, all 0.25s ease);
}

html[data-theme="dark"] .pill {
  background: rgba(var(--accent-rgb, 59, 130, 246), 0.1);
  border-color: rgba(var(--accent-rgb, 59, 130, 246), 0.2);
  color: var(--accent-color, #3b82f6);
}

html[data-theme="light"] .pill {
  background: rgba(var(--accent-rgb, 37, 99, 235), 0.08);
  border-color: rgba(var(--accent-rgb, 37, 99, 235), 0.15);
  color: var(--accent-color, #2563eb);
}

/* ============================================
   CONTENT AREA
   ============================================ */

.content {
  transition: background-color 0.3s ease, color 0.3s ease;
}

html[data-theme="dark"] .content {
  background: var(--bg-primary, #090c14) !important;
}

html[data-theme="light"] .content {
  background: var(--bg-primary, #f8fafc) !important;
}

/* ============================================
   CARD STYLING
   ============================================ */

.card {
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

html[data-theme="dark"] .card {
  background: var(--bg-card, rgba(18, 25, 47, 0.65)) !important;
  border-color: var(--border-color, rgba(255, 255, 255, 0.08)) !important;
  color: var(--text-primary, #f8fafc);
}

html[data-theme="light"] .card {
  background: var(--bg-card, rgba(255, 255, 255, 0.85)) !important;
  border-color: var(--border-color, rgba(0, 0, 0, 0.08)) !important;
  color: var(--text-primary, #0f172a);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

input,
textarea,
select {
  transition: var(--transition-smooth, all 0.25s ease);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: var(--bg-input, #12182e) !important;
  color: var(--text-primary, #f8fafc) !important;
  border-color: var(--border-color, rgba(255, 255, 255, 0.08)) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: var(--text-muted, #475569) !important;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus {
  border-color: var(--border-color-focus, rgba(59, 130, 246, 0.5)) !important;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 59, 130, 246), 0.1) !important;
}

html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select {
  background: var(--bg-input, #f1f5f9) !important;
  color: var(--text-primary, #0f172a) !important;
  border-color: var(--border-color, rgba(0, 0, 0, 0.08)) !important;
}

html[data-theme="light"] input:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] select:focus {
  border-color: var(--border-color-focus, rgba(37, 99, 235, 0.5)) !important;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 37, 99, 235), 0.08) !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-slide-down {
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-fade-in {
  animation: fadeIn 0.3s ease;
}

/* ============================================
   MITRABOOKS ERP REDESIGNED SHELL
   ============================================ */

.erp-sidebar {
  background: var(--bg-sidebar, #0a0d18);
  border-right: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100vh;
  padding: 18px 16px;
  position: sticky;
  top: 0;
}

.erp-brand {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 44px 1fr;
  isolation: isolate;
  min-height: 60px;
}

.brand-mark {
  background: var(--accent-color, #3b82f6);
  border-radius: 8px;
  filter: blur(12px);
  height: 42px;
  opacity: 0.25;
  position: absolute;
  width: 42px;
  z-index: -1;
}

.erp-brand .brand-logo {
  border-radius: 8px;
  height: 44px;
  object-fit: contain;
  width: 44px;
}

.brand-text h1 {
  color: var(--text-primary, #f8fafc);
  font-size: 18px;
  line-height: 1.15;
  margin: 0;
}

.brand-text p {
  color: var(--text-secondary, #94a3b8);
  font-size: 12px;
  line-height: 1.35;
  margin: 2px 0 0;
}

.org-selector,
.fy-selector {
  position: relative;
}

.selected-org,
.fy-badge,
.theme-btn,
.user-profile-tile,
.pwa-status-widget {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-primary, #f8fafc);
}

.selected-org {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.context-dot {
  background: var(--accent-color, #3b82f6);
  border-radius: 999px;
  box-shadow: 0 0 8px var(--accent-color, #3b82f6);
  flex: 0 0 10px;
  height: 10px;
  width: 10px;
}

.muted-dot {
  background: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.context-copy,
.user-details,
.pwa-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.context-copy span,
.context-copy small,
.user-details strong,
.user-details span,
.pwa-details span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-copy span,
.org-option strong,
.user-details strong,
.pwa-details strong {
  font-size: 12px;
  font-weight: 700;
}

.context-copy small,
.org-option small,
.fy-selector,
.user-details span,
.pwa-details span {
  color: var(--text-secondary, #94a3b8);
  font-size: 11px;
}

.chevron-icon {
  color: var(--text-secondary, #94a3b8);
  flex: 0 0 14px;
  height: 14px;
  transition: transform 0.2s ease;
  width: 14px;
}

.org-selector.open .chevron-icon {
  transform: rotate(180deg);
}

.org-dropdown,
.fy-dropdown {
  background: var(--bg-secondary, #0f1424);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
  left: 0;
  overflow: hidden;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
}

.org-dropdown[hidden],
.fy-dropdown[hidden] {
  display: none;
}

.org-option,
.fy-option {
  cursor: pointer;
  display: flex;
  gap: 12px;
  padding: 11px 12px;
}

.org-option:not(:last-child),
.fy-option:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.org-option:hover,
.fy-option:hover,
.org-option.active,
.fy-option.active {
  background: rgba(var(--accent-rgb, 59, 130, 246), 0.1);
}

.fy-selector {
  align-items: center;
  display: flex;
  gap: 8px;
  padding: 2px 0;
}

.fy-badge {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  padding: 6px 10px;
}

.fy-badge svg {
  height: 10px;
  width: 10px;
}

.fy-dropdown {
  left: 0;
  min-width: 148px;
  right: auto;
}

.fy-option {
  color: var(--text-primary, #f8fafc);
  display: block;
  font-size: 12px;
}

.fy-option small {
  color: var(--text-secondary, #94a3b8);
}

.erp-sidebar .nav {
  align-content: start;
  display: grid;
  gap: 6px;
}

.nav-group-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  justify-content: space-between;
  min-height: 28px;
  padding: 8px 4px 4px;
  text-transform: none;
}

.nav-group-toggle span:last-child {
  color: var(--text-muted, #64748b);
  font-size: 11px;
  transition: transform 0.16s ease;
}

.nav-group-toggle[aria-expanded="false"] span:last-child {
  transform: rotate(-90deg);
}

.nav-group-items {
  display: grid;
  gap: 4px;
}

.nav-group-items[hidden] {
  display: none;
}

.erp-sidebar .nav a.erp-nav-link {
  border-color: transparent;
  border-radius: 8px;
  display: grid;
  gap: 9px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  min-height: 38px;
  padding: 7px 10px;
}

.erp-sidebar .nav a.erp-nav-link::before {
  content: none;
}

.nav-icon {
  align-items: center;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 6px;
  color: #93c5fd;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  align-self: center;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.26);
  border-radius: 999px;
  color: #86efac;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
}

.erp-sidebar .nav a.erp-nav-link.locked {
  opacity: 0.62;
}

.erp-sidebar .nav a.erp-nav-link.locked .nav-icon {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.14);
  color: #94a3b8;
}

.app:not(.mandir-theme):not(.gruha-theme):not(.legal-theme):not(.invest-theme) .erp-sidebar .nav a.erp-nav-link.active {
  background: #ffffff;
  border-color: #ffffff;
  color: #111827;
}

.erp-sidebar .nav a.erp-nav-link.active .nav-icon {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.sidebar-footer {
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
}

.pwa-status-widget,
.user-profile-tile {
  align-items: center;
  display: flex;
  gap: 10px;
  padding: 10px;
}

.pwa-dot {
  background: var(--success-color, #10b981);
  border-radius: 999px;
  box-shadow: 0 0 6px var(--success-color, #10b981);
  height: 8px;
  width: 8px;
}

.theme-switcher {
  display: flex;
  gap: 8px;
}

.theme-btn {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  flex: 1;
  justify-content: center;
  min-height: 34px;
}

.theme-btn.active {
  border-color: rgba(var(--accent-rgb, 59, 130, 246), 0.45);
  color: var(--accent-color, #3b82f6);
}

.theme-btn svg {
  height: 15px;
  width: 15px;
}

.avatar {
  align-items: center;
  background: var(--accent-color, #3b82f6);
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  flex: 0 0 32px;
  font-size: 12px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.erp-topbar {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  min-height: 78px;
  padding: 16px 24px;
}

.page-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.breadcrumb {
  align-items: center;
  color: var(--text-secondary, #94a3b8);
  display: flex;
  font-size: 12px;
  gap: 8px;
}

.breadcrumb strong,
.page-title-block h1 {
  color: var(--text-primary, #f8fafc);
}

.page-title-block h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.topbar-control-strip {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-left: auto;
}

.health-score-widget {
  align-items: center;
  background: rgba(var(--warning-rgb, 245, 158, 11), 0.08);
  border: 1px solid rgba(var(--warning-rgb, 245, 158, 11), 0.22);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  min-width: 150px;
  padding: 8px 10px;
}

.health-score-widget.ok {
  background: rgba(var(--success-rgb, 16, 185, 129), 0.08);
  border-color: rgba(var(--success-rgb, 16, 185, 129), 0.25);
}

.health-score-widget.pending {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.18);
}

.circular-chart {
  flex: 0 0 40px;
  height: 40px;
  width: 40px;
}

.circle-bg,
.circle {
  fill: none;
  stroke-width: 2;
}

.circle-bg {
  stroke: rgba(148, 163, 184, 0.25);
}

.circle {
  stroke: var(--warning-color, #f59e0b);
  stroke-linecap: round;
  transition: stroke-dasharray 0.25s ease;
}

.health-score-widget.ok .circle {
  stroke: var(--success-color, #10b981);
}

.health-score-widget.pending .circle {
  stroke: var(--text-secondary, #94a3b8);
}

.percentage {
  fill: currentColor;
  font-size: 10px;
  font-weight: 800;
  text-anchor: middle;
}

.health-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.health-text strong {
  color: var(--text-primary, #f8fafc);
  font-size: 12px;
}

.health-text span {
  color: var(--text-secondary, #94a3b8);
  font-size: 11px;
}

.action-buttons {
  align-items: center;
  display: flex;
  gap: 10px;
}

.btn {
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 14px;
}

.btn-primary {
  background: var(--accent-color, #3b82f6);
  border: 1px solid var(--accent-color, #3b82f6);
  color: #ffffff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #f8fafc);
}

.btn:hover,
.theme-btn:hover,
.selected-org:hover,
.fy-badge:hover {
  filter: brightness(1.08);
}

.advanced-connection,
.technical-context[hidden] {
  display: none !important;
}

.app.signed-out {
  display: block;
  min-height: 100vh;
}

.app.signed-out .erp-sidebar,
.app.signed-out .erp-topbar,
.app.signed-out #context-cards,
.app.signed-out #legacy-strip,
.app.signed-out #dashboard-preview,
.app.signed-out .technical-context {
  display: none !important;
}

.app.signed-out .main {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

/* Hide legacy dashboard styles - but keep new clean version visible */
.legacy-dashboard:not(.business-dashboard-clean) {
  display: none !important;
}

.app.signed-out .content {
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.08)),
    var(--bg-primary, #090c14) !important;
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
  width: 100%;
}

.app.signed-out #access-panel {
  max-width: 760px;
  width: min(760px, 100%);
}

.app.signed-in:not(.mandir-domain) #access-panel {
  display: none;
}

.app.signed-in:not(.mandir-domain) #context-cards {
  display: none;
}

.app.signed-in:not(.mandir-domain) .main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.app.signed-in:not(.mandir-domain) .content {
  min-width: 0;
  overflow-x: hidden;
  padding-bottom: 112px;
}

.app.signed-in:not(.mandir-domain) #legacy-strip {
  display: none;
}

.module-switch[hidden],
.mandir-login-links[hidden] {
  display: none !important;
}

.business-context-cards .card {
  min-height: 148px;
}

.business-context-cards h3 {
  margin-bottom: 10px;
}

.dashboard-command-card,
.ceo-insight-card {
  display: grid;
  gap: 16px;
}

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

.mini-kpi-row span {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 8px;
  color: var(--text-secondary, #94a3b8);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.mini-kpi-row strong {
  color: var(--text-primary, #f8fafc);
  font-size: 18px;
}

.business-dashboard {
  display: grid;
  gap: 18px;
}

.business-dashboard .preview-heading {
  align-items: start;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(var(--accent-rgb, 59, 130, 246), 0.22);
  border-radius: 8px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 18px;
}

.business-dashboard .preview-heading h3 {
  font-size: 24px;
  margin: 0 0 6px;
}

.business-dashboard .preview-heading p {
  max-width: 760px;
}

.business-kpi-grid {
  margin-top: -2px;
}

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

.erp-workbench-card {
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 188px;
  padding: 16px;
}

.erp-workbench-card h4 {
  color: var(--text-primary, #f8fafc);
  font-size: 17px;
  margin: 0;
}

.erp-workbench-card strong {
  color: var(--text-primary, #f8fafc);
  font-size: 30px;
  line-height: 1;
}

.erp-workbench-card p {
  color: var(--text-secondary, #94a3b8);
  margin: 0;
}

.erp-workbench-card button {
  align-self: end;
  justify-self: start;
}

.executive-dashboard {
  display: grid;
  gap: 16px;
}

.executive-hero,
.finance-chart-card,
.ceo-panel {
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
}

.executive-hero {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 0.96fr) minmax(360px, 1.04fr);
  padding: 18px;
}

.executive-hero h3 {
  color: var(--text-primary, #f8fafc);
  font-size: 24px;
  margin: 6px 0 8px;
}

.executive-hero p,
.ceo-panel p,
.finance-chart-card p {
  color: var(--text-secondary, #94a3b8);
  margin: 0;
  max-width: 58ch;
}

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

.executive-kpi-strip article {
  background: rgba(15, 23, 42, 0.54);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 14px;
}

.executive-kpi-strip span,
.executive-kpi-strip small {
  color: var(--text-secondary, #94a3b8);
}

.executive-kpi-strip strong {
  color: var(--text-primary, #f8fafc);
  font-size: 25px;
  line-height: 1.1;
}

.finance-dashboard-grid {
  display: grid;
  gap: 16px;
  align-items: start;
  grid-template-columns: minmax(460px, 1.3fr) minmax(320px, 0.7fr);
}

.finance-chart-card,
.ceo-panel {
  padding: 16px;
}

.finance-chart {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(6, minmax(44px, 1fr));
  min-height: 152px;
  padding: 18px 4px 6px;
}

.finance-bar-group {
  align-items: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.finance-bars {
  align-items: end;
  display: flex;
  gap: 7px;
  height: 104px;
}

.finance-bars span {
  border-radius: 999px 999px 4px 4px;
  display: block;
  width: 16px;
}

.income-bar {
  background: linear-gradient(180deg, #22c55e, #16a34a);
}

.expense-bar {
  background: linear-gradient(180deg, #38bdf8, #2563eb);
}

.finance-bar-group small,
.chart-legend {
  color: var(--text-secondary, #94a3b8);
}

.chart-legend {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

.chart-legend span {
  align-items: center;
  display: inline-flex;
  gap: 7px;
}

.chart-legend i {
  border-radius: 999px;
  display: inline-block;
  height: 9px;
  width: 9px;
}

.income-dot {
  background: #22c55e;
}

.expense-dot {
  background: #38bdf8;
}

.ceo-panel {
  background:
    radial-gradient(circle at 14% 10%, rgba(168, 85, 247, 0.16), transparent 28%),
    linear-gradient(135deg, rgba(18, 25, 47, 0.92), rgba(20, 24, 54, 0.82));
  overflow: hidden;
}

.ceo-title-block {
  column-gap: 10px;
  display: grid;
  grid-template-columns: auto auto 1fr;
  row-gap: 2px;
}

.ceo-title-block h4 {
  margin: 0;
}

.ceo-title-block p {
  grid-column: 1 / -1;
}

.ceo-orbit {
  align-self: center;
  border: 2px solid rgba(168, 85, 247, 0.7);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.45);
  height: 16px;
  position: relative;
  width: 16px;
}

.ceo-orbit::after {
  background: #c084fc;
  border-radius: 999px;
  content: "";
  height: 5px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 5px;
}

.ai-badge {
  align-self: center;
  background: rgba(126, 34, 206, 0.58);
  border: 1px solid rgba(168, 85, 247, 0.42);
  border-radius: 999px;
  color: #d8b4fe;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 10px;
  width: max-content;
}

.ceo-insight-list {
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-bottom: 16px;
}

.ceo-insight-row {
  align-items: start;
  color: var(--text-primary, #f8fafc);
  display: grid;
  gap: 10px;
  grid-template-columns: 14px minmax(0, 1fr);
  line-height: 1.45;
}

.ceo-insight-copy {
  display: grid;
  gap: 4px;
}

.ceo-insight-copy strong {
  color: var(--text-primary, #f8fafc);
  font-size: 18px;
  line-height: 1.25;
}

.ceo-insight-copy span {
  color: var(--text-secondary, #cbd5e1);
  font-size: 14px;
}

.insight-spark {
  align-self: start;
  height: 14px;
  margin-top: 4px;
  position: relative;
  width: 14px;
}

.insight-spark::before {
  background: #c084fc;
  clip-path: polygon(50% 0, 64% 36%, 100% 50%, 64% 64%, 50% 100%, 36% 64%, 0 50%, 36% 36%);
  content: "";
  display: block;
  height: 14px;
  width: 14px;
}

.ceo-ask-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  margin-top: 18px;
}

.ceo-ask-row input {
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  color: var(--text-primary, #f8fafc);
  min-height: 44px;
  min-width: 0;
  padding: 0 14px;
}

.ceo-ask-row input::placeholder {
  color: rgba(148, 163, 184, 0.72);
}

.ceo-ask-row button {
  background: #3b82f6;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 800;
  min-height: 44px;
  padding: 0 18px;
}

.ceo-footnote {
  color: var(--text-secondary, #94a3b8);
  font-size: 12px;
  margin-top: 12px;
}

/* ============================================
   DASHBOARD WIDGET CONTROLS (Phase 2C.2-2C.3)
   Collapsible and Customizable Widgets
   ============================================ */

.dashboard-widget {
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 16px;
  position: relative;
  transition: all 0.3s ease;
}

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

.widget-header h4 {
  color: var(--text-primary, #f8fafc);
  font-size: 18px;
  margin: 0;
  padding: 0;
}

.widget-header-controls {
  align-items: center;
  display: flex;
  gap: 8px;
}

.widget-collapse-btn {
  background: transparent;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  font-size: 16px;
  min-width: 36px;
  padding: 6px 8px;
  transition: all 0.2s ease;
}

.widget-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary, #94a3b8);
  color: var(--text-primary, #f8fafc);
}

.widget-content {
  max-height: 999px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

/* Collapsed state: hide content with smooth animation */
.dashboard-widget.collapsed .widget-content {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

/* Hidden widgets (Phase 2C.3) */
.dashboard-widget.hidden {
  display: none;
}

/* Grid wrapper for side-by-side widgets */
.finance-dashboard-grid-wrapper {
  display: grid;
  gap: 16px;
  align-items: start;
  grid-template-columns: minmax(460px, 1.3fr) minmax(320px, 0.7fr);
}

/* Responsive: Stack on smaller screens */
@media (max-width: 1024px) {
  .finance-dashboard-grid-wrapper {
    grid-template-columns: 1fr;
  }

  .widget-header {
    flex-wrap: wrap;
  }

  .widget-header h4 {
    flex: 1;
    min-width: 200px;
  }
}

.business-overview-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
}

.business-overview-main,
.business-overview-side {
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.business-overview-side {
  align-content: start;
}

.business-recent-table table td strong {
  color: var(--text-primary, #f8fafc);
  display: block;
  font-size: 13px;
}

.business-recent-table .row-subtext {
  color: var(--text-secondary, #94a3b8);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.business-quick-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.business-focus-list {
  grid-template-columns: 1fr;
}

.business-overview-footer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 0 2px;
}

.inline-summary {
  color: var(--text-secondary, #94a3b8);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
}

.inline-summary strong {
  color: var(--text-primary, #f8fafc);
  margin-right: 4px;
}

.workbench-kicker {
  color: var(--accent-color, #3b82f6);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-tile,
.dashboard-main-grid > article,
.verification-panel,
.erp-health-panel,
.accounting-drilldown-panel,
.trend-panel,
.table-preview,
.entry-panel {
  border-radius: 8px;
}

html[data-theme="light"] .erp-sidebar .brand-text h1,
html[data-theme="light"] .erp-sidebar .brand-text p,
html[data-theme="light"] .erp-sidebar .context-copy span,
html[data-theme="light"] .erp-sidebar .user-details strong,
html[data-theme="light"] .erp-sidebar .pwa-details strong {
  color: var(--text-primary, #0f172a);
}

html[data-theme="light"] .erp-sidebar .context-copy small,
html[data-theme="light"] .erp-sidebar .user-details span,
html[data-theme="light"] .erp-sidebar .pwa-details span,
html[data-theme="light"] .fy-selector {
  color: var(--text-secondary, #475569);
}

/* ============================================
   CLEAN BUSINESS DASHBOARD
   ============================================ */

.business-dashboard-clean {
  display: grid;
  gap: 24px;
  padding: 0;
  width: 100%;
  min-height: auto;
}

/* Executive Dashboard Section */
.business-dashboard-clean .executive-dashboard {
  gap: 20px;
}

.executive-dashboard .executive-hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.04));
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 12px;
}

.executive-hero h3 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary, #f8fafc);
}

.executive-hero p {
  display: none; /* Hide descriptive text */
}

.executive-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.executive-kpi-strip article {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--bg-secondary, #0f1424);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
}

.executive-kpi-strip span {
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.executive-kpi-strip strong {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-color, #3b82f6);
}

.executive-kpi-strip small {
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
}

/* Finance Dashboard Grid (Chart + CEO Insights) */
.finance-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1200px) {
  .finance-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.finance-chart-card {
  padding: 20px;
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.finance-chart-card h4 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary, #f8fafc);
}

.finance-chart-card p {
  display: none; /* Hide descriptive text */
}

.preview-heading.compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
  border: none;
}

.preview-heading.compact .pill {
  display: none; /* Hide diagnostic pills */
}

/* CEO Panel Refinements */
.ceo-panel {
  padding: 20px;
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ceo-panel h4 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary, #f8fafc);
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #86efac;
  padding: 4px 8px;
  border-radius: 4px;
  width: fit-content;
  margin-top: 4px;
}

.ceo-insight-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ceo-insight-row {
  display: flex;
  gap: 12px;
  padding: 12px 0;
}

.ceo-insight-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
}

.ceo-insight-copy strong {
  font-size: 14px;
  color: var(--accent-color, #3b82f6);
}

.ceo-insight-copy span {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  line-height: 1.4;
  word-break: break-word;
}

.ceo-footnote {
  display: none; /* Hide scaffolding footnote */
}

.ceo-ask-row {
  display: none; /* Hide AI input for now */
}

/* Quick Actions - Moved Below CEO Insights */
.business-quick-actions-clean {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  padding: 0;
  margin-bottom: 48px;
}

/* Bottom Metrics - Improved Visual Hierarchy */
.business-bottom-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  padding: 0;
  margin-bottom: 32px;
}

.metric-item {
  padding: 24px;
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s ease;
}

.metric-item:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.metric-card {
  padding: 20px;
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.3);
}

.metric-label {
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
  line-height: 1.2;
}

.metric-sub {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  font-weight: 400;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 16px;
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  color: var(--text-primary, #f8fafc);
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  min-height: 100px;
}

.quick-action-btn:hover {
  transform: translateY(-2px);
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--accent-color, #3b82f6);
}

.quick-icon {
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Recent Activity */
.business-recent-activity-clean {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--bg-card, rgba(18, 25, 47, 0.65));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
}

.business-recent-activity-clean h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-list li {
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  padding-left: 20px;
  position: relative;
}

.activity-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-color, #3b82f6);
  font-weight: bold;
}

/* Finance Chart */
.finance-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 12px;
  height: 200px;
  padding: 16px 0;
}

.finance-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.finance-bars {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 160px;
}

.finance-bars span {
  width: 20px;
  border-radius: 4px;
}

.income-bar {
  background: linear-gradient(180deg, #10b981, #059669);
}

.expense-bar {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
}

.finance-bar-group small {
  font-size: 11px;
  color: var(--text-secondary, #94a3b8);
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.income-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 2px;
}

.expense-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #3b82f6;
  border-radius: 2px;
}

/* Hide Executive Dashboard Section Headers */
.executive-hero .workbench-kicker {
  display: none;
}

.ceo-title-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ceo-orbit {
  display: none; /* Hide decorative orbit icon */
}

/* Insight Spark Styling */
.insight-spark {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent-color, #3b82f6);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

/* ============================================
   USER PROFILE & CREDENTIALS
   ============================================ */

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.user-credentials-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-right: 12px;
  border-right: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.credential-label {
  font-size: 11px;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.credential-email {
  font-size: 13px;
  color: var(--text-primary, #f8fafc);
  font-weight: 600;
  word-break: break-all;
  max-width: 200px;
  text-align: right;
}

.account-menu {
  position: relative;
}

.account-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  color: var(--text-primary, #f8fafc);
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 13px;
  font-weight: 600;
}

.account-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.account-menu-trigger[aria-expanded="true"] {
  background: var(--accent-color, #3b82f6);
  border-color: var(--accent-color, #3b82f6);
  color: #ffffff;
}

.topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-color, #3b82f6);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.account-menu-trigger[aria-expanded="true"] .topbar-avatar {
  background: rgba(255, 255, 255, 0.2);
}

.account-menu-trigger svg {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
}

.account-menu-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.account-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary, #0f1424);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  min-width: 220px;
  z-index: 100;
  padding: 12px 0;
}

.account-menu-panel[hidden] {
  display: none !important;
}

.menu-section {
  padding: 12px 16px;
}

.menu-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.menu-item-info:last-child {
  margin-bottom: 0;
}

.menu-label {
  font-size: 11px;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.menu-value {
  font-size: 13px;
  color: var(--text-primary, #f8fafc);
  word-break: break-all;
}

.menu-divider {
  height: 1px;
  background: var(--border-color, rgba(255, 255, 255, 0.08));
  margin: 8px 0;
}

.menu-action-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary, #f8fafc);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.25s ease;
}

.menu-action-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-color, #3b82f6);
}

.menu-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

/* Change Password Dialog */
#change-password-dialog {
  min-width: 400px;
}

#change-password-dialog .dialog-head {
  margin-bottom: 20px;
}

#change-password-dialog h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

#change-password-dialog .field {
  margin-bottom: 16px;
}

#change-password-dialog label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #f8fafc);
}

#change-password-dialog input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input, #12182e);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  color: var(--text-primary, #f8fafc);
  font-size: 13px;
  box-sizing: border-box;
}

#change-password-dialog input:focus {
  outline: none;
  border-color: var(--accent-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#change-password-dialog .dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.dialog-actions button {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  border: none;
}

.dialog-actions .secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #f8fafc);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.dialog-actions .secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

#change-password-submit {
  background: var(--accent-color, #3b82f6);
  color: #ffffff;
  border: 1px solid var(--accent-color, #3b82f6);
}

#change-password-submit:hover {
  background: #2563eb;
  border-color: #2563eb;
}

#password-error-field {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  padding: 12px;
}

/* ============================================
   LOGIN FORM ENHANCEMENTS
   ============================================ */

.password-field-wrapper {
  display: flex;
  gap: 0;
  position: relative;
  width: 100%;
}

.password-field-wrapper input {
  border-radius: 6px 0 0 6px !important;
  padding-right: 40px !important;
  width: 100%;
}

.toggle-password-btn {
  background: var(--bg-input, #12182e);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-left: none;
  border-radius: 0 6px 6px 0;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  position: relative;
  transition: all 0.25s ease;
  width: 44px;
  flex-shrink: 0;
}

.toggle-password-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary, #f8fafc);
}

.toggle-password-btn svg {
  height: 18px;
  width: 18px;
}

.toggle-password-btn[aria-pressed="true"] {
  color: var(--accent-color, #3b82f6);
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

#login-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

#login-form label {
  color: var(--text-primary, #f8fafc);
  font-size: 13px;
  font-weight: 600;
}

#login-form input[type="email"],
#login-form input[type="password"],
#login-form input[type="text"] {
  border-radius: 6px;
  font-size: 14px;
  padding: 10px 12px;
}

#login-form input:focus {
  outline: none;
}

#login-form button {
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  min-height: 42px;
  padding: 10px 16px;
  transition: all 0.25s ease;
}

#login-form button[type="submit"] {
  background: var(--accent-color, #3b82f6);
  border: 1px solid var(--accent-color, #3b82f6);
  color: #ffffff;
  width: 100%;
}

#login-form button[type="submit"]:hover:not(:disabled) {
  background: #2563eb;
  border-color: #2563eb;
  filter: brightness(1.08);
}

#login-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#login-form .secondary,
#login-form .danger {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #f8fafc);
  flex: 1;
}

#login-form .danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

#login-form .secondary:hover,
#login-form .danger:hover {
  filter: brightness(1.08);
}

#login-error-field {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  margin: 0 !important;
  padding: 12px;
}

#login-error-field[hidden] {
  display: none;
}

#login-error-message {
  color: #fca5a5 !important;
  font-size: 14px;
  margin: 0 !important;
}

@media (max-width: 980px) {
  .app {
    display: block;
  }

  .erp-sidebar {
    min-height: auto;
    position: static;
  }

  .erp-topbar,
  .topbar-control-strip,
  .action-buttons {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-control-strip {
    width: 100%;
  }

  .health-score-widget,
  .action-buttons .btn {
    width: 100%;
  }

  .erp-workbench-grid {
    grid-template-columns: 1fr;
  }

  .mini-kpi-row,
  .executive-hero,
  .executive-kpi-strip,
  .finance-dashboard-grid,
  .business-overview-grid,
  .business-quick-grid {
    grid-template-columns: 1fr;
  }

  .finance-chart {
    gap: 8px;
    grid-template-columns: repeat(3, minmax(52px, 1fr));
  }

  .business-overview-footer {
    align-items: stretch;
    flex-direction: column;
  }
}

/* ============================================
   ACCOUNT SELECTOR COMPONENT (SEARCHABLE)
   ============================================ */

.account-selector-component {
  position: relative;
  width: 100%;
}

.account-input-wrapper {
  position: relative;
  display: flex;
  gap: 4px;
}

.account-search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

html[data-theme="dark"] .account-search-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="light"] .account-search-input {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

.account-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel-2);
}

.account-id-input {
  display: none;
}

.account-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  list-style: none;
  margin: 4px 0 0 0;
  padding: 4px 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

html[data-theme="dark"] .account-suggestions {
  background: #1a2332;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

html[data-theme="light"] .account-suggestions {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.account-suggestions[hidden] {
  display: none;
}

.account-suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  transition: background-color 0.15s ease;
}

html[data-theme="dark"] .account-suggestion-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

html[data-theme="light"] .account-suggestion-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.account-suggestion-item strong {
  color: var(--accent);
  min-width: 60px;
  font-family: monospace;
  font-size: 12px;
}

.account-suggestion-item span {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-suggestion-item:hover span {
  color: var(--text);
}

/* ============================================
   VOUCHER LINE ITEMS LAYOUT
   ============================================ */

.voucher-line-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel-2);
}

.voucher-account-field {
  display: flex;
  flex-direction: column;
}

.voucher-amount-field {
  display: flex;
  flex-direction: column;
}

.voucher-action-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.voucher-account-field label,
.voucher-amount-field label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.voucher-line-grid input[type="number"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: monospace;
  text-align: right;
}

.voucher-line-grid input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel-2);
}

@media (max-width: 768px) {
  .voucher-line-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .voucher-action-field {
    justify-content: flex-start;
  }
}

@media (max-width: 1260px) {
  .ceo-insight-row {
    grid-template-columns: 14px minmax(0, 1fr);
  }

  .ceo-ask-row {
    grid-template-columns: 1fr;
  }
}
