:root {
  --dark: #030712;
  --dark2: #111827;
  --dark3: #0a1120;
  --lime: #A3E635;
  --lime-dim: rgba(163, 230, 53, 0.08);
  --white: #F3F4F6;
  --gray: #6B7280;
  --gray-dark: #374151;
  --gray-light: #9CA3AF;
  --separator: #1F2937;
  --blue: #60A5FA;
  --red: #F87171;
  --radius: 8px;
  --radius-lg: 12px;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --sidebar-width: 220px;
  --sidebar-collapsed: 56px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 20px rgba(163, 230, 53, 0.15);
  --mono: 'JetBrains Mono', Consolas, Monaco, 'Courier New', monospace;
  --orange: #F59E0B;
  --yellow: #FBBF24;
  --green: #22C55E;
}

/* Screen reader only — visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

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

/* Custom scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray); }
* { scrollbar-width: thin; scrollbar-color: var(--gray-dark) transparent; }

/* Focus-visible for keyboard accessibility */
:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--mono);
  background: var(--dark);
  color: var(--white);
  display: flex;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--dark2);
  border-right: 1px solid var(--separator);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease;
  height: 100vh;
  position: relative;
  z-index: 50;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  border-bottom: 1px solid var(--separator);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(163, 230, 53, 0.04) 0%, transparent 100%);
  transition: background 0.2s;
}

.sidebar-brand:hover {
  background: linear-gradient(180deg, rgba(163, 230, 53, 0.08) 0%, rgba(163, 230, 53, 0.02) 100%);
}

.sidebar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.sidebar-title {
  font-size: 0.8rem;
  font-weight: 500;
  transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-title { opacity: 0; width: 0; }

.sidebar-toggle {
  position: absolute;
  top: 0.75rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--gray);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0.2rem;
  z-index: 2;
  transition: color 0.2s;
}

.sidebar-toggle:hover { color: var(--lime); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.sidebar-section {
  margin-bottom: 0.5rem;
}

.sidebar-section-label {
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gray-dark);
  padding: 0.5rem 1rem 0.25rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-section-label {
  font-size: 0;
  padding: 0.25rem 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
  font-size: 0.7rem;
  color: var(--gray-light);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  border-left: 2px solid transparent;
}

.sidebar-item:hover {
  color: var(--white);
  background: rgba(163, 230, 53, 0.04);
  border-left-color: rgba(163, 230, 53, 0.3);
}

.sidebar-item.active {
  color: var(--lime);
  background: rgba(163, 230, 53, 0.08);
  border-left-color: var(--lime);
  font-weight: 600;
}

.sidebar-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.sidebar-label {
  transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-label { opacity: 0; width: 0; }
.sidebar.collapsed .sidebar-item { padding: 0.5rem; justify-content: center; }

/* ============ APP MAIN ============ */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Page Header (contextual per route) */
.page-header {
  background: var(--dark2);
  border-bottom: 1px solid var(--separator);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 46px;
}

.page-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Page Content */
.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Editor Layout (replaces old .app-layout) */
.editor-layout {
  display: grid;
  grid-template-columns: 520px 1fr;
  height: 100%;
}

/* ============ MOBILE BOTTOM NAV ============ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--dark2);
  border-top: 1px solid var(--separator);
  z-index: 100;
  padding: 0.25rem 0;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.3rem 0;
  color: var(--gray);
  text-decoration: none;
  font-size: 0.55rem;
  transition: color 0.15s;
  flex: 1;
}

.mobile-nav-item:hover {
  color: var(--white);
}

.mobile-nav-item.active {
  color: var(--lime);
}

.mobile-nav-icon {
  font-size: 1rem;
}

.mobile-nav-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============ PLACEHOLDER VIEWS ============ */
.placeholder-view {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  animation: pageSlideIn 0.3s ease-out;
}

.placeholder-message {
  text-align: center;
  color: var(--gray);
}

.placeholder-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.placeholder-message h2 {
  font-size: 1rem;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.placeholder-message p {
  font-size: 0.75rem;
}

/* ============ PROJECTS ============ */
.projects-page,
.project-detail-page {
  padding: var(--space-lg);
  animation: pageSlideIn 0.3s ease-out;
}

.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
  flex-wrap: wrap;
}

.projects-filters {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  flex: 1;
}

.projects-filters .form-input,
.projects-filters .form-select {
  max-width: 200px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.project-card {
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

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

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.project-card-name {
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--white);
  line-height: 1.3;
}

.project-card-client {
  font-size: 0.7rem;
  color: var(--gray);
  margin-bottom: var(--space-sm);
}

.project-card-desc {
  font-size: 0.7rem;
  color: var(--gray-light);
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

.project-card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.project-card-budget {
  font-size: 0.7rem;
  color: var(--lime);
}

.project-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.project-type-badge {
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: bold;
  flex-shrink: 0;
}

.type-client { background: rgba(96, 165, 250, 0.15); color: var(--blue); }
.type-personal { background: rgba(163, 230, 53, 0.15); color: var(--lime); }
.type-internal { background: rgba(248, 113, 113, 0.15); color: var(--red); }

.project-status-badge {
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.status-active { background: rgba(163, 230, 53, 0.15); color: var(--lime); }
.status-paused { background: rgba(251, 191, 36, 0.15); color: #FBBF24; }
.status-completed { background: rgba(96, 165, 250, 0.15); color: var(--blue); }
.status-archived { background: rgba(107, 114, 128, 0.15); color: var(--gray); }

.project-tag {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--separator);
  color: var(--gray-light);
}

/* Project detail */
.project-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-md);
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
}

.project-detail-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.project-detail-name {
  font-size: 1rem;
  color: var(--white);
}

.project-detail-client {
  font-size: 0.75rem;
  color: var(--gray);
  margin-top: 4px;
}

.project-detail-desc {
  font-size: 0.75rem;
  color: var(--gray-light);
  margin-top: 6px;
  line-height: 1.4;
}

.project-detail-tags {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.project-detail-folder {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 4px;
}
.project-detail-folder code {
  color: var(--blue);
  font-size: 0.75rem;
}
.folder-icon {
  font-size: 0.8rem;
}

.project-detail-repo {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 4px;
}
.project-detail-repo a {
  color: var(--lime);
  text-decoration: none;
  font-size: 0.75rem;
}
.project-detail-repo a:hover {
  text-decoration: underline;
}
.repo-icon {
  font-size: 0.8rem;
}

.project-detail-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.project-stats {
  margin-bottom: var(--space-lg);
}

.budget-bar {
  width: 100%;
  height: 4px;
  background: var(--separator);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.budget-bar-fill {
  height: 100%;
  background: var(--lime);
  border-radius: 2px;
  transition: width 0.3s;
}

/* Project tabs */
.project-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--separator);
  margin-bottom: var(--space-md);
}

.project-tab {
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.project-tab:hover { color: var(--white); border-bottom-color: rgba(163, 230, 53, 0.3); }
.project-tab.active { color: var(--lime); border-bottom-color: var(--lime); }

.project-tab-content {
  min-height: 200px;
  animation: tabFadeIn 0.25s ease-out;
}
@keyframes tabFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Discovery tab */
.discovery-tab {
  padding: var(--space-sm) 0;
}
.discovery-start-card {
  background: var(--dark2);
  border: 2px dashed var(--lime);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
}
.discovery-section {
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}
.discovery-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.discovery-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lime);
}
.stakeholder-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.stakeholder-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s;
}

.stakeholder-card:hover {
  border-color: var(--gray-dark);
  transform: translateY(-1px);
}
.stakeholder-name {
  font-weight: 700;
  font-size: 0.85rem;
}
.stakeholder-role {
  font-size: 0.7rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stakeholder-email {
  font-size: 0.75rem;
  color: var(--blue);
}
.stakeholder-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.stakeholder-status {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 3px;
}
.sh-status-pending { color: var(--gray); background: rgba(107, 114, 128, 0.15); }
.sh-status-active { color: var(--lime); background: rgba(163, 230, 53, 0.15); }
.sh-status-completed { color: var(--blue); background: rgba(96, 165, 250, 0.15); }

/* === Estimate Review Modal === */
.modal.estimate-review-modal {
  max-width: 750px;
  width: 95vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.estimate-review-modal .modal-title { padding: 1.25rem 1.5rem 0; margin-bottom: 0.75rem; }
.estimate-review-modal .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.5rem;
  scrollbar-width: none;
}
.estimate-review-modal .modal-body:hover { scrollbar-width: thin; scrollbar-color: rgba(163,230,53,0.3) transparent; }
.estimate-review-modal .modal-body::-webkit-scrollbar { width: 0; }
.estimate-review-modal .modal-body:hover::-webkit-scrollbar { width: 6px; }
.estimate-review-modal .modal-body::-webkit-scrollbar-track { background: transparent; }
.estimate-review-modal .modal-body::-webkit-scrollbar-thumb { background: rgba(163,230,53,0.3); border-radius: 3px; }
.estimate-review-modal .modal-body::-webkit-scrollbar-thumb:hover { background: rgba(163,230,53,0.5); }
.estimate-review-modal .modal-actions { padding: 1rem 1.5rem; margin-top: 0; border-top: 1px solid var(--separator); }
.estimate-summary {
  color: var(--gray);
  font-size: 0.8rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(163, 230, 53, 0.05);
  border-left: 2px solid var(--lime);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.estimate-items-header {
  display: grid;
  grid-template-columns: 28px 1fr 70px 80px 90px;
  gap: 8px;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--separator);
  font-size: 0.7rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.est-phase-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lime);
  padding: 0.75rem 0 0.25rem;
  border-bottom: 1px solid rgba(163, 230, 53, 0.15);
  margin-top: 0.5rem;
}
.est-item-row {
  display: grid;
  grid-template-columns: 28px 1fr 70px 80px 90px;
  gap: 8px;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.5);
}
.est-item-row:hover { background: rgba(163, 230, 53, 0.03); }
.est-item-title { font-size: 0.8rem; color: var(--white); }
.est-item-desc { font-size: 0.7rem; color: var(--gray); margin-top: 2px; }
.est-col-check { display: flex; align-items: center; justify-content: center; }
.est-col-total { text-align: right; font-size: 0.8rem; color: var(--white); }
.est-item-row .form-input {
  padding: 4px 6px;
  font-size: 0.8rem;
  text-align: right;
  width: 100%;
}
.estimate-controls { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--separator); }
.estimate-subtotal { text-align: right; display: flex; align-items: center; gap: 0.75rem; }

