/* Theme Variables - Enhanced Elegant Palette */
:root {
  --bg: #0a0e1a;
  --bg-gradient: linear-gradient(135deg, #0a0e1a 0%, #0f1625 100%);
  --panel: #111827;
  --panel-2: #1a2332;
  --panel-3: #242d3d;
  --border: #1f2937;
  --border-light: rgba(255, 255, 255, 0.08);
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --accent: #ef4444;
  --accent-2: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-lg: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --success: #10b981;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --warning: #f59e0b;
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --error: #ef4444;
  --error-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --glow: 0 0 20px rgba(59, 130, 246, 0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #f1f5f9;
  --border: #e2e8f0;
  --border-light: rgba(0, 0, 0, 0.06);
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --accent: #ef4444;
  --accent-2: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 25px 80px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.06);
  --success: #10b981;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --warning: #f59e0b;
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --error: #ef4444;
  --error-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

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

body {
  font-family: "Plus Jakarta Sans", "Space Grotesk", system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  font-weight: 400;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Global Navigation */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

:root[data-theme="light"] .top-nav {
  background: rgba(255, 255, 255, 0.8);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  transition: var(--transition);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent-gradient);
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm), var(--glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.nav-link {
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text-secondary);
  background: transparent;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  position: relative;
}

.nav-link.active {
  color: var(--text);
  border-color: var(--border-light);
  background: rgba(59, 130, 246, 0.15);
  box-shadow: var(--shadow-sm);
}

#current-user-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

#current-user-wrapper label {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

#current-user-select {
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  min-width: 180px;
  cursor: pointer;
  transition: var(--transition);
}

#current-user-select:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), var(--shadow-sm);
}

.theme-toggle {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--border-light);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

:root[data-theme="light"] .theme-toggle {
  background: rgba(43, 140, 254, 0.22);
  color: #0f274a;
  border-color: rgba(43, 140, 254, 0.35);
}

/* Accounting Sub-Navigation */
.sub-nav {
  display: flex;
  gap: 10px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  position: sticky;
  top: 72px;
  z-index: 99;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

:root[data-theme="light"] .sub-nav {
  background: rgba(255, 255, 255, 0.9);
}

.sub-nav-link {
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text-secondary);
  background: transparent;
  font-weight: 600;
  font-size: 14px;
}

.sub-nav-link.active {
  color: var(--text);
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--border-light);
}

/* Generic Sub-Navigation (for buttons) */
.subnav {
  display: flex;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 62px;
  z-index: 99;
  flex-wrap: wrap;
}

.subnav-button {
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}

.subnav-button:hover {
  border-color: var(--accent-2);
  background: rgba(43, 140, 254, 0.1);
}

.subnav-button.active {
  border-color: var(--accent-2);
  background: rgba(43, 140, 254, 0.2);
}

/* Page Tabs - Full-width tab bar (reuses sub-nav styling) */
.page-tabs {
  display: flex;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 62px;
  z-index: 99;
  flex-wrap: wrap;
}

.page-tab {
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}

.page-tab:hover {
  border-color: var(--accent-2);
  background: rgba(43, 140, 254, 0.1);
}

.page-tab.page-tab--active {
  border-color: var(--accent-2);
  background: rgba(43, 140, 254, 0.2);
}

/* Main Content */
.content {
  flex: 1;
  padding: 24px 32px 48px;
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn 0.5s ease;
}

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

.page-header {
  margin-bottom: 0;
}

.page-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--muted);
  font-size: 16px;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

/* Hero */
.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.06));
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 720px;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.hero-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.pill-live {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.35);
}

.pill-muted {
  background: rgba(255, 255, 255, 0.04);
}

.pill-soft {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
  color: #cbd5ff;
}

.hero-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text);
}

.btn.primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-sm);
}

.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Insights */
.insights-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
  margin: 10px 0 32px;
}

.dashboard-section-wide {
  grid-column: 1 / -1;
}

.chart-card {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
}

.bar-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  border-radius: 10px 10px 6px 6px;
  background: var(--accent-gradient);
  position: relative;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.bar:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.bar-tooltip {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translate(-50%, -4px);
  background: var(--panel-2);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.bar-label {
  font-size: 12px;
  color: var(--muted);
}

.chart-stats {
  display: grid;
  gap: 14px;
}

.stat-block {
  background: var(--panel-2);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
}

.stat-hint {
  color: var(--muted);
  font-size: 12px;
}

.progress-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-labels {
  display: flex;
  flex-direction: column;
  min-width: 80px;
}

.progress-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm) inset;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-gradient);
  transition: width 0.4s ease;
}

