:root {
  --brand: #1f2a6b;
  --brand-2: #2a3480;
  --brand-deep: #171f52;
  --brand-soft: #eef0f8;
  --gold: #c4a04a;
  --gold-badge: #f0b429;
  --gold-badge-text: #3a2a05;
  --bg: #ffffff;
  --text: #1a1f2e;
  --muted: #8b93a7;
  --line: #eceff4;
  --danger: #e24747;
  --success: #2f9e66;
  --warn: #e3a23c;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(31, 42, 107, 0.10);
  --shadow-btn: 0 4px 14px rgba(31, 42, 107, 0.22);
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --page-w: 420px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); text-decoration: none; }

/* ——— Topbar ——— */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
}
.has-brand-left .topbar {
  grid-template-columns: 1fr auto;
}
.has-brand-left .topbar__brand { grid-column: 1; justify-self: start; }
.has-brand-left .lang-switch { grid-column: 2; }
.has-back .link-back { grid-column: 1; justify-self: start; }
.has-back .topbar__brand--center { grid-column: 2; justify-self: center; }
.has-back .lang-switch { grid-column: 3; justify-self: end; }

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--brand);
  line-height: 0;
  background: none !important;
  box-shadow: none;
  padding: 0;
}
.logo-img {
  display: block;
  height: 36px;
  width: auto;
  max-width: min(172px, 50vw);
  object-fit: contain;
  object-position: left center;
  background: transparent !important;
}
.has-back .topbar__brand--center {
  padding: 0;
  background: none !important;
}
.has-back .topbar__brand--center .logo-img {
  max-width: min(152px, 44vw);
  height: 32px;
}
.logo-mark,
.logo-text { display: none; }
.link-back {
  color: #9aa3b5;
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}
.lang-switch a {
  color: #9aa3b5;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.lang-switch a.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.lang-switch__sep { display: none; }

.page {
  width: min(var(--page-w), 100%);
  margin: 0 auto;
  padding: 8px 16px calc(36px + var(--safe-b));
}

/* ——— Hero ——— */
.hero {
  text-align: center;
  margin: 12px 0 28px;
  animation: fadeUp .35s ease both;
}
.hero--compact { margin: 8px 0 20px; }
.hero__title {
  margin: 14px 0 10px;
  font-size: clamp(26px, 7vw, 32px);
  line-height: 1.15;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero__title--sm {
  font-size: 20px;
  font-weight: 700;
  max-width: 16em;
  margin-inline: auto;
  line-height: 1.35;
}
.hero__text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  max-width: 28em;
  margin-inline: auto;
}
.hero__branch {
  display: inline-block;
  margin-top: 4px;
  color: #a0a8b8;
  font-weight: 600;
}
.hero-icon {
  display: inline-flex;
  width: 56px;
  height: 56px;
  color: var(--gold);
}
.hero-icon svg { width: 100%; height: 100%; }

.chip-row { display: flex; justify-content: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 9px 14px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  max-width: 100%;
}
.chip__icon { width: 18px; height: 18px; display: inline-flex; }
.chip__icon svg { width: 100%; height: 100%; }

/* ——— Services ——— */
.service-list {
  display: grid;
  gap: 11px;
  animation: fadeUp .4s ease .05s both;
}
.service-btn {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 34px;
  align-items: center;
  column-gap: 14px;
  padding: 15px 14px 15px 16px;
  min-height: 70px;
  background: linear-gradient(180deg, var(--brand-2) 0%, var(--brand) 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-btn);
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}
.service-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 22px rgba(31, 42, 107, 0.28);
}
.service-btn:active { transform: scale(0.985); }
.service-btn__icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  color: #fff;
  opacity: 0.95;
}
.service-btn__icon svg { width: 100%; height: 100%; }
.service-btn__body { min-width: 0; }
.service-btn__name {
  display: block;
  font-weight: 700;
  font-size: 15.5px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.service-btn__meta {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0.72;
}
.badge {
  display: inline-flex;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--gold-badge);
  color: var(--gold-badge-text);
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(240, 180, 41, 0.35);
  justify-self: end;
}
.badge--navy { background: var(--brand); color: #fff; box-shadow: none; }

.active-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
  padding: 13px 14px;
  background: linear-gradient(90deg, #eef8f2, #f7fcf9);
  border: 1px solid #d0eadb;
  border-radius: 12px;
  color: #1f6b45;
  font-size: 13.5px;
  font-weight: 600;
  animation: fadeUp .3s ease;
}
.active-banner strong { white-space: nowrap; font-weight: 800; }

/* ——— Form ——— */
.form { display: grid; gap: 16px; animation: fadeUp .3s ease; }
.field { display: grid; gap: 8px; }
.field__label { font-size: 13px; color: var(--muted); font-weight: 700; }
.field__control {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid #d9dee8;
  border-radius: 12px;
  padding: 0 14px;
  min-height: 54px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field__control:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(31, 42, 107, 0.08);
}
.field__control input {
  flex: 1;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  padding: 14px 0;
  letter-spacing: 0.01em;
}
.field__check {
  display: none;
  color: var(--success);
  width: 22px;
  height: 22px;
}
.field__control.is-valid {
  border-color: var(--success);
  box-shadow: 0 0 0 4px rgba(47, 158, 102, 0.12);
}
.field__control.is-valid .field__check { display: inline-flex; }
.field__control.is-invalid { border-color: var(--danger); }
.field__hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.field__error { color: var(--danger); font-size: 13px; font-weight: 600; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 15px 18px;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity .15s ease, transform .1s ease, filter .15s ease;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 12px; font-size: 13px; }
.btn--lg { padding: 18px; font-size: 17px; }
.btn--primary {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn--secondary { background: var(--brand-soft); color: var(--brand); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--warn { background: var(--warn); color: #2a220f; }
.btn--success { background: var(--success); color: #fff; }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

/* ——— Ticket ——— */
.ticket-head { text-align: center; margin-bottom: 16px; animation: fadeUp .3s ease; }
.ticket-warn {
  margin: 0;
  color: var(--text);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.ticket-warn span {
  display: inline-block;
  margin-top: 2px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
}
.ticket-branch { margin: 10px 0 0; color: #a0a8b8; font-size: 13px; font-weight: 600; }

.ticket-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 0 20px 18px;
  text-align: center;
  position: relative;
  margin-bottom: 16px;
  overflow: hidden;
  animation: fadeUp .35s ease .05s both;
}
.ticket-card__stub {
  height: 14px;
  margin: 0 -20px 16px;
  background:
    radial-gradient(circle at 10px 0, transparent 7px, #edf7f1 7.5px) left top / 20px 14px repeat-x,
    linear-gradient(#edf7f1, #edf7f1);
}
.ticket-card__label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.ticket-card__number {
  font-size: clamp(58px, 17vw, 76px);
  line-height: 1;
  font-weight: 800;
  color: var(--brand);
  margin: 8px 0 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.ticket-card__service {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.ticket-card__rows { display: grid; gap: 0; text-align: left; }
.ticket-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  padding: 11px 0;
  border-bottom: 1px dashed #e5e9f0;
}
.ticket-row:last-child { border-bottom: 0; }
.ticket-row strong {
  color: var(--text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ticket-card__time {
  margin-top: 8px;
  font-size: 12px;
  color: #aab2c2;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ticket-warn--success { color: var(--success); }
.ticket-card__window {
  margin: 8px 0 4px;
  padding: 16px 12px;
  background: #e8f7ef;
  border-radius: 14px;
}
.ticket-card__window-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.ticket-card__window strong {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--success);
  letter-spacing: -0.02em;
}
.calls-table-title {
  padding: 12px 14px 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9aa3b5;
}
.ticket-done {
  text-align: center;
  padding: 28px 8px 8px;
  animation: fadeUp .35s ease;
}
.ticket-done__icon { margin-bottom: 12px; }
.ticket-done__mark {
  display: inline-flex;
  width: 64px;
  height: 64px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e8f7ef;
  color: var(--success);
  font-size: 32px;
  font-weight: 800;
}
.ticket-done__mark--warn {
  background: #fff4e5;
  color: var(--warn);
}
.ticket-done__eyebrow {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
}
.ticket-done__label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.ticket-done__number {
  margin: 6px 0 10px;
  font-size: 56px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.ticket-done__window {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.ticket-done__window strong { color: var(--text); font-weight: 800; }
.ticket-done__hint {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.ticket-view.is-called .ticket-card {
  border-color: #bfe5ce;
  box-shadow: 0 10px 30px rgba(47, 158, 102, 0.16);
}
.ticket-keep {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 12px 0 0;
  font-weight: 500;
}


.calls-table-wrap {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  animation: fadeUp .4s ease .08s both;
}
.calls-table { width: 100%; border-collapse: collapse; }
.calls-table th, .calls-table td {
  padding: 13px 14px;
  text-align: left;
  font-size: 14px;
}
.calls-table th {
  background: #f5f7fb;
  color: #9aa3b5;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.calls-table td { font-weight: 600; }
.calls-table tr.is-latest {
  background: #e8f7ef;
  font-weight: 800;
}
.calls-table tr.is-empty td {
  color: var(--muted);
  text-align: center;
  font-weight: 500;
}
.call-arrow { color: var(--success); margin-right: 6px; }

/* ——— Modal ——— */
.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  padding-bottom: max(16px, var(--safe-b));
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 22, 48, 0.52);
  backdrop-filter: blur(3px);
}
.modal__dialog {
  position: relative;
  width: min(380px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 30px 22px 22px;
  box-shadow: 0 20px 50px rgba(16, 22, 48, 0.25);
  text-align: center;
  animation: modalIn .22s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.modal__title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.modal__text {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14.5px;
  font-weight: 500;
}
.modal__actions--stack { display: grid; gap: 10px; }
.modal__actions--stack form { display: block; }

/* ——— Feedback ——— */
.reason-list { display: grid; gap: 10px; margin-bottom: 6px; }
.reason-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  cursor: pointer;
  min-height: 54px;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.reason-item:active { transform: scale(0.99); }
.reason-item:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.reason-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.reason-item__radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #c8cedc;
  flex: 0 0 20px;
  position: relative;
}
.reason-item:has(input:checked) .reason-item__radio { border-color: var(--brand); }
.reason-item:has(input:checked) .reason-item__radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand);
}
.reason-item__text { font-size: 15px; font-weight: 600; }
.center-link { text-align: center; margin-top: 18px; }
.center-link a { color: var(--muted); font-size: 14px; font-weight: 600; }

.flash {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}
.flash--error { background: #fdecec; color: #8f1f1f; }
.flash--success { background: #e8f7ef; color: #1f6b45; }
.flash--info { background: var(--brand-soft); color: var(--brand); }

/* ——— Operator ——— */
.panel {
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.panel__title { margin: 0 0 4px; color: var(--brand); font-size: 22px; font-weight: 800; }
.panel__meta { color: var(--muted); margin: 0 0 16px; font-size: 14px; font-weight: 500; }
.op-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.op-head__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.current-ticket {
  text-align: center;
  padding: 24px 16px;
  background: #f5f7fb;
  border-radius: 16px;
  margin-bottom: 16px;
  border: 1px dashed #d5dae6;
}
.current-ticket.has-ticket {
  background: #e8f7ef;
  border-style: solid;
  border-color: #c4e6d3;
}
.current-ticket__label { color: var(--muted); font-size: 13px; margin-bottom: 6px; font-weight: 600; }
.current-ticket__number {
  font-size: 64px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.current-ticket__service { margin-top: 8px; color: var(--muted); font-weight: 600; }
.current-ticket__empty { color: var(--muted); padding: 18px 0; font-weight: 600; }
.op-actions { display: grid; gap: 10px; }
.op-actions__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.waiting-box { margin-top: 22px; }
.waiting-box__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.waiting-box h2 { margin: 0; font-size: 15px; font-weight: 800; }
.waiting-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.waiting-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  background: #f5f7fb;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
}
.waiting-list span { color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }

.page-admin .page {
  width: min(720px, 100%);
}
.admin__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.admin__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
}
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.admin-tabs__item {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f3f5f8;
  color: #6b7785;
  font-size: 13px;
  font-weight: 700;
}
.admin-tabs__item.is-active {
  background: var(--brand);
  color: #fff;
}
.admin-panel { padding: 18px; }
.admin-section { margin-bottom: 22px; }
.admin-section h2 { margin: 0 0 12px; font-size: 16px; font-weight: 800; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.stat-card {
  background: #f5f7fb;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 4px;
}
.stat-card span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-card strong { font-size: 22px; color: var(--brand); font-weight: 800; }
.admin-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-form-row input:not([type="checkbox"]):not([type="radio"]),
.admin-form-row select,
.admin-stack input:not([type="checkbox"]):not([type="radio"]),
.admin-stack select {
  min-height: 42px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  font-weight: 600;
  flex: 1;
  min-width: 120px;
  background: #fff;
}
.admin-form-row input[type="checkbox"],
.admin-form-row input[type="radio"],
.admin-stack input[type="checkbox"],
.admin-stack input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex: 0 0 16px;
  padding: 0;
  margin: 0;
  accent-color: #1f2a6b;
}
.admin-stack { display: grid; gap: 10px; }
.admin-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafbfe;
}
.admin-card__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.admin-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.admin-input { flex: 1; min-width: 140px; }
.admin-input--sm { max-width: 90px; flex: 0 0 90px; }
.admin-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
}
.admin-pill.is-on { background: #e8f7ef; color: #1f6b45; }
.admin-pill.is-off { background: #fdecec; color: #8f1f1f; }
.admin-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.admin-checks label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  font-weight: 600;
}
.admin-hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; line-height: 1.45; }
.admin-check-inline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
}

body.modal-open { overflow: hidden; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 768px) {
  .page { padding-top: 18px; }
  .service-btn { min-height: 74px; padding-block: 17px; }
  .service-btn__name { font-size: 16px; }
}