/* Hours mode segmented toggle */
.hours-mode-group {
  display: inline-flex;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  overflow: hidden;
}
.hours-mode-btn {
  padding: 4px 12px;
  font-size: 0.7rem;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--gray);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.hours-mode-btn:not(:last-child) { border-right: 1px solid var(--separator); }
.hours-mode-btn:hover { background: rgba(163, 230, 53, 0.1); color: var(--white); }
.hours-mode-btn.active { background: var(--lime); color: var(--dark); font-weight: 700; }

/* Hour range hint under qty inputs */
.est-hrs-range {
  font-size: 0.6rem;
  color: var(--gray);
  text-align: right;
  margin-top: 1px;
  line-height: 1;
}

/* Options modal (pre-estimate) */
.modal.estimate-options-modal {
  max-width: 400px;
  width: 90vw;
}
.est-mode-hint {
  font-size: 0.7rem;
  color: var(--gray);
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* === Estimate View Modal === */
/* Estimate View Modal styles moved after base .modal for cascade specificity */

.btn-tiny {
  padding: 2px 8px;
  font-size: 0.65rem;
}

/* Project modal — color picker */
.color-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--white); }

.project-modal {
  max-width: 540px;
}

/* Form Column */
.form-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--separator);
}

.form-panel {
  overflow-y: auto;
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background:
    linear-gradient(var(--dark2) 30%, transparent) center top,
    linear-gradient(transparent, var(--dark2) 70%) center bottom,
    linear-gradient(rgba(0,0,0,0.35), transparent 30%) center top,
    linear-gradient(transparent 70%, rgba(0,0,0,0.35)) center bottom;
  background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--separator);
  background: linear-gradient(180deg, var(--dark2) 0%, var(--dark3) 100%);
  flex-shrink: 0;
}

.form-section {
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 1.1rem;
  background: rgba(255,255,255,0.01);
}

.form-section-title {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  opacity: 0.85;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(163, 230, 53, 0.06);
}

.form-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.form-label {
  font-size: 0.6rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.form-input, .form-select, .form-textarea {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
  color: var(--white);
  font-family: inherit;
  font-size: 0.75rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 2px rgba(163, 230, 53, 0.1);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--gray);
  opacity: 0.7;
}

textarea.form-input,
.form-textarea {
  resize: vertical;
  min-height: 40px;
}

.form-select {
  cursor: pointer;
}

/* Line Items */
.line-item {
  background: var(--dark3);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.7rem;
  margin-bottom: 0.5rem;
  position: relative;
  transition: border-color 0.2s;
}

@keyframes lineItemRemove {
  to { opacity: 0; transform: translateX(20px); height: 0; padding: 0; margin: 0; overflow: hidden; }
}
.line-item.removing {
  animation: lineItemRemove 0.25s ease-in forwards;
  pointer-events: none;
}
.line-item:focus-within {
  border-color: var(--gray-dark);
}

