/* ==========================================================================
   شرکت پولاد سازه لاهیج — سامانه صدور و انبارداری متریال (پوسته P5)
   Poolad Sazeh Lahij Crimson Red Theme & Light Executive Palette
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;300;400;500;600;700;800;900&display=swap');

:root {
  /* Poolad Sazeh Heavy Industrial Theme Tokens */
  --theme-primary: #dc2626;
  --theme-primary-hover: #ef4444;
  --theme-glow: rgba(220, 38, 38, 0.35);

  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --steel-slate: #334155;
  --steel-dark: #0f172a;

  /* Dark Industrial Theme Tokens */
  --bg-dark: #090b10;
  --bg-header: rgba(15, 18, 28, 0.92);
  --bg-card: #121522;
  --bg-card-hover: #181d2e;
  --bg-input: #171b29;
  --border-color: rgba(255, 255, 255, 0.14);
  --border-focus: rgba(220, 38, 38, 0.70);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

/* Light Theme Variables (Industrial Shop Floor Executive Palette) */
body[data-theme="light"] {
  --bg-dark: #eef2f6;
  --bg-header: rgba(255, 255, 255, 0.96);
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #f1f5f9;
  --border-color: rgba(203, 213, 225, 0.95);
  --border-focus: rgba(220, 38, 38, 0.85);

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #64748b;
}

body[data-theme="dark"] {
  --bg-dark: #090b10;
  --bg-header: rgba(18, 21, 32, 0.95);
  --bg-card: #121522;
  --bg-card-hover: #191e2e;
  --bg-input: #171b29;
  --border-color: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(220, 38, 38, 0.80);

  --text-main: #f8fafc;
  --text-muted: #d1d5db;
  --text-dim: #9ca3af;
}

