:root {
  --bg-primary: #0b132b;
  --bg-secondary: #1c2541;
  --bg-card: #1f2a48;
  --bg-card-hover: #263357;
  --bg-input: #131b31;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #06d6a0;
  --accent-blue: #3a86ff;
  --accent-indigo: #6366f1;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --border-color: #334155;
  --border-light: #475569;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: linear-gradient(180deg, rgba(28, 37, 65, 0.95) 0%, rgba(19, 27, 49, 0.95) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(6, 214, 160, 0.3);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-tag {
  font-size: 11px;
  background: rgba(58, 134, 255, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.4);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.brand-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(11, 19, 43, 0.6);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.stat-value.highlight {
  color: var(--accent-cyan);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.btn-blue {
  background: linear-gradient(135deg, var(--accent-blue) 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(58, 134, 255, 0.35);
}

.btn-blue:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--text-muted);
}

.btn-danger {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Navigation Tabs */
.app-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(6, 214, 160, 0.05);
}

.nav-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
}

.nav-tab.active .nav-badge {
  background: rgba(6, 214, 160, 0.2);
  color: var(--accent-cyan);
}

/* Main Container */
.main-content {
  flex: 1;
  padding: 20px 24px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Split Pane for Ledger / Receipt */
.split-container {
  display: grid;
  grid-template-columns: minmax(460px, 32vw) 1fr;
  gap: 20px;
  height: calc(100vh - 170px);
  min-height: 600px;
}

@media (max-width: 1200px) {
  .split-container {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.receipt-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  height: 42px;
  padding: 0 12px;
  background: rgba(11, 19, 43, 0.75);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  user-select: none;
}

.panel-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  white-space: nowrap;
}

.panel-icon {
  font-size: 14px;
}

.preload-pill {
  font-size: 11px;
  background: rgba(6, 214, 160, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 214, 160, 0.25);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
}

.preload-pill.ready {
  background: rgba(6, 214, 160, 0.16);
  border-color: rgba(6, 214, 160, 0.4);
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Compact Segmented Control Group for Image Viewer */
.viewer-btn-group {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
  height: 28px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.v-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.v-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.v-btn:active {
  background: rgba(255, 255, 255, 0.18);
}

.v-btn-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  min-width: 44px;
  color: var(--accent-cyan);
  padding: 0 4px;
}

.v-sep {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
}

.upload-header-btn {
  background: var(--accent-cyan);
  color: #0b132b;
  border: none;
  font-size: 11px;
  font-weight: 700;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(6, 214, 160, 0.25);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.upload-header-btn:hover {
  background: #05bf8f;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(6, 214, 160, 0.35);
}

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

.receipt-viewer {
  flex: 1;
  overflow: hidden;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #090d16;
  position: relative;
  user-select: none;
  cursor: grab;
}

.receipt-viewer.panning {
  cursor: grabbing;
}

.receipt-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-sm);
  transition: transform 0.15s ease-out;
  transform-origin: center center;
  pointer-events: auto;
}

/* Receipt Thumbnail Strip */
.receipt-thumb-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #0d131f;
  border-top: 1px solid var(--border-color);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  flex-shrink: 0;
  height: 72px;
}

.receipt-thumb-bar::-webkit-scrollbar {
  height: 5px;
}
.receipt-thumb-bar::-webkit-scrollbar-track {
  background: transparent;
}
.receipt-thumb-bar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.receipt-thumb-bar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.thumb-item {
  flex: 0 0 44px;
  height: 54px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: #1e293b;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.65;
  transition: opacity 0.15s;
  pointer-events: none;
}

.thumb-item .thumb-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.85);
  color: #e2e8f0;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 2px;
  line-height: 1;
}

.thumb-item:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

.thumb-item:hover img {
  opacity: 0.95;
}

.thumb-item.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(6, 214, 160, 0.5);
  transform: translateY(-2px);
}

.thumb-item.active img {
  opacity: 1;
}

.thumb-item.active .thumb-badge {
  background: var(--accent-cyan);
  color: #0b0f17;
}

