/* ============================================
   LEGAL TOOLS - SHARED STYLES
   Matches main website design system
   ============================================ */

/* === Google Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Frank+Ruhl+Libre:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');


/* === Court Style Fonts === */
@font-face {
  font-family: "David";
  src: url(./david.ttf);
}
@font-face {
  font-family: "David";
  src: url(./davidbd.ttf);
  font-weight: bold;
}
@font-face {
  font-family: "Calibri";
  src: url(./calibri.ttf);
}
@font-face {
  font-family: "Calibri";
  src: url(./calibrib.ttf);
  font-weight: bold;
}

/* === Design Tokens === */
:root {
  /* Colors - matching main site */
  --navy-950: #050a12;
  --navy-900: #0a1628;
  --navy-800: #0f2137;
  --navy-700: #1a3352;
  --navy-600: #1e3a5f;
  --navy-500: #2a4a73;
  --navy-400: #3d5f8a;
  --navy-300: #5a7ba3;
  
  --gold-700: #5c4400;
  --gold-600: #6b5000;
  --gold-500: #8b6914;
  --gold-400: #d4a84b;
  --gold-300: #e6c77a;
  --gold-200: #f0dba3;
  --gold-100: #faf3e0;
  
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #3d4654;
  --gray-700: #2d3748;
  --gray-800: #1a202c;
  --gray-900: #111827;
  
  /* Typography */
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-hebrew: 'Frank Ruhl Libre', 'David Libre', 'Times New Roman', serif;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition-medium: 0.3s ease-out;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
  
  /* Print settings */
  --fnt_sz_rg: 12pt;
  --fnt_sz_bg: 14pt;
  --mrgn_sides: 25mm;
  --mrgn_tb: 25mm;
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--gray-800);
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* RTL/LTR Support */
.he, [dir="rtl"] {
  direction: rtl;
  font-family: var(--font-hebrew), var(--font-sans);
}

.en, [dir="ltr"] {
  direction: ltr;
  font-family: var(--font-sans);
}

/* Language-based visibility: hide elements based on body class */
body.he .en,
body[dir="rtl"] .en {
  display: none !important;
}

body.en .he,
body[dir="ltr"] .he {
  display: none !important;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--navy-800);
  margin: 0 0 var(--space-md) 0;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.2rem; min-height: 1.5em; }
h4 { font-size: 1.1rem; }

p { margin: 0 0 var(--space-md) 0; }

a {
  color: var(--gold-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--gold-500);
  text-decoration: underline;
}

/* === Page Header === */
.tool-header {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-950) 100%);
  color: var(--white);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  border-bottom: 3px solid var(--gold-500);
}

.tool-header h1 {
  color: var(--white);
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.tool-header .subtitle {
  color: var(--gold-300);
  font-size: 0.9rem;
  font-style: italic;
}

/* === Main Container === */
.tool-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-xl);
}

/* === Cards === */
.card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  border: 1px solid var(--gray-200);
}

.card-header {
  border-bottom: 2px solid var(--gold-500);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-lg);
}

.card-header h2, .card-header h3 {
  margin: 0;
  color: var(--navy-800);
}

/* === Form Elements === */
label {
  display: block;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-xs);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(139, 105, 20, 0.15);
}

input[type="checkbox"] {
  width: auto;
  margin-inline-end: var(--space-sm);
  accent-color: var(--gold-500);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

/* === Buttons === */
button,
input[type="submit"],
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--white);
  background: linear-gradient(135deg, var(--gold-600) 0%, var(--gold-500) 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

button:hover,
input[type="submit"]:hover,
.btn:hover {
  background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-400) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active,
input[type="submit"]:active,
.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.btn-danger {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

/* === Tables === */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-lg);
}

th, td {
  padding: var(--space-sm) var(--space-md);
  text-align: start;
  border-bottom: 1px solid var(--gray-200);
}

th {
  background: var(--navy-800);
  color: var(--white);
  font-weight: 600;
}

th:first-child {
  border-radius: 8px 0 0 0;
}

th:last-child {
  border-radius: 0 8px 0 0;
}

tr:hover td {
  background: var(--gray-50);
}