.progress-value {
  min-width: 60px;
  text-align: right;
  color: var(--text-secondary);
  font-weight: 700;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.mini-stat {
  background: var(--panel-2);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex: 1;
}

/* Keep hero KPI cards consistent widths and prevent label wrapping */
.hero-actions .mini-stat {
  flex: 1 1 260px;
  min-width: 260px;
}

.mini-label {
  color: var(--muted);
  font-size: 13px;
}

.mini-value {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent-2);
}

.split-bar {
  position: relative;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm) inset;
  margin: 16px 0;
}

.split-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  transition: width 0.4s ease;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.ops-chip {
  background: var(--panel-2);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.section-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

  .chart-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .page-hero {
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .mini-stat {
    flex: 1 1 100%;
  }
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0.6;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.metric-header .metric-icon {
  display: none;
}

.metric-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.metric-badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(43, 140, 254, 0.16);
  color: #c9dcff;
  border: 1px solid rgba(43, 140, 254, 0.3);
}

.metric-badge.success {
  background: rgba(34, 197, 94, 0.16);
  color: #9cf1e7;
  border-color: rgba(34, 197, 94, 0.35);
}

.metric-badge.warning {
  background: rgba(250, 204, 21, 0.16);
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.3);
}

.metric-value {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent-2);
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
  background-clip: initial;
  line-height: 1.2;
}

.metric-card-success .metric-value,
.metric-card-warning .metric-value,
.metric-card-alert .metric-value {
  color: var(--accent-2);
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
  background-clip: initial;
}

.metric-detail {
  font-size: 13px;
  color: var(--muted);
}

.metric-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 8px 0;
}

.metric-split-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-split-label {
  font-size: 13px;
  color: var(--muted);
}

.metric-split-value {
  font-size: 28px;
  font-weight: 700;
}

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

.metric-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.metric-list-item:last-child {
  border-bottom: none;
}

.metric-list-label {
  font-size: 14px;
  color: var(--muted);
}

.metric-list-value {
  font-size: 16px;
  font-weight: 600;
}

.metric-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
}

.metric-breakdown-item span:first-child {
  font-weight: 600;
}

.metric-breakdown-item span:last-child {
  color: var(--muted);
}

/* Content Sections */
.content-section {
  margin-top: 32px;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 18px;
}

.activity-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.activity-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

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

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.activity-item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.activity-item-title {
  font-weight: 600;
  font-size: 14px;
}

.activity-item-desc {
  font-size: 13px;
  color: var(--muted);
}

.activity-item-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  margin-left: 12px;
}

.activity-item.alert-warning {
  border-color: rgba(250, 204, 21, 0.3);
  background: rgba(250, 204, 21, 0.08);
}

.activity-item.alert-info {
  border-color: rgba(43, 140, 254, 0.3);
  background: rgba(43, 140, 254, 0.08);
}

/* Placeholder Page Styles */
.placeholder-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow);
}

.placeholder-content h2 {
  font-size: 28px;
  margin-bottom: 12px;
}

.placeholder-content p {
  color: var(--muted);
  font-size: 16px;
}

/* Accounting Section Styles */
.accounting-section {
  display: block;
}

.accounting-section[style*="display: none"] {
  display: none !important;
}

/* Chart of Accounts Styles */
.coa-controls {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.coa-controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.coa-search-wrapper {
  flex: 1;
  min-width: 200px;
}

.coa-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

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

.coa-filter-wrapper {
  min-width: 150px;
}

.coa-filter-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.coa-filter-select:focus {
  outline: none;
  border-color: var(--accent-2);
}

.coa-count-wrapper {
  margin-top: 8px;
}

.coa-count {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.coa-table-wrapper {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.coa-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.coa-table thead {
  border-bottom: 2px solid var(--border);
}

.coa-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.coa-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}

.coa-table tbody tr:hover {
  background: var(--panel-2);
}

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

/* Ledger pivot table styles */
.ledger-account-row {
  background: var(--panel-2);
  font-weight: 600;
}

.ledger-account-row:hover {
  background: var(--panel-3);
}

.ledger-period-row {
  background: var(--panel);
  border-left: 3px solid var(--border);
}

.ledger-period-row:hover {
  background: var(--panel-2);
}

.ledger-detail-row {
  background: var(--panel);
  border-left: 3px solid var(--border);
}

.ledger-detail-row:hover {
  background: var(--panel-2);
}

.ledger-caret {
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.ledger-caret:hover {
  color: var(--text);
}

.status-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}

.status-badge.active {
  background: rgba(34, 197, 94, 0.16);
  color: #9cf1e7;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.status-badge.inactive {
  background: rgba(156, 163, 175, 0.16);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.35);
}

.status-badge.warn {
  background: rgba(250, 204, 21, 0.16);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.3);
}

