@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --gold: #dbcd4f;
  --pink: #d496a7;
  --ink: #4f4f4f;
  --velvet-noise-yellow: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  --velvet-noise-rose: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
  --velvet-noise-graphite: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  --dark-bg: #1a1a1a;
  --card-bg: #2a2a2a;
  --panel-bg: #202020;
  --text-primary: #f0f0f0;
  --text-secondary: #b7b7b7;
  --border-color: #3a3a3a;
  --danger: #d16a7d;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --transition: 0.22s ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 30px 20px;
  background: var(--dark-bg);
  color: var(--text-primary);
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none !important;
}

.container {
  width: min(1200px, 100%);
  max-width: 100%;
  min-height: calc(100vh - 60px);
  margin: 0 auto;
  padding: 25px 30px 34px;
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.header,
.projects-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.logo-wrapper {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.logo {
  font-size: 28px;
  font-weight: 800;
}

.logo span,
.pink {
  color: var(--pink);
}

.logo-sub,
.projects-head p,
.empty-inline,
small,
.hint {
  color: var(--text-secondary);
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(212, 150, 167, 0.62);
  border-radius: 999px;
}

.language-switch button {
  min-width: 38px;
  min-height: 32px;
  padding: 5px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.language-switch button.active {
  background: var(--pink);
  color: var(--dark-bg);
}

.language-switch button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.nav a,
.nav-user,
.btn-link,
.instruction-link,
.project-card .actions a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: color var(--transition);
}

.nav-user {
  cursor: default;
  color: var(--pink);
}

.nav a:hover,
.nav a.active,
.btn-link,
.instruction-link,
.project-card .actions a:hover {
  color: var(--pink);
}

.statusbar {
  min-height: 22px;
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 13px;
}

.first-screen-legal {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.first-screen-legal a,
.legal-page a {
  color: var(--pink);
  text-decoration: none;
}

.first-screen-legal a {
  font-size: 13px;
}

.first-screen-legal a:hover,
.legal-page a:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 30;
  max-width: min(380px, calc(100vw - 44px));
  padding: 13px 16px;
  border: 1px solid rgba(212, 150, 167, 0.55);
  border-radius: 8px;
  background: rgba(42, 42, 42, 0.96);
  color: var(--text-primary);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

#toolTabs[hidden] {
  display: none !important;
}

.tab {
  position: relative;
  padding: 7px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transform: translateZ(0);
  transition:
    color var(--transition),
    background-color var(--transition),
    background-image var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.tab:hover {
  color: var(--text-primary);
  transform: translateY(-1px);
}

.tab.active {
  background: var(--pink);
  color: var(--dark-bg);
  border-color: var(--pink);
  font-weight: 500;
}

.legal-page {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 32px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.legal-back {
  font-size: 14px;
}

.legal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.legal-languages {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.legal-languages [aria-current="page"] {
  color: var(--text-secondary);
}

.legal-page h1 {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 30px;
  line-height: 1.2;
  text-wrap: balance;
}

.legal-page h2 {
  margin: 28px 0 10px;
  color: var(--pink);
  font-size: 18px;
}

.legal-page p {
  max-width: 72ch;
  margin: 0 0 12px;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.7;
}

.legal-muted {
  color: var(--text-secondary) !important;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.project-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  min-height: 560px;
}

.left-col,
.right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.block {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.block-compact {
  min-height: 132px;
}

.block-grow {
  flex: 1;
  min-height: 340px;
  display: flex;
  flex-direction: column;
}

.narrow {
  width: min(680px, 100%);
  margin: 0 auto;
}

.wide-review {
  width: min(760px, 100%);
}

.block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-weight: 700;
}

.form-group {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.block-grow .form-group {
  flex: 1;
}

label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--card-bg);
  color: var(--text-primary);
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
}

textarea {
  min-height: 260px;
  flex: 1;
  resize: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(212, 150, 167, 0.18);
}

.btn,
.btn-link {
  border: 0;
  background: none;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  overflow: hidden;
  border-radius: 999px;
  padding: 8px 22px;
  border: 1px solid rgba(79, 79, 79, 0.45);
  background-color: var(--gold);
  background-image:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.2) 0%, transparent 70%),
    var(--velvet-noise-yellow);
  background-blend-mode: overlay, normal;
  background-size: auto;
  color: var(--dark-bg);
  font-weight: 400;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.45),
    inset 0 -6px 12px rgba(79, 79, 79, 0.3),
    inset 0 0 0 2px rgba(255, 245, 151, 0.28),
    0 2px 0 rgba(84, 76, 25, 0.9),
    0 8px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, filter var(--transition), box-shadow var(--transition);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 4px 6px;
  z-index: 0;
  border-radius: inherit;
  border: 1px solid rgba(79, 79, 79, 0.34);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.32),
    inset 0 -2px 3px rgba(73, 62, 19, 0.22);
  opacity: 0.95;
  pointer-events: none;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background-image: var(--velvet-noise-yellow);
  mix-blend-mode: overlay;
  opacity: 0.18;
  pointer-events: none;
}

.btn:hover {
  filter: brightness(1.02) saturate(1.08);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.5),
    inset 0 -7px 14px rgba(79, 79, 79, 0.32),
    inset 0 0 0 2px rgba(255, 245, 151, 0.34),
    0 2px 0 rgba(84, 76, 25, 0.85),
    0 10px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.btn.secondary {
  background-color: rgba(32, 32, 32, 0.92);
  background-image:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 70%),
    var(--velvet-noise-graphite);
  background-blend-mode: overlay, normal;
  background-size: auto;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.btn-pink {
  background-color: var(--gold);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(209, 106, 125, 0.45);
}

.btn-group,
.recommend-actions,
.launch-area,
.projects-actions,
.map-nav-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.launch-area {
  width: 100%;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  text-align: left;
}

.launch-area .btn,
.launch-area .instruction-link {
  align-self: center;
}

@media (max-width: 640px) {
  .launch-area {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
  }
}


.file-input-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-flex;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.recommend-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.recommend-list {
  flex: 1;
  min-height: 230px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  padding: 10px 14px;
}

.recommend-list .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.recommend-list .item:last-child {
  border-bottom: 0;
}

.add-btn {
  color: var(--pink);
  font-weight: 500;
  cursor: pointer;
}

.map-steps {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.map-step {
  color: var(--text-secondary);
  font-weight: 600;
}

.map-step.active {
  color: var(--pink);
}

.map-requests-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: grid;
  gap: 8px;
}

.map-requests-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.remove-request {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--pink);
  font-size: 22px;
  cursor: pointer;
}

.map-review-item {
  margin-bottom: 16px;
}

.map-review-item label {
  display: block;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
}

.map-review-item .value {
  color: var(--text-primary);
}

.map-review-item a {
  color: var(--pink);
}