tr.total td {
  background: var(--gold-100);
  font-weight: 600;
  border-top: 2px solid var(--gold-500);
}

/* === Form Groups === */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
}

/* === Dropzone === */
.dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: var(--space-2xl);
  text-align: center;
  background: var(--gray-50);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--gold-500);
  background: var(--gold-100);
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.dropzone-text {
  color: var(--gray-600);
  font-size: 1.1rem;
}

/* === Settings Panel === */
.settings-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: var(--space-md);
  transition: all var(--transition-fast);
}

.settings-toggle:hover {
  background: var(--gray-200);
}

.settings-panel {
  display: none;
  padding: var(--space-lg);
  background: var(--gray-50);
  border-radius: 8px;
  margin-bottom: var(--space-lg);
}

.settings-panel.is-open {
  display: block;
}

/* === File List === */
.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.file-list-item {
  display: grid;
  grid-template-columns: 1fr 120px 1fr 40px;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--gray-200);
  transition: background var(--transition-fast);
}

.file-list-item:hover {
  background: var(--gray-50);
}

.file-list-item input {
  width: 100%;
}

.file-remove {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1.2rem;
  padding: 0;
}

.file-remove:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

/* === Download Link === */
.download-link {
  display: block;
  padding: var(--space-lg);
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-900) 100%);
  border-radius: 12px;
  color: var(--white);
  text-align: center;
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-top: var(--space-lg);
}

.download-link:hover {
  background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-800) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: var(--gold-300);
}

.download-link h3 {
  color: var(--gold-400);
  margin-bottom: var(--space-xs);
}

.download-link p {
  color: var(--gray-300);
  margin: 0;
  font-size: 0.9rem;
}

/* === Navigation Menu === */
.tool-nav {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

[dir="rtl"] .tool-nav {
  right: auto;
  left: var(--space-md);
  flex-direction: row-reverse;
}

.menu-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--navy-800);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.menu-toggle:hover {
  background: var(--navy-700);
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--white);
  border-radius: 1px;
  transition: all var(--transition-fast);
}

.menu-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + var(--space-sm));
  right: 0;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
  overflow: hidden;
}

[dir="rtl"] .menu-dropdown {
  right: auto;
  left: 0;
}

.menu-toggle.is-open + .menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.menu-dropdown a {
  display: block;
  padding: var(--space-md) var(--space-lg);
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  transition: all var(--transition-fast);
}

.menu-dropdown a:hover {
  background: var(--gold-100);
  color: var(--gold-700);
  text-decoration: none;
}

.menu-dropdown a:last-child {
  border-bottom: none;
}

/* === Language Toggle === */
.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0.2em;
  margin: 0;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid var(--gray-300);
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-medium);
  text-decoration: none;
  margin-inline-start: auto;
}

.lang-toggle:hover {
  background: var(--gray-50);
  border-color: var(--gold-400);
  transform: scale(1.05);
}

/* Legacy select-based language selector */
.lang-selector {
  position: fixed;
  top: calc(var(--space-md) + 60px);
  right: var(--space-md);
  left: auto;
  z-index: 1000;
}

[dir="rtl"] .lang-selector {
  right: auto;
  left: var(--space-md);
}

.lang-selector select {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9rem;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  cursor: pointer;
}

/* === Loading Overlay === */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-medium);
}

.loading-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.loading-text {
  color: var(--gold-400);
  font-size: 1.5rem;
  font-weight: 500;
}

/* === Utility Classes === */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-1 { margin-top: var(--space-md); }
.mt-2 { margin-top: var(--space-lg); }
.mb-1 { margin-bottom: var(--space-md); }
.mb-2 { margin-bottom: var(--space-lg); }

/* === PDF Preview === */
.pdf-preview {
  width: 100%;
  height: 600px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--gray-100);
}

.pdf-preview[src=""] {
  display: none;
}