:root[data-theme="light"] .status-badge.active {
  background: rgba(17, 168, 139, 0.16);
  color: #0c5043;
  border-color: rgba(17, 168, 139, 0.38);
}

:root[data-theme="light"] .status-badge.inactive {
  background: rgba(156, 163, 175, 0.18);
  color: #4b5563;
  border-color: rgba(156, 163, 175, 0.35);
}

.btn-small {
  padding: 6px 10px;
  border: 1px solid var(--accent-2);
  border-radius: 8px;
  background: var(--accent-2);
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  margin: 0 2px;
  transition: all 0.2s ease;
}

.btn-small:hover {
  background: #1a7fe8;
  border-color: #1a7fe8;
  color: #ffffff;
}

.btn-small.btn-delete:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.text-center {
  text-align: center;
}

.coa-form {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.coa-form-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

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

.coa-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.coa-form-field-full {
  grid-column: 1 / -1;
}

.coa-form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.coa-form-field input,
.coa-form-field select,
.coa-form-field textarea {
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
}

.coa-form-field input:focus,
.coa-form-field select:focus,
.coa-form-field textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), var(--shadow-sm);
}

.coa-form-field input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.coa-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-direction: row !important;
}

.coa-checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.coa-form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn {
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}

.btn-refresh {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid var(--success);
  color: var(--success);
  box-shadow: none;
}

.btn-refresh:hover {
  background: rgba(16, 185, 129, 0.26);
  border-color: #059669;
  color: #059669;
}

.btn-refresh-compact {
  padding: 8px 14px;
  height: auto;
  min-height: unset;
  max-height: unset;
  font-size: 13px;
  border-radius: 10px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
}

.btn-primary:hover {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
}

/* Ensure all buttons maintain consistent height, especially in flex containers */
button.btn,
a.btn {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
}

/* Ensure buttons with flex: 1 maintain height */
[style*="flex: 1"].btn {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  align-self: stretch;
}

/* Journal Modal Styles */
.journal-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.journal-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
}

.journal-modal-content {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1001;
  animation: slideUp 0.3s ease;
}

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

.journal-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.journal-modal-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.journal-modal-close:hover {
  background: var(--panel-2);
}

#journal-entry-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.journal-form-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.journal-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.journal-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.journal-form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.journal-form-field input,
.journal-form-field textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.journal-form-field input:focus,
.journal-form-field textarea:focus {
  outline: none;
  border-color: var(--accent-2);
}

.journal-lines-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.journal-lines-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.journal-lines-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.journal-lines-table-wrapper {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
}

.journal-lines-table {
  width: 100%;
  border-collapse: collapse;
}

.journal-lines-table thead {
  background: var(--panel);
  border-bottom: 2px solid var(--border);
}

.journal-lines-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.journal-lines-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

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

.journal-account-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.journal-account-select:focus {
  outline: none;
  border-color: var(--accent-2);
}

.journal-debit-input,
.journal-credit-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  text-align: right;
}

.journal-debit-input:focus,
.journal-credit-input:focus {
  outline: none;
  border-color: var(--accent-2);
}