/* Receipt Metadata Bar (Full-Width, Clear Text, No Overlap) */
.receipt-meta-bar {
  padding: 8px 14px;
  background: #0f172a;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.meta-page-badge {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.meta-page-badge strong {
  color: var(--accent-cyan);
  font-size: 13px;
  font-weight: 700;
}

.meta-supp-badge {
  background: rgba(58, 134, 255, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(58, 134, 255, 0.35);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

/* Bottom Pagination (Clean, Well-Spaced, No Overlap) */
.receipt-pagination {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.28);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  flex-shrink: 0;
}

.page-step-btn {
  font-weight: 600;
  padding: 5px 12px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.receipt-jump-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  justify-content: center;
}

.jump-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.select-page-dropdown {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  width: 100%;
  max-width: 250px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.select-page-dropdown:focus {
  border-color: var(--accent-cyan);
}

.ledger-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.toolbar {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input, .select-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

.search-input:focus, .select-input:focus {
  border-color: var(--accent-cyan);
}

.table-scroll {
  flex: 1;
  overflow: auto;
}

/* Custom Financial Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  background: #19223c;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.6);
  white-space: nowrap;
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tr.selected {
  background: rgba(6, 214, 160, 0.18) !important;
  border-left: 4px solid var(--accent-cyan) !important;
  box-shadow: inset 0 0 0 1px rgba(6, 214, 160, 0.35);
}

.data-table tr.selected td {
  color: #ffffff !important;
}

.data-table tr.selected input.cell-input {
  color: #ffffff !important;
  font-weight: 600 !important;
}

@keyframes focusPulse {
  0% { box-shadow: inset 0 0 0 2px rgba(6, 214, 160, 0.9), 0 0 25px rgba(6, 214, 160, 0.4); }
  50% { box-shadow: inset 0 0 0 3px rgba(6, 214, 160, 0.6), 0 0 35px rgba(6, 214, 160, 0.25); }
  100% { box-shadow: none; }
}

.receipt-viewer.flash-focus {
  animation: focusPulse 0.75s ease-out;
}

.receipt-focus-pill {
  padding: 6px 12px;
  background: rgba(6, 214, 160, 0.12);
  border: 1px solid rgba(6, 214, 160, 0.35);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  transition: all 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table td.numeric {
  text-align: right;
  font-family: var(--font-mono);
}

.data-table input.cell-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
}

.data-table input.cell-input:focus {
  background: var(--bg-input);
  border-color: var(--accent-cyan);
  outline: none;
}

.badge-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-dept {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.badge-supp {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

/* Master Catalog Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-body {
  padding: 16px 20px;
  overflow: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
}

/* Cards & Overview Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.card-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.card-subtext {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-light);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-left: 4px solid var(--accent-cyan);
}

.toast.error {
  border-left: 4px solid var(--accent-red);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Filter Toolbars & Preset Chips */
.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.filter-chips-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 16px;
  transition: all 0.15s ease;
  user-select: none;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-blue);
  color: #fff;
}

.filter-chip.active {
  background: rgba(6, 214, 160, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
  box-shadow: 0 0 8px rgba(6, 214, 160, 0.2);
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.date-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
}

.date-input:focus {
  border-color: var(--accent-cyan);
}

/* KPI Summary Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}

.kpi-card:hover {
  border-color: var(--border-light);
}

.kpi-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-num {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Drag & Drop Overlay on Viewer */
.receipt-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.94);
  border: 2px dashed var(--accent-cyan);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.receipt-drop-overlay.active {
  opacity: 1;
}

.ocr-status-badge {
  background: rgba(6, 214, 160, 0.1);
  border: 1px solid rgba(6, 214, 160, 0.3);
  color: var(--accent-cyan);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Stepper Toolbar (Daily & Monthly Navigation) */
.stepper-toolbar {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stepper-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper-nav-btn {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}

.stepper-nav-btn:hover:not(:disabled) {
  background: rgba(58, 134, 255, 0.18);
  border-color: var(--accent-blue);
  color: #fff;
  transform: translateY(-1px);
}

.stepper-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.stepper-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}

.stepper-icon {
  font-size: 15px;
}

.stepper-text {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
  letter-spacing: 0.5px;
}

.stepper-badge {
  font-size: 11px;
  background: rgba(6, 214, 160, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 214, 160, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.stepper-badge.dimmed {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border-color: rgba(255, 255, 255, 0.1);
}

.stepper-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stepper-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 2px;
}

.date-stepper-picker {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  padding: 2px 4px;
}

.date-stepper-picker::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

/* Empty State Box for Day Stepping */
.empty-daily-state {
  text-align: center;
  padding: 36px 20px;
  background: rgba(255, 255, 255, 0.015);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
  margin: 16px;
}

.empty-daily-state .empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.empty-daily-state .empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-daily-state .empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

.empty-daily-state .empty-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Clickable Month Columns & Highlighting in Monthly Table */
.clickable-month-th {
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.clickable-month-th:hover {
  background: #253355 !important;
  color: var(--accent-cyan) !important;
}

.col-month-focused {
  background: rgba(6, 214, 160, 0.09) !important;
  border-left: 1px solid rgba(6, 214, 160, 0.35) !important;
  border-right: 1px solid rgba(6, 214, 160, 0.35) !important;
}

th.col-month-focused {
  background: #1a365d !important;
  color: var(--accent-cyan) !important;
  font-weight: 800 !important;
  border-top: 2px solid var(--accent-cyan) !important;
}

tfoot td.col-month-focused {
  background: rgba(6, 214, 160, 0.18) !important;
  font-weight: 800 !important;
  color: var(--accent-cyan) !important;
}

/* ==========================================================================
   Handwriting Profiles & Glyph Knowledge Base Styling
   ========================================================================== */
.hw-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .hw-layout {
    flex-direction: column;
  }
}

.hw-sidebar {
  width: 330px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 900px) {
  .hw-sidebar {
    width: 100%;
  }
}

.hw-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hw-supplier-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}

.hw-supplier-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.hw-supplier-card.active {
  border-color: var(--accent-cyan);
  background: rgba(6, 214, 160, 0.06);
  box-shadow: 0 0 12px rgba(6, 214, 160, 0.2);
  border-left: 4px solid var(--accent-cyan);
}

.hw-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.hw-supplier-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hw-accuracy-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  background: rgba(6, 214, 160, 0.15);
  color: var(--accent-cyan);
  padding: 2px 7px;
  border-radius: 4px;
}

.hw-scribe-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hw-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hw-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hw-tag.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

.hw-tag.emerald {
  background: rgba(6, 214, 160, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(6, 214, 160, 0.3);
}

.hw-sandbox-box {
  background: #0d1424;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hw-sandbox-result {
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
}

/* Multi-Batch System Styles */
.batch-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.batch-label {
  font-size: 12px;
  font-weight: 700;
  color: #93c5fd;
  white-space: nowrap;
}

.batch-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.batch-badge.b1 {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.batch-badge.b2 {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.batch-option-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.batch-option-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 214, 160, 0.05);
}

.batch-option-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.batch-option-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.batch-option-card.highlighted {
  border-color: rgba(6, 214, 160, 0.5);
  background: rgba(6, 214, 160, 0.08);
}

/* Manual Selection Action Bar & Row Checkbox Styles */
.selection-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(6, 214, 160, 0.25);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  margin-bottom: 10px;
  transition: all 0.25s ease;
}

.selection-bar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.selection-count-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.selection-amount-badge {
  font-size: 12px;
  color: var(--text-muted);
}

.quick-select-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn:hover {
  background: rgba(6, 214, 160, 0.15);
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

.selection-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

tr.row-checked {
  background-color: rgba(6, 214, 160, 0.08) !important;
}

tr.row-checked td:first-child {
  border-left: 3px solid var(--accent-cyan);
}

.row-select-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent-cyan);
  vertical-align: middle;
}