/* Base Settings */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body {
  direction: rtl;
  text-align: right;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Technical Blueprint Grid & Industrial Micro Pattern */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    linear-gradient(rgba(220, 38, 38, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(220, 38, 38, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(15, 23, 42, 0.02) 2px, transparent 2px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.02) 2px, transparent 2px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
  pointer-events: none;
  z-index: 0;
}

body[data-theme="dark"]::before {
  background-image: 
    linear-gradient(rgba(220, 38, 38, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(220, 38, 38, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 2px, transparent 2px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
}

.app-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 24px;
  position: relative;
  z-index: 1;
}

/* Operational LED Status Dots */
.ind-led {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
}

.ind-led-green {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981, 0 0 14px rgba(16, 185, 129, 0.6);
  animation: ledPulseGreen 2s infinite ease-in-out;
}

.ind-led-amber {
  background-color: #f59e0b;
  box-shadow: 0 0 8px #f59e0b, 0 0 14px rgba(245, 158, 11, 0.6);
  animation: ledPulseAmber 1.8s infinite ease-in-out;
}

.ind-led-red {
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444, 0 0 14px rgba(239, 68, 68, 0.7);
  animation: ledPulseRed 1.2s infinite ease-in-out;
}

@keyframes ledPulseGreen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
@keyframes ledPulseAmber {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}
@keyframes ledPulseRed {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* App Header styling (P5 Style) */
.app-header {
  background: var(--bg-header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  position: relative;
  padding: 12px 20px;
  transition: all 0.3s ease;
}

body[data-theme="dark"] .app-header {
  border-color: rgba(220, 38, 38, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.app-header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #dc2626, #ef4444, #991b1b);
}

/* Interactive Logo Hover Reaction (Transparent Logo with Glowing Red Pulse) */
.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-img {
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 6px rgba(220, 38, 38, 0.35));
}

.brand-logo-wrap:hover .brand-logo-img {
  transform: scale(1.20) rotate(6deg);
  filter: drop-shadow(0 0 12px rgba(220, 38, 38, 0.85)) drop-shadow(0 0 24px rgba(239, 68, 68, 0.6));
}

/* Cards & Panels (P5 Light Executive Card) */
.p5-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body[data-theme="dark"] .p5-card {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

/* Dark Mode Color Harmonization for Labels, Inputs & Containers */
body[data-theme="dark"] label {
  color: #e2e8f0 !important;
}

body[data-theme="dark"] small {
  color: #94a3b8 !important;
}

body[data-theme="dark"] option {
  background-color: #121319 !important;
  color: #f8fafc !important;
}

body[data-theme="dark"] select {
  background-color: #1a1b24 !important;
  color: #f8fafc !important;
}

body[data-theme="dark"] .custom-table th,
body[data-theme="dark"] table th {
  background-color: #1e202e !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body[data-theme="dark"] .custom-table td,
body[data-theme="dark"] table td {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Plate Dims Box Theme Harmonization */
#in-plate-dims-row {
  background-color: rgba(6, 182, 212, 0.08) !important;
  border: 1px solid rgba(6, 182, 212, 0.25) !important;
}

body[data-theme="dark"] #in-plate-dims-row {
  background-color: rgba(6, 182, 212, 0.12) !important;
  border: 1px solid rgba(6, 182, 212, 0.35) !important;
}

body[data-theme="dark"] #in-plate-dims-row label {
  color: #67e8f9 !important;
}

body[data-theme="dark"] #in-plate-dims-row small {
  color: #cbd5e1 !important;
}

/* Custom Dims Box Theme Harmonization */
#in-custom-dims-row {
  background-color: rgba(245, 158, 11, 0.08) !important;
  border: 1px solid rgba(245, 158, 11, 0.25) !important;
}

body[data-theme="dark"] #in-custom-dims-row {
  background-color: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

body[data-theme="dark"] #in-custom-dims-row label {
  color: #fde047 !important;
}

body[data-theme="dark"] #in-custom-dims-row small {
  color: #cbd5e1 !important;
}

/* Digital Crane Scale Terminal (باسکول دیجیتال انبار متریال) */
.calc-result-box {
  background: linear-gradient(180deg, #0b0f19 0%, #151a28 100%) !important;
  border: 2px solid #334155 !important;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8), 0 4px 15px rgba(0, 0, 0, 0.15);
  border-radius: 14px !important;
  color: #f8fafc !important;
  position: relative;
  overflow: hidden;
  padding: 16px !important;
}

.calc-result-box::before {
  content: "DIGITAL SCALE TERMINAL • POOLAD SAZEH";
  position: absolute;
  top: 4px;
  right: 12px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.calc-result-box span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-variant-numeric: tabular-nums !important;
}

#in-weight-result, #out-weight-result, #calc-result-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: -0.5px;
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

/* Machined Steel Badges & Steel Grades */
.steel-grade-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.grade-st37 {
  background: rgba(71, 85, 105, 0.15);
  color: #334155;
  border: 1px solid #94a3b8;
}
body[data-theme="dark"] .grade-st37 {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border-color: #64748b;
}

.grade-st52 {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.4);
}
body[data-theme="dark"] .grade-st52 {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.5);
}

/* Stock Status LED Badges */
.stock-badge-high {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.stock-badge-medium {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-partial {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #d97706 !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

body[data-theme="dark"] .badge-partial {
  background: rgba(245, 158, 11, 0.25) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
}

.stock-badge-partial {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(6, 182, 212, 0.12);
  color: #0284c7;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

body[data-theme="dark"] .stock-badge-partial {
  background: rgba(6, 182, 212, 0.2);
  color: #38bdf8;
  border-color: rgba(6, 182, 212, 0.5);
}

/* Offcut Dedicated Row Styling */
.offcut-row {
  background-color: rgba(245, 158, 11, 0.05) !important;
  border-right: 4px solid #f59e0b !important;
  transition: background-color 0.2s ease;
}

body[data-theme="dark"] .offcut-row {
  background-color: rgba(245, 158, 11, 0.09) !important;
  border-right: 4px solid #d97706 !important;
}

.offcut-row:hover {
  background-color: rgba(245, 158, 11, 0.14) !important;
}

.stock-badge-low {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(225, 29, 72, 0.12);
  color: #e11d48;
  border: 1px solid rgba(225, 29, 72, 0.35);
}

/* Glass Inputs */
.glass-input {
  background: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  transition: all 0.2s ease;
}

.glass-input:focus {
  border-color: var(--theme-primary) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2) !important;
  outline: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.5);
}

body[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #0f172a;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #334155;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Table Styles */
.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.custom-table th {
  padding: 12px 14px;
  white-space: nowrap;
}

.custom-table td {
  padding: 12px 14px;
}

.custom-table tbody tr:hover {
  background: rgba(241, 245, 249, 0.7);
}

body[data-theme="dark"] .custom-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.8);
}

/* Table Foot & Summary Rows */
.custom-table tfoot {
  border-top: 2px solid var(--border-color);
}

.tfoot-row {
  font-weight: 700;
  transition: background 0.15s ease;
}

.tfoot-row-plate {
  background: rgba(6, 182, 212, 0.08);
}

.tfoot-row-section {
  background: rgba(245, 158, 11, 0.08);
}

.tfoot-row-grandtotal {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.1), rgba(16, 185, 129, 0.1));
  border-top: 2px solid #dc2626;
}