.journal-totals {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  padding: 16px;
  background: var(--panel-2);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.journal-total-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.journal-total-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.journal-total-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.journal-balance-status {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}

.journal-balance-status.balanced {
  background: rgba(34, 197, 94, 0.16);
  color: #9cf1e7;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.journal-balance-status.unbalanced {
  background: rgba(250, 204, 21, 0.16);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.journal-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-small {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-small:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.btn-small.btn-delete:hover {
  background: var(--accent);
  border-color: var(--accent);
}

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

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .coa-controls-row {
    flex-direction: column;
  }

  .coa-search-wrapper,
  .coa-filter-wrapper {
    width: 100%;
  }

  .coa-table-wrapper {
    padding: 12px;
  }

  .coa-table {
    font-size: 13px;
  }

  .coa-table th,
  .coa-table td {
    padding: 8px 12px;
  }

  .coa-form-grid {
    grid-template-columns: 1fr;
  }

  .journal-modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .journal-form-row {
    grid-template-columns: 1fr;
  }

  .journal-totals {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .journal-lines-table {
    font-size: 13px;
  }

  .journal-lines-table th,
  .journal-lines-table td {
    padding: 8px 12px;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .top-nav {
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    margin-top: 8px;
  }

  .sub-nav {
    top: auto;
    position: relative;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .activity-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 18px;
  }
}

/* Balance Sheet Styles */
.bs-container {
  max-width: 1200px;
  margin: 0 auto;
}

.bs-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  margin-bottom: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.bs-summary-bar strong {
  color: var(--muted);
  font-weight: 600;
  margin-right: 8px;
}

.bs-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

@media (max-width: 968px) {
  .bs-columns {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.bs-column {
  display: flex;
  flex-direction: column;
}

.bs-column-title {
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 700;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
  color: var(--text);
}

.bs-section {
  margin-bottom: 32px;
}

.bs-section-title {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
}

.bs-account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  padding-left: 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.bs-account-amount {
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.bs-negative-balance {
  color: var(--error, #f87171);
}

.bs-section-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  margin-top: 12px;
  background: var(--panel-2);
  border-radius: 6px;
  border: 1px solid var(--border);
  font-weight: 700;
}

.bs-section-total-amount {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bs-column-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  margin-top: 24px;
  border-top: 3px solid var(--border);
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.bs-column-total-amount {
  text-align: right;
  font-weight: 700;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.bs-equity-section {
  margin-top: 48px;
}

.bs-total {
  font-weight: 700;
}

/* Light theme adjustments */
:root[data-theme="light"] .bs-negative-balance {
  color: #dc2626;
}

:root[data-theme="light"] .bs-section-total {
  background: var(--panel-2);
}

/* Settings Page Styles */
.settings-page .page-header {
  margin-top: 0;
  margin-bottom: 0;
}

.settings-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.settings-section {
  margin-bottom: 2rem;
}

.settings-section-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: var(--text);
}

.settings-card {
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  overflow: visible;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.settings-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  min-width: 80px;
}

.settings-row input[type="date"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.settings-row input[type="date"]:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--panel);
}

.prices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.price-table-card {
  background-color: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  overflow: visible;
}

.price-table-card .price-table {
  overflow: visible;
}

.price-table-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.price-table {
  width: 100%;
  border-collapse: collapse;
}

.price-table th,
.price-table td {
  padding: 0.35rem 0.25rem;
}

.price-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
}

.price-table td {
  font-size: 0.85rem;
  color: var(--text);
}

.price-input {
  max-width: 120px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

.settings-actions {
  margin-top: 1.5rem;
  margin-bottom: 0;
}

.settings-history-table th {
  white-space: nowrap; /* Ensure header stays on one line */
}

.settings-history-table td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.settings-history-table td:last-child {
  white-space: nowrap;
  text-align: center;
}

.settings-history-table .btn-small {
  margin: 0 4px;
  padding: 4px 8px;
  font-size: 14px;
}

/* Sell New Cylinder Layout */
.sell-top-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(260px, 1fr);
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.sell-top-left,
.sell-top-right {
  min-width: 0;
}

@media (max-width: 900px) {
  .sell-top-layout {
    grid-template-columns: 1fr;
  }
}

.sell-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sell-card h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.sell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.sell-col {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.sell-card label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.sell-card input,
.sell-card select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.sell-card input:focus,
.sell-card select:focus {
  outline: none;
  border-color: var(--accent-2);
}

.sell-card input[readonly] {
  background: var(--panel-3);
  color: var(--muted);
}

.sell-actions-row {
  display: flex;
  justify-content: flex-end;
}

.sell-field-with-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.invoice-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.invoice-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.invoice-value {
  font-size: 0.95rem;
  font-weight: 600;
}

.invoice-total {
  font-size: 1.25rem;
  font-weight: 700;
}

.sell-filters-card {
  margin-bottom: 1.5rem;
}

.sell-history-card {
  width: 100%;
}

.sell-filters-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sell-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sell-filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.sell-filter-group input,
.sell-filter-group select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.sell-filter-group input:focus,
.sell-filter-group select:focus {
  outline: none;
  border-color: var(--accent-2);
}

.sell-history-sidebar {
  display: flex;
  flex-direction: column;
}

.snapshot-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.snapshot-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.snapshot-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.snapshot-breakdown h4 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.snapshot-breakdown ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.snapshot-breakdown li {
  font-size: 0.85rem;
  padding: 0.25rem 0;
  color: var(--text);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 0.75rem;
  text-align: left;
}

.history-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.history-table td {
  font-size: 0.875rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.history-table tbody tr:hover {
  background-color: var(--panel-2);
}

/* Settings Form Styles */
.settings-form {
  margin-bottom: 1.5rem;
}

.settings-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.settings-form-col {
  display: flex;
  flex-direction: column;
}

.settings-form-col label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.settings-form-col input,
.settings-form-col select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.settings-form-col input:focus,
.settings-form-col select:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--panel);
}

.settings-form-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.75rem;
}

.btn-secondary {
  background: #ffffff;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
}

.btn-secondary:hover {
  background: rgba(43, 140, 254, 0.1);
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.settings-panel {
  width: 100%;
}

.ops-panel {
  width: 100%;
}

.hidden {
  display: none;
}

/* Operations Page Styles */
.ops-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.ops-btn {
  min-width: 180px;
}

.ops-section {
  margin-top: 1rem;
}

.hidden {
  display: none;
}

.ops-form-container {
  max-width: 1000px;
}

.ops-form-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.ops-purchase-summary {
  margin-top: 24px;
}

/* Customer Suggestions Dropdown */
.customer-suggestions {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
}

.customer-suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  transition: background-color 0.15s ease;
}

.customer-suggestion-item:last-child {
  border-bottom: none;
}

.customer-suggestion-item:hover {
  background-color: var(--panel-2);
}

.customer-suggestion-item:active {
  background-color: var(--accent-2);
  color: white;
}

/* HR Module Styles */
.hr-panel {
  animation: fadeIn 0.3s ease;
}

.hr-panel.hidden {
  display: none;
}

/* Form Section Headers */
.form-section-header {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-2);
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.form-section-header:first-child {
  margin-top: 0;
}

.required {
  color: var(--error);
  margin-left: 2px;
}

/* Employee Photo Upload */
.employee-photo-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.employee-photo-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.employee-photo-section > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .employee-photo-section > div {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.employee-photo-preview {
  width: 150px;
  height: 150px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.employee-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 14px;
}

.employee-photo-placeholder span:first-child {
  font-size: 48px;
  opacity: 0.5;
}

.employee-photo-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

/* Badge Styles */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-warning {
  background: rgba(250, 204, 21, 0.2);
  color: var(--warning);
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.badge-error {
  background: rgba(248, 113, 113, 0.2);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.badge-muted {
  background: rgba(159, 176, 200, 0.2);
  color: var(--muted);
  border: 1px solid rgba(159, 176, 200, 0.3);
}

/* Employee Table Photo Column */
#employee-table td:first-child {
  text-align: center;
  vertical-align: middle;
}

/* Children Table in Employee Form */
#employee-children-table {
  margin-top: 0.5rem;
}

#employee-children-table input[type="text"],
#employee-children-table input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  width: 100%;
}

#employee-children-table input[type="text"]:focus,
#employee-children-table input[type="date"]:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--panel);
}

#employee-children-table input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: var(--accent-2);
}

/* Family Information Section Styling */
.family-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  transition: all 0.3s ease;
}

.family-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.family-section-deceased {
  opacity: 0.5;
  background: var(--panel);
}

.family-section-deceased input:not([type="checkbox"]) {
  background: var(--panel-3) !important;
  color: var(--muted) !important;
  cursor: not-allowed !important;
}

.family-section-deceased .family-section-header {
  opacity: 0.6;
}

.family-section-deceased .family-section-header input[type="checkbox"] {
  cursor: pointer !important;
  pointer-events: auto !important;
}

#employee-spouse-deceased,
#employee-father-deceased,
#employee-mother-deceased {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-2);
}

/* Leave Calendar Styles */
.leave-view {
  animation: fadeIn 0.3s ease;
}

.leave-view.hidden {
  display: none;
}

/* Payroll Views */
.payroll-view {
  animation: fadeIn 0.3s ease;
}

.payroll-view.hidden {
  display: none;
}

/* Payslip Styles */
.payslip-container {
  margin-top: 1.5rem;
}

.payslip-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.payslip-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}

.payslip {
  background: white;
  color: #333;
  padding: 30px;
  max-width: 800px;
  margin: 0 auto;
}

.payslip-header {
  text-align: center;
  border-bottom: 3px solid #333;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.payslip-header h1 {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 5px;
  letter-spacing: 2px;
  color: #333;
}

.payslip-company {
  font-size: 14px;
  color: #666;
  text-transform: uppercase;
}

.payslip-info {
  margin-bottom: 25px;
}

.payslip-info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 5px 0;
  border-bottom: 1px dotted #ddd;
}

