/* ==========================================================================
   Zakup XBK & STROYNA - Sverka & Oldi-Berdi Portal Tizimi
   Ultra-modern Glassmorphism Dark Theme Design System
   ========================================================================== */

:root {
  --bg-main: #060813;
  --bg-surface: #0b1021;
  --bg-card: rgba(16, 23, 44, 0.7);
  --bg-card-hover: rgba(24, 34, 64, 0.85);
  --bg-card-subtle: rgba(255, 255, 255, 0.03);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-hover: rgba(255, 255, 255, 0.18);
  
  /* Brand Accent Colors */
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.3);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.3);
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.3);
  --rose: #f43f5e;
  --rose-glow: rgba(244, 63, 94, 0.3);
  --purple: #a855f7;
  
  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  /* Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 35px var(--primary-glow);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Ambient glow background effect */
.ambient-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.18;
  animation: floatOrb 22s infinite alternate ease-in-out;
}

.orb-1 {
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
  top: -200px;
  left: -150px;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  top: 30%;
  right: -150px;
  animation-delay: -7s;
}

.orb-3 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #10b981 0%, transparent 70%);
  bottom: -200px;
  left: 20%;
  animation-delay: -14s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.08); }
  100% { transform: translate(-40px, 70px) scale(0.95); }
}

/* App Container */
.app-layout {
  position: relative;
  z-index: 1;
  max-width: 1720px;
  margin: 0 auto;
  padding: 24px 32px 64px 32px;
}

/* Top Navigation Bar */
.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

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

.back-to-portal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.back-to-portal-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: var(--border-hover);
  transform: translateX(-2px);
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}

.brand-info h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-tag {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 400;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateY(-2px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: var(--border-subtle);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

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

@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.kpi-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: all 0.25s ease;
  overflow: hidden;
}

.kpi-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--card-accent, #6366f1);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.kpi-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kpi-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--card-accent, #6366f1);
  font-size: 1.1rem;
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 6px;
  color: #fff;
}

.kpi-subtext {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.kpi-subtext strong {
  color: var(--text-main);
  font-weight: 600;
}

.badge-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.badge-rose {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}

/* Period (Davr) Selector Card */
.period-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 22px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.period-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #06b6d4, #10b981);
}

.period-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.period-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.period-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.2rem;
}

.period-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
}

.period-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.active-period-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.period-presets-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.period-row-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.period-pills-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.period-controls-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.period-control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.period-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.period-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #fff;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-select:focus, .period-select:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.period-select option {
  background: #0d1226;
  color: #fff;
}

.period-control-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.1);
}

.custom-range-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px 10px;
}

.date-input-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.date-input-wrap .date-input {
  border: none;
  background: transparent;
  padding: 6px 4px;
  font-size: 0.84rem;
  color: #fff;
}

.range-arrow {
  color: var(--text-subtle);
  font-size: 0.9rem;
}

/* Filter & Search Bar */
.filter-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 24px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}

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

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 4px;
}

.filter-btn-pill {
  padding: 7px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.filter-btn-pill:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border-color: var(--border-hover);
}

.filter-btn-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--primary-glow);
}

.search-box-wrap {
  position: relative;
  min-width: 260px;
  flex: 1;
  max-width: 360px;
}

.search-box-wrap i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.custom-dates-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-input {
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.8rem;
  outline: none;
  font-family: 'JetBrains Mono', monospace;
}

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

/* Navigation Tabs */
.view-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  padding-bottom: 4px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  outline: none;
}

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

.tab-btn.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.1);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 12px var(--primary-glow);
}

.tab-badge {
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.tab-btn.active .tab-badge {
  background: var(--primary);
  color: #fff;
}

.tab-badge.badge-alert {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Tab Panels */
.tab-content {
  display: none;
}

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

/* Table Cards */
.table-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.table-header-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-stats-pill {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.data-table-wrapper {
  overflow-x: auto;
  max-height: 680px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0e1428;
  padding: 12px 16px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.86rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

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

/* Matching Row specific styles */
.matched-cell {
  background: rgba(16, 185, 129, 0.04);
}

.diff-cell {
  background: rgba(245, 158, 11, 0.06);
}

.unmatched-cell {
  background: rgba(244, 63, 94, 0.06);
}

.doc-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.doc-pill:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #fff;
}

.doc-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.money {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  white-space: nowrap;
}

.money-positive {
  color: #34d399;
}

.money-negative {
  color: #fb7185;
}

.money-neutral {
  color: #fff;
}

.money-diff {
  color: #fbbf24;
  font-weight: 700;
}

/* Status Indicators */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-tag.exact {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-tag.diff {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-tag.unmatched {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Two-column Comparison View */
.dual-col-header {
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  padding: 14px 20px;
  background: #0d1226;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
}

.dual-col-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dual-col-side.right {
  justify-content: flex-end;
}

.dual-card-row {
  display: grid;
  grid-template-columns: 1fr 140px 1fr;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

.dual-card-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.dual-side-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dual-side-card.empty {
  background: rgba(244, 63, 94, 0.05);
  border-style: dashed;
  border-color: rgba(244, 63, 94, 0.3);
  justify-content: center;
  color: #fb7185;
  font-size: 0.82rem;
  padding: 16px;
}

.dual-center-match {
  text-align: center;
  padding: 0 10px;
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.modal-box {
  background: #0d1226;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 900px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
  animation: modalEnter 0.25s ease;
}

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

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-doc-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .modal-doc-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.meta-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.meta-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 600;
  margin-bottom: 4px;
}

.meta-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Prominent Comment & Payment Purpose Card */
.modal-comment-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(6, 182, 212, 0.06) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-left: 5px solid #6366f1;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  position: relative;
}

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

.modal-section-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #c7d2fe;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.copy-comment-btn {
  padding: 4px 10px;
  font-size: 0.76rem;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.copy-comment-btn:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
  border-color: var(--primary);
}

.comment-content-box {
  font-size: 0.94rem;
  line-height: 1.65;
  color: #f8fafc;
  background: rgba(0, 0, 0, 0.35);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.comment-content-box.empty {
  color: var(--text-subtle);
  font-style: italic;
  font-size: 0.88rem;
  background: rgba(0, 0, 0, 0.15);
}

/* Extra Details Card (Attributes / Owner / Expense Item) */
.modal-extra-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.attributes-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attr-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
}

.attr-chip-name {
  color: var(--text-muted);
  font-weight: 500;
}

.attr-chip-val {
  color: #38bdf8;
  font-weight: 700;
}

/* Linked Operations */
.operations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.op-pill-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Loading Overlay */
.loading-spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: var(--text-muted);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-subtle);
  margin-bottom: 14px;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.85rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Print Optimization */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .ambient-canvas, .top-navbar, .filter-card, .view-tabs, .action-btn {
    display: none !important;
  }
  .table-card {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    background: #fff !important;
  }
  .data-table th {
    background: #f1f5f9 !important;
    color: #000 !important;
  }
  .data-table td {
    color: #000 !important;
    border-bottom: 1px solid #ddd !important;
  }
}
