:root {
  --page-bg: #3650c8;
  --page-bg-deep: #2b43b5;
  --panel-bg: #f4f5f8;
  --panel-border: rgba(20, 31, 89, 0.08);
  --field-bg: #ececf1;
  --text: #10162f;
  --muted: #646b82;
  --muted-soft: #8d93a8;
  --white: #ffffff;
  --yellow: #ffc61f;
  --yellow-deep: #f0b800;
  --blue: #3650c8;
  --blue-soft: #dfe5ff;
  --interest: #fb8c47;
  --principal: #3650c8;
  --error: #d1495b;
  --shadow-lg: 0 30px 80px rgba(17, 29, 91, 0.24);
  --shadow-md: 0 16px 36px rgba(17, 29, 91, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Manrope, Arial, sans-serif;
  color: var(--white);
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.12), transparent 20%),
    linear-gradient(180deg, var(--page-bg), var(--page-bg-deep));
}

.page-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

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

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--white);
  transition: opacity 160ms ease;
}

.site-logo:hover {
  opacity: 0.85;
}

.site-logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  line-height: 1;
}

.site-logo-text em {
  font-style: normal;
  font-weight: 500;
  font-size: 0.72rem;
  opacity: 0.55;
  letter-spacing: 0.01em;
}

.lang-switch {
  display: flex;
  gap: 6px;
}

.lang-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 7px 16px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.lang-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.55);
}

.lang-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.hero {
  text-align: center;
  margin-bottom: 30px;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 0.98;
  font-weight: 800;
}

.hero p {
  width: min(900px, 100%);
  margin: 0 auto 12px;
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.7;
}

.mode-switch {
  display: flex;
  width: fit-content;
  margin: 0 auto 38px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.mode-tab {
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  color: var(--white);
  background: transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.mode-tab.active {
  color: var(--blue);
  background: var(--white);
}

.mode-tab:hover {
  transform: translateY(-1px);
}

.calculator-panel {
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--panel-bg);
}

.calculator-form,
.results-panel {
  padding: 26px 28px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.field-card {
  display: grid;
  gap: 10px;
}

.field-card label {
  color: var(--muted);
  font-size: 0.95rem;
}

.input-shell,
.compound-shell {
  min-height: 72px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: var(--field-bg);
  color: var(--text);
}

.input-shell {
  position: relative;
}

.compound-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(120px, 0.42fr);
  align-items: stretch;
}

.compound-divider {
  width: 1px;
  background: rgba(16, 22, 47, 0.12);
}

.compact-select,
.input-shell input,
.compound-shell input,
.select-shell select {
  width: 100%;
  height: 100%;
}

input,
select {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 20px;
  outline: none;
}


input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-shell input,
.select-shell select {
  padding: 18px 54px 18px 18px;
}

.compound-shell > input {
  padding: 18px;
}

.compact-select,
.select-shell {
  position: relative;
}

.select-shell select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.compact-select input {
  padding: 18px 42px 18px 18px;
}

.suffix {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 700;
}

.select-shell::after {
  content: "▾";
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  color: var(--text);
  pointer-events: none;
}

.field-property.hidden,
.field-payment.hidden {
  display: none;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 16px 26px;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button {
  color: var(--text);
  background: linear-gradient(180deg, var(--yellow), var(--yellow-deep));
  box-shadow: 0 16px 28px rgba(255, 198, 31, 0.32);
}

.secondary-button {
  color: var(--blue);
  background: var(--white);
  border: 1px solid rgba(54, 80, 200, 0.16);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.results-panel {
  border-top: 1px solid var(--panel-border);
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.58));
}

.results-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.metric-card {
  padding: 14px 0 8px;
}

.metric-card span,
.metric-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 0.96rem;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.6rem, 2.5vw, 2.05rem);
  line-height: 1.08;
}

.metric-card.accent strong {
  color: var(--principal);
}

.form-message {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.form-message.error {
  color: var(--error);
}

.schedule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.schedule-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--muted-soft);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.schedule-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
}

.table-wrap {
  overflow: auto;
  border-radius: 22px;
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
}

.schedule-table th,
.schedule-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(16, 22, 47, 0.08);
  white-space: nowrap;
}

.schedule-table th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.schedule-table td {
  color: var(--text);
  font-size: 0.94rem;
}

.site-footer {
  text-align: center;
  padding: 28px 0 20px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.45);
}

.site-footer a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-weight: 700;
  transition: color 160ms ease;
}

.site-footer a:hover {
  color: var(--white);
}

.schedule-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.schedule-modal.hidden {
  display: none;
}

.schedule-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 19, 51, 0.62);
  backdrop-filter: blur(6px);
}

.schedule-dialog {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  max-height: min(88vh, 920px);
  padding: 24px;
  border-radius: 28px;
  background: var(--panel-bg);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}

@media (max-width: 1040px) {
  .field-grid,
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: calc(100% - 16px);
    padding: 18px 0 28px;
  }

  .site-logo-text {
    display: none;
  }

  .hero {
    margin-bottom: 22px;
  }

  .mode-switch {
    width: 100%;
    margin-bottom: 22px;
  }

  .mode-tab {
    flex: 1 1 0;
    padding: 13px 14px;
    font-size: 0.92rem;
  }

  .calculator-form,
  .results-panel {
    padding: 18px;
  }

  .field-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .compound-shell {
    grid-template-columns: 1fr;
  }

  .compound-divider {
    display: none;
  }

  .form-actions,
  .schedule-head {
    flex-direction: column;
    align-items: stretch;
  }

  .results-actions {
    justify-content: stretch;
  }
}