.payslip-info-col {
  flex: 1;
}

.payslip-section {
  margin-bottom: 25px;
}

.payslip-section h2 {
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 2px solid #333;
  color: #333;
}

.payslip-table {
  width: 100%;
  border-collapse: collapse;
}

.payslip-table td {
  padding: 8px 5px;
  border-bottom: 1px solid #eee;
  color: #333;
}

.payslip-table td:first-child {
  padding-left: 0;
}

.payslip-table td:last-child {
  padding-right: 0;
}

.payslip-table .text-right {
  text-align: right;
}

.payslip-total {
  border-top: 2px solid #333;
  border-bottom: 2px solid #333;
  font-weight: bold;
}

.payslip-total td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.payslip-net {
  background-color: #f5f5f5;
  font-size: 14px;
}

.payslip-takehome {
  background-color: #e8f4f8;
  font-size: 16px;
  font-weight: bold;
}

.payslip-takehome td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.payslip-notes {
  padding: 10px;
  background-color: #f9f9f9;
  border-left: 3px solid #333;
  margin-top: 10px;
  color: #333;
}

.payslip-footer {
  margin-top: 30px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
  text-align: center;
  font-size: 10px;
  color: #666;
}

.payslip-footer p {
  margin: 3px 0;
}

@media print {
  .payslip-actions {
    display: none;
  }
  
  .payslip-content {
    border: none;
    background: white;
  }
  
  .payslip {
    border: none;
    padding: 20px;
  }
}