/* === Responsive === */
@media (max-width: 768px) {
  .tool-container {
    padding: var(--space-md);
  }
  
  .card {
    padding: var(--space-lg);
  }
  
  .file-list-item {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   LETTER TOOL SPECIFIC STYLES
   ============================================ */

/* Hide print-only elements on screen */
#header, #output { display: none; }
.print_only { display: none; }

/* Document Editor */
.editor-section {
  margin-bottom: var(--space-lg);
}

.editor-section h2 {
  color: var(--navy-800);
  font-size: 1.25rem;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--gold-500);
}

.editor-section h3 {
  color: var(--gray-700);
  font-size: 1rem;
  margin-bottom: var(--space-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.editor-section h3::before {
  content: "▶";
  font-size: 0.7em;
  transition: transform var(--transition-fast);
}

.editor-section h3.open::before {
  transform: rotate(90deg);
}

textarea#letter_content {
  font-family: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  min-height: 92vh;
  font-size: 0.95rem;
  line-height: 1.35;
  resize: vertical;
  tab-size: 4;
  -moz-tab-size: 4;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* RTL markdown editor - use Hebrew-friendly monospace */
[dir="rtl"] textarea#letter_content,
.he textarea#letter_content {
  font-family: "Courier New", "David", monospace;
  letter-spacing: 0;
}

/* Form Layout */
.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-xl);
  margin-bottom: var(--space-md);
}

.option-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.option-item label {
  margin: 0;
  cursor: pointer;
}

.field-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-md);
}

.field-row label {
  margin: 0;
  text-align: end;
}

[dir="rtl"] .field-row label {
  text-align: start;
}

.field-row input[type="text"],
.field-row select {
  width: 100%;
  max-width: 400px;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.action-buttons .btn {
  flex: 1;
  min-width: 150px;
  text-align: center;
}

/* Settings Panel */
.settings-content {
  display: none;
  padding: var(--space-lg);
  background: var(--gray-50);
  border-radius: 8px;
  margin-top: var(--space-md);
}

.settings-content.is-open {
  display: block;
}

.settings-content textarea {
  min-height: 80px;
  margin-top: var(--space-sm);
}

/* File Import Button */
.import-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
  color: var(--gray-700);
}

.import-btn:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

input[type="file"] {
  display: none;
}

/* Dropzone for letter */
#dropzone {
  transition: all var(--transition-fast);
  border-radius: 12px;
  padding: var(--space-md);
}

#dropzone.dragover {
  background: var(--gold-100);
  border: 2px dashed var(--gold-500);
}

/* Instructions */
.instructions {
  background: var(--gray-50);
  border-radius: 8px;
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.instructions h2 {
  font-size: 1.15rem;
  color: var(--navy-800);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--gray-200);
}

.instructions h2:first-child {
  margin-top: 0;
}