.tfoot-row-grandtotal td {
  padding-top: 14px;
  padding-bottom: 14px;
}

.summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
}

.badge-plate-summary {
  background: rgba(6, 182, 212, 0.15);
  color: #0284c7;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-section-summary {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-total-summary {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
  border: 1px solid #dc2626;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
}

.badge-inward {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-outward {
  background: rgba(225, 29, 72, 0.15);
  color: #e11d48;
  border: 1px solid rgba(225, 29, 72, 0.3);
}

.badge-material {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

/* Granular Summary Table */
.inventory-summary-box {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
}

.compact-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.compact-summary-table th {
  padding: 10px 12px;
  white-space: nowrap;
}

.compact-summary-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.mini-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.mini-progress-bg {
  flex: 1;
  height: 7px;
  background: rgba(203, 213, 225, 0.5);
  border-radius: 4px;
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.compact-stats-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.compact-stat-pill {
  flex: 1;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.15s ease;
}

.compact-stat-pill:hover {
  transform: translateY(-2px);
}

.compact-stat-pill.pill-plate {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.05);
}

.compact-stat-pill.pill-section {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.05);
}

.compact-stat-pill.pill-total {
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.06);
}

.pct-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #0284c7;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.pct-gold {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pct-green {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

/* Print Invoice Styles */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    direction: rtl !important;
  }

  .no-print, header, nav, .btn, button, footer, #particle-canvas {
    display: none !important;
  }

  .app-container {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .p5-card {
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .custom-table, .compact-summary-table {
    border: 1px solid #475569 !important;
    color: #000000 !important;
  }

  .custom-table th, .custom-table td,
  .compact-summary-table th, .compact-summary-table td {
    border: 1px solid #64748b !important;
    color: #000000 !important;
    background: none !important;
  }

  .print-header {
    display: block !important;
  }
}

/* ==========================================================================
   APP FOOTER (Exact P5 Poolad Sazeh Brand Identity)
   ========================================================================== */
.app-footer {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-shrink: 0;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-brand-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.footer-logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  transition: all 0.25s ease;
}

body[data-theme="light"] .footer-logo-img {
  filter: none;
}

.footer-logo-img:hover {
  transform: scale(1.05);
}

.footer-desc-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.footer-links a, .colored-footer-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  direction: ltr;
  font-size: 0.8rem;
}

.footer-links a:hover, .colored-footer-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.2);
  border-color: var(--theme-primary);
}

body[data-theme="light"] .colored-footer-link {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.footer-icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.footer-divider {
  opacity: 0.4;
  color: var(--text-muted);
}

.footer-author-badge-wrap {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.author-badge-a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 18px;
  border-radius: 20px;
  background: rgba(6, 182, 212, 0.08);
  border: 1.5px solid rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.15);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body[data-theme="light"] .author-badge-a {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.45);
  color: #0f172a;
}