/* Payroll Report Styles */
.payroll-report-container {
  margin-top: 1.5rem;
}

.report-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.payroll-report-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  overflow-x: auto;
}

.payroll-report {
  background: white;
  color: #333;
  padding: 30px;
  min-width: 1200px;
  margin: 0 auto;
}

.report-header {
  text-align: center;
  border-bottom: 3px solid #333;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.report-header h1 {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 5px;
  letter-spacing: 1px;
  color: #333;
}

.report-period {
  font-size: 14px;
  font-weight: 600;
  margin-top: 5px;
  color: #333;
}

.report-date {
  font-size: 11px;
  color: #666;
  margin-top: 3px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 9px;
}

.report-table thead {
  background-color: #333;
  color: white;
}

.report-table th {
  padding: 8px 5px;
  text-align: left;
  font-weight: bold;
  border: 1px solid #555;
}

.report-table tbody td {
  padding: 6px 5px;
  border: 1px solid #ddd;
  color: #333;
}

.report-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.report-table tbody tr:hover {
  background-color: #f0f0f0;
}

.report-total-row {
  background-color: #e8f4f8 !important;
  border-top: 3px solid #333;
  border-bottom: 3px solid #333;
}

.report-total-row td {
  padding: 10px 8px !important;
  border: 1px solid #333;
  font-weight: bold;
}

.report-summary {
  margin: 25px 0;
  clear: both;
}

.report-summary-section {
  width: 50%;
  float: left;
}

.report-summary-section h3 {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 10px;
  text-transform: uppercase;
  border-bottom: 2px solid #333;
  padding-bottom: 5px;
  color: #333;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
}

.summary-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #eee;
  color: #333;
}

.report-signatures {
  clear: both;
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  margin-bottom: 20px;
}

.signature-section {
  width: 30%;
  text-align: center;
}

.signature-line {
  border-top: 1px solid #333;
  margin-bottom: 5px;
  height: 50px;
}

.signature-label {
  font-weight: 600;
  font-size: 10px;
  margin-bottom: 3px;
  color: #333;
}

.signature-name {
  height: 20px;
  margin-bottom: 3px;
}

.signature-date {
  font-size: 9px;
  color: #666;
}

.report-footer {
  margin-top: 30px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
  text-align: center;
  font-size: 9px;
  color: #666;
  clear: both;
}

.report-footer p {
  margin: 3px 0;
}

@media print {
  .report-actions {
    display: none;
  }
  
  .payroll-report-content {
    border: none;
    background: white;
  }
  
  .payroll-report {
    border: none;
    padding: 20px;
    min-width: auto;
  }
}

.leave-calendar-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
}

.leave-calendar-table thead th {
  background: var(--panel-2);
  padding: 12px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--border);
}

.leave-calendar-table tbody td {
  border: 1px solid var(--border);
  padding: 8px;
  vertical-align: top;
  min-height: 100px;
  height: 120px;
  width: 14.28%; /* 100% / 7 days */
}

.calendar-day-empty {
  background: var(--panel-3);
  opacity: 0.3;
}

.calendar-day {
  background: var(--panel-2);
  position: relative;
}

.calendar-day-today {
  background: rgba(43, 140, 254, 0.1);
  border: 2px solid var(--accent-2) !important;
}

.calendar-day-number {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
}

.calendar-leave-item {
  margin-bottom: 4px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  border-left: 3px solid;
}

.calendar-leave-item:hover {
  opacity: 0.8;
}

.calendar-leave-success {
  background: rgba(34, 197, 94, 0.2);
  border-left-color: var(--success);
  color: var(--text);
}

.calendar-leave-warning {
  background: rgba(250, 204, 21, 0.2);
  border-left-color: var(--warning);
  color: var(--text);
}

.calendar-leave-muted {
  background: rgba(159, 176, 200, 0.2);
  border-left-color: var(--muted);
  color: var(--muted);
}

