:root {
  color-scheme: light;
  font-family: 'IBM Plex Sans', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #111322;
  --muted: #5c6273;
  --accent: #2f6fed;
  --accent-soft: rgba(47, 111, 237, 0.12);
  --border: #e0e4ef;
  --receipt-bg: #faf9f5;
  --receipt-ink: #1c1c1c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.shell {
  display: grid;
  grid-template-columns: minmax(360px, 420px) 1fr;
  gap: 2rem;
  padding: 2.5rem;
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }
}

.form-panel,
.preview-panel {
  background: var(--panel);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(17, 19, 34, 0.08);
}

.form-panel header h1 {
  margin: 0;
  font-size: 2rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem;
}

.lede {
  margin: 0.4rem 0 1.5rem;
  color: var(--muted);
}

form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.field-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

label {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.full-span {
  grid-column: 1 / -1;
}

input[type='text'],
input[type='number'],
input[type='datetime-local'],
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

legend {
  padding: 0 0.5rem;
  font-weight: 600;
  color: var(--ink);
}

[data-template='taxi'] legend {
  color: var(--accent);
}

.items-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 70px 90px 36px;
  gap: 0.5rem;
  align-items: center;
}

.item-row button {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
}

.item-row button:hover {
  color: #c03434;
}

.ghost {
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  padding: 0.55rem;
  font-size: 0.9rem;
  color: var(--accent);
  cursor: pointer;
}

.ghost:hover {
  border-color: var(--accent);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.helptext {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

button[type='submit'],
.secondary {
  border: none;
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

button[type='submit'] {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 15px 25px rgba(47, 111, 237, 0.35);
}

button[type='submit']:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary {
  background: #eef2ff;
  color: var(--accent);
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-head h2 {
  margin: 0;
}

#receipt-preview {
  background: var(--receipt-bg);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.receipt {
  width: 320px;
  background: #fff;
  border-radius: 6px;
  padding: 1.5rem 1.3rem;
  font-family: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 0.8rem;
  color: var(--receipt-ink);
  box-shadow: inset 0 0 0 1px #f1f1f1;
}

.receipt header {
  text-align: center;
}

.store-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.store-tagline {
  text-transform: uppercase;
  font-size: 0.65rem;
  color: #777;
  margin: 0.3rem 0;
}

.store-meta {
  font-size: 0.65rem;
  color: #999;
}

.divider {
  border-bottom: 1px solid #e4e4e4;
  margin: 0.8rem 0;
}

.dotted {
  border-bottom-style: dotted;
}

.dashed {
  border-bottom-style: dashed;
}

.meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.3rem 0.6rem;
  font-size: 0.7rem;
}

.ride-details {
  display: grid;
  gap: 0.25rem;
  font-size: 0.72rem;
}

.ride-details div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.ride-details span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6rem;
  color: #777;
}

.ride-fares {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
}

.ride-fares div {
  display: flex;
  justify-content: space-between;
}

.ride-fares .fine-print {
  font-size: 0.6rem;
  color: #777;
  justify-content: flex-end;
  font-style: italic;
}

.receipt--taxi .thanks {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ride-note {
  font-style: italic;
  color: #555;
  margin: 0.2rem 0 0.4rem;
}

.status-ok {
  color: #1c7c54;
}

.status-error {
  color: #c03434;
}

.items-header,
#preview-items div {
  display: grid;
  grid-template-columns: 1fr 50px 70px;
}

.items-header {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.2rem;
  margin-bottom: 0.3rem;
}

#preview-items div {
  padding: 0.15rem 0;
}

.totals {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
}

.totals div {
  display: flex;
  justify-content: space-between;
}

.grand {
  font-size: 0.95rem;
  font-weight: 700;
}

footer {
  text-align: center;
  font-size: 0.68rem;
  color: #777;
}

.barcode {
  letter-spacing: 0.2em;
  margin: 0.5rem 0 0.2rem;
}

.thanks {
  font-weight: 600;
  margin: 0;
}

.output-panel {
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 1rem;
}

#save-status {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.output-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
