*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.4;
  background: #0f172a; color: #e2e8f0;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }
a { color: #93c5fd; }
.ly-top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .75rem;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem;
  background: rgba(15, 23, 42, .96); border-bottom: 1px solid #1e293b;
}
.ly-top h1 { font-size: 1.1rem; margin: 0; flex: 1; }
.ly-back { font-size: .9rem; text-decoration: none; white-space: nowrap; }
#ly-main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.ly-status { color: #94a3b8; }
.ly-panel { background: #1e293b; border-radius: 1rem; padding: 1.25rem; max-width: 28rem; margin: 2rem auto; text-align: center; }
.ly-panel h2 { margin-top: 0; font-size: 1.15rem; }
.ly-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .5rem 1rem; border-radius: .75rem;
  border: 1px solid #334155; background: #1e293b; color: #e2e8f0;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.ly-primary { background: #22c55e; border-color: #22c55e; color: #052e16; }
.ly-danger { background: transparent; border-color: #ef4444; color: #fca5a5; }
.ly-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.ly-toolbar input, .ly-toolbar select {
  min-height: 44px; border-radius: .75rem; border: 1px solid #334155;
  background: #0b1220; color: #e2e8f0; font: inherit; padding: .4rem .75rem;
}
.ly-toolbar input { flex: 1 1 100%; }
.ly-toolbar select { flex: 1 1 auto; }
.ly-seg { display: inline-flex; border: 1px solid #334155; border-radius: .75rem; overflow: hidden; }
.ly-seg button { min-height: 44px; padding: 0 1rem; background: #0b1220; color: #cbd5e1; border: 0; font: inherit; cursor: pointer; }
.ly-seg button.active { background: #334155; color: #fff; }
.ly-empty { color: #94a3b8; text-align: center; padding: 2rem 0; }
.ly-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: 1fr; }
.ly-card {
  width: 100%; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: .25rem;
  padding: 1rem; border-radius: 1rem; border: 1px solid #334155;
  background: linear-gradient(135deg, #1e293b, #172033); color: inherit; font: inherit;
}
.ly-card:active { transform: scale(.99); }
.ly-card-program { font-weight: 700; font-size: 1.05rem; }
.ly-card-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; color: #94a3b8; font-size: .9rem; }
.ly-card-number { font-family: ui-monospace, Menlo, Consolas, monospace; color: #e2e8f0; letter-spacing: .05em; }
.ly-badge { font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: #78350f; color: #fde68a; }
.ly-overlay {
  position: fixed; inset: 0; z-index: 30; background: rgba(2, 6, 23, .7);
  display: flex; align-items: flex-end; justify-content: center;
}
.ly-sheet {
  width: 100%; max-width: 32rem; max-height: 92vh; overflow-y: auto;
  background: #1e293b; border-radius: 1.25rem 1.25rem 0 0; padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: .75rem;
}
.ly-sheet h2 { margin: 0; font-size: 1.15rem; }
.ly-sheet label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: #cbd5e1; }
.ly-sheet input:not([type=checkbox]), .ly-sheet select, .ly-sheet textarea {
  min-height: 44px; border-radius: .6rem; border: 1px solid #334155; background: #0b1220; color: #e2e8f0;
  font: inherit; font-size: 16px; padding: .5rem .7rem;
}
.ly-sheet .ly-check { flex-direction: row; align-items: center; gap: .6rem; }
.ly-check input { width: 22px; height: 22px; }
.ly-share-box { border: 1px solid #334155; border-radius: .75rem; padding: .6rem .8rem .8rem; margin: 0; }
.ly-share-box legend { padding: 0 .3rem; font-size: .9rem; color: #cbd5e1; }
.ly-hint { margin: 0 0 .5rem; font-size: .8rem; color: #94a3b8; }
.ly-share-list { display: flex; flex-direction: column; gap: .35rem; }
.ly-share-list .ly-check { min-height: 40px; }
.ly-tag { font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: #1e3a8a; color: #bfdbfe; }
.ly-tag-shared { background: #134e4a; color: #99f6e4; }
.ly-err { color: #fca5a5; margin: 0; white-space: pre-line; }
.ly-actions { display: flex; gap: .5rem; align-items: center; }
.ly-spacer { flex: 1; }
/* Checkout: pure white, black bars, maximum contrast for scanners */
.ly-scan {
  position: fixed; inset: 0; z-index: 50; background: #fff; color: #000;
  display: flex; flex-direction: column; align-items: stretch;
  padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
}
.ly-scan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.ly-scan-program { font-size: 1.4rem; font-weight: 800; }
.ly-scan-owner { font-size: 1rem; color: #333; }
.ly-scan-close { font-size: 2.2rem; line-height: 1; width: 52px; height: 52px; border-radius: 50%; border: 2px solid #000; background: #fff; color: #000; cursor: pointer; }
.ly-scan-code { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1rem 0; min-height: 0; }
.ly-scan-code svg { width: 100%; max-width: 640px; height: auto; max-height: 60vh; background: #fff; }
.ly-scan-code svg.ly-qr { width: min(80vw, 60vh, 420px); height: auto; }
.ly-scan-msg { font-size: 1.2rem; text-align: center; color: #000; }
.ly-scan-number { text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(1.4rem, 6vw, 2.4rem); font-weight: 700; letter-spacing: .08em; word-break: break-all; }
.ly-scan-foot { display: flex; justify-content: center; margin-top: 1rem; }
.ly-scan .ly-btn { background: #fff; color: #000; border-color: #000; }
@media (min-width: 768px) {
  .ly-toolbar input { flex: 1 1 18rem; }
  .ly-toolbar select { flex: 0 0 12rem; }
  .ly-list { grid-template-columns: repeat(2, 1fr); }
  .ly-overlay { align-items: center; }
  .ly-sheet { border-radius: 1.25rem; }
}
@media (min-width: 1100px) { .ly-list { grid-template-columns: repeat(3, 1fr); } }
