:root {
  --bg: #120f1c;
  --bg-alt: #1b1730;
  --card: #201b38;
  --card-border: #3a3260;
  --text: #f0ece0;
  --text-muted: #9a92b8;
  --accent: #ff7a59;      /* coral */
  --accent-dim: #7a3f2f;
  --mint: #6fe7c9;
  --danger: #ff6b6b;
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
  background:
    radial-gradient(circle at 15% 10%, rgba(255,122,89,0.06), transparent 42%),
    radial-gradient(circle at 85% 85%, rgba(111,231,201,0.05), transparent 42%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,122,89,0.14);
  color: var(--accent);
}
.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: #fff;
}

.tagline {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 40ch;
  line-height: 1.55;
}

/* --- Ticket --- */
.ticket {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  background: linear-gradient(180deg, var(--card), var(--bg-alt));
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.35);
  overflow: hidden;
  animation: rise 0.5s ease both;
}
@media (max-width: 800px) {
  .ticket { grid-template-columns: 1fr; }
  .perforation { display: none; }
}

.ticket-half { padding: 2rem; }

.stub-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  color: #fff;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  padding: 5px 11px;
  border-radius: 999px;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.ghost-btn:hover { color: var(--accent); border-color: var(--accent-dim); transform: translateY(-1px); }

/* Perforation divider */
.perforation {
  position: relative;
  width: 1px;
  background: none;
}
.perf-line {
  position: absolute;
  top: 14px; bottom: 14px; left: 0;
  border-left: 2px dashed var(--card-border);
}
.notch {
  position: absolute;
  left: -9px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--card-border);
}
.notch-top { top: -9px; }
.notch-bottom { bottom: -9px; }

/* Form fields */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1rem;
}
@media (max-width: 480px) { .field-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; position: relative; }
.combobox-field { grid-column: span 2; }
@media (max-width: 480px) { .combobox-field { grid-column: span 1; } }

.field label { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); }

.field input, .field select {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.58rem 0.68rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,122,89,0.14);
}
.field input.invalid { border-color: var(--danger); }

.field select {
  font-family: var(--font-body);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239a92b8' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 1.9rem;
}

/* Combobox */
.combobox { position: relative; }
.combobox input[type="text"] { width: 100%; font-family: var(--font-body); }
.combobox-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0; right: 0;
  max-height: 210px;
  overflow-y: auto;
  background: #171330;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  padding: 4px;
}
.combobox-list li { padding: 8px 10px; border-radius: 6px; font-size: 0.85rem; cursor: pointer; }
.combobox-list li:hover, .combobox-list li.active { background: rgba(255,122,89,0.14); color: var(--accent); }
.combobox-list .no-match { color: var(--text-muted); cursor: default; }
.combobox-list .no-match:hover { background: none; color: var(--text-muted); }

.form-error {
  margin-top: 1rem;
  background: rgba(255,107,107,0.08);
  border: 1px solid rgba(255,107,107,0.35);
  color: #ffb3b3;
  font-size: 0.8rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
}

.submit-btn {
  width: 100%;
  background: var(--accent);
  color: #1c0e08;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.98rem;
  padding: 0.8rem;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.15s ease;
  box-shadow: 0 8px 24px rgba(255,122,89,0.2);
}
.submit-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(255,122,89,0.3); }
.submit-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.btn-spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(28,14,8,0.3);
  border-top-color: #1c0e08;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Result stub */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px; color: var(--text-muted); padding: 2.6rem 1rem;
}
.empty-state svg { color: #4a4370; }
.empty-state p { font-size: 0.85rem; }

.record-locator {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.predicted-badge { display: flex; align-items: center; gap: 14px; animation: rise 0.4s ease both; }
.predicted-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,122,89,0.14); color: var(--accent); flex-shrink: 0;
}
.predicted-label { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: #fff; }
.predicted-confidence { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }

.prob-bars { display: flex; flex-direction: column; gap: 11px; }
.prob-row { display: flex; flex-direction: column; gap: 5px; }
.prob-row-top { display: flex; justify-content: space-between; font-size: 0.76rem; }
.prob-row-top .name { color: var(--text-muted); }
.prob-row-top .val { font-family: var(--font-mono); color: var(--text); }
.prob-track {
  height: 7px; background: var(--bg); border: 1px solid var(--card-border);
  border-radius: 999px; overflow: hidden;
}
.prob-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.prob-fill.is-top { background: linear-gradient(90deg, var(--mint), var(--accent)); }

.barcode-wrap {
  border-top: 1px dashed var(--card-border);
  padding-top: 1.1rem;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
.barcode { width: 100%; height: 46px; }
.barcode rect { fill: var(--text); }
.barcode-caption { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.08em; }

.footer-note {
  text-align: center; color: #56507a; font-size: 0.72rem; font-family: var(--font-mono);
}

.hidden { display: none !important; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .ticket, .predicted-badge, .prob-fill, .submit-btn { animation: none !important; transition: none !important; }
}