.instructions h5 {
  color: var(--navy-800);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.instructions h5:first-child {
  margin-top: 0;
}

.instructions code {
  background: var(--navy-800);
  color: var(--gold-300);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.instructions ul {
  padding-inline-start: 1.5em;
}

.instructions li {
  margin-bottom: var(--space-sm);
}

/* Responsive for letter */
@media (max-width: 768px) {
  .field-row {
    grid-template-columns: 1fr;
  }
  
  .field-row label {
    text-align: start;
  }
}

/* === Dark Mode Support === */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-900) 100%);
    color: var(--gray-200);
  }
  
  /* All headings need light colors in dark mode */
  h1, h2, h3, h4, h5, h6 {
    color: var(--gray-100);
  }
  
  .card {
    background: var(--navy-800);
    border-color: var(--navy-700);
  }
  
  .card-header h2,
  .card-header h3 {
    color: var(--white);
  }
  
  label {
    color: var(--gray-300);
  }
  
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="email"],
  select,
  textarea {
    background: var(--navy-700);
    border-color: var(--navy-600);
    color: var(--gray-200);
  }
  
  input:focus,
  select:focus,
  textarea:focus {
    border-color: var(--gold-500);
    box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.2);
  }
  
  .dropzone {
    background: var(--navy-700);
    border-color: var(--navy-600);
  }
  
  .dropzone:hover,
  .dropzone.dragover {
    background: rgba(139, 105, 20, 0.2);
    border-color: var(--gold-500);
  }
  
  .settings-toggle {
    background: var(--navy-700);
    border-color: var(--navy-600);
    color: var(--gray-300);
  }
  
  .settings-toggle:hover {
    background: var(--navy-600);
  }

  .settings-toggle-btn:hover {
    color: var(--gold-400);
    background: rgba(139, 105, 20, 0.2);
  }
  
  .settings-panel {
    background: var(--navy-700);
  }
  
  .file-list-item:hover {
    background: var(--navy-700);
  }
  
  .file-remove {
    background: var(--navy-700);
    border-color: var(--navy-600);
    color: var(--gray-400);
  }
  
  th {
    background: var(--navy-950);
  }
  
  td {
    border-color: var(--navy-700);
  }
  
  tr:hover td {
    background: var(--navy-700);
  }
  
  tr.total td {
    background: rgba(139, 105, 20, 0.2);
  }
  
  .btn-secondary {
    background: var(--navy-700);
    color: var(--gray-300);
    border-color: var(--navy-600);
  }
  
  .btn-secondary:hover {
    background: var(--navy-600);
    color: var(--white);
  }
  
  .menu-dropdown {
    background: var(--navy-800);
  }
  
  .menu-dropdown a {
    color: var(--gray-300);
    border-color: var(--navy-700);
  }
  
  .menu-dropdown a:hover {
    background: rgba(139, 105, 20, 0.2);
    color: var(--gold-400);
  }
  
  a {
    color: var(--gold-400);
  }
  
  a:hover {
    color: var(--gold-300);
  }
  
  .instructions {
    background: var(--navy-700);
  }

  .instructions h2,
  .instructions h5 {
    color: var(--gold-300);
    border-bottom-color: var(--navy-600);
  }

  .instructions p,
  .instructions li {
    color: var(--gray-300);
  }

  .instructions code {
    background: var(--navy-950);
  }

  .editor-section h3 {
    color: var(--gray-300);
  }

  .editor-section h3:hover {
    color: var(--gold-400);
  }

  .settings-content {
    background: var(--navy-700);
  }
  
  .file-list-item {
    background: var(--navy-800);
    border-color: var(--navy-700);
  }

  .file-list-item:hover {
    background: var(--navy-700);
  }

  .file-list-item.is-cover {
    background: rgba(139, 105, 20, 0.2);
    border-left-color: var(--gold-500);
  }
  
  .expense-table tr:hover td {
    background: var(--navy-700);
  }

  .expense-table tr.total td {
    background: rgba(139, 105, 20, 0.25);
    color: var(--gold-300);
    border-top-color: var(--gold-400);
  }

  .expense-table .comment {
    color: var(--gray-400);
  }

  .danger-zone {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
  }

  .export-section {
    background: var(--navy-700);
  }
}

/* ============================================
   BATES TOOL SPECIFIC STYLES
   ============================================ */

/* File list styling */
.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.file-list-header {
  display: grid;
  grid-template-columns: 1fr 120px 1fr 40px;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--navy-800);
  color: var(--white);
  font-weight: 600;
  border-radius: 8px 8px 0 0;
}

.file-list-item {
  display: grid;
  grid-template-columns: 1fr 120px 1fr 40px;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  transition: background var(--transition-fast);
  cursor: grab;
}

.file-list-item:hover {
  background: var(--gray-50);
}

.file-list-item.dragging {
  opacity: 0.5;
  background: var(--gold-100);
}

.file-list-item.is-cover {
  background: var(--gold-100);
  border-left: 3px solid var(--gold-500);
}

.file-list-item input {
  width: 100%;
}

/* Dropzone enhancements */
.dropzone {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dropzone-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.dropzone-text {
  font-size: 1.25rem;
  color: var(--gray-600);
}

.dropzone-subtext {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-top: var(--space-sm);
}

/* Settings grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.settings-grid .form-group {
  margin-bottom: var(--space-md);
}

.settings-grid label {
  display: block;
  margin-bottom: var(--space-xs);
}

/* Checkbox row */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.checkbox-row label {
  margin: 0;
  cursor: pointer;
}

/* PDF Preview */
.pdf-preview-container {
  margin-top: var(--space-xl);
}

.pdf-preview {
  width: 100%;
  height: 600px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--gray-100);
}

