/*
 * Инвестиционный калькулятор — палитра в стиле poluyanov.ru portfolio.
 */
:root {
  --bg-1: #e8eef3;
  --bg-2: #eef2f5;
  --bg-3: #e2e8ee;
  --surface: #ffffff;
  --surface-muted: #f7f9fb;
  --border: rgba(16, 24, 32, 0.11);
  --text: #101820;
  --text-muted: #5a6a78;
  --accent-blue: #1a6b8a;
  --accent-teal: #0f4f68;
  --accent-lilac: #4a6278;
  --mint: #e8f0f4;
  --mint-border: rgba(26, 107, 138, 0.28);
  --shadow: 0 10px 28px rgba(16, 24, 32, 0.06);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --radius: 4px;
  --font-display: "Syne", sans-serif;
  --font-body: "Instrument Sans", sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body), system-ui, sans-serif;
  margin: 0;
  color: var(--text);
  color-scheme: light;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 55% at 100% 0%, rgba(26, 107, 138, 0.12), transparent 50%),
    radial-gradient(ellipse 70% 45% at 0% 100%, rgba(45, 90, 70, 0.08), transparent 50%),
    linear-gradient(165deg, var(--bg-1) 0%, var(--bg-2) 42%, var(--bg-3) 100%);
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px;
}

header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  z-index: 10;
  box-shadow: var(--shadow);
}

h1 {
  margin: 0 0 10px;
  font-family: var(--font-display), sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-cyan,
.brand-emerald {
  color: var(--accent-blue);
}

.subtitle {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  max-width: 1100px;
}

h2 {
  margin-top: 0;
  font-family: var(--font-display), sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.modes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-btn {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 9px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
}

.mode-btn:hover {
  background: #fff;
  color: var(--text);
}

.mode-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: none;
}

main {
  display: grid;
  gap: 14px;
  padding: 14px 2px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  box-shadow: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

input,
select {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  min-height: 40px;
  font-family: inherit;
  font-size: 14px;
  box-shadow: none;
}

input::placeholder {
  color: rgba(90, 106, 120, 0.55);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(26, 107, 138, 0.2);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px #f7f9fb inset;
  border: 1px solid var(--border);
  transition: background-color 99999s ease-out 0s;
}

button {
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--accent-blue);
  color: #fff;
  padding: 10px;
  min-height: 40px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

button:hover {
  background: var(--accent-teal);
  filter: none;
}

.toolbar button {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.toolbar button:hover {
  border-color: var(--accent-blue);
  color: var(--accent-teal);
}

.toolbar input:hover,
.toolbar select:hover {
  border-color: var(--accent-blue);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.kpi-item {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}

.kpi-item .name {
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-item .value {
  font-size: 18px;
  margin-top: 4px;
  color: var(--text);
  font-weight: 600;
}

.charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 9px 7px;
  text-align: right;
  color: var(--text);
}

th:first-child,
td:first-child {
  text-align: center;
}

.site-footer {
  padding: 8px 6px 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.site-footer a {
  color: var(--accent-teal);
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 107, 138, 0.35);
  font-weight: 600;
}

.site-footer a:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

@media (max-width: 900px) {
  .charts {
    grid-template-columns: 1fr;
  }
  .app-shell {
    padding: 10px;
  }
  header {
    padding: 14px;
  }
  h1 {
    font-size: 20px;
  }
  .subtitle {
    font-size: 12px;
  }
  .mode-btn {
    width: 100%;
    justify-content: center;
  }
  .modes {
    display: grid;
    grid-template-columns: 1fr;
  }
  table {
    min-width: 760px;
  }
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.range-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 700px) {
  .range-summary {
    grid-template-columns: 1fr;
  }
}

.seo-lead {
  margin: 0 0 12px;
  padding: 12px 12px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 1100px;
}

.seo-lead p {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.seo-lead-caption {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.seo-lead-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 6px 12px;
}

.seo-lead-list li {
  position: relative;
  padding: 6px 8px 6px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.seo-lead-list li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--accent-blue);
}

@media (max-width: 900px) {
  .seo-lead {
    padding: 10px;
  }
  .seo-lead p,
  .seo-lead-list li {
    font-size: 12px;
  }
}
