/* ==========================================================================
   SHREE PARVATHY SHIPPING - GATE PASS GENERATOR
   Executive Maritime Theme & Exact 1:1 A4 Printable Gate Pass Sheet
   ========================================================================== */

:root {
  /* UI Theme Palette - Dark (Default) */
  --bg-main: #0b111e;
  --bg-surface: #131d2f;
  --bg-card: #1a273e;
  --bg-card-subtle: #213250;
  --border-color: #2e4368;
  --border-focus: #38bdf8;
  
  --bg-input: #0f172a;
  --bg-input-focus: #111e38;
  --bg-preview: #0f1623;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --success: #10b981;
  --success-hover: #059669;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Roboto Mono', monospace;
  --font-doc-heading: 'Times New Roman', 'Lora', serif;
  --font-doc-body: 'Times New Roman', 'Lora', serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --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 12px 30px rgba(0, 0, 0, 0.5);
  --shadow-doc: 0 15px 35px rgba(0, 0, 0, 0.4), 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* Light Theme Variables */
:root.light-theme, html.light-theme, body.light-theme {
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --border-color: #cbd5e1;
  --border-focus: #0284c7;
  
  --bg-input: #ffffff;
  --bg-input-focus: #f0f9ff;
  --bg-preview: #e2e8f0;

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

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.12);
  --shadow-doc: 0 15px 35px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.08);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* --------------------------------------------------------------------------
   HEADER NAVIGATION
   -------------------------------------------------------------------------- */
.app-header {
  height: 68px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

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

.brand-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease-in-out;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-subtle);
  border-color: #47628f;
}

.btn-accent {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
}
.btn-accent:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: var(--success-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.text-danger {
  color: #f87171 !important;
}
.text-danger:hover {
  border-color: rgba(239, 68, 68, 0.5) !important;
}

/* --------------------------------------------------------------------------
   LAYOUT CONTAINER
   -------------------------------------------------------------------------- */
.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(100vh - 68px);
}