.line-item-header {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.line-item-numbers {
  display: flex;
  gap: 0.5rem;
}

.line-item-amount {
  font-size: 0.7rem;
  color: var(--lime);
  text-align: right;
  margin-top: 0.3rem;
}

.line-item-actions {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: flex;
  gap: 0.2rem;
  z-index: 2;
}

.remove-item, .dup-item {
  background: none;
  border: none;
  color: var(--gray-dark);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  padding: 0 0.3rem;
  transition: color 0.2s;
}

.remove-item:hover { color: #EF4444; }
.dup-item:hover { color: var(--lime); }

/* Line item templates */
.li-templates {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.li-template-btn {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: 3px;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.55rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  transition: all 0.15s;
}

.li-template-btn:hover {
  color: var(--lime);
  border-color: var(--lime);
}

/* Suggestion dropdown */
.suggestion-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: 4px;
  max-height: 150px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.suggestion-dropdown.show { display: block; }

.suggestion-item {
  padding: 0.4rem 0.6rem;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  transition: background 0.1s;
}

.suggestion-item:hover {
  background: rgba(163, 230, 53, 0.08);
}

.suggestion-item .rate {
  color: var(--lime);
  font-size: 0.65rem;
}

/* Totals Display */
.totals {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--separator);
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.total-row.grand {
  font-weight: 700;
  color: var(--lime);
  font-size: 0.85rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--separator);
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  letter-spacing: 0.01em;
}

.btn-lime {
  background: var(--lime);
  color: var(--dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn-lime:hover {
  box-shadow: var(--shadow-glow), 0 2px 8px rgba(0,0,0,0.3);
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-lime:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-outline {
  background: transparent;
  color: var(--gray-light);
  border: 1px solid var(--separator);
}

.btn-outline:hover {
  color: var(--lime);
  border-color: var(--lime);
  background: rgba(163, 230, 53, 0.04);
}

.btn-small {
  font-size: 0.65rem;
  padding: 0.3rem 0.6rem;
}

.btn-danger {
  background: transparent;
  color: var(--gray);
  border: 1px solid var(--separator);
}

.btn-danger:hover {
  color: #EF4444;
  border-color: #EF4444;
}

/* Preview Panel */
.preview-panel {
  overflow: auto;
  padding: 2rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0d0d1a 100%);
}

.preview-frame {
  background: white;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  max-width: 100%;
  border-radius: 2px;
}

.preview-frame img {
  display: block;
  width: 612px;
  max-width: 100%;
  height: auto;
}

.preview-empty {
  color: var(--gray-dark);
  font-size: 0.8rem;
  text-align: center;
  padding: 2rem;
}

/* Discount toggle */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.toggle-label {
  font-size: 0.65rem;
  color: var(--gray);
  cursor: pointer;
}

input[type="checkbox"] {
  accent-color: var(--lime);
}

/* Invoice history dropdown */
.history-select {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.65rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.history-select:hover {
  border-color: var(--gray-dark);
}

.history-select:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 2px rgba(163, 230, 53, 0.1);
}

.history-search {
  width: 110px;
  font-size: 0.65rem;
  padding: 0.3rem 0.5rem;
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: 4px;
}

/* Save spinner */
.btn-lime:focus-visible {
  outline: 2px solid var(--dark);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(163, 230, 53, 0.4);
}

.btn-outline:focus-visible, .btn-danger:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.modal-close-x:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 1px;
}

.btn-lime:disabled {
  opacity: 0.5;
  cursor: wait;
  filter: grayscale(0.3);
  pointer-events: none;
}
.btn-outline:disabled, .btn-danger:disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.5);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--dark);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.3rem;
}

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

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

.view-enter {
  animation: viewFadeIn 0.3s ease-out;
}

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

/* Validation error */
.form-input.error {
  border-color: #EF4444;
}

.validation-msg {
  color: #EF4444;
  font-size: 0.65rem;
  margin-top: 0.25rem;
  display: none;
}

.validation-msg.show { display: block; }

/* Discount type toggle */
.discount-type-toggle {
  display: flex;
  border: 1px solid var(--separator);
  border-radius: 4px;
  overflow: hidden;
}

.discount-type-btn {
  flex: 1;
  background: var(--dark);
  border: none;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.65rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.discount-type-btn:hover {
  background: rgba(163, 230, 53, 0.1);
  color: var(--white);
}

.discount-type-btn.active {
  background: var(--lime);
  color: var(--dark);
  font-weight: 700;
}

/* History actions */
.history-actions {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.btn-icon {
  background: none;
  border: 1px solid var(--separator);
  border-radius: 4px;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: var(--lime);
  border-color: var(--lime);
}

.btn-icon.danger:hover {
  color: #EF4444;
  border-color: #EF4444;
}

/* Edit mode indicator */
.edit-badge {
  background: var(--lime);
  color: var(--dark);
  font-size: 0.55rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.5rem;
  display: none;
}

.edit-badge.show { display: inline-block; }

/* Status select */
.status-select {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.status-select:focus {
  box-shadow: 0 0 0 2px rgba(163, 230, 53, 0.1);
}

.status-select.status-draft { color: var(--gray-light); border-color: var(--gray-dark); }
.status-select.status-sent { color: #60A5FA; border-color: #3B82F6; }
.status-select.status-paid { color: var(--lime); border-color: var(--lime); }
.status-select.status-overdue { color: #F87171; border-color: #EF4444; }

/* ============ TOAST ============ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--white);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: auto;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { border-left: 3px solid var(--lime); }
.toast-error { border-left: 3px solid #EF4444; }
.toast-info { border-left: 3px solid #60A5FA; }
.toast-warning { border-left: 3px solid #F59E0B; }

/* Undo toast */
.toast-undo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast-undo-btn {
  background: none;
  border: 1px solid var(--lime);
  border-radius: 3px;
  color: var(--lime);
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
}

.toast-undo-btn:hover {
  background: var(--lime);
  color: var(--dark);
}

/* Toast action button (used by post-save toasts) */
.toast-action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast-action-btn {
  background: none;
  border: 1px solid var(--lime);
  border-radius: 3px;
  color: var(--lime);
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.toast-action-btn:hover {
  background: var(--lime);
  color: var(--dark);
}

/* Toast progress bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--lime);
  border-radius: 0 0 var(--radius) var(--radius);
  animation: toastCountdown linear forwards;
  opacity: 0.5;
}
.toast-error .toast-progress { background: #EF4444; }
.toast-warning .toast-progress { background: #F59E0B; }
.toast-info .toast-progress { background: #60A5FA; }

@keyframes toastCountdown {
  from { width: 100%; }
  to { width: 0%; }
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s;
}

.modal-overlay.show { opacity: 1; }

.modal {
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  background:
    var(--dark2),
    linear-gradient(var(--dark2) 30%, transparent) center top,
    linear-gradient(transparent, var(--dark2) 70%) center bottom,
    linear-gradient(rgba(0,0,0,0.4), transparent 30%) center top,
    linear-gradient(transparent 70%, rgba(0,0,0,0.4)) center bottom;
  background-size: 100%, 100% 40px, 100% 40px, 100% 14px, 100% 14px;
  background-repeat: no-repeat;
  background-attachment: scroll, local, local, scroll, scroll;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-close-x {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--gray);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  z-index: 1;
  font-family: inherit;
}
.modal-close-x:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}

.modal-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.modal-body {
  font-size: 0.75rem;
  color: var(--gray-light);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* === Estimate View Modal (after base .modal for cascade) === */
.modal.estimate-view-modal {
  max-width: 1200px;
  width: 96vw;
  max-height: 96vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.estimate-view-modal .modal-title {
  padding: 1.25rem 1.5rem 0;
  margin-bottom: 0.75rem;
}
.estimate-view-modal .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.75rem;
  scrollbar-width: none;
}
.estimate-view-modal .modal-body:hover { scrollbar-width: thin; scrollbar-color: rgba(163,230,53,0.3) transparent; }
.estimate-view-modal .modal-body::-webkit-scrollbar { width: 0; }
.estimate-view-modal .modal-body:hover::-webkit-scrollbar { width: 6px; }
.estimate-view-modal .modal-body::-webkit-scrollbar-track { background: transparent; }
.estimate-view-modal .modal-body::-webkit-scrollbar-thumb { background: rgba(163,230,53,0.3); border-radius: 3px; }
.estimate-view-modal .modal-body::-webkit-scrollbar-thumb:hover { background: rgba(163,230,53,0.5); }
.estimate-view-modal .modal-actions {
  padding: 1rem 1.5rem;
  margin-top: 0;
  border-top: 1px solid var(--separator);
}
.estimate-preview-frame { background: white; border-radius: var(--radius); }
.estimate-preview-frame svg { display: block; width: 100%; height: auto; }

/* Email draft modal */
.email-draft {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.email-draft-label {
  font-size: 0.6rem;
  color: var(--gray);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.email-draft-content {
  font-size: 0.75rem;
  color: var(--white);
  white-space: pre-wrap;
  line-height: 1.5;
}

.email-no-recipient {
  padding: 0.5rem 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid #F59E0B;
  border-radius: 4px;
  color: #F59E0B;
  font-size: 0.7rem;
  margin-bottom: 0.75rem;
}

/* ============ CLIENT LEDGER ============ */
.ledger-modal {
  max-width: 620px;
}

.ledger-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ledger-stat {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.65rem;
  text-align: center;
}

.ledger-stat-label {
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  margin-bottom: 0.2rem;
}

.ledger-stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--white);
}

.ledger-stat-value.lime { color: var(--lime); }
.ledger-stat-value.red { color: var(--red); }

.ledger-contact {
  font-size: 0.7rem;
  color: var(--gray-light);
  margin-bottom: 0.75rem;
}

.ledger-section-title {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  margin-top: 0.75rem;
}

.ledger-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.5rem;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}

.ledger-table th {
  text-align: left;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--separator);
}

.ledger-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--separator);
  color: var(--gray-light);
}

.ledger-table td.amount {
  color: var(--white);
  font-weight: 600;
}

.ledger-actions {
  white-space: nowrap;
  text-align: right;
}

.ledger-payments {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.5rem;
}

.ledger-payment-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
  background: var(--dark);
  border-radius: 3px;
}

.ledger-pay-date {
  color: var(--gray);
  min-width: 75px;
}

.ledger-pay-inv {
  color: var(--gray-light);
  min-width: 90px;
}

.ledger-pay-method {
  color: var(--gray-light);
  min-width: 50px;
}

.ledger-pay-ref {
  color: var(--gray);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-pay-amount {
  color: var(--lime);
  font-weight: 600;
  min-width: 70px;
  text-align: right;
}

.clickable-client {
  cursor: pointer;
  transition: color 0.15s;
}

.clickable-client:hover {
  color: var(--lime);
}

/* ============ PAYMENT MODAL ============ */
.payment-summary {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.payment-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.75rem;
  color: var(--gray-light);
}

.payment-summary-row.payment-balance {
  border-top: 1px solid var(--separator);
  margin-top: 0.3rem;
  padding-top: 0.5rem;
  font-weight: 700;
  color: var(--white);
  font-size: 0.85rem;
}

.payment-history {
  margin-bottom: 1rem;
}

.payment-history-title {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  margin-bottom: 0.4rem;
}

.payment-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  color: var(--gray-light);
  background: var(--dark);
  border-radius: 3px;
  margin-bottom: 0.2rem;
}

.payment-history-row span:last-child {
  font-weight: 600;
  color: var(--lime);
}

.payment-form .form-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.payment-form .form-group {
  display: flex;
  flex-direction: column;
}

.payment-form .form-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray);
  margin-bottom: 0.25rem;
}

