/* ============================================================
   LEDGER (Καρτέλα) — On-screen + Print styling
   ============================================================ */

/* ===== Button group (pills) ===== */
.btn-group {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

/* ===== Ledger print area (on-screen) ===== */
.ledger-print-area {
  background: white;
  padding: 24px 28px;
  font-family: var(--font-body);
}

.ledger-print-header {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 16px;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--brand-burgundy, #7a1d1d);
}

.ledger-print-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.ledger-print-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ledger-print-company {
  font-family: var(--font-display, 'Manrope', sans-serif);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--brand-black, #1a1a1a);
}

.ledger-print-subtitle {
  font-size: 12px;
  color: var(--muted, #666);
  letter-spacing: 0.3px;
}

.ledger-print-doc {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-burgundy, #7a1d1d);
  margin-top: 4px;
}

.ledger-print-meta {
  font-size: 11px;
  color: var(--muted, #666);
  text-align: right;
  line-height: 1.5;
}

/* ===== Entity info box ===== */
.ledger-entity-box {
  background: var(--bg-alt, #f7f5f3);
  border-left: 3px solid var(--brand-burgundy, #7a1d1d);
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: 4px;
}

.ledger-entity-name {
  font-family: var(--font-display, 'Manrope', sans-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-black, #1a1a1a);
  margin-bottom: 4px;
}

.ledger-entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted, #555);
}

.ledger-entity-meta span {
  white-space: nowrap;
}

.ledger-entity-meta strong {
  color: var(--text, #1a1a1a);
  font-weight: 600;
}

/* ===== Ledger table ===== */
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.ledger-table thead th {
  background: var(--brand-black, #1a1a1a);
  color: white;
  font-weight: 600;
  text-align: left;
  padding: 10px 8px;
  border: none;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ledger-table thead th.num {
  text-align: right;
}

.ledger-table tbody td {
  padding: 8px;
  border-bottom: 1px solid var(--border, #e5e2de);
  vertical-align: top;
}

.ledger-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.ledger-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger-table .ledger-opening {
  background: var(--bg-alt, #f7f5f3) !important;
  font-style: italic;
}

.ledger-table tfoot tr {
  background: var(--bg-alt, #f7f5f3);
}

.ledger-table .ledger-totals td {
  border-top: 2px solid var(--brand-black, #1a1a1a);
  padding: 12px 8px;
  font-size: 13px;
}

.ledger-table .ledger-closing td {
  background: var(--brand-burgundy, #7a1d1d);
  color: white;
  padding: 12px 8px;
  font-size: 14px;
  border: none;
}

.ledger-table .ledger-closing strong {
  color: white;
}

/* ===== Print footer (only visible when printing) ===== */
.ledger-print-footer {
  display: none;
}

/* ============================================================
   PRINT-SPECIFIC STYLES
   ============================================================ */
@media print {
  /* Hide everything that's not the ledger */
  body * {
    visibility: hidden;
  }
  
  .ledger-print-area, .ledger-print-area * {
    visibility: visible;
  }
  
  .ledger-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Hide all UI chrome */
  .no-print,
  .sidebar,
  .topbar,
  .tab-bar,
  .page-header,
  .toast-container,
  .modal-backdrop {
    display: none !important;
  }
  
  /* Page setup */
  @page {
    size: A4;
    margin: 12mm 14mm 18mm 14mm;
  }
  
  /* Print-friendly colors (preserve burgundy/black) */
  body {
    background: white !important;
    color: black !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ledger-table thead th {
    background: #1a1a1a !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ledger-table .ledger-closing td {
    background: #7a1d1d !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ledger-entity-box {
    background: #f5f3f0 !important;
    border-left: 3px solid #7a1d1d !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Show print footer */
  .ledger-print-footer {
    display: flex !important;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #ccc;
    font-size: 10px;
    color: #888;
  }
  
  /* Avoid splitting rows across pages */
  .ledger-table tr {
    page-break-inside: avoid;
  }
  
  .ledger-table tfoot {
    page-break-inside: avoid;
  }
}

/* ===== Helper: label-inline ===== */
.label-inline {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #666);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
