* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #0F1A2A;
  background: #F5F1EA;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.d-portal {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 32px 64px;
  display: flex;
  flex-direction: column;
}

.d-brand { display: flex; justify-content: center; margin-bottom: 32px; }
.d-logo { height: 96px; width: auto; }

.d-screen { display: none; }
.d-screen.active { display: block; animation: fadeIn 180ms ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.d-h1 { text-align: center; margin: 0 0 8px; font-size: 36px; font-weight: 700; color: #0F1A2A; }
.d-sub { text-align: center; margin: 0 0 32px; font-size: 18px; color: #6B6558; }
.d-error { color: #B0392E; text-align: center; margin-top: 16px; }

/* Tariffs grid */
.d-tariffs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  max-width: 1040px;
  margin: 0 auto;
}
.d-tariff-item { display: flex; flex-direction: column; gap: 10px; }
.d-tariff {
  width: 100%;
  background: #fff;
  border: 1px solid #E3DCC9;
  border-radius: 24px;
  padding: 32px 24px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: center;
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.d-tariff:hover { background: #FAF3E5; border-color: #1B6FD4; transform: translateY(-2px); }
.d-tariff:active { transform: scale(0.98); }
.d-tariff[disabled] { opacity: 0.5; cursor: not-allowed; }
.d-tariff .d-ico {
  width: 56px; height: 56px;
  background: #E3EEF8;
  color: #1B6FD4;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.d-tariff .d-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.d-tariff .d-data { font-size: 14px; color: #6B6558; margin-bottom: 16px; }
.d-tariff .d-price { font-size: 28px; font-weight: 700; }
.free-help {
  min-height: 38px;
  border: 1px solid #D7E4F2;
  border-radius: 999px;
  background: #E3EEF8;
  color: #1B6FD4;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.free-help:active { transform: scale(0.98); }

body.modal-open { overflow: hidden; }
.info-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.info-modal.active { display: flex; }
.info-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 26, 42, 0.42);
}
.info-modal__dialog {
  position: relative;
  width: min(100%, 460px);
  background: #fff;
  border: 1px solid #E3DCC9;
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(15, 26, 42, 0.24);
  padding: 30px 30px 24px;
  text-align: center;
  animation: modalIn 140ms ease-out;
}
.info-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #F5F1EA;
  color: #6B6558;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.info-modal__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #E3EEF8;
  color: #1B6FD4;
  font-size: 28px;
  font-weight: 800;
}
.info-modal__title {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.2;
}
.info-modal__text {
  margin: 0;
  color: #3D4758;
  font-size: 16px;
  line-height: 1.6;
}
.info-modal__action {
  width: 100%;
  height: 46px;
  margin-top: 24px;
  border: 0;
  border-radius: 999px;
  background: #1B6FD4;
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.info-modal__action:active,
.info-modal__close:active { transform: scale(0.98); }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.d-tariff[data-id="basic"] { border-color: #F2A93B; position: relative; }
.d-tariff[data-id="basic"] .d-ico { background: #FCEFD6; color: #C28319; }
.d-tariff[data-id="basic"]::before {
  content: "★ ПОПУЛЯРНЫЙ";
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: #F2A93B; color: #1A1A1A;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 5px 12px; border-radius: 999px;
  white-space: nowrap;
}
.d-tariff[data-id="basic"]:hover { background: #FCEFD6; border-color: #F2A93B; }

@media (max-width: 900px) {
  .d-tariffs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* QR screen */
.d-qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  max-width: 900px;
  margin: 0 auto;
  align-items: center;
}
.d-qr-info .d-h1 { text-align: left; }
.d-steps {
  margin: 0 0 24px;
  padding-left: 24px;
  color: #2A3A52;
  font-size: 17px;
}
.d-steps li { margin-bottom: 8px; }
.d-summary {
  background: #fff;
  border: 1px solid #E3DCC9;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.d-row { display: flex; justify-content: space-between; padding: 6px 0; }
.d-row span { color: #6B6558; }
.d-row strong { font-size: 17px; }
.d-hint { color: #6B6558; font-size: 14px; margin: 0 0 24px; }
.d-actions { display: flex; gap: 12px; }

.d-qr-box { display: flex; flex-direction: column; align-items: center; }
.d-qr-card {
  background: #fff;
  border: 1px solid #E3DCC9;
  border-radius: 24px;
  padding: 24px;
  display: flex; align-items: center; justify-content: center;
}
.d-qr-img { width: 320px; height: 320px; display: block; }
.d-qr-small { color: #6B6558; font-size: 13px; margin: 12px 0 0; }

/* Buttons */
.d-btn {
  height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, color 120ms;
}
.d-btn-primary { background: #1B6FD4; color: #fff; }
.d-btn-primary:hover { background: #155CB3; }
.d-btn-test { background: #F2A93B; color: #1A1A1A; }
.d-btn-test:hover { background: #DC9722; }
.d-btn-ghost { background: transparent; color: #6B6558; border: 1px solid #C5BDA8; }
.d-btn-ghost:hover { background: #EDE7D6; }

/* Session */
.d-session { max-width: 600px; margin: 0 auto; }
.d-session-head { text-align: center; margin-bottom: 32px; }
.d-circle-ok {
  width: 80px; height: 80px;
  border-radius: 999px;
  background: #E0F4E4;
  color: #2D9F4A;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.d-progress-card {
  background: #fff;
  border: 1px solid #E3DCC9;
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
}
.d-progress-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  font-size: 18px;
}
.d-progress-row strong { font-size: 22px; }
.d-bar { height: 12px; background: #ECE4D2; border-radius: 999px; overflow: hidden; }
.d-bar-fill { height: 100%; background: #1B6FD4; transition: width 200ms; }
.d-bar-fill.warn { background: #F2A93B; }
.d-bar-meta { display: flex; justify-content: space-between; color: #6B6558; font-size: 14px; margin-top: 8px; }
.d-warn {
  background: #FFF1D6; color: #8C5A09;
  border-radius: 12px; padding: 12px 16px;
  margin-bottom: 24px;
}
.d-session .d-btn { display: block; width: 100%; }

/* Error screen */
.d-error-block { max-width: 500px; margin: 0 auto; text-align: center; }
.d-circle-err {
  width: 80px; height: 80px;
  border-radius: 999px;
  background: #FBE4E1;
  color: #B0392E;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.d-error-block .d-btn { margin-top: 24px; }

[hidden] { display: none !important; }