.payment-form .form-input,
.payment-form .form-select {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  color: var(--white);
  font-family: inherit;
  font-size: 0.75rem;
  outline: none;
}

.payment-form .form-input:focus,
.payment-form .form-select:focus {
  border-color: var(--lime);
}

/* Payment analytics card */
.dash-payment-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.dash-payment-stat {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
}

.dash-payment-stat-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 0.3rem;
}

.dash-payment-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
}

.dash-payment-methods {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.dash-payment-method-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
}

.dash-payment-method-name {
  min-width: 60px;
  color: var(--gray-light);
}

.dash-payment-method-bar {
  flex: 1;
  height: 6px;
  background: var(--separator);
  border-radius: 3px;
  overflow: hidden;
}

.dash-payment-method-fill {
  height: 100%;
  background: var(--lime);
  border-radius: 3px;
}

.dash-payment-method-count {
  min-width: 30px;
  text-align: right;
  color: var(--gray-light);
  font-size: 0.65rem;
}

/* ============ DASHBOARD ============ */
.dashboard-view {
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Needs Attention panel */
#dashAttention {
  display: none;
  margin-bottom: 1rem;
}

.attn-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.attn-header-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange, #F59E0B);
}

.attn-count {
  background: var(--orange, #F59E0B);
  color: var(--dark);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
}

.attn-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.attn-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: var(--dark2);
  border-left: 3px solid var(--separator);
  transition: background 0.2s;
}

.attn-card:hover {
  background: rgba(17, 24, 39, 0.8);
}

