/* Терминал (киоск): планшет 10″ альбом/портрет, касания, без прокрутки страницы. body.kiosk и .q-logo — из brand.css. */
body.kiosk { --logo-h: 34px; touch-action: manipulation; }
.hidden { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 32px 0; flex: 0 0 auto; }
.top-right { display: flex; align-items: center; gap: 18px; }

main { flex: 1 1 auto; min-height: 0; display: flex; padding: 10px 32px 22px; }
.screen { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; animation: q-fade-in .25s ease-out; }
.screen.active { display: flex; }
h1 { font-size: clamp(30px, 5vh, 46px); margin: 0; }
h2 { font-size: clamp(24px, 4vh, 34px); margin: 0; }
.lead { font-size: clamp(17px, 2.6vh, 22px); color: var(--muted); margin: 6px 0 16px; }
.lbl { color: var(--muted); font-weight: 700; font-size: clamp(16px, 2.4vh, 20px); }
.row-btns { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

/* ---- главный экран: 6 плиток ------------------------------------------------------------------- */
.tiles { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 16px; }
.tile { border: 0; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px;
  text-align: left; font: inherit; color: var(--coal); cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end;
  gap: 4px; min-height: 0; transition: transform .08s, box-shadow .12s; }
.tile:active { transform: scale(.98); box-shadow: 0 3px 12px rgba(27, 90, 97, .12); }
.tile svg { width: clamp(34px, 6vh, 52px); height: auto; color: var(--lazur); margin-bottom: auto; }
.tile.alt svg { color: var(--vasilek-mid); }
.tile-title { font-weight: 800; font-size: clamp(19px, 3.1vh, 27px); color: var(--lazur-dark); line-height: 1.15; }
.tile-sub { font-size: clamp(13px, 1.9vh, 16px); color: var(--muted); }

/* ---- ввод: поле + экранная клавиатура ------------------------------------------------------------- */
.entry { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.entry-left { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; min-width: 0; }
.field { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 24px; min-width: min(100%, 520px);
  font-size: clamp(28px, 5vh, 44px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .04em; color: var(--lazur-dark);
  white-space: nowrap; overflow: hidden; }
.field .p { color: #C5CAD8; }          /* ещё не введённые позиции маски */
.field .ph { color: #C5CAD8; font-weight: 600; letter-spacing: 0; font-size: .7em; }   /* текстовая подсказка в пустом поле */
.field-hint { color: var(--muted); font-size: clamp(14px, 2.1vh, 18px); }
.keypad { display: grid; grid-template-columns: repeat(3, clamp(76px, 12vh, 110px)); grid-auto-rows: clamp(58px, 10.5vh, 92px); gap: 10px; }
.key { border: 0; font: inherit; font-weight: 800; font-size: clamp(24px, 4.5vh, 36px); color: var(--lazur-dark); background: var(--white);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); cursor: pointer; }
.key:active { background: var(--lazur-light); transform: translateY(1px); }
.key.bs { color: var(--vasilek-mid); font-size: clamp(22px, 4vh, 32px); }
.key.empty { visibility: hidden; }

/* ---- идентификация: вкладки ----------------------------------------------------------------------- */
.ident-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ident-head .pill { font-size: 16px; }
.tabs { display: flex; gap: 10px; margin: 10px 0 14px; flex-wrap: wrap; }
.tab { border: 0; font: inherit; font-weight: 700; font-size: clamp(15px, 2.3vh, 19px); padding: 11px 20px; border-radius: 999px;
  background: var(--white); color: var(--lazur-dark); box-shadow: var(--shadow); cursor: pointer; }
.tab.active { background: var(--lazur); color: var(--vasilek-dark); }
.pane { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.pane.active { display: flex; }

/* демо-список пациентов: единственное место с внутренней прокруткой */
.demo-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; align-content: start; padding: 4px 4px 12px; -webkit-overflow-scrolling: touch; }
.demo-row { border: 0; text-align: left; font: inherit; background: var(--white); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 12px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; color: var(--coal); }
.demo-row:active { background: var(--lazur-light); }
.demo-row .name { font-weight: 800; font-size: 18px; color: var(--lazur-dark); }
.demo-row .meta { color: var(--muted); font-size: 14px; }
.demo-row .flag { align-self: flex-start; margin-top: 4px; font-size: 12px; }
.demo-note { grid-column: 1 / -1; color: var(--muted); font-size: 15px; }

/* ---- подтверждение, ошибка ------------------------------------------------------------------------ */
.confirm { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 20px; }
.confirm .q { font-size: clamp(24px, 4.2vh, 38px); font-weight: 800; color: var(--lazur-dark); line-height: 1.3; }
/* Значение выделяем плашкой, а не светлым цветом: lazur-mid на белом — 2,97:1, ниже порога даже для крупного текста. */
.confirm .val { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--lazur-dark); background: var(--lazur-light);
  border-radius: var(--radius-sm); padding: 0 .35em; }
.confirm .entry { flex: 0 0 auto; }
.confirm .entry-left { align-items: center; }
.err-icon { width: 72px; height: 72px; border-radius: 50%; background: #FDE3E5; color: var(--bad); font-weight: 800; font-size: 40px;
  display: flex; align-items: center; justify-content: center; }
.err-text { font-size: clamp(18px, 2.8vh, 24px); max-width: 720px; line-height: 1.4; }

/* ---- результат ------------------------------------------------------------------------------------ */
.banner { background: #FFF1D6; color: #8A5A00; border-radius: var(--radius-sm); padding: 10px 18px; font-weight: 700; font-size: clamp(15px, 2.3vh, 19px); margin-bottom: 10px; }
.result { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; align-items: center; }
.result-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ticket-huge { font-size: clamp(68px, 17vh, 150px); line-height: 1; }
.next-room { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.next-room .no { font-size: clamp(32px, 6.5vh, 60px); font-weight: 800; color: var(--lazur-dark); line-height: 1.1; }
.next-room .nm { font-size: clamp(20px, 3.4vh, 30px); font-weight: 700; color: var(--lazur-dark); }
.spec { font-size: clamp(16px, 2.5vh, 21px); color: var(--muted); }
.ahead { font-size: clamp(20px, 3.2vh, 28px); font-weight: 700; color: var(--vasilek-mid); margin-top: 4px; }
.hold { font-size: clamp(20px, 3.2vh, 28px); font-weight: 700; color: #8A5A00; }
.services { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.services li { background: var(--lazur-light); color: var(--lazur-dark); padding: 5px 13px; border-radius: 999px; font-weight: 700; font-size: clamp(13px, 2vh, 16px); }
.msg { font-size: clamp(15px, 2.3vh, 19px); color: var(--coal); }
.result-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.result-side img { width: min(260px, 34vh); height: auto; border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow); padding: 8px; }
.qr-cap { color: var(--muted); font-size: clamp(14px, 2.1vh, 17px); max-width: 300px; }

/* ---- занято ---------------------------------------------------------------------------------------- */
.busy { position: fixed; inset: 0; background: rgba(247, 248, 252, .86); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; z-index: 50; font-size: 24px; font-weight: 700; color: var(--lazur-dark); }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid var(--lazur-light); border-top-color: var(--lazur); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- портрет / узкий экран ----------------------------------------------------------------------- */
@media (orientation: portrait), (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .entry { grid-template-columns: 1fr; justify-items: center; align-content: center; gap: 18px; }
  .entry-left { align-items: center; text-align: center; }
  .result { grid-template-columns: 1fr; align-content: center; gap: 14px; }
  .result-main { align-items: center; text-align: center; }
  .next-room { justify-content: center; }
  .services { justify-content: center; }
  .ticket-huge { font-size: clamp(60px, 12vh, 120px); }
  .result-side img { width: min(200px, 24vh); }
}
@media (max-width: 600px) {
  .top, main { padding-left: 16px; padding-right: 16px; }
  .btn.big { font-size: 20px; padding: 16px 24px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px 14px; }
}
/* Телефон: киоск не целевое устройство, но страница не должна ломаться — плитки строками, прокрутка разрешена. */
@media (max-width: 480px) {
  body.kiosk { height: auto; min-height: 100vh; overflow: auto; }
  .top { flex-wrap: wrap; gap: 8px; }
  .tiles { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .tile { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; min-height: 88px; }
  .tile svg { grid-row: 1 / 3; width: 40px; margin: 0; }
  .keypad { grid-template-columns: repeat(3, 1fr); width: 100%; max-width: 320px; }
  .field { min-width: 0; width: 100%; font-size: 26px; }
  .ticket-huge { font-size: 64px; }
}