.pdf-preview:not([src]), .pdf-preview[src=""] {
  display: none;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-medium);
}

.loading-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--navy-700);
  border-top-color: var(--gold-400);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-lg);
}

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

.loading-text {
  color: var(--gold-400);
  font-size: 1.5rem;
  font-weight: 500;
}

/* Action buttons row */
.action-row {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  flex-wrap: wrap;
}

.action-row .btn {
  flex: 1;
  min-width: 150px;
}

/* Demo template (hidden) */
#demo {
  display: none !important;
}

/* Responsive for bates */
@media (max-width: 768px) {
  .file-list-header,
  .file-list-item {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .file-list-header > *:not(:first-child) {
    display: none;
  }

  .file-list-item > div {
    display: flex;
    flex-direction: column;
  }

  .file-list-item > div::before {
    content: attr(data-label);
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 2px;
  }
}

/* ============================================
   EXPENSES TOOL SPECIFIC STYLES
   ============================================ */

/* Form layout */
.expense-form {
  display: grid;
  gap: var(--space-lg);
}

.expense-form .form-group {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--space-md);
  align-items: center;
}

.expense-form .form-group label {
  margin: 0;
  text-align: end;
}

[dir="rtl"] .expense-form .form-group label {
  text-align: start;
}

.expense-form .form-group input {
  max-width: 400px;
}

.expense-form .form-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

/* Dropzone for form */
.expense-form.dragging {
  background: var(--gold-100);
  border: 2px dashed var(--gold-500);
  border-radius: 12px;
}

/* Expense Tables */
.expense-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-lg);
}

.expense-table th,
.expense-table td {
  padding: var(--space-sm) var(--space-md);
  text-align: start;
  border-bottom: 1px solid var(--gray-200);
}

.expense-table th {
  background: var(--navy-800);
  color: var(--white);
  font-weight: 600;
}

.expense-table th:first-child {
  border-radius: 8px 0 0 0;
}

.expense-table th:last-child {
  border-radius: 0 8px 0 0;
}

.expense-table tr:hover td {
  background: var(--gray-50);
}

.expense-table tr.total td {
  background: var(--gold-100);
  font-weight: 600;
  border-top: 2px solid var(--gold-500);
}

.expense-table .comment {
  font-size: 0.85em;
  color: var(--gray-600);
  margin-top: 2px;
}

.expense-table .remove-btn {
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1.2rem;
  transition: color var(--transition-fast);
}

.expense-table .remove-btn:hover {
  color: #dc2626;
}

/* Printed name */
#printed_name {
  text-align: center;
  color: var(--navy-800);
  margin-bottom: var(--space-lg);
  display: none;
}

/* Danger zone */
.danger-zone {
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

.danger-zone h3 {
  color: #dc2626;
  margin-bottom: var(--space-md);
}

.danger-zone .btn-danger {
  margin-right: var(--space-md);
}

/* Export section */
.export-section {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  background: var(--gray-50);
  border-radius: 8px;
}

.export-section h3 {
  margin: 0;
  color: var(--navy-800);
}

/* Settings toggle button (h3 used as toggle) */
.instructions .settings-toggle-btn, .settings-toggle-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;
  transition: all var(--transition-fast);
  user-select: none;
  font-size: 1.15rem;
}

.instructions .settings-toggle-btn:hover, .settings-toggle-btn:hover {
  color: var(--gold-600);
  background: var(--gold-100);
}

.instructions .settings-toggle-btn::before, .settings-toggle-btn::before {
  content: "▶";
  font-size: 0.7em;
  transition: transform var(--transition-fast);
}
.he .instructions .settings-toggle-btn::before, .he .settings-toggle-btn::before {
  transform: rotate(180deg);
}

.instructions .settings-toggle-btn.open::before, .settings-toggle-btn.open::before {
  transform: rotate(90deg);
}

/* Responsive for expenses */
@media (max-width: 768px) {
  .expense-form .form-group {
    grid-template-columns: 1fr;
  }

  .expense-form .form-group label {
    text-align: start;
  }
}
