.history-nav { display: flex; align-items: center; gap: 9px; }
.secondary-nav { color: rgba(255,255,255,.78); }
.history-shell { width: min(1180px, calc(100% - 48px)); }
.history-filters { margin-top: 30px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); display: grid; grid-template-columns: minmax(190px, 260px) minmax(240px, 1fr); gap: 12px; }
.history-filters label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 850; }
.history-filters input { width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); outline: none; font-size: 12px; }
.history-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.history-stats article { min-width: 0; }
.history-stats strong { font-size: clamp(17px, 2vw, 23px); }
.history-panel { min-height: 350px; padding: 23px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 12px 35px rgba(20,42,36,.055); }
.history-panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.history-panel-head h2 { margin: 0; font: 700 25px/1 Georgia, serif; }
.payment-breakdown { display: flex; align-items: center; gap: 8px; }
.payment-breakdown span { padding: 9px 11px; border-radius: 10px; background: #f1efe9; color: var(--muted); font-size: 9px; font-weight: 800; }
.payment-breakdown b { margin-left: 6px; color: var(--forest); }
.history-list { margin-top: 20px; border-top: 1px solid var(--line); }
.history-row { min-width: 0; padding: 15px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 76px minmax(135px, 1.25fr) minmax(120px, 1fr) minmax(100px, .8fr) 112px; align-items: center; gap: 16px; }
.history-time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.history-order strong, .history-payment strong { display: block; font-size: 12px; }
.history-order span, .history-payment span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.history-total { color: var(--forest); font-size: 14px; font-weight: 900; text-align: right; }
.receipt-button { height: 36px; padding: 0 11px; border: 1px solid #d2d7d2; border-radius: 10px; background: #f4f3ee; color: var(--forest); font-size: 9px; font-weight: 850; cursor: pointer; }
.print-dialog { width: auto; max-width: none; height: auto; max-height: none; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible; }
.print-dialog::backdrop { background: rgba(11,27,23,.58); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.print-modal-card { width: min(94vw, 500px); max-height: 90vh; padding: 24px; border: 1px solid rgba(255,255,255,.4); border-radius: 24px; background: var(--paper); box-shadow: 0 30px 90px rgba(11,31,25,.28); overflow-y: auto; }
.print-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.print-modal-head h2 { margin: 0; font: 700 27px/1 Georgia, serif; }
.thermal-paper { --paper-width: 58mm; width: min(100%, var(--paper-width)); margin: 22px auto 18px; padding: 18px 14px; background: white; color: #111; box-shadow: 0 7px 28px rgba(30,30,30,.1); font: 10.5px/1.45 "Courier New", monospace; }
.thermal-paper.paper-80 { --paper-width: 80mm; }
.print-brand { text-align: center; }
.print-brand h3 { margin: 0; font: 900 16px/1.2 "Courier New", monospace; }
.print-brand p, .print-footer { margin: 4px 0; text-align: center; }
.print-rule { margin: 10px 0; border-top: 1px dashed #555; }
.print-meta div, .print-line, .print-total div { display: flex; justify-content: space-between; gap: 12px; }
.print-meta div + div, .print-total div + div { margin-top: 3px; }
.print-section-title { margin: 12px 0 6px; font-weight: 900; text-align: center; }
.print-item { margin: 7px 0; }
.print-item > b { display: block; }
.print-total .grand { margin-top: 7px; padding-top: 7px; border-top: 1px dashed #777; font-size: 13px; font-weight: 900; }
.signature-lines { margin-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; text-align: center; }
.signature-lines span { display: block; padding-top: 25px; border-bottom: 1px solid #777; }
.print-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.paper-toggle { padding: 3px; border-radius: 10px; background: #efeee8; display: flex; }
.paper-toggle button { height: 35px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.paper-toggle button.active { background: white; color: var(--forest); box-shadow: 0 2px 8px rgba(20,30,25,.08); }
@media (max-width: 760px) {
  .secondary-nav { display: none; }
  .history-shell { width: min(100% - 28px, 600px); }
  .history-filters { grid-template-columns: 1fr; }
  .history-stats { grid-template-columns: 1fr 1fr; }
  .history-panel { padding: 18px; }
  .history-panel-head { align-items: flex-start; flex-direction: column; }
  .payment-breakdown { width: 100%; }
  .payment-breakdown span { flex: 1; display: flex; justify-content: space-between; }
  .history-row { padding: 15px 0; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 9px 12px; }
  .history-payment { grid-column: 2; }
  .history-total { grid-column: 3; grid-row: 1; }
  .receipt-button { grid-column: 3; grid-row: 2; }
}
@media (max-width: 430px) {
  .history-heading .primary-button { width: 100%; }
  .history-stats article { min-height: 91px; }
  .history-row { grid-template-columns: 48px minmax(0, 1fr); }
  .history-total { grid-column: 2; grid-row: 2; text-align: left; }
  .history-payment { grid-column: 2; grid-row: 3; }
  .receipt-button { grid-column: 1 / -1; grid-row: 4; }
}
@media print {
  @page { size: 58mm auto; margin: 0; }
  body * { visibility: hidden !important; }
  #printDialog, #printDialog *, #printContent { visibility: visible !important; }
  #printDialog { display: block !important; position: absolute; inset: 0; margin: 0; padding: 0; background: white; }
  #printDialog::backdrop, .no-print { display: none !important; }
  .print-modal-card { width: auto; max-height: none; padding: 0; border: 0; box-shadow: none; overflow: visible; }
  .thermal-paper { width: var(--paper-width); margin: 0; padding: 4mm 3mm; box-shadow: none; }
}