.attn-overdue { border-left-color: var(--red, #EF4444); }
.attn-draft { border-left-color: var(--gray); }
.attn-rebill { border-left-color: var(--orange, #F59E0B); }
.attn-comingdue { border-left-color: var(--blue, #60A5FA); }

.attn-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.attn-overdue .attn-icon { background: rgba(239, 68, 68, 0.15); color: var(--red, #EF4444); }
.attn-draft .attn-icon { background: rgba(107, 114, 128, 0.15); color: var(--gray); }
.attn-rebill .attn-icon { background: rgba(245, 158, 11, 0.15); color: var(--orange, #F59E0B); }
.attn-comingdue .attn-icon { background: rgba(96, 165, 250, 0.15); color: var(--blue, #60A5FA); }

.attn-body {
  flex: 1;
  min-width: 0;
}

.attn-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--white);
}

.attn-detail {
  font-size: 0.65rem;
  color: var(--gray);
  margin-top: 0.1rem;
}

.attn-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Stat cards */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.dash-stat-card {
  background: linear-gradient(160deg, var(--dark2) 0%, var(--dark3) 100%);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
}

.dash-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--gray-dark);
}

.dash-stat-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  margin-bottom: 0.5rem;
}

.dash-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
}

.dash-stat-value.lime { color: var(--lime); }
.dash-stat-value.red { color: #F87171; }
.dash-stat-value.blue { color: #60A5FA; }

.dash-stat-clickable {
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dash-stat-clickable:hover {
  border-color: var(--lime);
  background: rgba(163, 230, 53, 0.04);
}

.dash-stat-sub {
  font-size: 0.6rem;
  color: var(--gray);
  margin-top: 0.2rem;
}

/* Sections */
.dash-section {
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
}

.dash-section-title {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
  opacity: 0.85;
}

/* Dashboard grid for side-by-side sections */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Status breakdown bars */
.dash-status-bars {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dash-status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-badge {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem 0.15rem 0.4rem;
  border-radius: 3px;
  min-width: 60px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.status-draft { background: rgba(55, 65, 81, 0.6); color: var(--gray-light); }
.status-badge.status-draft::before { background: var(--gray-light); opacity: 0.5; }
.status-badge.status-sent { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.status-badge.status-sent::before { background: #60A5FA; }
.status-badge.status-paid { background: rgba(163, 230, 53, 0.12); color: var(--lime); }
.status-badge.status-paid::before { background: var(--lime); }
.status-badge.status-overdue { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.status-badge.status-overdue::before { background: #F87171; animation: overduePulse 2s ease-in-out infinite; }

@keyframes overduePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Revenue by client bars */
.dash-client-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dash-client-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
}

.dash-client-name {
  min-width: 100px;
  color: var(--gray-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-client-bar-track {
  flex: 1;
  height: 8px;
  background: var(--separator);
  border-radius: 4px;
  overflow: hidden;
}

.dash-client-bar-fill {
  height: 100%;
  background: var(--lime);
  border-radius: 4px;
  transition: width 0.3s;
}

.dash-client-amount {
  min-width: 80px;
  text-align: right;
  color: var(--white);
  font-weight: 600;
}

/* Monthly revenue trend */
.dash-empty {
  font-size: 0.7rem;
  color: var(--gray);
  text-align: center;
  padding: 1.5rem 1rem;
  border: 1px dashed var(--separator);
  border-radius: var(--radius);
  background: rgba(163, 230, 53, 0.02);
}
.dash-empty::before {
  content: '—';
  display: block;
  font-size: 1.2rem;
  opacity: 0.3;
  margin-bottom: 0.35rem;
  color: var(--lime);
}

.dash-trend {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
}

.dash-trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.dash-trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
}

.dash-trend-bar {
  width: 100%;
  background: var(--lime);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  position: relative;
  transition: height 0.3s;
  cursor: default;
}

.dash-trend-bar:hover {
  opacity: 0.8;
}

.dash-trend-bar .trend-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  border: 1px solid var(--separator);
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  font-size: 0.6rem;
  white-space: nowrap;
  color: var(--white);
  z-index: 10;
}

.dash-trend-bar:hover .trend-tooltip {
  display: block;
}

.dash-trend-labels {
  display: flex;
  gap: 4px;
  margin-top: 0.3rem;
}

.dash-trend-label {
  flex: 1;
  text-align: center;
  font-size: 0.5rem;
  color: var(--gray);
}

/* Aging report */
.dash-aging {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.dash-aging-bucket {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.8rem;
  text-align: center;
}

.dash-aging-clickable {
  cursor: pointer;
  transition: border 0.2s;
  border: 1px solid transparent;
}

.dash-aging-clickable:hover {
  border-color: var(--lime);
  box-shadow: 0 0 0 1px rgba(163, 230, 53, 0.1);
}

.dash-aging-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 0.3rem;
}

.dash-aging-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
}

.dash-aging-count {
  font-size: 0.6rem;
  color: var(--gray);
}

.dash-aging-bucket.overdue .dash-aging-amount {
  color: #F87171;
}

/* Section header with filters */
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dash-section-header .dash-section-title {
  margin-bottom: 0;
}

.dash-filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.dash-search {
  width: 200px;
  font-size: 0.7rem;
  padding: 0.35rem 0.6rem;
}

.dash-status-filter, .dash-date-filter {
  font-size: 0.7rem;
  padding: 0.35rem 0.6rem;
  width: auto;
}

.dash-date-filter {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.dash-date-filter .form-input {
  width: 130px;
  font-size: 0.7rem;
  padding: 0.35rem 0.5rem;
}

.dash-date-sep {
  color: var(--gray);
  font-size: 0.7rem;
}

.dash-bar-track {
  flex: 1;
  height: 6px;
  background: var(--separator);
  border-radius: 3px;
  overflow: hidden;
}

.dash-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.dash-bar-draft { background: var(--gray-dark); }
.dash-bar-sent { background: #3B82F6; }
.dash-bar-paid { background: var(--lime); }
.dash-bar-overdue { background: #EF4444; }

.dash-bar-count {
  font-size: 0.7rem;
  color: var(--gray-light);
  min-width: 20px;
  text-align: right;
}

/* Invoices table */
.dash-table-wrap {
  overflow-x: auto;
}

.dash-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.dash-table th {
  text-align: left;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--separator);
}

.dash-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(31, 41, 55, 0.5);
  color: var(--gray-light);
}

.dash-table td.amount {
  color: var(--white);
  font-weight: 600;
}

.dash-row {
  cursor: pointer;
  transition: background 0.2s;
}

.dash-row:hover {
  background: rgba(163, 230, 53, 0.05);
  box-shadow: inset 2px 0 0 var(--lime);
}

.dash-row:hover td {
  color: var(--white);
}

.dash-row:active {
  background: rgba(163, 230, 53, 0.08);
}

.clickable-cell {
  cursor: pointer;
}

/* Clickable client name underline */
.clickable-cell:hover {
  text-decoration: underline;
  text-decoration-color: var(--lime);
  text-underline-offset: 2px;
  color: var(--white);
}

/* Quick action buttons */
.qa-cell {
  white-space: nowrap;
  text-align: right;
}

.qa-btn {
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--separator);
  border-radius: 4px;
  background: transparent;
  color: var(--gray);
  font-family: var(--mono);
  font-size: 0.7rem;
  cursor: pointer;
  margin-left: 0.25rem;
  transition: all 0.15s;
}

.qa-btn:hover {
  color: var(--white);
  border-color: var(--gray);
}

.qa-paid:hover {
  color: var(--lime);
  border-color: var(--lime);
  background: rgba(163, 230, 53, 0.1);
}

.qa-send:hover {
  color: var(--blue, #60A5FA);
  border-color: var(--blue, #60A5FA);
  background: rgba(96, 165, 250, 0.1);
}

.qa-reinvoice:hover {
  color: var(--orange, #F59E0B);
  border-color: var(--orange, #F59E0B);
  background: rgba(245, 158, 11, 0.1);
}

/* Bulk select */
.dash-table .bulk-check {
  width: 20px;
}

.bulk-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0;
}

.bulk-actions .bulk-count {
  font-size: 0.7rem;
  color: var(--lime);
}

/* Keyboard shortcuts */
.shortcuts-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1rem;
}

.shortcut-key {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: 3px;
  padding: 0.15rem 0.4rem;
  font-size: 0.65rem;
  color: var(--lime);
  text-align: center;
}

.shortcut-desc {
  font-size: 0.7rem;
  color: var(--gray-light);
  display: flex;
  align-items: center;
}

/* Due date indicator */
.due-date-hint {
  font-size: 0.6rem;
  color: var(--gray);
  margin-top: 0.2rem;
}

.due-date-hint.overdue {
  color: #F87171;
}

.form-hint {
  font-size: 0.6rem;
  color: var(--gray);
  margin-top: 0.2rem;
}

.form-hint.red {
  color: #F87171;
}

/* ============ RECURRING INVOICES ============ */
.rec-summary {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.rec-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.75rem;
  color: var(--gray-light);
}

.rec-summary-total {
  border-top: 1px solid var(--separator);
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  font-weight: 700;
  color: var(--white);
}

.rec-form .form-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.rec-schedules {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rec-card {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--lime);
  transition: border-color 0.2s;
}

.rec-card:hover {
  border-color: var(--gray-dark);
}

.rec-card.rec-paused {
  border-left-color: var(--gray);
  opacity: 0.7;
}

.rec-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.rec-client {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--white);
}

.rec-freq {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lime);
  background: rgba(163, 230, 53, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

.rec-paused .rec-freq {
  color: var(--gray);
  background: rgba(107, 114, 128, 0.15);
}

.rec-card-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.2rem 1rem;
  margin-bottom: 0.5rem;
}

.rec-detail {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--gray);
  padding: 0.15rem 0;
}

.rec-detail span:last-child {
  color: var(--gray-light);
}

.rec-amount {
  color: var(--white) !important;
  font-weight: 600;
}

.rec-card-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
  padding-top: 0.4rem;
  border-top: 1px solid var(--separator);
}

/* ============ ACTIVITY TIMELINE ============ */
.timeline-panel {
  border-top: 1px solid var(--separator);
  background: var(--dark2);
  flex-shrink: 0;
  max-height: 220px;
  display: flex;
  flex-direction: column;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  user-select: none;
}

.timeline-header:hover {
  background: rgba(163, 230, 53, 0.04);
}

.timeline-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--lime);
}

.timeline-toggle {
  font-size: 0.6rem;
  color: var(--gray);
  transition: transform 0.2s;
}

.timeline-body {
  overflow-y: auto;
  padding: 0 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background:
    linear-gradient(var(--dark2) 30%, transparent) center top,
    linear-gradient(transparent, var(--dark2) 70%) center bottom,
    linear-gradient(rgba(0,0,0,0.3), transparent 30%) center top,
    linear-gradient(transparent 70%, rgba(0,0,0,0.3)) center bottom;
  background-size: 100% 30px, 100% 30px, 100% 10px, 100% 10px;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}

.timeline-body.collapsed {
  display: none;
}

.tl-event {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  background: var(--dark);
}

.tl-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}

.tl-created .tl-icon {
  background: rgba(163, 230, 53, 0.15);
  color: var(--lime);
}

.tl-status .tl-icon {
  background: rgba(96, 165, 250, 0.15);
  color: var(--blue);
}

.tl-payment .tl-icon {
  background: rgba(163, 230, 53, 0.15);
  color: var(--lime);
}

.tl-text {
  flex: 1;
  color: var(--gray-light);
}

.tl-time {
  font-size: 0.6rem;
  color: var(--gray);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Mobile preview toggle — hidden on desktop */
.mobile-preview-toggle {
  display: none;
}

/* ============ RESPONSIVE ============ */

/* === TABLET (≤1024px): Collapse sidebar, stack editor === */
@media (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }
  .sidebar .sidebar-title { opacity: 0; width: 0; }
  .sidebar .sidebar-section-label { font-size: 0; padding: 0.25rem 0; }
  .sidebar .sidebar-label { opacity: 0; width: 0; }
  .sidebar .sidebar-item { padding: 0.5rem; justify-content: center; }
  .sidebar-toggle { display: none; }

  .editor-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .page-content {
    overflow-y: auto;
  }

  .preview-panel {
    display: none;
  }

  .preview-panel.mobile-show {
    display: flex;
    min-height: 50vh;
  }

  .mobile-preview-toggle {
    display: block;
    width: 100%;
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .form-column {
    border-right: none;
  }
}

/* === MOBILE (≤768px): Hide sidebar, show bottom nav === */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  body {
    padding-bottom: 52px;
  }

  .page-header {
    flex-wrap: wrap;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  /* Scale up fonts and touch targets */
  .form-label {
    font-size: 0.75rem;
  }

  .form-input, .form-select, .form-textarea {
    font-size: 0.9rem;
    padding: 0.6rem;
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .btn-small {
    min-height: 44px;
    padding: 0.4rem 0.8rem;
  }

  .qa-btn {
    min-height: 44px;
    padding: 0.4rem 0.8rem;
  }

  .btn-icon {
    min-height: 44px;
    padding: 0.4rem 0.5rem;
  }

  /* Dashboard responsive grids */
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .dash-aging {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-view {
    padding: 1rem;
    gap: 1rem;
  }

  /* Responsive invoice table — card layout */
  .dash-table thead {
    display: none;
  }

  .dash-table, .dash-table tbody {
    display: block;
    min-width: 0;
  }

  .dash-table tr.dash-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--dark);
    border: 1px solid var(--separator);
    border-radius: var(--radius);
  }

  .dash-table td {
    padding: 0.2rem 0;
    border-bottom: none;
  }

  .dash-table td:first-child {
    display: none;
  }

  .dash-table td.qa-cell {
    grid-column: 1 / -1;
    text-align: left;
    padding-top: 0.4rem;
    border-top: 1px solid var(--separator);
    margin-top: 0.25rem;
  }

  .dash-filters {
    flex-direction: column;
    width: 100%;
  }

  .dash-search {
    width: 100%;
  }

  .dash-date-filter {
    width: 100%;
  }

  .dash-date-filter .form-input {
    width: 100%;
    flex: 1;
  }

  .dash-section-header {
    flex-direction: column;
    align-items: stretch;
  }

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

  .toast-container {
    left: 0;
    right: 0;
    bottom: 52px;
    padding: 0.5rem;
  }

  .toast {
    max-width: 100%;
  }

  .settings-view {
    padding: 1rem;
    max-width: 100%;
  }

  .ledger-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .tax-summary-cards {
    grid-template-columns: 1fr;
  }

  .history-actions {
    flex-wrap: wrap;
  }

  .history-search {
    width: 100%;
  }

  .history-select {
    width: 100%;
  }

  .bulk-actions {
    flex-wrap: wrap;
  }
}

/* === SMALL MOBILE (≤480px): Full stacking === */
@media (max-width: 480px) {
  .dash-stats {
    grid-template-columns: 1fr;
  }

  .dash-aging {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
  }

  .form-panel {
    padding: 0.75rem;
  }

  .form-actions {
    padding: 0.5rem 0.75rem;
  }

  .line-item-numbers {
    flex-wrap: wrap;
  }

  .template-fields {
    flex-direction: column;
  }

  .template-fields .tmpl-rate {
    flex: 1;
  }

  .rate-table {
    grid-template-columns: 1fr;
  }

  .dash-stat-card {
    padding: 0.75rem;
  }

  .dash-section {
    padding: 0.75rem;
  }

  /* Attention cards stack */
  .attn-card {
    flex-wrap: wrap;
  }

  .attn-actions {
    width: 100%;
    margin-top: 0.25rem;
  }
}

/* ============ EXPENSES ============ */
.expense-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.expense-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  background: var(--dark);
  border: 1px solid var(--separator);
  transition: border-color 0.15s, background 0.15s;
}

.expense-row:hover {
  border-color: var(--gray-dark);
  background: rgba(255,255,255,0.01);
}

.expense-date {
  color: var(--gray-light);
  flex: 0 0 5.5rem;
  font-size: 0.7rem;
}

.expense-category-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  background: var(--gray-dark);
  color: var(--white);
  flex: 0 0 auto;
  white-space: nowrap;
}

.cat-travel { background: #2563EB; }
.cat-meals { background: #D97706; }
.cat-software { background: #7C3AED; }
.cat-office-supplies { background: #059669; }
.cat-professional-services { background: #DC2626; }
.cat-marketing { background: #DB2777; }
.cat-other { background: var(--gray-dark); }

.expense-desc {
  flex: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-vendor {
  flex: 1;
  color: var(--gray-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-amount {
  flex: 0 0 6rem;
  text-align: right;
  font-weight: 600;
  color: var(--red);
}

.expense-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex: 0 0 auto;
}

.expense-tax-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 3px;
  background: var(--lime);
  color: var(--dark);
  font-size: 0.6rem;
  font-weight: 700;
}

.expense-bar {
  background: var(--red) !important;
}

.expense-trend-bar {
  background: var(--red) !important;
}

.expense-modal .modal-body {
  max-width: 500px;
}

/* ============ TIME TRACKING ============ */
.time-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.time-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  background: var(--dark);
  border: 1px solid var(--separator);
  transition: border-color 0.15s, background 0.15s;
}

.time-row:hover { border-color: var(--gray-dark); background: rgba(255,255,255,0.01); }
.time-billed { opacity: 0.6; }

.time-date { color: var(--gray-light); flex: 0 0 5.5rem; font-size: 0.7rem; }
.time-client { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-task { flex: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-hours { flex: 0 0 3rem; text-align: right; font-weight: 600; color: var(--blue); }
.time-amount { flex: 0 0 5rem; text-align: right; font-weight: 600; color: var(--lime); }

.time-status-badge {
  font-size: 0.6rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  flex: 0 0 auto;
}
.ts-unbilled { background: #F59E0B; color: var(--dark); }
.ts-billed { background: var(--lime); color: var(--dark); }

.time-actions { display: flex; gap: 0.25rem; align-items: center; flex: 0 0 auto; }
.time-bar { background: var(--blue) !important; }

.time-generate-modal .modal-body { max-width: 550px; }
.time-gen-info { font-size: 0.8rem; color: var(--gray-light); margin-bottom: 0.75rem; }

.time-gen-group { margin-bottom: 0.75rem; }
.time-gen-client {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--separator);
  margin-bottom: 0.3rem;
}
.time-gen-subtotal { color: var(--lime); font-size: 0.75rem; }

.time-gen-entry {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.2rem 0 0.2rem 1.2rem;
  font-size: 0.7rem;
  color: var(--gray-light);
  cursor: pointer;
}
.time-gen-entry:hover { color: var(--white); }
.time-gen-entry span { flex: 1; }
.time-gen-entry span:last-child { flex: 0 0 auto; }
.time-gen-entry .lime { color: var(--lime); }

/* ============ TAX REPORT ============ */
.tax-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.tax-table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.tax-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.tax-table th {
  text-align: left;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  padding: 0.55rem 0.75rem;
  border-bottom: 2px solid var(--separator);
}

.tax-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(31, 41, 55, 0.5);
  color: var(--gray-light);
}

.tax-table td.amount {
  font-weight: 600;
  color: var(--white);
  text-align: right;
}

.tax-table th:not(:first-child) {
  text-align: right;
}

.tax-row-empty td {
  opacity: 0.4;
}

.tax-totals-row td {
  border-top: 2px solid var(--gray-dark);
  background: rgba(163, 230, 53, 0.04);
}

.tax-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.tax-card {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.85rem;
  text-align: center;
}

.tax-card-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  margin-bottom: 0.3rem;
}

.tax-card-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
}

.tax-card-value.lime { color: var(--lime); }
.tax-card-value.red { color: var(--red); }

/* ============ ESTIMATES ============ */
.estimate-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.estimate-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  background: var(--dark);
  border: 1px solid var(--separator);
  transition: border-color 0.15s, background 0.15s;
}

.estimate-row:hover {
  border-color: var(--gray-dark);
  background: rgba(255,255,255,0.01);
}

.estimate-expiring {
  border-color: var(--red) !important;
  background: rgba(248, 113, 113, 0.05);
}

.estimate-id {
  flex: 0 0 7rem;
  color: var(--blue);
  font-weight: 600;
}

.estimate-client {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.estimate-amount {
  flex: 0 0 6rem;
  text-align: right;
  font-weight: 600;
  color: var(--lime);
}

.estimate-date {
  flex: 0 0 7rem;
  font-size: 0.7rem;
  color: var(--gray-light);
}

.estimate-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex: 0 0 auto;
}

.estimate-converted {
  font-size: 0.65rem;
  color: var(--lime);
  font-weight: 600;
}

/* ============ SKELETON LOADING ============ */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--separator) 25%, var(--gray-dark) 50%, var(--separator) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 1.4rem;
  width: 60%;
  margin-bottom: 0.3rem;
}

.skeleton-value {
  height: 2rem;
  width: 80%;
}

/* ============ SETTINGS ============ */
.settings-view {
  padding: 2rem;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.rate-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.rate-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rate-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-light);
  min-width: 3rem;
}

.rate-input {
  width: 6rem;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.template-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.55rem 0.6rem;
  transition: border-color 0.2s;
}
.template-item:focus-within {
  border-color: var(--gray-dark);
}

.template-fields {
  display: flex;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.template-fields .form-input {
  flex: 1;
  min-width: 0;
}

.template-fields .tmpl-rate {
  flex: 0 0 5rem;
}

/* ============ PRINT ============ */
@media print {
  body {
    background: white;
    color: black;
  }
  .sidebar,
  .page-header,
  .form-column,
  .form-actions,
  .dashboard-view,
  .settings-view,
  .toast-container,
  .modal-overlay,
  .mobile-nav {
    display: none !important;
  }
  .editor-layout {
    display: block;
    height: auto;
  }
  .preview-panel {
    padding: 0;
    background: white;
  }
  .preview-frame {
    box-shadow: none;
  }
}

/* ===== FULL-PAGE VIEWS ===== */
.fullpage-view {
  padding: 2rem;
  animation: pageSlideIn 0.3s ease-out;
}
.fullpage-view .dash-stats {
  margin-bottom: 2rem;
  grid-template-columns: repeat(4, 1fr);
}
.fullpage-view .dash-section {
  margin-bottom: 1.5rem;
}
.fullpage-view .dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Stat cards (used by fullpage views) */
.stat-card {
  background: linear-gradient(160deg, var(--dark2) 0%, var(--dark3) 100%);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--gray-dark);
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  margin-top: 0.35rem;
}

/* Staggered stat card entrance */
@keyframes statCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.dash-stats .stat-card { animation: statCardIn 0.35s ease-out both; }
.dash-stats .stat-card:nth-child(1) { animation-delay: 0s; }
.dash-stats .stat-card:nth-child(2) { animation-delay: 0.05s; }
.dash-stats .stat-card:nth-child(3) { animation-delay: 0.1s; }
.dash-stats .stat-card:nth-child(4) { animation-delay: 0.15s; }
.dash-stats .stat-card:nth-child(5) { animation-delay: 0.2s; }
.dash-stats .stat-card:nth-child(6) { animation-delay: 0.25s; }
.dash-stats .stat-card:nth-child(7) { animation-delay: 0.3s; }

/* Staggered section entrance */
@keyframes sectionFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fullpage-view .dash-section,
.home-section {
  animation: sectionFadeIn 0.35s ease-out both;
}
.fullpage-view .dash-section:nth-child(1),
.home-section:nth-child(1) { animation-delay: 0.1s; }
.fullpage-view .dash-section:nth-child(2),
.home-section:nth-child(2) { animation-delay: 0.15s; }
.fullpage-view .dash-section:nth-child(3),
.home-section:nth-child(3) { animation-delay: 0.2s; }
.fullpage-view .dash-section:nth-child(4),
.home-section:nth-child(4) { animation-delay: 0.25s; }

/* Utility text color classes */
.lime { color: var(--lime); }
.red { color: var(--red); }
.gray { color: var(--gray); }
.blue { color: var(--blue); }

/* Client cards */
.client-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.client-card {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.client-card:hover {
  border-color: var(--gray-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.client-card-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.25rem;
}
.client-card-contact {
  color: var(--gray);
  font-size: 0.85rem;
}
.client-card-email {
  color: var(--gray);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}
.client-card-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--separator);
}
.client-card-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.client-card-stat-label {
  font-size: 0.7rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.client-card-stat-value {
  font-size: 0.9rem;
  color: var(--white);
}

/* Tax deductible summary */
.tax-deductible-summary .dash-client-row {
  padding: 0.4rem 0;
}

@media (max-width: 768px) {
  .fullpage-view {
    padding: 1rem;
  }
  .fullpage-view .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .fullpage-view .dash-grid {
    grid-template-columns: 1fr;
  }
  .client-card-grid {
    grid-template-columns: 1fr;
  }
  .stat-card {
    padding: 0.75rem;
  }
}

/* ===== BILLS PAGE ===== */
.bills-page {
  padding: 2rem;
  animation: pageSlideIn 0.3s ease-out;
}
.bills-page .dash-stats {
  margin-bottom: 2rem;
}
.bill-overdue {
  background: rgba(239, 68, 68, 0.08) !important;
}
.bill-overdue td {
  color: #EF4444;
}
.bill-due-soon {
  background: rgba(251, 191, 36, 0.06) !important;
}
.bill-due-soon td:nth-child(4) {
  color: #FBBF24;
  font-weight: 600;
}
.status-unpaid {
  background: rgba(251, 191, 36, 0.15);
  color: #FBBF24;
}
.status-scheduled {
  background: rgba(96, 165, 250, 0.15);
  color: #60A5FA;
}
.bill-modal {
  max-width: 540px;
}
.pay-bill-modal {
  max-width: 420px;
}
.pay-bill-summary {
  background: var(--dark3);
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

/* ===== HOME / TODAY PAGE ===== */
.home-page {
  padding: 2rem;
  animation: pageSlideIn 0.3s ease-out;
}
.home-loading {
  color: var(--gray);
  text-align: center;
  padding: 3rem;
}
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.home-section {
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.home-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.home-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--lime);
  margin-bottom: 0.75rem;
  opacity: 0.85;
}
.home-section-header .home-section-title {
  margin-bottom: 0;
}

/* Attention section */
.home-attention {
  margin-bottom: 1.5rem;
}
.home-attention .home-section-header {
  margin-bottom: 0.5rem;
}
.home-attention-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.home-all-clear {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(163, 230, 53, 0.06) 0%, transparent 60%);
  border: 1px solid rgba(163, 230, 53, 0.1);
  border-radius: var(--radius-lg);
}
.home-all-clear-icon {
  font-size: 1.3rem;
  color: var(--lime);
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(163, 230, 53, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(163, 230, 53, 0.1);
}
.home-all-clear-text {
  color: var(--gray-light);
  font-size: 0.85rem;
}

/* Cash Position */
.home-cash-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.home-cash-card {
  background: linear-gradient(160deg, var(--dark3) 0%, var(--dark2) 100%);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.home-cash-card:hover {
  border-color: var(--gray-dark);
  box-shadow: var(--shadow-sm);
}
.home-cash-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  margin-bottom: 0.35rem;
}
.home-cash-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.home-cash-sub {
  font-size: 0.7rem;
  color: var(--gray);
  margin-top: 0.25rem;
}
.home-cash-summary {
  border-top: 1px solid var(--separator);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.home-cash-summary-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--gray);
}
.home-cash-summary-total {
  border-top: 1px solid var(--separator);
  padding-top: 0.5rem;
  font-weight: 700;
  color: var(--white);
}

/* Quick Actions */
.home-action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.home-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 0.5rem;
  background: var(--dark3);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  color: var(--gray-light);
  font-family: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
}
.home-action-btn:hover {
  border-color: var(--lime);
  background: rgba(163, 230, 53, 0.06);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.home-action-btn:active {
  transform: translateY(0);
}
.home-action-icon {
  font-size: 1.15rem;
  color: var(--lime);
  opacity: 0.8;
  transition: opacity 0.2s;
}
.home-action-btn:hover .home-action-icon {
  opacity: 1;
}

/* Active Projects */
.home-project-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.home-project-card {
  background: var(--dark3);
  border: 1px solid var(--separator);
  border-left: 3px solid var(--lime);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.home-project-card:hover {
  border-color: var(--lime);
  background: rgba(163, 230, 53, 0.03);
  box-shadow: var(--shadow-sm);
}
.home-project-name {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}
.home-project-stats {
  font-size: 0.75rem;
  color: var(--gray);
}
.home-project-budget {
  color: var(--gray);
}

/* Recent Activity */
.home-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.home-activity-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.home-activity-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.home-activity-payment { background: rgba(163, 230, 53, 0.15); color: var(--lime); }
.home-activity-invoice { background: rgba(96, 165, 250, 0.15); color: #60A5FA; }
.home-activity-bill { background: rgba(251, 191, 36, 0.15); color: #FBBF24; }
.home-activity-bill-paid { background: rgba(163, 230, 53, 0.15); color: var(--lime); }
.home-activity-expense { background: rgba(239, 68, 68, 0.15); color: #EF4444; }
.home-activity-time { background: rgba(168, 85, 247, 0.15); color: #A855F7; }
.home-activity-text {
  flex: 1;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-activity-date {
  color: var(--gray);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
  .home-cash-cards {
    grid-template-columns: 1fr;
  }
  .home-action-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============ ROADMAP PROGRESS (Multi-Perspective) ============ */

.roadmap-progress {
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 1rem;
}

.roadmap-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.roadmap-progress-text {
  font-size: 0.8rem;
  color: var(--white);
  font-weight: 600;
}

.roadmap-progress-bar {
  height: 6px;
  background: var(--separator);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.roadmap-progress-fill {
  height: 100%;
  background: var(--lime);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.roadmap-perspective-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.perspective-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--separator);
  color: var(--gray);
  background: var(--dark);
}

.perspective-chip.perspective-ok {
  border-color: var(--lime);
  color: var(--lime);
}

.perspective-chip.perspective-failed {
  border-color: var(--red);
  color: var(--red);
}

.perspective-chip.perspective-running {
  border-color: var(--gray);
  color: var(--gray);
}

.perspective-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--gray);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: perspectiveSpin 0.8s linear infinite;
}

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

/* Confidence badges */
.confidence-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-align: center;
  min-width: 30px;
}

.confidence-badge.confidence-low {
  background: rgba(248, 113, 113, 0.15);
  color: #F87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.confidence-badge.confidence-med {
  background: rgba(234, 179, 8, 0.15);
  color: #EAB308;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.confidence-badge.confidence-high {
  background: rgba(163, 230, 53, 0.15);
  color: var(--lime);
  border: 1px solid rgba(163, 230, 53, 0.3);
}

/* Scope badges and filter */
.feature-extended { opacity: 0.6; border-style: dashed !important; }
.scope-badge { font-size: 0.65rem; padding: 2px 6px; border-radius: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.scope-badge-core { background: rgba(163,230,53,0.15); color: #A3E635; }
.scope-badge-extended { background: rgba(107,114,128,0.15); color: #9CA3AF; }
.rm-scope-filter { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.rm-scope-filter button { font-size: 0.75rem; padding: 4px 12px; }

/* Smaller perspective chips for 7-panel display */
.perspective-chip { font-size: 0.7rem; padding: 3px 8px; }

/* === Document Package === */
.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}
.package-card {
  background: var(--dark2);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s;
}

.package-card:hover {
  border-color: var(--gray-dark);
}
.package-card-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}
.package-card-actions {
  display: flex;
  gap: 0.25rem;
}

/* ============ ACCOUNTS MONITOR ============ */
.acct-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.acct-provider-card {
  background: var(--dark);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: left;
  color: var(--white);
  font-family: var(--mono);
}

.acct-provider-card:hover {
  border-color: var(--gray-dark);
  background: rgba(163, 230, 53, 0.03);
}

.acct-provider-card.selected {
  border-color: var(--lime);
  background: rgba(163, 230, 53, 0.06);
}

.acct-provider-name {
  font-size: 0.8rem;
  font-weight: 700;
}

.acct-provider-cat {
  font-size: 0.6rem;
  color: var(--gray);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.acct-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 1.5rem;
  margin-bottom: 1rem;
}

.acct-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.acct-detail-item .form-label {
  margin-bottom: 0;
}

.acct-detail-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--separator);
}

.acct-error-badge {
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  background: rgba(248, 113, 113, 0.12);
  color: var(--red);
}

.acct-link-modal {
  max-width: 550px;
}

.acct-detail-modal {
  max-width: 700px;
}