.map-leader-input {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.map-leader-input input[type="number"] {
  width: 150px;
}

.checkbox-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkbox-group input {
  width: 18px;
  height: 18px;
}

.map-total {
  color: var(--pink);
  font-size: 20px;
  font-weight: 400;
  margin: 12px 0 18px;
}

.map-total span {
  color: var(--text-secondary);
  font-size: 14px;
}

.map-total strong {
  font-weight: 500;
}

.map-leader-input input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.projects-head {
  margin-bottom: 20px;
}

.projects-head h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.personal-referral {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1.2fr);
  gap: 16px 24px;
  align-items: center;
  margin: 0 0 20px;
  padding: 18px 20px;
  border: 1px solid rgba(212, 150, 167, 0.55);
  border-radius: var(--radius);
  background: var(--panel-bg);
}

.personal-referral[hidden] {
  display: none;
}

.personal-referral h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 500;
}

.personal-referral p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.personal-referral-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.personal-referral-link a {
  min-width: 0;
  color: var(--pink);
  overflow-wrap: anywhere;
  text-decoration: none;
}

.personal-referral-stats {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13px;
}

.personal-referral-stats strong {
  margin-right: 5px;
  color: var(--text-primary);
  font-weight: 500;
}

.project-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.project-card .url {
  font-size: 17px;
  font-weight: 600;
  word-break: break-word;
}

.project-card .meta {
  margin: 8px 0 14px;
  color: var(--text-secondary);
  font-size: 14px;
}

.report-line {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.report-line a {
  color: var(--pink);
  text-decoration: none;
}

.report-line a:hover {
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--pink);
  color: var(--dark-bg);
  font-size: 11px;
  font-weight: 800;
}

.status-pill {
  margin-left: 0;
  margin-right: 6px;
  background: var(--pink);
}

.project-card .actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.project-card .actions a[data-open-report] {
  color: var(--pink);
}

.empty-state,
.empty-inline {
  padding: 40px 0;
  text-align: center;
}

.table-wrap {
  overflow: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--pink);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  width: min(520px, 100%);
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  padding: 28px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  color: var(--pink);
}

.modal-close {
  border: 0;
  background: none;
  color: var(--text-secondary);
  font-size: 28px;
  cursor: pointer;
}

.tariff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.tariff-card,
.period-item {
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--dark-bg);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
}

.tariff-card.active,
.period-item.active {
  border-color: var(--gold);
}

.tariff-card .value {
  font-size: 22px;
  font-weight: 600;
}

.tariff-card .label,
.period-item small {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
}

.tariff-card .price,
.tariff-total .price {
  color: var(--pink);
  font-weight: 800;
}

.tariff-period {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.tariff-total {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding: 16px 0;
  font-size: 18px;
}

.map-url-help {
  margin-top: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(219, 205, 79, 0.35);
  border-radius: 8px;
  background: rgba(219, 205, 79, 0.08);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.map-url-help strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 600;
}

.map-url-help ol {
  margin: 0 0 10px;
  padding-left: 18px;
}

.map-url-help p {
  margin: 8px 0 0;
}

.map-url-help span {
  color: var(--gold);
}

.info-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
  cursor: help;
}

.info-dot::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 40;
  width: min(330px, 80vw);
  padding: 10px 12px;
  border-radius: 4px;
  background: #303030;
  color: white;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  transition: opacity var(--transition), transform var(--transition);
}

.info-dot:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #fffdf8;
  color: #2f2f2f;
  border-color: rgba(79, 79, 79, 0.16);
}

.modal-header {
  align-items: flex-start;
}

.modal-header h2 {
  color: #1f1f1f;
  font-size: 24px;
}

.modal-header p {
  margin: 8px 0 0;
  color: #77736a;
  font-size: 13px;
}

.modal-close {
  color: #4f4f4f;
}

.tariff-calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.tariff-calc-grid label {
  display: grid;
  gap: 8px;
  color: #5e5a52;
  font-size: 13px;
}

.tariff-calc-grid small {
  color: #9a958c;
}

.modal input {
  background: white;
  color: #2f2f2f;
  border-color: rgba(79, 79, 79, 0.18);
  min-height: 54px;
}

.tariff-recommendation {
  padding: 18px 20px;
  border: 1px solid rgba(219, 205, 79, 0.55);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(219, 205, 79, 0.14), rgba(255, 250, 210, 0.52));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.rec-label {
  margin-bottom: 16px;
  color: #64571d;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rec-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  color: #6d675e;
  border-bottom: 1px dashed rgba(79, 79, 79, 0.22);
  font-size: 13px;
}

.rec-row strong {
  color: #3e3e3e;
  font-weight: 500;
}

.rec-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 14px;
}

.rec-main strong {
  color: #252525;
  font-size: 34px;
  line-height: 1;
}

.rec-main span,
.rec-monthly {
  color: #6d675e;
}

.rec-monthly {
  margin-top: 7px;
  font-size: 13px;
}

.recommended-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 18px 20px;
  border: 2px solid var(--gold);
  border-radius: 10px;
  background: white;
}

.recommended-plan small {
  display: block;
  margin-bottom: 6px;
  color: #7d754f;
}

.recommended-plan strong,
.recommended-plan span {
  display: block;
}

.recommended-plan strong {
  color: #303030;
  font-size: 20px;
  font-weight: 700;
}

.recommended-plan span {
  margin-top: 8px;
  color: #2f2f2f;
  font-weight: 600;
}

.tariff-toggle {
  margin: 14px 0 8px;
  color: #8b8460;
}

.tariff-table-wrap {
  max-width: 100%;
  overflow: visible;
  border-top: 1px dashed rgba(79, 79, 79, 0.2);
  padding-top: 12px;
}

.tariff-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  color: #4f4f4f;
}

.tariff-table th {
  color: #8b8460;
  font-size: 11px;
  text-transform: uppercase;
}

.tariff-table td,
.tariff-table th {
  border-bottom: 1px solid rgba(79, 79, 79, 0.12);
  overflow-wrap: anywhere;
}

.tariff-table tbody tr {
  cursor: pointer;
}

.tariff-table tbody tr.active {
  background: transparent;
}

.modal .tariff-total {
  color: #2f2f2f;
  border-top-color: rgba(79, 79, 79, 0.12);
}

.map-bulk-requests {
  min-height: 130px;
}

.tariff-tool-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.tariff-panel {
  display: none;
}

.tariff-panel.recurring-mode {
  flex: 0 0 260px;
  height: 260px;
  min-height: 260px;
}

#searchTariffPanel.recurring-mode {
  flex: 0 0 260px;
  height: 260px;
  min-height: 260px;
}

@media (max-width: 760px) {
  .tariff-panel.recurring-mode {
    flex-basis: auto;
    height: auto;
    min-height: 0;
  }

  #searchTariffPanel.recurring-mode {
    flex-basis: auto;
    height: auto;
    min-height: 0;
  }
}

