/* Receipt Motion module */
.receipt-workspace {
  grid-template-columns: 290px minmax(440px, 1fr) minmax(370px, .85fr);
  align-items: start;
}

.data-panel,
.songs-panel {
  max-height: calc(100vh - 106px);
  overflow: auto;
}

.controls-scroll {
  max-height: calc(100vh - 174px);
  overflow-y: auto;
}

.receipt-preview-panel {
  position: sticky;
  top: 92px;
  display: grid;
  max-height: calc(100vh - 106px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.receipt-page {
  background: radial-gradient(circle at 86% 0, rgba(86,217,232,.07), transparent 28%), var(--bg);
}

.receipt-page .button--primary {
  color: #071215;
  background: var(--cyan);
}

.song-form {
  padding-bottom: 4px;
}

.future-search {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.search-row input {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: #0c0e13;
}

.field-hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: .65rem;
}

.range-field {
  margin-bottom: 14px;
}

.range-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 750;
  text-transform: uppercase;
}

.range-field input {
  width: 100%;
  accent-color: var(--cyan);
}

.advanced-settings {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.02);
}

.advanced-settings summary {
  padding: 13px 14px;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.advanced-settings__body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border);
}

.receipt-advanced-controls input[type="color"] {
  height: 42px;
  padding: 5px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: .72rem;
}

.song-form .button--wide {
  width: 100%;
}

.song-table-wrap {
  min-height: 320px;
  overflow: auto;
  border-top: 1px solid var(--border);
}

.song-table-wrap.has-items .empty-state {
  display: none;
}

.song-table-wrap .editor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .72rem;
}

.song-table-wrap th,
.song-table-wrap td {
  padding: 9px 7px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: left;
}

.song-table-wrap th {
  color: var(--text-muted);
  font-size: .6rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.editable-cell {
  width: 100%;
  min-width: 90px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
}

.editable-cell:focus {
  border-color: var(--cyan);
  outline: 0;
  background: #0b0d11;
}

.drag-handle { color: var(--text-muted); cursor: grab; letter-spacing: -2px; }
.row-actions { display: flex; gap: 4px; }
.table-icon {
  position: relative;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  font-size: 0;
}

.table-icon::before,
.table-icon::after {
  content: "";
  position: absolute;
}

.table-icon[data-action="edit"]::before {
  width: 13px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-38deg);
}

.table-icon[data-action="edit"]::after {
  width: 4px;
  height: 4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translate(5px, 5px) rotate(-38deg);
}

.table-icon[data-action="duplicate"]::before {
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  transform: translate(2px, -2px);
}

.table-icon[data-action="duplicate"]::after {
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  transform: translate(-3px, 3px);
  opacity: .55;
}

.table-icon[data-action="delete"]::before,
.table-icon[data-action="delete"]::after {
  width: 13px;
  height: 1.6px;
  border-radius: 999px;
  background: currentColor;
}

.table-icon[data-action="delete"]::before {
  transform: rotate(45deg);
}

.table-icon[data-action="delete"]::after {
  transform: rotate(-45deg);
}

.receipt-stage {
  min-height: 0;
  padding: 18px;
  overflow: auto;
}

.receipt-frame {
  display: grid;
  width: min(100%, 350px);
  min-height: 0;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  align-items: start;
  justify-items: center;
  padding: 7%;
  overflow: hidden;
  background: #090a0d;
  transition: width 180ms ease, aspect-ratio 180ms ease;
}

.receipt-frame.format-1-1 { width: min(100%, 500px); aspect-ratio: 1; }
.receipt-frame.format-4-5 { width: min(100%, 430px); aspect-ratio: 4 / 5; }
.receipt-frame.format-16-9 { width: min(100%, 680px); aspect-ratio: 16 / 9; }

.receipt-paper {
  position: relative;
  width: min(100%, 330px);
  min-height: 570px;
  padding: 30px 26px 26px;
  color: #171713;
  background: #efede5;
  box-shadow: 0 24px 60px rgba(0,0,0,.52);
  font-family: "Courier New", monospace;
  transform-origin: top center;
  transition: none;
}

.receipt-head { text-align: center; }
.receipt-store { margin: 0 0 15px; font-size: .63rem; font-weight: 700; letter-spacing: .12em; }
.receipt-head h3 { margin: 0; font-family: var(--font-display); font-size: 1.55rem; line-height: .98; }
.receipt-head > p:last-child { margin: 7px 0 0; font-size: .58rem; letter-spacing: .08em; }
.thermal-rule { margin: 14px 0; overflow: hidden; font-size: .62rem; white-space: nowrap; }

.receipt-meta,
.receipt-summary {
  margin: 0;
  font-size: .59rem;
}

.receipt-meta div,
.receipt-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.receipt-meta dt, .receipt-meta dd,
.receipt-summary dt, .receipt-summary dd { margin: 0 0 4px; }
.receipt-meta dd, .receipt-summary dd { max-width: 60%; text-align: right; overflow-wrap: anywhere; }