/* LEFT FORM PANE */
.form-pane {
  flex: 1;
  min-width: 480px;
  max-width: 640px;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  background: var(--bg-surface);
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.form-container {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-section-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
}

.form-section-banner h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-banner p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

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

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

/* FORM CARDS */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.form-card:hover {
  border-color: #3d567f;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-title-flex .card-title {
  margin-bottom: 0;
}

.auto-calc-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.input-grid {
  display: grid;
  gap: 12px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group label .req {
  color: #f87171;
}

/* Inputs & Selects */
input[type="text"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  height: 38px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input, #0f172a);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.86rem;
  outline: none;
  transition: all 0.15s ease;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
  background: var(--bg-input-focus, #111e38);
}

input::placeholder {
  color: var(--text-dim);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  font-size: 0.85rem;
  pointer-events: none;
}

.input-with-icon input,
.input-with-icon select {
  padding-left: 34px;
}

.input-with-icon input#inp-pass-no {
  padding-right: 36px;
}

.btn-input-action {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: #38bdf8;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.15s ease;
}

.btn-input-action:hover {
  background: #38bdf8;
  color: #0f172a;
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-suffix .suffix {
  position: absolute;
  right: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  pointer-events: none;
}

.input-with-suffix input {
  padding-right: 40px;
}

.input-with-suffix.highlight input {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-weight: 700;
}

.custom-weight-override {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-control input {
  display: none;
}

.toggle-slider {
  width: 34px;
  height: 18px;
  background: #334155;
  border-radius: 20px;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.toggle-control input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-control input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

.toggle-label {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.form-actions-bar {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.form-actions-bar .btn {
  flex: 1;
  justify-content: center;
  padding: 12px;
  font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   RIGHT PANEL: LIVE PREVIEW & TOOLBAR
   -------------------------------------------------------------------------- */
.preview-pane {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  background: var(--bg-preview, #0f1623);
  overflow: hidden;
  transition: background-color 0.25s ease;
}

.preview-toolbar {
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-pill {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 10px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preview-dim {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.toolbar-center {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.tool-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
}

.zoom-indicator {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: #93c5fd;
  min-width: 44px;
  text-align: center;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-opt-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.ink-select {
  height: 28px;
  padding: 2px 8px;
  font-size: 0.76rem;
  border-radius: 4px;
  background: var(--bg-card);
}

.preview-scroll-viewport {
  flex: 1;
  overflow: auto;
  padding: 30px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: radial-gradient(circle at 50% 50%, #1e2b45 0%, #0d131f 100%);
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.preview-zoom-container {
  transform-origin: top center;
  transition: transform 0.15s ease-out;
}

/* --------------------------------------------------------------------------
   A5 COMPACT SHEET (148mm × 210mm) - CRISP, HIGH-LEGIBILITY & BALANCED
   -------------------------------------------------------------------------- */
.gatepass-page.a5-sheet {
  width: 148mm;
  height: 208mm;
  max-height: 208mm;
  background: #ffffff;
  color: #000000;
  font-family: var(--font-doc-body);
  padding: 9mm 14mm 9mm 14mm;
  box-shadow: var(--shadow-doc);
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  page-break-after: avoid;
  page-break-inside: avoid;
}

.gatepass-page.a5-sheet .doc-header-top { margin-bottom: 4px; }
.gatepass-page.a5-sheet .doc-licence-no { font-size: 11px; font-weight: 700; color: #000; }

.gatepass-page.a5-sheet .doc-company-block { margin-bottom: 11px; }
.gatepass-page.a5-sheet .doc-company-name { font-size: 23px; font-weight: 700; margin-bottom: 3px; color: #000; }
.gatepass-page.a5-sheet .doc-company-address { font-size: 9.8px; line-height: 1.38; max-width: 96%; color: #000; }

.gatepass-page.a5-sheet .doc-meta-block { margin-bottom: 11px; }
.gatepass-page.a5-sheet .meta-label { font-size: 12px; font-weight: 700; margin-right: 4px; min-width: 28px; color: #000; }
.gatepass-page.a5-sheet .meta-no-val { font-size: 13px; font-weight: 700; min-height: 18px; color: #000; }
.gatepass-page.a5-sheet .meta-field-line { min-height: 18px; font-size: 11.5px; font-weight: 600; padding: 0 4px; color: #000; }
.gatepass-page.a5-sheet .line-date,
.gatepass-page.a5-sheet .line-shift { width: 125px; }

.gatepass-page.a5-sheet .doc-recipients-block { margin-bottom: 11px; font-size: 11.5px; line-height: 1.32; color: #000; }

.gatepass-page.a5-sheet .doc-title-wrapper { margin: 7px 0 9px 0; }
.gatepass-page.a5-sheet .doc-title { font-size: 13.5px; font-weight: 700; color: #000; }

.gatepass-page.a5-sheet .doc-salutation-block { margin-bottom: 10px; }
.gatepass-page.a5-sheet .doc-salutation { font-size: 11.5px; margin-bottom: 3px; color: #000; }
.gatepass-page.a5-sheet .doc-permission-line { font-size: 11.5px; color: #000; }

.gatepass-page.a5-sheet .doc-items-block { gap: 6.5px; margin-bottom: 11px; }
.gatepass-page.a5-sheet .item-label,
.gatepass-page.a5-sheet .item-inline-label { font-size: 11.5px; color: #000; }
.gatepass-page.a5-sheet .item-inline-label { margin: 0 4px 0 10px; }
.gatepass-page.a5-sheet .item-field-line { min-height: 18px; font-size: 11.5px; font-weight: 600; padding: 0 4px 1px 4px; color: #000; }
.gatepass-page.a5-sheet .line-inline-date { width: 115px; }

.gatepass-page.a5-sheet .doc-weights-block { margin-top: 3px; margin-bottom: 12px; padding: 0; }
.gatepass-page.a5-sheet .weight-label { font-size: 11.5px; font-weight: 600; margin-right: 4px; color: #000; }
.gatepass-page.a5-sheet .weight-line { min-height: 18px; font-size: 11.5px; font-weight: 700; padding: 0 4px; color: #000; }

.gatepass-page.a5-sheet .doc-declaration-block { margin-bottom: 10px; }
.gatepass-page.a5-sheet .declaration-text { font-size: 11px; margin-bottom: 4px; color: #000; }
.gatepass-page.a5-sheet .thanking-text { font-size: 11.5px; color: #000; }

.gatepass-page.a5-sheet .doc-signature-block { margin-top: 20px; }
.gatepass-page.a5-sheet .sig-wrapper { min-width: 180px; }
.gatepass-page.a5-sheet .sig-salut { font-size: 11.5px; font-weight: 600; margin-bottom: 5px; color: #000; }
.gatepass-page.a5-sheet .sig-company { font-size: 12.5px; font-weight: 700; color: #000; }

/* --------------------------------------------------------------------------
   THE A4 PRINTABLE DOCUMENT (210mm × 297mm)
   -------------------------------------------------------------------------- */
.gatepass-page.a4-sheet {
  width: 210mm;
  height: 294mm;
  max-height: 294mm;
  background: #ffffff;
  color: #000000;
  font-family: var(--font-doc-body);
  padding: 14mm 20mm 14mm 20mm;
  box-shadow: var(--shadow-doc);
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  page-break-after: avoid;
  page-break-inside: avoid;
}

/* Ink color scheme for the filled text */
.gatepass-page.ink-black .item-field-line,
.gatepass-page.ink-black .meta-field-line,
.gatepass-page.ink-black .meta-no-val,
.gatepass-page.ink-black .weight-line {
  color: #050505;
}

.gatepass-page.ink-navy .item-field-line,
.gatepass-page.ink-navy .meta-field-line,
.gatepass-page.ink-navy .meta-no-val,
.gatepass-page.ink-navy .weight-line {
  color: #0d2850; /* Official deep blue ink */
}

/* Document Top Right Licence */
.doc-header-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.doc-licence-no {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #000;
}

/* Document Company Name & Address */
.doc-company-block {
  text-align: center;
  margin-bottom: 12px;
}

.doc-company-name {
  font-family: var(--font-doc-heading);
  font-size: 28px;
  font-weight: 700;
  color: #000;
  letter-spacing: 0.5px;
  line-height: 1.15;
  margin-bottom: 5px;
}

.doc-company-address {
  font-size: 11.8px;
  line-height: 1.4;
  color: #111;
  max-width: 92%;
  margin: 0 auto;
}

/* Reference No / Date / Shift Block */
.doc-meta-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.meta-col-left {
  display: flex;
  align-items: flex-end;
  width: 45%;
}

.meta-col-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 45%;
}

.meta-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.meta-label {
  font-size: 15px;
  font-weight: 700;
  margin-right: 6px;
  color: #000;
  min-width: 32px;
}

/* Strictly NO line under No. - matches original official document */
.meta-no-val {
  font-size: 16px;
  font-weight: 700;
  color: #000;
  min-height: 22px;
  display: inline-flex;
  align-items: flex-end;
  border-bottom: none !important;
  text-decoration: none !important;
  letter-spacing: 0.8px;
  padding: 0 4px;
}

.meta-field-line {
  border-bottom: 1.2px solid #000;
  min-height: 22px;
  display: inline-flex;
  align-items: flex-end;
  padding: 0 6px 1px 6px;
  font-size: 14.5px;
  font-weight: 600;
}

.line-date, .line-shift {
  width: 195px;
}

/* Authorities Recipients Block */
.doc-recipients-block {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.35;
  color: #000;
}

.recipient-left {
  text-align: left;
}

.recipient-right {
  text-align: left;
  width: 35%;
}

/* Document Title (EXPORT GATE PASS) */
.doc-title-wrapper {
  text-align: center;
  margin: 10px 0 12px 0;
}

.doc-title {
  font-family: var(--font-doc-heading);
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #000;
  display: inline-block;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Salutation Block */
.doc-salutation-block {
  margin-bottom: 10px;
}

.doc-salutation {
  font-size: 14px;
  color: #000;
  margin-bottom: 4px;
}

.doc-permission-line {
  font-size: 14px;
  color: #000;
}

/* Items Block (1 to 9) */
.doc-items-block {
  display: flex;
  flex-direction: column;
  gap: 8.5px;
  margin-bottom: 14px;
}

.doc-line-row {
  display: flex;
  align-items: flex-end;
  width: 100%;
}

.item-label {
  font-size: 14px;
  color: #000;
  white-space: nowrap;
  margin-right: 8px;
}

.item-inline-label {
  font-size: 14px;
  color: #000;
  white-space: nowrap;
  margin: 0 8px 0 14px;
}

.item-field-line {
  border-bottom: 1.2px solid #000;
  min-height: 20px;
  display: inline-flex;
  align-items: flex-end;
  padding: 0 6px 1px 6px;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-expand {
  flex: 1;
}

.line-vessel,
.line-sb,
.line-wharfage,
.line-vehicle {
  flex: 1;
}

.line-inline-date {
  width: 160px;
  flex-shrink: 0;
}

/* Weight Block */
.doc-weights-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 4px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.weight-cell {
  display: flex;
  align-items: flex-end;
  width: 31%;
}

.weight-label {
  font-size: 14px;
  color: #000;
  white-space: nowrap;
  margin-right: 8px;
}

.weight-line {
  border-bottom: 1.2px solid #000;
  min-height: 20px;
  flex: 1;
  display: inline-flex;
  align-items: flex-end;
  padding: 0 6px 1px 6px;
  font-size: 14px;
  font-weight: 700;
}

.doc-line-second {
  margin-top: -2px;
  width: 100%;
}

/* Footer Declaration & Signature Block */
.doc-declaration-block {
  margin-bottom: 14px;
}

.declaration-text {
  font-size: 14px;
  color: #000;
  margin-bottom: 8px;
}

.thanking-text {
  font-size: 14px;
  color: #000;
}

.doc-signature-block {
  display: flex;
  justify-content: flex-end;
  margin-top: 28px;
  margin-bottom: 0;
  padding-bottom: 0;
}

.sig-wrapper {
  text-align: right;
  min-width: 250px;
}

.sig-salut {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.sig-company {
  font-size: 15px;
  font-weight: 700;
}

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

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 960px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(15px);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal-card {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: #fff;
}

.modal-toolbar {
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
}

.search-box input {
  padding-left: 36px;
  height: 36px;
}

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

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.history-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-card);
}

.history-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

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

.action-btns-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.history-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  display: none;
}

.history-empty-state i {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

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

.toast {
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  font-size: 0.86rem;
  animation: slideIn 0.25s ease-out;
}

.toast.toast-success {
  border-left: 4px solid #10b981;
}

.toast.toast-info {
  border-left: 4px solid #38bdf8;
}

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

/* --------------------------------------------------------------------------
   WEIGHT UNIT SELECTOR & SUFFIX
   -------------------------------------------------------------------------- */
.weight-unit-select {
  height: 28px;
  padding: 2px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: #38bdf8;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.weight-unit-select:focus {
  border-color: var(--border-focus);
}

.input-with-suffix .suffix.weight-unit-suffix {
  color: #38bdf8;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.12);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
}

/* --------------------------------------------------------------------------
   THEME TOGGLE BUTTON
   -------------------------------------------------------------------------- */
#btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

#btn-theme-toggle #theme-icon {
  font-size: 0.95rem;
  color: #f59e0b;
  transition: transform 0.3s ease, color 0.2s ease;
}

.light-theme #btn-theme-toggle #theme-icon {
  color: #6366f1;
  transform: rotate(20deg);
}

/* --------------------------------------------------------------------------
   LIGHT THEME OVERRIDES & COMPONENT STYLING
   -------------------------------------------------------------------------- */
.light-theme .app-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.light-theme .brand-title {
  color: #0f172a;
}

.light-theme .brand-subtitle {
  color: #64748b;
}

.light-theme .btn-secondary {
  background: #ffffff;
  color: #1e293b;
  border-color: #cbd5e1;
}

.light-theme .btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.light-theme .form-pane {
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
}

.light-theme .form-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.light-theme .form-card:hover {
  border-color: #cbd5e1;
}

.light-theme .card-title {
  color: #1e40af;
}

.light-theme .card-title i {
  color: #2563eb;
}

.light-theme .form-section-banner {
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  border: 1px solid #bae6fd;
}

.light-theme .form-section-banner h2 {
  color: #0284c7;
}

.light-theme .form-section-banner p {
  color: #475569;
}

.light-theme .status-indicator {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.light-theme .status-dot {
  background: #16a34a;
  box-shadow: 0 0 6px #16a34a;
}

.light-theme .auto-calc-badge {
  color: #0284c7;
  background: #e0f2fe;
  border-color: #bae6fd;
}

.light-theme .form-group label {
  color: #334155;
}

.light-theme input[type="text"],
.light-theme input[type="date"],
.light-theme input[type="number"],
.light-theme select {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.light-theme input[type="text"]:focus,
.light-theme input[type="date"]:focus,
.light-theme input[type="number"]:focus,
.light-theme select:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.light-theme input::placeholder {
  color: #94a3b8;
}

.light-theme .input-with-icon i {
  color: #64748b;
}

.light-theme .btn-input-action {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0284c7;
}

.light-theme .btn-input-action:hover {
  background: #0284c7;
  color: #ffffff;
}

.light-theme .input-with-suffix.highlight input {
  background: #f0fdf4;
  border-color: #86efac;
  color: #15803d;
}

.light-theme .weight-unit-select {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0284c7;
}

.light-theme .input-with-suffix .suffix.weight-unit-suffix {
  color: #0284c7;
  background: #e0f2fe;
  border-color: #bae6fd;
}

.light-theme .custom-weight-override {
  border-top-color: #e2e8f0;
}

.light-theme .toggle-slider {
  background: #cbd5e1;
}

.light-theme .toggle-label {
  color: #475569;
}

.light-theme .preview-pane {
  background: #e2e8f0;
}

.light-theme .preview-toolbar {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
}

.light-theme .preview-pill {
  color: #0284c7;
  background: #e0f2fe;
  border-color: #bae6fd;
}

.light-theme .preview-dim {
  color: #64748b;
}

.light-theme .toolbar-center {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.light-theme .tool-btn {
  color: #475569;
}

.light-theme .tool-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.light-theme .zoom-indicator {
  color: #0284c7;
}

.light-theme .view-opt-label {
  color: #475569;
}

.light-theme .ink-select {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

.light-theme .modal-card {
  background: #ffffff;
  border-color: #cbd5e1;
}

.light-theme .modal-header {
  border-bottom-color: #e2e8f0;
}

.light-theme .modal-title {
  color: #0f172a;
}

.light-theme .btn-close {
  color: #64748b;
}

.light-theme .btn-close:hover {
  color: #0f172a;
}

.light-theme .modal-toolbar {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

.light-theme .history-table th {
  background: #f1f5f9;
  color: #334155;
  border-bottom-color: #cbd5e1;
}

.light-theme .history-table td {
  border-bottom-color: #f1f5f9;
  color: #0f172a;
}

.light-theme .history-table tr:hover td {
  background: #f8fafc;
}

.light-theme .toast {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #cbd5e1;
}

/* --------------------------------------------------------------------------
   MEDIA PRINT RULES FOR 100% ACCURATE PHYSICAL A4 OUTPUT
   -------------------------------------------------------------------------- */
@media print {
  @page {
    size: auto;
    margin: 0;
  }

  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* Hide entire UI */
  .app-header,
  .form-pane,
  .preview-toolbar,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }

  .app-main {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .preview-pane {
    background: transparent !important;
    display: block !important;
    overflow: visible !important;
  }

  .preview-scroll-viewport {
    background: transparent !important;
    padding: 0 !important;
    overflow: visible !important;
    display: block !important;
  }

  .preview-zoom-container {
    transform: none !important;
  }

  .gatepass-page.a5-sheet {
    box-shadow: none !important;
    width: 148mm !important;
    height: 208mm !important;
    max-height: 208mm !important;
    margin: 0 auto !important;
    padding: 9mm 14mm 9mm 14mm !important;
    overflow: hidden !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  .gatepass-page.a4-sheet {
    box-shadow: none !important;
    width: 210mm !important;
    height: 294mm !important;
    max-height: 294mm !important;
    margin: 0 auto !important;
    padding: 14mm 20mm 14mm 20mm !important;
    overflow: hidden !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }
}

/* Responsive adjustments */
@media (max-width: 1080px) {
  .app-main {
    flex-direction: column;
    height: auto;
    overflow: auto;
  }
  .form-pane {
    max-width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .preview-pane {
    min-height: 700px;
  }
}