/* Billing modes are mutually exclusive; hidden controls must never reappear via component display rules. */
#tariffModal [hidden] {
  display: none !important;
}

/* Keep the total and subscription disclosure stable while tariff details scroll independently. */
#tariffModal .modal {
  height: min(760px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

#tariffModal .tariff-panel.active,
#tariffModal #searchTariffPanel.active,
#tariffModal #mapsTariffPanel.active,
#tariffModal #searchTariffPanel.recurring-mode.active {
  flex: 1 1 0 !important;
  height: auto !important;
  min-height: 0 !important;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

#tariffModal .tariff-total,
#tariffModal .yookassa-subscription,
#tariffModal .subscription-notice,
#tariffModal #searchTariffPayBtn,
#tariffModal .subscription-cancel {
  flex: 0 0 auto;
}

#tariffModal .tariff-total {
  margin-top: 12px;
}

@media (max-width: 760px) {
  #tariffModal .modal {
    display: block;
    width: calc(100vw - 20px);
    height: auto;
    max-height: calc(100dvh - 20px);
    overflow-x: hidden;
    overflow-y: auto;
  }

  #tariffModal .tariff-panel.active,
  #tariffModal #searchTariffPanel.active,
  #tariffModal #mapsTariffPanel.active,
  #tariffModal #searchTariffPanel.recurring-mode.active {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible;
    padding-right: 0;
  }
}

.tariff-panel.active {
  display: block;
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--card-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.modal-header h2 {
  color: var(--pink);
  font-size: 24px;
}

.modal-header p,
.tariff-calc-grid label,
.rec-row,
.rec-main span,
.rec-monthly {
  color: var(--text-secondary);
}

.modal-close {
  color: var(--text-secondary);
}

.modal input {
  min-height: 46px;
  background: var(--panel-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.tariff-recommendation {
  border-color: rgba(219, 205, 79, 0.42);
  background: rgba(219, 205, 79, 0.08);
  box-shadow: none;
}

.rec-label,
.tariff-toggle,
.tariff-table th {
  color: var(--gold);
}

.rec-row {
  border-bottom-color: var(--border-color);
}

.rec-row strong,
.rec-main strong,
.recommended-plan strong,
.recommended-plan span {
  color: var(--text-primary);
}

.recommended-plan {
  background: var(--panel-bg);
  border-color: var(--gold);
}

.recommended-plan small {
  color: var(--text-secondary);
}

.tariff-table {
  color: var(--text-secondary);
}

.tariff-table td,
.tariff-table th {
  border-bottom-color: var(--border-color);
}

.tariff-table tbody tr.active {
  background: rgba(219, 205, 79, 0.12);
}

.modal .tariff-total {
  color: var(--text-primary);
  border-top-color: var(--border-color);
}

@media (max-width: 820px) {
  body {
    padding: 0;
  }

  .container {
    min-height: 100vh;
    border-radius: 0;
    padding: 20px;
  }

  .project-form {
    grid-template-columns: 1fr;
  }

  .map-steps,
  .tabs {
    flex-wrap: wrap;
  }

  .tariff-grid,
  .tariff-period {
    grid-template-columns: 1fr 1fr;
  }

  .tariff-calc-grid,
  .summary {
    grid-template-columns: 1fr;
  }

  .recommended-plan,
  .rec-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Final visual pass: matte velvet, quieter tariff UI. */
.btn,
.btn.secondary,
.btn-pink {
  border: 0;
  background-color: var(--gold);
  background-image:
    radial-gradient(circle at 24% 22%, rgba(255, 255, 255, 0.12), transparent 24%),
    linear-gradient(145deg, #e7da62, var(--gold) 58%, #b9ad3d);
  color: var(--dark-bg);
  text-shadow: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  filter: none;
}

.btn.secondary {
  background-color: #4f4f4f;
  background-image:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.08), transparent 24%),
    linear-gradient(145deg, #626262, var(--ink) 62%, #3f3f3f);
  color: var(--text-primary);
}

.btn::before,
.btn::after {
  display: none;
}

.btn:hover {
  filter: saturate(1.04) brightness(1.01);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
}

.badge,
.status-pill,
.tab.active {
  background-color: var(--pink);
  background-image:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.16), transparent 25%),
    linear-gradient(145deg, #e0a8b7, var(--pink) 62%, #bd7f90);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.modal {
  border-radius: 12px;
  padding: 24px;
}

.tariff-recommendation {
  padding: 16px;
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  border-radius: 8px;
}

.recommended-plan {
  padding: 14px 16px;
  border: 1px solid rgba(219, 205, 79, 0.45);
  background: rgba(219, 205, 79, 0.07);
  border-radius: 8px;
}

.rec-label {
  margin-bottom: 10px;
}

.rec-main strong {
  font-size: 28px;
}

.tariff-table-wrap {
  overflow: visible;
}

.tariff-table {
  min-width: 0;
  table-layout: auto;
}

.tariff-table tbody tr.active {
  outline: 1px solid rgba(219, 205, 79, 0.45);
  outline-offset: -1px;
}

/* Softer velour texture: no stripes, just fine matte fibers. */
.btn,
.btn.secondary,
.btn-pink {
  border: 0;
  border-radius: 999px;
  background-color: var(--gold);
  background-image:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.2) 0%, transparent 70%),
    var(--velvet-noise-yellow);
  background-blend-mode: overlay, normal;
  box-shadow:
    inset 0 -3px 10px rgba(0, 0, 0, 0.14),
    inset 0 2px 5px rgba(255, 255, 255, 0.16),
    0 7px 16px rgba(0, 0, 0, 0.18);
  text-shadow: none;
}

.btn.secondary {
  background-color: var(--ink);
  background-image:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 70%),
    var(--velvet-noise-graphite);
  background-blend-mode: overlay, normal;
  box-shadow:
    inset 0 -3px 10px rgba(0, 0, 0, 0.22),
    inset 0 2px 5px rgba(255, 255, 255, 0.08),
    0 7px 16px rgba(0, 0, 0, 0.18);
}

.badge,
.status-pill,
.tab.active {
  background-color: var(--pink);
  background-image:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 70%),
    var(--velvet-noise-rose);
  background-blend-mode: overlay, normal;
  box-shadow:
    inset 0 -3px 9px rgba(0, 0, 0, 0.16),
    inset 0 2px 5px rgba(255, 255, 255, 0.12),
    0 5px 12px rgba(0, 0, 0, 0.14);
}

.tariff-card,
.period-item,
.tariff-recommendation,
.recommended-plan {
  border-radius: 12px;
}

.tariff-table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.tariff-table td,
.tariff-table th {
  border-bottom: 0;
}

.tariff-table tbody td {
  background: var(--dark-bg);
}

.tariff-table tbody td:first-child {
  border-radius: 12px 0 0 12px;
}

.tariff-table tbody td:last-child {
  border-radius: 0 12px 12px 0;
}