.author-badge-a:hover {
  transform: translateY(-2px) scale(1.03);
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
  color: var(--accent-cyan);
}

.author-badge-a .badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  transition: transform 0.3s ease;
}

.author-badge-a:hover .badge-icon {
  transform: rotate(12deg) scale(1.15);
}

/* ==========================================================================
   ENHANCED STAHL TABLE STYLES
   ========================================================================== */
.stahl-category-pill {
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  white-space: nowrap;
}

.stahl-category-pill.active, .stahl-category-pill:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.btn-stahl-use {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.12);
  color: #0284c7;
  border: 1px solid rgba(6, 182, 212, 0.35);
  transition: all 0.2s ease;
}

.btn-stahl-use:hover {
  background: #06b6d4;
  color: #ffffff;
  border-color: #06b6d4;
}

.btn-stahl-copy {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(241, 245, 249, 0.9);
  color: #475569;
  border: 1px solid #cbd5e1;
  transition: all 0.2s ease;
}

body[data-theme="dark"] .btn-stahl-copy {
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  border-color: #475569;
}

.btn-stahl-copy:hover {
  background: #475569;
  color: #ffffff;
}

/* ==========================================================================
   DARK THEME COMPREHENSIVE OVERRIDES (data-theme="dark")
   ========================================================================== */
body[data-theme="dark"] {
  background-color: #070709 !important;
  color: #f8fafc !important;
}

/* 1. Header & Brand Title */
body[data-theme="dark"] .app-header {
  background: rgba(15, 17, 26, 0.90) !important;
  border-color: rgba(220, 38, 38, 0.4) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
}

body[data-theme="dark"] .app-header h2 {
  color: #f8fafc !important;
}

body[data-theme="dark"] .app-header .w-12.bg-white {
  background-color: #1e293b !important;
  border-color: rgba(220, 38, 38, 0.4) !important;
}

body[data-theme="dark"] #theme-toggle-btn {
  background-color: #1e293b !important;
  color: #fbbf24 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

body[data-theme="dark"] #btn-no-letterhead-mode {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Nav Tabs */
body[data-theme="dark"] nav.bg-slate-100 {
  background-color: #181b2a !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body[data-theme="dark"] .tab-btn:not(.active) {
  color: #94a3b8 !important;
}

body[data-theme="dark"] .tab-btn:not(.active):hover {
  background-color: #262a3d !important;
  color: #f8fafc !important;
}

