/* Design tokens: all colors via CSS variables for tenant brand theming (Plan 8.9) */
:root {
  --primary: #0a5c56;
  --primary-deep: #07413d;
  --accent: #ffb81c;
  --accent-wash: #fff6dc;
  --bg: #eef4f2;
  --card: #ffffff;
  --line: #c9d9d5;
  --text: #10211f;
  --muted: #4d6360;
  --danger: #b3243d;
  --ok: #17784a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}
[hidden] { display: none !important; }

/* Header & Brand */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--primary);
  color: #fff;
}
.top__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top__logo { height: 32px; width: auto; max-width: 120px; object-fit: contain; }
.top__mark { color: var(--accent); flex: none; }
.top__name {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top__lang {
  flex: none;
  min-height: 38px;
  padding: 0 14px;
  border: 2px solid rgba(255,255,255,.5);
  border-radius: 20px;
  background: transparent;
  color: #fff;
  font: 600 14px var(--font);
  cursor: pointer;
}

.wrap { max-width: 480px; margin: 0 auto; padding: 20px 16px 16px; }
.panel h2 { margin: 0 0 14px; font-size: 21px; line-height: 1.25; font-weight: 800; }
.panel--center { text-align: center; padding-top: 12px; }
.muted { color: var(--muted); margin: 0; }
.big {
  margin: 8px 0 20px;
  font-size: 36px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--primary-deep);
}

/* Tabs */
.tabs {
  display: flex;
  background: rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
  gap: 4px;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: all .15s ease;
}
.tab.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Template: TICKET layout */
.tickets { display: grid; gap: 12px; margin-bottom: 20px; }
.ticket { position: relative; display: block; cursor: pointer; }
.ticket input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ticket__body {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  min-height: 76px;
  transition: border-color .12s, background-color .12s;
}
.ticket__stub {
  position: relative;
  flex: none;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 2px dashed var(--line);
  padding: 8px;
}
.ticket__stub::before, .ticket__stub::after {
  content: "";
  position: absolute;
  right: -9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line);
}
.ticket__stub::before { top: -10px; clip-path: inset(50% 0 0 0); }
.ticket__stub::after { bottom: -10px; clip-path: inset(0 0 50% 0); }
.ticket__num { font-size: 32px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--primary-deep); }
.ticket__unit { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.ticket__main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 8px 16px; min-width: 0; }
.ticket__name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.ticket__price { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ticket__speed { font-size: 13px; color: var(--muted); }
.ticket__tag {
  position: absolute;
  top: -10px;
  right: 12px;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--accent);
  color: #3b2a00;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.ticket.is-selected .ticket__body {
  border-color: var(--accent);
  background: var(--accent-wash);
  box-shadow: 0 0 0 2px var(--accent);
}
.ticket.is-selected .ticket__body::after {
  content: "\2713";
  position: absolute;
  right: 12px;
  bottom: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 24px;
  text-align: center;
}

/* Template: LIST layout */
.layout-list .ticket__body { min-height: 60px; }
.layout-list .ticket__stub { width: 80px; }
.layout-list .ticket__num { font-size: 24px; }

/* Template: HERO layout */
.layout-hero .ticket.is-featured .ticket__body {
  border-width: 3px;
  border-color: var(--primary);
  background: #ffffff;
}

/* Form fields */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 14px; }
.field input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: 600 18px var(--font);
}
.field input:focus {
  outline: 3px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
.field input.is-bad { border-color: var(--danger); }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.msg { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.msg--error { background: #fde8ec; color: var(--danger); }

/* Checkbox terms */
.terms-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 16px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.terms-box input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
  accent-color: var(--primary);
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  padding: 0 18px;
  border-radius: 12px;
  border: 2px solid transparent;
  font: 800 17px var(--font);
  cursor: pointer;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary:active:not(:disabled) { background: var(--primary-deep); }
.btn--ghost { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn--link {
  background: transparent;
  color: var(--primary);
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
}
.btn:focus-visible, .top__lang:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Status indicators */
.spinner {
  width: 48px;
  height: 48px;
  margin: 12px auto 20px;
  border: 4px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.badge-ok {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--ok);
  color: #fff;
  border-radius: 50%;
  font-size: 32px;
  font-weight: 800;
  line-height: 56px;
}

.foot {
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: var(--muted);
}
.foot a { color: var(--primary); font-weight: 700; text-decoration: none; }