.tariff-table tbody tr.active td {
  background: rgba(219, 205, 79, 0.13);
}

/* Adaptive polish: no horizontal page scroll, rounded tariff states, calm tab motion. */
.container,
.modal,
.project-card,
.card,
.tariff-panel,
.tariff-recommendation,
.recommended-plan,
.tariff-table-wrap,
.table-wrap,
.map-review-item,
.map-url-help {
  min-width: 0;
  max-width: 100%;
}

.table-wrap,
.tariff-table-wrap {
  overflow-x: hidden;
}

.tariff-card,
.period-item,
.recommended-plan,
.tariff-recommendation,
.tariff-table tbody td {
  transition:
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.tariff-card.active,
.period-item.active {
  border-color: var(--gold);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(219, 205, 79, 0.16), rgba(219, 205, 79, 0.06)),
    var(--dark-bg);
  box-shadow:
    inset 0 0 0 1px rgba(219, 205, 79, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.tariff-card:hover,
.period-item:hover {
  transform: translateY(-1px);
}

.tariff-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.tariff-table tbody tr,
.tariff-table tbody tr.active {
  background: transparent !important;
}

.tariff-table tbody td {
  background: var(--dark-bg);
  overflow-wrap: anywhere;
  word-break: normal;
}

.tariff-table tbody tr.active td {
  background: rgba(219, 205, 79, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(219, 205, 79, 0.18),
    inset 0 -1px 0 rgba(219, 205, 79, 0.18);
}

.tariff-table tbody tr.active td:first-child {
  border-radius: 14px 0 0 14px;
  box-shadow:
    inset 1px 0 0 rgba(219, 205, 79, 0.18),
    inset 0 1px 0 rgba(219, 205, 79, 0.18),
    inset 0 -1px 0 rgba(219, 205, 79, 0.18);
}

.tariff-table tbody tr.active td:last-child {
  border-radius: 0 14px 14px 0;
  box-shadow:
    inset -1px 0 0 rgba(219, 205, 79, 0.18),
    inset 0 1px 0 rgba(219, 205, 79, 0.18),
    inset 0 -1px 0 rgba(219, 205, 79, 0.18);
}

.tabs,
.tariff-tool-switch,
.map-steps {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.tab,
.map-step {
  white-space: normal;
  will-change: transform, background-color, box-shadow;
}

.map-step {
  transition:
    color var(--transition),
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.map-step:hover {
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  body {
    width: 100%;
  }

  .container {
    padding-inline: 14px;
  }

  .tabs,
  .tariff-tool-switch,
  .map-steps {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tariff-table {
    font-size: 12px;
  }

  .tariff-table th,
  .tariff-table td {
    padding: 9px 6px;
  }
}

/* Tariff correction pass: thinner selection, stable panels, fully rounded map rows. */
.tariff-grid,
.tariff-period {
  align-items: stretch;
}

.tariff-card,
.period-item {
  min-height: 86px;
  border: 1px solid transparent !important;
  border-radius: 14px;
  transform: translateZ(0);
  transition:
    background-color 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    transform 0.28s ease;
}

.period-item {
  min-height: 54px;
}

.tariff-card.active,
.period-item.active {
  border-color: rgba(219, 205, 79, 0.5) !important;
  box-shadow:
    inset 0 0 0 1px rgba(219, 205, 79, 0.08),
    0 5px 14px rgba(0, 0, 0, 0.14);
}

.tariff-card:hover,
.period-item:hover {
  transform: translateY(-1px);
}

.tariff-panel {
  min-height: 520px;
}

#searchTariffPanel {
  min-height: 520px;
}

#mapsTariffPanel {
  min-height: 520px;
}

.tariff-table {
  display: block;
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.tariff-table thead,
.tariff-table tbody {
  display: block;
}

.tariff-table tr {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 0.75fr) minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}

.tariff-table tbody tr {
  margin-top: 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--dark-bg) !important;
  cursor: pointer;
  overflow: hidden;
  transition:
    background-color 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    transform 0.28s ease;
}

.tariff-table tbody tr:hover {
  transform: translateY(-1px);
}

.tariff-table tbody tr.active {
  border-color: rgba(219, 205, 79, 0.42);
  background: rgba(219, 205, 79, 0.08) !important;
  box-shadow:
    inset 0 0 0 1px rgba(219, 205, 79, 0.06),
    0 5px 14px rgba(0, 0, 0, 0.14);
  outline: 0 !important;
}

.tariff-table th,
.tariff-table td {
  display: block;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  overflow-wrap: anywhere;
}

.tariff-table tbody td,
.tariff-table tbody tr.active td,
.tariff-table tbody tr.active td:first-child,
.tariff-table tbody tr.active td:last-child {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

@media (max-width: 640px) {
  .tariff-panel,
  #searchTariffPanel,
  #mapsTariffPanel {
    min-height: auto;
  }

  .tariff-table tr {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.72fr) minmax(0, 1.18fr) minmax(0, 0.95fr);
  }

  .tariff-table th,
  .tariff-table td {
    padding: 8px 6px;
  }
}

/* Interface consistency pass: calmer typography, equal tabs, scroll-free region picker. */
body {
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

.logo {
  line-height: 1.05;
}

.logo-sub,
.statusbar,
small,
.hint,
.empty-inline,
.project-card .meta,
.rec-row,
.rec-monthly,
.map-url-help,
.report-line {
  font-size: 13px;
  line-height: 1.45;
}

.block-title,
label,
.nav a,
.btn-link,
.instruction-link,
.tab,
.map-step,
.tariff-card,
.period-item,
.tariff-table,
.btn {
  font-family: inherit;
  letter-spacing: 0;
}

.block-title {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

label {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

input,
select,
textarea {
  font-size: 14px;
  line-height: 1.45;
}

.tabs {
  align-items: stretch;
}

.tabs .tab {
  min-height: 42px;
  min-width: 148px;
}

.tariff-tool-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  width: 100%;
}

.tariff-tool-switch .tab {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 16px;
  text-align: center;
}

.tariff-card,
.period-item {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
}

.tariff-card .value {
  font-size: 21px;
  line-height: 1.1;
  font-weight: 600;
}

.tariff-card .label,
.period-item small,
.tariff-card .price {
  font-size: 12px;
  line-height: 1.3;
}

.region-select select {
  display: none;
}

.region-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.region-chip {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition:
    color 0.24s ease,
    background-color 0.24s ease,
    border-color 0.24s ease,
    box-shadow 0.24s ease,
    transform 0.24s ease;
}

.region-chip:hover {
  color: var(--text-primary);
  transform: translateY(-1px);
}

.region-chip.active {
  border-color: rgba(212, 150, 167, 0.55);
  background-color: var(--pink);
  background-image:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 70%),
    var(--velvet-noise-rose);
  background-blend-mode: overlay, normal;
  color: var(--dark-bg);
  box-shadow:
    inset 0 -2px 7px rgba(0, 0, 0, 0.12),
    inset 0 1px 4px rgba(255, 255, 255, 0.1);
}

@media (max-width: 640px) {
  .tabs .tab {
    width: 100%;
    min-width: 0;
  }

  .region-chips {
    grid-template-columns: 1fr;
  }
}

/* UI type lock: keep text rhythm consistent across older component rules. */
.form-group > label,
.tariff-calc-grid label,
.map-review-item label,
.checkbox-group,
.map-leader-input .hint {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.nav a,
.btn-link,
.instruction-link,
.project-card .actions a,
.statusbar,
.toast,
.report-line,
.project-card .meta {
  font-size: 13px;
  line-height: 1.45;
}

.btn,
.tab,
.region-chip,
.map-step {
  font-size: 14px;
  line-height: 1.35;
}

/* Hard lock for the tariff/region UX: equal panels, visible inactive tabs, no page overflow. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

.page {
  min-width: 0;
  transition:
    opacity 0.24s ease,
    transform 0.24s ease;
}

.tabs {
  gap: 10px;
}

.tabs .tab,
.tariff-tool-switch .tab {
  border: 1px solid rgba(212, 150, 167, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  box-shadow: none;
  transition:
    color 0.24s ease,
    background-color 0.24s ease,
    border-color 0.24s ease,
    box-shadow 0.24s ease,
    transform 0.24s ease;
}

.tabs .tab.active,
.tariff-tool-switch .tab.active {
  border-color: var(--pink);
  color: var(--dark-bg);
}

.modal {
  width: min(760px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header,
.tariff-tool-switch,
.tariff-total,
#searchTariffPayBtn {
  flex: 0 0 auto;
}

.tariff-panel {
  display: none;
  flex: 1 1 auto;
  height: 520px;
  min-height: 520px;
  overflow: hidden;
  transition:
    opacity 0.24s ease,
    transform 0.24s ease;
}

.tariff-panel.active {
  display: block;
}

#searchTariffPanel,
#mapsTariffPanel {
  height: 520px;
  min-height: 520px;
}

.tariff-grid,
.tariff-period {
  min-height: 0;
}

.tariff-card,
.period-item,
.tariff-table tbody tr {
  border-color: rgba(219, 205, 79, 0.22) !important;
}

.tariff-card.active,
.period-item.active,
.tariff-table tbody tr.active {
  border-color: rgba(219, 205, 79, 0.34) !important;
}

.tariff-table th {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 500;
}

.tariff-table tbody tr,
.tariff-table tbody tr.active {
  border-radius: 14px !important;
  overflow: hidden;
}

.tariff-table tbody td,
.tariff-table tbody tr.active td,
.tariff-table tbody tr.active td:first-child,
.tariff-table tbody tr.active td:last-child {
  border-radius: 0 !important;
}

.tariff-table tbody tr td:first-child {
  border-radius: 14px 0 0 14px !important;
}

.tariff-table tbody tr td:last-child {
  border-radius: 0 14px 14px 0 !important;
}

.region-code-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin-top: 8px;
}


.region-code-picker input {
  min-width: 0;
  min-height: 38px;
  border-radius: 999px;
}

.region-search-results {
  grid-column: 1 / -1;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--panel-bg);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.region-search-result {
  width: 100%;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.region-search-result:last-child {
  border-bottom: 0;
}

.region-search-result:hover,
.region-search-result:focus-visible {
  background: rgba(212, 150, 167, 0.1);
}

.region-search-result small,
.region-search-empty {
  color: var(--text-secondary);
  font-size: 12px;
}

.region-search-empty {
  padding: 14px 12px;
  text-align: center;
}

.region-code-add {
  white-space: nowrap;
}

.recommend-container {
  gap: 14px;
}

.recommend-list {
  min-height: 220px;
  padding-bottom: 14px;
}

.recommend-actions {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  padding-top: 2px;
}

@media (max-width: 760px) {
  .modal {
    width: calc(100vw - 20px);
    height: calc(100dvh - 20px);
  }

  .tariff-panel,
  #searchTariffPanel,
  #mapsTariffPanel {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    overflow: auto;
  }

  .region-code-picker {
    grid-template-columns: 1fr;
  }
}

/* Maps and tariff correction requested after review. */
.tabs .tab,
.tariff-tool-switch .tab {
  border-color: rgba(212, 150, 167, 0.62) !important;
  background: transparent !important;
  color: var(--text-primary) !important;
}

.tabs .tab.active,
.tariff-tool-switch .tab.active {
  border-color: var(--pink) !important;
  background-color: var(--pink) !important;
  background-image:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 70%),
    var(--velvet-noise-rose) !important;
  background-blend-mode: overlay, normal;
  color: var(--dark-bg) !important;
}

.modal {
  width: min(760px, calc(100vw - 32px));
  height: auto;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
}

.tariff-panel,
#searchTariffPanel,
#mapsTariffPanel {
  height: auto;
  min-height: 520px;
  overflow: visible;
}

.map-review-item label,
.tariff-calc-grid label,
.checkbox-group,
.map-leader-input .hint {
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.map-review-item,
.map-review-item .value,
.map-review-item a,
.map-url-help,
.report-line,
.project-card .url {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.field-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(209, 106, 125, 0.18) !important;
}

.auth-modal {
  width: min(460px, calc(100vw - 32px));
}

#authModal {
  z-index: 40;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form [hidden],
.auth-switch[hidden] {
  display: none !important;
}

.auth-form .btn {
  width: 100%;
}

.auth-message {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(212, 150, 167, 0.55);
  border-radius: 10px;
  color: #f0b5c5;
  background: rgba(212, 150, 167, 0.1);
  font-size: 14px;
  line-height: 1.4;
}

.auth-message.success {
  border-color: rgba(219, 205, 79, 0.45);
  color: #e8dc72;
  background: rgba(219, 205, 79, 0.08);
}

.auth-link {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pink);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-switch {
  margin-bottom: 18px;
}

.nav a[hidden],
.nav-user[hidden] {
  display: none !important;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.admin-summary div {
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--panel-bg);
}

.admin-summary span {
  display: block;
  color: var(--pink);
  font-size: 24px;
  line-height: 1.1;
}

.admin-summary small {
  display: block;
  margin-top: 5px;
}

.admin-section-tabs {
  margin: 18px 0 22px;
  max-width: 650px;
}

.admin-stats-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}

.admin-stats-toolbar select {
  width: auto;
  min-width: 88px;
  min-height: 36px;
  padding: 7px 30px 7px 12px;
  border: 1px solid rgba(212, 150, 167, 0.72);
  border-radius: 999px;
  background: var(--panel-bg);
  color: var(--text-primary);
}

.admin-click-ranges {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(212, 150, 167, 0.45);
  border-radius: 999px;
  background: transparent;
  white-space: nowrap;
}

.admin-click-range {
  min-width: 40px;
  min-height: 26px;
  padding: 4px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}

.admin-click-range:hover,
.admin-click-range:focus-visible {
  color: var(--pink);
}

.admin-click-range.is-active {
  background: var(--pink);
  color: var(--panel-bg);
}

.admin-click-range:disabled {
  cursor: wait;
  opacity: 0.55;
}

.worker-stats,
.click-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.worker-stat,
.click-day-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--panel-bg);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.worker-stat b,
.click-day-stat b,
.stat-success {
  color: var(--pink);
  font-style: normal;
  font-weight: 500;
}

.worker-stat em,
.click-day-stat em,
.stat-failed {
  color: var(--danger);
  font-style: normal;
  font-weight: 500;
}

.click-day-stat span {
  color: var(--text-secondary);
}

.admin-click-table th:nth-child(1) { width: 20%; }
.admin-click-table th:nth-child(2) { width: 16%; }
.admin-click-table th:nth-child(3),
.admin-click-table th:nth-child(4),
.admin-click-table th:nth-child(5) { width: 10%; }
.admin-click-table th:nth-child(6) { width: 34%; }

.referral-create {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 22px;
  max-width: 760px;
}

.referral-create .form-group {
  margin: 0;
}

.referral-copy + small {
  display: block;
  max-width: 260px;
  overflow-wrap: anywhere;
  margin-top: 7px;
}

.referral-table td small + small {
  margin-top: 4px;
}

.registrations-table th:nth-child(1) { width: 23%; }
.registrations-table th:nth-child(2) { width: 17%; }
.registrations-table th:nth-child(3) { width: 12%; }
.registrations-table th:nth-child(4) { width: 20%; }
.registrations-table th:nth-child(5) { width: 28%; }

.registrations-table td:last-child small {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: hidden;
}

.admin-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.admin-table th {
  color: var(--text-primary);
  background: rgba(212, 150, 167, 0.12);
  font-weight: 500;
}

.admin-table td {
  color: var(--text-secondary);
}

.admin-table td strong,
.admin-table td small {
  display: block;
}

.admin-table td strong {
  color: var(--text-primary);
  font-weight: 500;
}

.table-action {
  border: 1px solid rgba(212, 150, 167, 0.75);
  border-radius: 999px;
  background: transparent;
  color: var(--pink);
  padding: 6px 12px;
  cursor: pointer;
}

.admin-row-action .table-action + .table-action {
  margin-top: 8px;
}

.table-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.admin-toggle-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.admin-toggle-track {
  position: relative;
  width: 30px;
  height: 16px;
  flex: 0 0 30px;
  border: 1px solid rgba(212, 150, 167, 0.72);
  border-radius: 999px;
  background: transparent;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.admin-toggle-track > span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 180ms ease, background-color 180ms ease;
}

.admin-toggle.is-on .admin-toggle-track {
  border-color: var(--pink);
  background: var(--pink);
}

.admin-toggle.is-on .admin-toggle-track > span {
  background: var(--panel-bg);
  transform: translateX(14px);
}

.admin-toggle-name {
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.admin-toggle:hover .admin-toggle-name,
.admin-toggle:focus-visible .admin-toggle-name {
  color: var(--pink);
}

.admin-toggle:focus-visible {
  outline: 2px solid rgba(212, 150, 167, 0.55);
  outline-offset: 3px;
}

.admin-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.admin-check-date {
  margin-top: 5px;
  font-size: 10px;
}

.region-code-hint {
  display: block;
  min-height: 18px;
  color: var(--pink);
}

.map-nav-buttons {
  gap: 10px;
}

/* Final polish for maps/search project filters and tariff text sizing. */
.tabs,
.tariff-tool-switch,
.project-type-tabs {
  padding-top: 6px;
}

.project-type-tabs {
  margin: 2px 0 18px;
  border-bottom: 0;
}

.region-code-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.region-code-preview {
  grid-column: 1 / -1;
  grid-row: 2;
  min-height: 16px;
  max-width: 100%;
  overflow: hidden;
  color: var(--pink);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 12px;
}

.region-code-add {
  grid-column: 2;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.search-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  margin-right: 1px;
  width: 12px;
  height: 12px;
  border: 1.6px solid currentColor;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 1.6px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
}

.rec-label,
.tariff-toggle,
.tariff-table th {
  color: var(--text-secondary) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#addAllRecommendedBtn {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pink);
  box-shadow: none;
}

#addAllRecommendedBtn:hover {
  color: var(--pink);
  transform: none;
}

.subscription-cancel {
  display: block;
  margin: 14px auto 0;
  color: var(--pink);
}

.subscription-cancel[hidden] {
  display: none !important;
}

.subscription-notice {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.trial-notice {
  margin: 2px 0 12px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.trial-notice[hidden] {
  display: none !important;
}

.yookassa-subscription {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.yookassa-subscription > p { margin: 0; text-align: center; }

.payment-method-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.payment-method-switch label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(212, 150, 167, 0.55);
  border-radius: 14px;
  cursor: pointer;
}

.payment-method-switch input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  flex: 0 0 18px;
}

.payment-method-switch label:has(input:checked) {
  background: rgba(212, 150, 167, 0.18);
  border-color: var(--pink);
}

.recurring-consent { display: flex; align-items: flex-start; gap: 9px; }
.recurring-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 3px 0 0;
  flex: 0 0 18px;
}
.recurring-consent span { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.recurring-consent a { color: var(--pink); }

.tariff-panel.recurring-mode {
  flex: 0 0 260px;
  height: 260px;
  min-height: 260px;
}

@media (max-width: 760px) {
  .tariff-panel.recurring-mode {
    flex-basis: auto;
    height: auto;
    min-height: 0;
  }
}

/* Tariff modal: one continuous layout, no nested scrollbars or overlapping sections. */
#tariffModal {
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

#tariffModal::-webkit-scrollbar,
#tariffModal .modal::-webkit-scrollbar,
#tariffModal .tariff-panel::-webkit-scrollbar {
  display: none;
}

#tariffModal .modal {
  display: block;
  width: min(900px, calc(100vw - 24px));
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 22px 26px;
}