/* 2. Executive Cards (.p5-card) & Container Backgrounds */
body[data-theme="dark"] .p5-card {
  background-color: #0f121d !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

body[data-theme="dark"] .p5-card h2,
body[data-theme="dark"] .p5-card h3,
body[data-theme="dark"] .p5-card label,
body[data-theme="dark"] .p5-card th {
  color: #f8fafc !important;
}

body[data-theme="dark"] .text-slate-800,
body[data-theme="dark"] .text-slate-700 {
  color: #f8fafc !important;
}

body[data-theme="dark"] .text-slate-600,
body[data-theme="dark"] .text-slate-500 {
  color: #cbd5e1 !important;
}

body[data-theme="dark"] .text-slate-400 {
  color: #94a3b8 !important;
}

body[data-theme="dark"] .bg-white {
  background-color: #0f121d !important;
}

body[data-theme="dark"] .bg-slate-100,
body[data-theme="dark"] .bg-slate-50 {
  background-color: #181b2a !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

body[data-theme="dark"] .border-slate-200,
body[data-theme="dark"] .border-slate-300 {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* 3. Form Inputs & Selects */
body[data-theme="dark"] input:not([type="submit"]):not([type="button"]),
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .glass-input {
  background-color: #181b2a !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

body[data-theme="dark"] select option {
  background-color: #0f121d !important;
  color: #f8fafc !important;
}

/* 4. Stat Badges & Colored Cards in Dark Mode */
body[data-theme="dark"] .bg-cyan-50 {
  background-color: rgba(6, 182, 212, 0.15) !important;
  border-color: rgba(6, 182, 212, 0.35) !important;
  color: #38bdf8 !important;
}

body[data-theme="dark"] .bg-emerald-50 {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #34d399 !important;
}

body[data-theme="dark"] .bg-rose-50 {
  background-color: rgba(244, 63, 94, 0.15) !important;
  border-color: rgba(244, 63, 94, 0.35) !important;
  color: #fb7185 !important;
}

body[data-theme="dark"] .bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fbbf24 !important;
}

body[data-theme="dark"] .bg-red-50 {
  background-color: rgba(220, 38, 38, 0.15) !important;
  border-color: rgba(220, 38, 38, 0.35) !important;
  color: #f87171 !important;
}

body[data-theme="dark"] .bg-red-100 {
  background-color: rgba(220, 38, 38, 0.2) !important;
  border-color: rgba(220, 38, 38, 0.4) !important;
  color: #f87171 !important;
}

body[data-theme="dark"] .bg-cyan-100 {
  background-color: rgba(6, 182, 212, 0.2) !important;
  border-color: rgba(6, 182, 212, 0.4) !important;
  color: #38bdf8 !important;
}

body[data-theme="dark"] .bg-emerald-100 {
  background-color: rgba(16, 185, 129, 0.2) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #34d399 !important;
}

body[data-theme="dark"] .bg-rose-100 {
  background-color: rgba(244, 63, 94, 0.2) !important;
  border-color: rgba(244, 63, 94, 0.4) !important;
  color: #fb7185 !important;
}

body[data-theme="dark"] .bg-amber-100 {
  background-color: rgba(245, 158, 11, 0.2) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #fbbf24 !important;
}

/* 5. Tables & Divide Lines */
body[data-theme="dark"] .custom-table th,
body[data-theme="dark"] .compact-summary-table th {
  background-color: #181b2a !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

body[data-theme="dark"] .custom-table td,
body[data-theme="dark"] .compact-summary-table td {
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

body[data-theme="dark"] .custom-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

body[data-theme="dark"] .divide-slate-100 > * + *,
body[data-theme="dark"] .divide-slate-200 > * + * {
  border-color: rgba(255, 255, 255, 0.06) !important;
}

/* 6. Footer in Dark Mode */
body[data-theme="dark"] .app-footer {
  background-color: #0f121d !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}

body[data-theme="dark"] .colored-footer-link {
  background-color: #1a1b24 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body[data-theme="dark"] .btn-length-preset {
  background-color: #1a1b24 !important;
  color: #d1d5db !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Universal True Charcoal Black Dark Mode Overrides (Zero Navy Blue) */
html.dark body,
body[data-theme="dark"],
html[data-theme="dark"] body {
  background-color: #08080a !important;
  color: #f8fafc !important;
}

body[data-theme="dark"] .bg-white {
  background-color: #121319 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

body[data-theme="dark"] .bg-slate-50,
body[data-theme="dark"] .bg-slate-100 {
  background-color: #1a1b24 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

body[data-theme="dark"] .bg-slate-200 {
  background-color: #262833 !important;
  color: #f8fafc !important;
}

body[data-theme="dark"] .text-slate-800,
body[data-theme="dark"] .text-slate-900 {
  color: #f8fafc !important;
}

body[data-theme="dark"] .text-slate-700 {
  color: #d1d5db !important;
}

body[data-theme="dark"] .text-slate-600 {
  color: #9ca3af !important;
}

body[data-theme="dark"] .border-slate-200,
body[data-theme="dark"] .border-slate-300 {
  border-color: rgba(255, 255, 255, 0.10) !important;
}

body[data-theme="dark"] select.glass-input,
body[data-theme="dark"] input.glass-input {
  background-color: #1a1b24 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

body[data-theme="dark"] select.glass-input option {
  background-color: #121319 !important;
  color: #f8fafc !important;
}

/* ==========================================================================
   OFFICIAL PRINT STYLESHEET (@media print)
   ========================================================================== */
@media print {
  @page {
    size: A4 landscape;
    margin: 8mm 8mm 8mm 8mm;
  }

  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    direction: rtl !important;
    text-align: right !important;
    font-size: 10pt !important;
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide Web UI Components */
  .no-print,
  .app-header,
  .app-footer,
  .app-container,
  #custom-modal-overlay,
  button,
  input,
  select,
  nav,
  .history-period-pill,
  .dash-factory-pill,
  .glass-input,
  .p5-card {
    display: none !important;
  }

  /* Display Official Print Template */
  .print-only,
  #official-print-template {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
  }

  /* Letterhead Header */
  .print-letterhead-wrap {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 3px double #dc2626 !important;
    padding-bottom: 8px !important;
    margin-bottom: 10px !important;
  }

  .print-company-name {
    font-size: 16pt !important;
    font-weight: 900 !important;
    color: #dc2626 !important;
    margin: 0 !important;
  }

  .print-company-sub {
    font-size: 8.5pt !important;
    color: #475569 !important;
    margin: 2px 0 4px 0 !important;
  }

  .print-doc-title {
    font-size: 10.5pt !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    background: #f1f5f9 !important;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    display: inline-block !important;
    border: 1px solid #cbd5e1 !important;
  }

  .print-logo {
    height: 46px !important;
    object-fit: contain !important;
  }

  .print-meta-box {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    background: #f8fafc !important;
    font-size: 8pt !important;
    line-height: 1.5 !important;
    min-width: 200px !important;
  }

  .print-meta-row span {
    color: #64748b !important;
  }

  .print-meta-row strong {
    color: #0f172a !important;
  }

  /* Executive Summary Bar */
  .print-summary-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .print-summary-card {
    border: 1px solid #94a3b8 !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    background: #f1f5f9 !important;
    font-size: 8pt !important;
  }

  .print-summary-card span {
    display: block !important;
    color: #475569 !important;
    font-size: 7.5pt !important;
    font-weight: 700 !important;
  }

  .print-summary-card strong {
    display: block !important;
    color: #dc2626 !important;
    font-size: 10pt !important;
    font-weight: 900 !important;
    margin-top: 2px !important;
  }

  /* Official Data Table */
  .print-official-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 8.5pt !important;
    margin-bottom: 14px !important;
  }

  .print-official-table th,
  .print-official-table td {
    border: 1px solid #334155 !important;
    padding: 5px 6px !important;
    text-align: right !important;
  }

  .print-official-table th {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    font-size: 8.5pt !important;
  }

  .print-official-table tr:nth-child(even) {
    background-color: #f8fafc !important;
  }

  /* Official Signatures Block */
  .print-signatures-wrapper {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 14px !important;
    margin-top: 18px !important;
    margin-bottom: 10px !important;
    page-break-inside: avoid !important;
  }

  .print-signature-box {
    border: 1px solid #64748b !important;
    border-radius: 8px !important;
    padding: 10px 12px !important;
    background: #ffffff !important;
    text-align: center !important;
    font-size: 8.5pt !important;
  }

  .print-signature-box .sig-title {
    font-weight: 900 !important;
    font-size: 9.5pt !important;
    color: #0f172a !important;
    border-bottom: 1px dashed #cbd5e1 !important;
    padding-bottom: 4px !important;
    margin-bottom: 4px !important;
  }

  .print-signature-box .sig-role {
    font-size: 7.5pt !important;
    color: #64748b !important;
    margin-bottom: 14px !important;
  }

  .print-signature-box .sig-line {
    text-align: right !important;
    font-size: 8pt !important;
    color: #334155 !important;
    margin-top: 6px !important;
  }

  /* Official Footer */
  .print-official-footer {
    border-top: 1px solid #cbd5e1 !important;
    padding-top: 5px !important;
    font-size: 7.5pt !important;
    color: #64748b !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
}