.calendar-leave-overlap {
  background: rgba(248, 113, 113, 0.3) !important;
  border-left-color: var(--error) !important;
  font-weight: 600;
}

.calendar-leave-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.calendar-leave-type {
  font-size: 10px;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive adjustments for employee form */
@media (max-width: 768px) {
  .employee-photo-container {
    flex-direction: column;
    align-items: center;
  }

  .employee-photo-actions {
    flex-direction: row;
    width: 100%;
    justify-content: center;
  }

  .leave-calendar-table tbody td {
    height: 80px;
    padding: 4px;
  }

  .calendar-leave-item {
    font-size: 10px;
    padding: 2px 4px;
  }

  .calendar-leave-name {
    font-size: 10px;
  }

  .calendar-leave-type {
    font-size: 9px;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  max-width: 90%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
}

/* Template Editor Styles */
#template-editor-section textarea {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
}

#template-variables {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: var(--accent-2);
}

.form-section-header {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.form-section-header:first-of-type {
  margin-top: 0;
}

#template-preview-content {
  background: var(--panel-2);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  min-height: 400px;
}

#template-preview-content iframe {
  background: white;
  color: #333;
  display: block;
  width: 100%;
}

/* Enhanced Dashboard Styles */
.metric-icon {
  font-size: 28px;
  opacity: 0.8;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.metric-card-primary::before {
  background: var(--accent-gradient);
}

.metric-card-success::before {
  background: var(--success-gradient);
}

.metric-card-warning::before {
  background: var(--warning-gradient);
}

.metric-card-alert::before {
  background: var(--error-gradient);
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 24px;
  margin-top: 32px;
  align-items: start;
}

.dashboard-section-full {
  grid-row: 1 / -1;
}

@media (max-width: 1024px) {
  .dashboard-main-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  
  .dashboard-section-full {
    grid-row: auto;
  }
}

.dashboard-section {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.dashboard-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
  opacity: 0.6;
}

.dashboard-section-priority::before {
  background: var(--error-gradient);
  opacity: 1;
}

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

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.section-badge {
  background: var(--error-gradient);
  color: white;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  min-width: 36px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.05);
  }
}

.section-content {
  max-height: 600px;
  overflow-y: auto;
}

.section-content-fixed {
  max-height: 600px;
  overflow-y: auto;
}

.section-content-expand {
  min-height: 600px;
  max-height: calc(100vh - 400px);
  overflow-y: auto;
}

/* Pending Approvals */
.pending-approvals-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pending-item {
  background: var(--panel-2);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.pending-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--warning-gradient);
  opacity: 0.8;
}

.pending-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pending-item-type {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
}

.pending-icon {
  font-size: 20px;
}

.pending-badge {
  background: rgba(250, 204, 21, 0.2);
  color: var(--warning);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.pending-item-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.pending-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.pending-label {
  color: var(--muted);
}

.pending-value {
  font-weight: 600;
  color: var(--text);
}

.pending-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.btn-approve {
  background: var(--success-gradient);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.btn-reject {
  background: var(--error-gradient);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* Recent Activity */
.recent-activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--panel-2);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  position: relative;
}

.activity-item::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-gradient);
  opacity: 0.6;
  border-radius: 14px 0 0 14px;
}

.activity-item-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.activity-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.activity-item-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.status-badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