#tariffModal .modal-header {
  margin-bottom: 14px;
}

#tariffModal .tariff-tool-switch {
  margin-bottom: 14px;
}

#tariffModal .tariff-panel.active,
#tariffModal #searchTariffPanel.active,
#tariffModal #mapsTariffPanel.active,
#tariffModal #searchTariffPanel.recurring-mode.active {
  display: block;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible;
  padding-right: 0;
}

#tariffModal .tariff-calc-grid {
  margin-bottom: 10px;
}

#tariffModal .tariff-calc-grid input {
  min-height: 44px;
}

#tariffModal .tariff-recommendation {
  padding: 14px 18px;
}

#tariffModal .rec-label {
  margin-bottom: 8px;
}

#tariffModal .rec-row {
  padding: 6px 0;
}

#tariffModal .rec-main {
  margin-top: 10px;
}

#tariffModal .recommended-plan {
  margin-top: 12px;
  padding: 12px 16px;
}

#tariffModal .tariff-toggle {
  margin: 10px 0 6px;
}

#tariffModal .tariff-table-wrap {
  padding-top: 8px;
  overflow: visible;
}

@media (min-width: 761px) {
  #tariffModal .tariff-table thead {
    display: none;
  }

  #tariffModal .tariff-table tbody {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  #tariffModal .tariff-table tbody tr,
  #tariffModal .tariff-table tbody tr.active {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 3px;
    min-width: 0;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(219, 205, 79, 0.22) !important;
    border-radius: 12px !important;
    background: var(--panel-bg) !important;
  }

  #tariffModal .tariff-table tbody tr.active {
    border-color: rgba(219, 205, 79, 0.5) !important;
    background: rgba(219, 205, 79, 0.1) !important;
  }

  #tariffModal .tariff-table tbody td,
  #tariffModal .tariff-table tbody tr td:first-child,
  #tariffModal .tariff-table tbody tr td:last-child {
    min-width: 0;
    padding: 1px 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  #tariffModal .tariff-table tbody td:first-child {
    color: var(--text-primary);
    font-weight: 500;
  }

  #tariffModal .tariff-table tbody td:nth-child(n + 3) {
    color: var(--text-secondary);
    font-size: 12px;
  }
}