.receipt-track-list { min-height: 80px; }
.receipt-track {
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) auto;
  gap: 6px;
  margin-bottom: 8px;
  font-size: .58rem;
}

.receipt-track strong,
.receipt-track small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-track small { opacity: .62; }
.receipt-placeholder { margin: 28px 0; opacity: .45; font-size: .58rem; text-align: center; }
.payment-line { margin: 16px 0; font-size: .58rem; font-weight: 700; text-align: center; }

.barcode {
  width: 70%;
  height: 36px;
  margin: 12px auto;
  background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 5px, currentColor 5px 6px, transparent 6px 9px);
}

.qr-placeholder {
  display: grid;
  width: 36px;
  height: 36px;
  margin: 10px auto;
  place-items: center;
  border: 2px solid currentColor;
  font-size: .48rem;
  font-weight: 700;
}

.receipt-footer { text-align: center; }
.receipt-footer p { margin: 13px 0 5px; font-size: .58rem; font-weight: 700; }
.receipt-footer small { opacity: .58; font-size: .45rem; }

.theme-crumpled-receipt {
  background:
    linear-gradient(115deg, transparent 30%, rgba(0,0,0,.08) 31%, transparent 32%),
    linear-gradient(25deg, transparent 64%, rgba(255,255,255,.4) 65%, transparent 67%),
    #e8e3d7;
  clip-path: polygon(1% 0, 99% 1%, 100% 98%, 97% 100%, 2% 99%, 0 3%);
}

.theme-dark-thermal { color: #e9e9e2; border: 1px solid #3d403a; background: #161714; }
.theme-dark-thermal .thermal-rule { opacity: .45; }
.theme-dark-thermal .receipt-head h3 { letter-spacing: .06em; }

.theme-viper-green { color: #071109; border: 3px solid #071109; background: #adffbc; }
.theme-viper-green .receipt-head { padding: 12px; color: #adffbc; background: #071109; }

.theme-blood-receipt { color: #2a0508; border-top: 12px solid #70131b; background: #ffc5c7; }
.theme-blood-receipt .receipt-head h3 { font-style: italic; }

.theme-glam-metal { color: #160c17; border: 5px double #602456; background: linear-gradient(145deg, #f1d7ec, #bce9e7); }
.theme-glam-metal .receipt-head h3 { text-shadow: 2px 2px #7dd3d1; }

.theme-vhs-glitch {
  color: #102226;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.04) 3px 4px), #c6f5ef;
  box-shadow: 7px 0 #ea4775, -7px 0 #3dd8db;
}
.theme-vhs-glitch .receipt-head { transform: translateX(2px); text-shadow: 2px 0 #ea4775, -2px 0 #3dd8db; }

.theme-punk-receipt { color: #111; border: 4px solid #111; background: #e8ec79; transform: rotate(-.7deg); }
.theme-punk-receipt .receipt-track:nth-child(odd) { transform: rotate(-.35deg); }
.theme-punk-receipt .receipt-head h3 { text-decoration: underline 4px; }

.theme-retro-thermal {
  color: #332b21;
  border: 1px solid #8d7656;
  background: repeating-linear-gradient(0deg, transparent 0 4px, rgba(70,50,25,.035) 4px 5px), #ead9b8;
}

.theme-cyberpunk-receipt { color: #071015; border: 4px solid #071015; background: #57f0e5; box-shadow: 8px 8px #f15785; }
.theme-cyberpunk-receipt .receipt-head { text-align: left; }
.theme-cyberpunk-receipt .receipt-head h3 { font-style: italic; }

.theme-concert-ticket { color: #f1ede4; border: 2px dashed #d35a8c; border-left: 16px solid #d35a8c; background: #2a202b; }
.theme-concert-ticket .receipt-head { text-align: left; }
.theme-concert-ticket .barcode { width: 100%; }

.theme-cassette-label { color: #1e1b18; border: 9px solid #282828; border-radius: 3px; background: #e9a758; }
.theme-cassette-label .receipt-head { padding: 12px; border: 2px solid currentColor; border-radius: 50% / 18%; }

.receipt-paper.is-animated { animation: receipt-float 2.8s ease-in-out infinite; }
@keyframes receipt-float {
  0%, 100% { transform: translateY(0) rotate(-.2deg) scale(var(--preview-scale, 1)); }
  50% { transform: translateY(-8px) rotate(.4deg) scale(var(--preview-scale, 1)); }
}

.receipt-actions { flex-wrap: wrap; }

@media (max-width: 1080px) {
  .receipt-workspace { grid-template-columns: 290px 1fr; }
  .receipt-preview-panel { grid-column: 1 / -1; }
  .receipt-preview-panel {
    position: static;
    max-height: none;
  }
  .data-panel,
  .songs-panel { max-height: none; }
}

@media (max-width: 760px) {
  .receipt-workspace { display: flex; }
  .receipt-workspace > .panel { width: 100%; }
  .receipt-stage { min-height: 650px; padding: 18px; }
  .songs-panel { min-height: 600px; }
}