.status-badge.approved {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge.pending {
  background: rgba(250, 204, 21, 0.2);
  color: var(--warning);
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.status-badge.rejected {
  background: rgba(248, 113, 113, 0.2);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.status-badge.status-success {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge.status-warning {
  background: rgba(250, 204, 21, 0.2);
  color: var(--warning);
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.status-badge.status-error {
  background: rgba(248, 113, 113, 0.2);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.status-badge.status-info {
  background: rgba(43, 140, 254, 0.2);
  color: var(--accent-2);
  border: 1px solid rgba(43, 140, 254, 0.3);
}

.status-badge.status-accent {
  background: rgba(43, 140, 254, 0.2);
  color: var(--accent-2);
  border: 1px solid rgba(43, 140, 254, 0.3);
}

.status-badge.status-muted {
  background: rgba(159, 176, 200, 0.2);
  color: var(--muted);
  border: 1px solid rgba(159, 176, 200, 0.3);
}

.activity-item-details {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.activity-item-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-link:hover {
  background: rgba(43, 140, 254, 0.1);
}

/* Role Badges */
.role-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.role-badge-error {
  background: rgba(248, 113, 113, 0.16);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.role-badge-warning {
  background: rgba(250, 204, 21, 0.16);
  color: var(--warning);
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.role-badge-primary {
  background: rgba(43, 140, 254, 0.16);
  color: var(--accent-2);
  border: 1px solid rgba(43, 140, 254, 0.3);
}

.role-badge-muted {
  background: rgba(159, 176, 200, 0.16);
  color: var(--muted);
  border: 1px solid rgba(159, 176, 200, 0.3);
}

/* Read-only indicator */
.nav-link.access-restricted {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.nav-link.access-restricted:hover {
  opacity: 0.8;
  border-color: var(--warning);
}

.page-tab.access-restricted {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.page-tab.access-restricted:hover {
  opacity: 0.8;
  border-color: var(--warning);
}

.nav-link.read-only::after {
  content: " (R/O)";
  font-size: 10px;
  opacity: 0.7;
}

/* Accounting Summary Board */
.summary-board {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.summary-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.summary-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

.summary-narrative {
  margin-bottom: 1.5rem;
  line-height: 1.8;
  color: var(--text);
  font-size: 14px;
}

.summary-narrative p {
  margin: 0;
}

.summary-visuals {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.summary-visual-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-visual-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-visual-bar {
  position: relative;
  width: 100%;
  height: 40px;
  background: var(--panel-2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.summary-visual-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
}

.summary-visual-value {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  z-index: 1;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.summary-list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.summary-list-rank {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-2);
  color: white;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.summary-list-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-list-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.summary-list-code {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.summary-list-bar {
  width: 100%;
  height: 6px;
  background: var(--panel);
  border-radius: 3px;
  overflow: hidden;
}

.summary-list-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.summary-list-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  min-width: 120px;
  text-align: right;
}

.summary-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 14px;
}

.summary-balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.summary-balance-item {
  padding: 1rem;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
}

.summary-balance-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.summary-balance-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.summary-balance-count {
  font-size: 11px;
  color: var(--muted);
}

/* Two-column layout responsive */
@media (max-width: 968px) {
  .summary-board > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  
  .summary-section {
    padding: 1rem;
  }
}

/* Reports Tabs */
.reports-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.report-tab {
  background: none;
  border: none;
  padding: 12px 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.report-tab:hover {
  color: var(--text);
  background: rgba(43, 140, 254, 0.05);
}

.report-tab.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

.report-panel {
  display: none;
}

.report-panel.active {
  display: block;
}

/* Report Results */
.report-summary {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.report-summary h3 {
  margin-bottom: 1rem;
  font-size: 18px;
  color: var(--text);
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.report-summary-item {
  padding: 1rem;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.report-summary-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-summary-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* Document Library Grid Styles */
.document-category-section {
  margin-bottom: 3rem;
}

.document-category-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-light);
  text-transform: capitalize;
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.document-card {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative;
  display: flex;
  flex-direction: column;
}

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

.document-thumbnail {
  width: 100%;
  height: 200px;
  background: var(--panel-2);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.document-thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.document-thumbnail-icon {
  font-size: 64px;
  opacity: 0.6;
}

.document-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.document-card:hover .document-overlay {
  opacity: 1;
}

.document-action-btn {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.document-action-btn:hover {
  background: white;
  transform: scale(1.1);
}

.document-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.document-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.document-version {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-2);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
}

.document-date {
  color: var(--muted);
}

.document-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-filename {
  font-size: 11px;
  color: var(--muted);
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .document-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
  }
  
  .document-thumbnail {
    height: 160px;
  }
}

/* Templates Grid Styles */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.template-card {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition);
}

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

.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.template-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.template-card-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.template-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.template-card-actions .btn-small {
  padding: 6px 10px;
  min-height: 32px;
}

.template-badges {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}
/* Cash Flow Statement Styles */
.cfs-container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.cfs-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.cfs-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.cfs-period {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cfs-section {
  margin-bottom: 2rem;
}

.cfs-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.cfs-line {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cfs-line.indent {
  padding-left: 1.5rem;
}

.cfs-line.cfs-total {
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  padding: 0.75rem 0;
  margin-top: 0.5rem;
  font-weight: 600;
}

.cfs-line.cfs-final {
  border-top: 3px solid var(--accent-2);
  margin-top: 1rem;
  padding-top: 1rem;
}

.cfs-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 150px;
  color: var(--text);
}

.cfs-amount.negative {
  color: var(--error);
}

.cfs-subsection {
  margin: 0.5rem 0;
}

.cfs-subtitle {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin: 0.75rem 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Performance Summary Cards */
.performance-card {
  padding: 1rem;
  background: var(--panel-2);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.performance-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0.8;
}

.performance-card-success::before {
  background: var(--success-gradient);
}

.performance-card-warning::before {
  background: var(--warning-gradient);
}

.performance-card-error::before {
  background: var(--error-gradient);
}

.performance-card-primary::before {
  background: var(--accent-gradient);
}