#tariffModal .tariff-total {
  margin-top: 10px;
  padding: 12px 0;
}

#tariffModal .yookassa-subscription {
  gap: 9px;
  margin-bottom: 10px;
}

#tariffModal .yookassa-subscription > p {
  font-size: 12px;
}

#tariffModal .recurring-consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 40px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(212, 150, 167, 0.42);
  border-radius: 12px;
  background: rgba(212, 150, 167, 0.06);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}

#tariffModal .recurring-consent input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  border: 1px solid rgba(212, 150, 167, 0.75);
  border-radius: 5px;
  background: var(--panel-bg);
  cursor: pointer;
}

#tariffModal .recurring-consent input[type="checkbox"]:checked {
  border-color: var(--pink);
  background: var(--pink);
}

#tariffModal .recurring-consent input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid var(--dark-bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

#tariffModal .recurring-consent span {
  min-width: 0;
  white-space: nowrap;
}

#tariffModal #searchTariffPayBtn {
  width: 100%;
}

@media (min-width: 761px) {
  #tariffModal.maps-mode .modal {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(270px, 310px);
    grid-template-areas:
      "header header"
      "switch switch"
      "panel total"
      "panel yookassa"
      "panel stripe"
      "panel search-pay"
      "panel cancel";
    column-gap: 16px;
    align-items: start;
  }

  #tariffModal.maps-mode .modal-header {
    grid-area: header;
  }

  #tariffModal.maps-mode .tariff-tool-switch {
    grid-area: switch;
  }

  #tariffModal.maps-mode #mapsTariffPanel {
    grid-area: panel;
  }

  #tariffModal.maps-mode .tariff-total {
    grid-area: total;
    margin-top: 0;
  }

  #tariffModal.maps-mode .yookassa-subscription {
    grid-area: yookassa;
  }

  #tariffModal.maps-mode #stripeRecurringNotice {
    grid-area: stripe;
  }

  #tariffModal.maps-mode #searchTariffPayBtn {
    grid-area: search-pay;
  }

  #tariffModal.maps-mode .subscription-cancel {
    grid-area: cancel;
  }

  #tariffModal.maps-mode .payment-method-switch {
    grid-template-columns: 1fr;
  }

  #tariffModal.maps-mode .recurring-consent {
    align-items: start;
  }

  #tariffModal.maps-mode .recurring-consent span {
    white-space: normal;
  }
}

@media (max-width: 760px) {
  #tariffModal {
    align-items: flex-start;
    padding: 10px 0;
  }

  #tariffModal .modal {
    display: block;
    width: calc(100vw - 20px);
    padding: 18px 14px;
  }

  #tariffModal .recurring-consent {
    align-items: start;
  }

  #tariffModal .recurring-consent span {
    white-space: normal;
  }
}

@media (max-width: 760px) {
  .region-code-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .region-code-preview {
    max-width: 100%;
  }
}

/* Mobile repair: admin rows and map tariffs stay readable without overlap. */
@media (max-width: 640px) {
  .personal-referral {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .personal-referral-link {
    align-items: stretch;
    flex-direction: column;
  }

  .personal-referral-link .table-action {
    width: 100%;
  }

  .personal-referral-stats {
    grid-column: 1;
    flex-direction: column;
    gap: 8px;
  }

  .referral-create {
    grid-template-columns: 1fr;
  }

  .admin-section-tabs {
    max-width: none;
  }

  body {
    padding:
      max(12px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .container {
    min-height: calc(100dvh - 24px);
    padding: 18px 14px 24px;
    border-radius: 16px;
  }

  .header {
    gap: 14px;
  }

  .logo-wrapper,
  .nav {
    width: 100%;
  }

  .nav {
    gap: 12px 18px;
  }

  .nav a,
  .nav-user {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .language-switch {
    min-height: 44px;
  }

  .projects-head {
    align-items: flex-start;
  }

  .projects-actions .btn,
  #adminRefreshBtn {
    min-height: 44px;
  }

  .admin-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-table-wrap {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .admin-table {
    border: 0;
    background: transparent;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tbody {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .admin-table tr {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--panel-bg);
  }

  .admin-table td {
    display: grid;
    grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
    gap: 12px;
    padding: 8px 0;
    border: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .admin-table td > *,
  .admin-table td strong,
  .admin-table td small {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .admin-table td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-size: 12px;
  }

  .admin-table td.admin-row-action {
    display: block;
    padding-top: 12px;
  }

  .admin-table td.admin-row-action::before {
    content: none;
  }

  .admin-table .table-action {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    padding-inline: 14px;
    overflow: hidden;
    white-space: normal;
  }

  .admin-table .admin-toggle {
    display: inline-flex;
    width: auto;
    min-height: 24px;
    padding: 0;
    white-space: nowrap;
  }

  .admin-toggle-group {
    gap: 8px 12px;
  }

  .modal {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 18px 14px;
  }

  .tariff-panel,
  #searchTariffPanel,
  #mapsTariffPanel {
    height: auto;
    min-height: 0;
    overflow: visible;
    min-width: 0;
  }

  .recommended-plan {
    align-items: stretch;
  }

  .recommended-plan .btn {
    width: 100%;
    min-height: 44px;
  }

  .tariff-table-wrap {
    overflow: visible;
  }

  .tariff-table,
  .tariff-table tbody,
  .tariff-table tr,
  .tariff-table td {
    display: block;
    width: 100%;
  }

  .tariff-table thead {
    display: none;
  }

  .tariff-table tbody {
    display: grid;
    gap: 10px;
  }

  .tariff-table tbody tr,
  .tariff-table tbody tr.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    padding: 14px;
    border: 1px solid rgba(219, 205, 79, 0.22) !important;
    border-radius: 14px !important;
    background: var(--panel-bg);
  }

  .tariff-table tbody tr.active {
    border-color: rgba(219, 205, 79, 0.5) !important;
  }

  .tariff-table tbody td,
  .tariff-table tbody tr.active td,
  .tariff-table tbody tr td:first-child,
  .tariff-table tbody tr td:last-child {
    min-width: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow-wrap: normal;
    word-break: normal;
  }

  .tariff-table tbody td:nth-child(1),
  .tariff-table tbody td:nth-child(2) {
    font-weight: 500;
  }

  .tariff-table tbody td:nth-child(3),
  .tariff-table tbody td:nth-child(4) {
    color: var(--text-secondary);
    font-size: 12px;
  }

  .modal > .tariff-total {
    position: static;
    z-index: auto;
    width: 100%;
    margin-top: 16px;
    padding: 14px 0 10px;
    background: var(--card-bg);
  }

  #searchTariffPayBtn {
    position: static;
    width: 100%;
    min-height: 44px;
  }

  .info-dot::after {
    right: -8px;
    left: auto;
    width: min(240px, calc(100vw - 64px));
    transform: translateY(4px);
  }

  .info-dot:hover::after {
    transform: translateY(0);
  }
}

@media (max-width: 360px) {
  .tariff-table tbody tr,
  .tariff-table tbody tr.active {
    grid-template-columns: 1fr;
  }
}

/* Final tariff QA: lock the page, keep tooltips inside the calculator and reset checkbox input styles. */
html:has(#tariffModal.active),
body:has(#tariffModal.active) {
  overflow: hidden !important;
}

#tariffModal .recurring-consent input[type="checkbox"] {
  display: block !important;
  flex: 0 0 18px !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
}

#tariffModal .recurring-consent input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(212, 150, 167, 0.65);
  outline-offset: 3px;
}

#tariffModal #searchTariffPayBtn {
  width: 100% !important;
  max-width: none !important;
}

@media (min-width: 761px) {
  #tariffModal.maps-mode .tariff-calc-grid > label > span {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
  }

  #tariffModal.maps-mode .tariff-calc-grid .info-dot::after {
    right: 0;
    left: auto;
    width: min(220px, calc(100vw - 64px));
    transform: translateY(4px);
  }

  #tariffModal.maps-mode .tariff-calc-grid .info-dot:hover::after {
    transform: translateY(0);
  }
}

/* Primary actions match the tariff selector: transparent with a fine gold edge. */
.btn:not(.secondary):not(.btn-danger) {
  border: 1px solid rgba(219, 205, 79, 0.48);
  background: transparent;
  color: var(--text-primary);
  box-shadow: none;
  filter: none;
  text-shadow: none;
  transition:
    color var(--transition),
    background-color var(--transition),
    border-color var(--transition),
    transform var(--transition);
}

.btn:not(.secondary):not(.btn-danger):hover {
  border-color: rgba(219, 205, 79, 0.72);
  background: rgba(219, 205, 79, 0.07);
  box-shadow: none;
  filter: none;
  transform: translateY(-1px);
}

.btn:not(.secondary):not(.btn-danger):active {
  background: rgba(219, 205, 79, 0.11);
  transform: translateY(0);
}

.btn:not(.secondary):not(.btn-danger):disabled {
  border-color: rgba(219, 205, 79, 0.2);
  background: transparent;
  color: var(--text-secondary);
  opacity: 0.6;
}

#searchTariffPanel.recurring-mode {
  flex: 0 0 260px;
  height: 260px;
  min-height: 260px;
}

@media (max-width: 760px) {
  #searchTariffPanel.recurring-mode {
    flex-basis: auto;
    height: auto;
    min-height: 0;
  }
}

/* Compact monthly subscription panel; keep billing controls in the same viewport. */
.tariff-panel.recurring-mode {
  flex: 0 0 260px;
  height: 260px;
  min-height: 260px;
}

/* Unified tariff composition: maps and search share one wide content flow. */
#tariffModal.maps-mode .modal {
  display: block;
}

#tariffModal.maps-mode #mapsTariffPanel {
  width: 100%;
}

@media (min-width: 761px) {
  #tariffModal.maps-mode .tariff-recommendation {
    display: grid;
    grid-template-columns: minmax(250px, 0.78fr) minmax(0, 1.42fr);
    gap: 16px;
    align-items: start;
  }

  #tariffModal.maps-mode .tariff-analysis,
  #tariffModal.maps-mode .tariff-choice {
    min-width: 0;
  }

  #tariffModal.maps-mode .recommended-plan {
    margin-top: 0;
  }

  #tariffModal.maps-mode .tariff-table-wrap {
    padding-top: 8px;
  }

  #tariffModal.maps-mode .tariff-table tbody tr,
  #tariffModal.maps-mode .tariff-table tbody tr.active {
    padding: 8px 10px;
  }
}

#tariffModal.maps-mode .tariff-billing-footer .tariff-total,
#tariffModal.maps-mode .tariff-billing-footer .yookassa-subscription,
#tariffModal.maps-mode .tariff-billing-footer #stripeRecurringNotice {
  grid-area: auto;
}

#tariffModal .tariff-billing-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

#tariffModal .tariff-billing-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.55fr) minmax(240px, 1.35fr) minmax(300px, 1.4fr);
  align-items: center;
  gap: 12px;
}

#tariffModal .tariff-billing-row .tariff-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

#tariffModal .tariff-billing-row .trial-notice,
#tariffModal .tariff-billing-row .subscription-notice {
  min-width: 0;
  margin: 0;
  text-align: left;
  text-wrap: pretty;
}

#tariffModal .tariff-billing-row .payment-method-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

#tariffModal .tariff-billing-row .payment-method-switch[hidden] {
  display: none !important;
}

#tariffModal .tariff-billing-footer .yookassa-subscription {
  margin: 10px 0 0;
}

#tariffModal .tariff-billing-footer .recurring-consent {
  width: 100%;
}

#tariffModal.english-mode .tariff-billing-row {
  grid-template-columns: minmax(140px, 0.45fr) minmax(0, 2fr);
}

@media (max-width: 760px) {
  #tariffModal .tariff-billing-row,
  #tariffModal.english-mode .tariff-billing-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #tariffModal .tariff-billing-row .trial-notice,
  #tariffModal .tariff-billing-row .subscription-notice {
    text-align: center;
  }
}

@media (max-width: 760px) {
  .tariff-panel.recurring-mode {
    flex-basis: auto;
    height: auto;
    min-height: 0;
  }
}
