:root {
  --paper: #E9EEF0;
  --ink: #14212C;
  --neva: #2D6E7E;
  --gold: #B4915B;
  --brick: #93493A;
  --mist: #C7D1D3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Manrope', sans-serif;
}

h1, h2, h3, .brand-name {
  font-family: 'PT Serif', serif;
  font-weight: 700;
  margin: 0;
}

.mono { font-family: 'JetBrains Mono', monospace; }
.muted { color: rgba(20,33,44,.45); }
.muted-text { color: rgba(20,33,44,.65); font-size: 14px; line-height: 1.65; max-width: 620px; }
.small { font-size: 11px; }
.accent { color: var(--gold); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

/* signature element: решётчатый (оградный) разделитель между секциями */
.lattice {
  height: 10px;
  background-image:
    linear-gradient(45deg, var(--gold) 23%, transparent 23%, transparent 77%, var(--gold) 77%),
    linear-gradient(45deg, var(--gold) 23%, transparent 23%, transparent 77%, var(--gold) 77%);
  background-size: 14px 14px;
  background-position: 0 0, 7px 7px;
  opacity: .3;
}

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(233,238,240,.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--mist);
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-badge {
  width: 30px; height: 30px; border-radius: 4px; background: var(--ink); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.brand-badge.small { width: 22px; height: 22px; font-size: 11px; border-radius: 3px; }
.brand-name { font-size: 18px; letter-spacing: -.01em; }
.brand-name.small { font-size: 14px; }
.nav-links { display: flex; gap: 26px; font-size: 13px; font-weight: 500; color: rgba(20,33,44,.6); }
.nav-links a { color: inherit; text-decoration: none; }
.nav-links a:hover { color: var(--ink); }
@media (max-width: 860px) { .nav-links { display: none; } }

.auth-slot { display: flex; gap: 8px; align-items: center; }

/* BUTTONS */
.btn { border: none; cursor: pointer; font-family: 'Manrope', inherit; font-weight: 700; font-size: 13px; border-radius: 4px; padding: 10px 16px; transition: .15s; }
.btn-ghost { background: transparent; color: rgba(20,33,44,.7); border: 1px solid transparent; }
.btn-ghost:hover { border-color: var(--mist); color: var(--ink); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #223342; }
.btn-cta { background: var(--gold); color: var(--ink); font-size: 14px; padding: 14px 22px; border-radius: 4px; margin-top: 32px; }
.btn-cta:hover { background: #c19f6c; }
.btn.full { width: 100%; padding: 13px; }

/* HERO */
.hero {
  padding: 60px 0 56px;
  background: linear-gradient(180deg, #EEF2F3 0%, var(--paper) 100%);
}
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 36px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.3fr .9fr; } }
.eyebrow { font-family: 'JetBrains Mono'; font-size: 11px; text-transform: uppercase; letter-spacing: .16em; color: var(--neva); font-weight: 500; margin-bottom: 22px; }
h1 { font-size: 2rem; line-height: 1.1; max-width: 560px; margin-bottom: 18px; }
@media (min-width: 640px) { h1 { font-size: 2.7rem; } }
.br-desktop { display: none; }
@media (min-width: 640px) { .br-desktop { display: block; } }
.hero-lead { font-size: 14px; color: rgba(20,33,44,.65); line-height: 1.6; max-width: 460px; margin-bottom: 4px; }

.hero-stat {
  background: var(--ink); color: var(--paper);
  border-radius: 6px; padding: 30px 28px;
  border: 1px solid #223342;
}
.hero-stat-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: rgba(233,238,240,.55); margin-bottom: 14px; }
.flip-number {
  font-family: 'JetBrains Mono'; font-weight: 500; font-size: 2.6rem; letter-spacing: -.01em;
  animation: flipin .5s ease-out;
}
@keyframes flipin {
  from { opacity: 0; transform: translateY(6px); filter: blur(2px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.hero-stat-delta { font-family: 'JetBrains Mono'; font-size: 13px; font-weight: 500; margin-top: 10px; }
.hero-stat-delta.down { color: #E38C79; }
.hero-stat-delta.up { color: #7FC79A; }
.hero-stat-foot { font-size: 11px; margin-top: 18px; color: rgba(233,238,240,.45) !important; }

/* SECTIONS */
.section { padding: 48px 0; }
.section-band { border-top: none; background: #fff; padding: 48px 0; }
.section-num { display: block; font-size: 11px; color: var(--gold); margin-bottom: 8px; font-weight: 500; }
.section-head { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; column-gap: 14px; margin-bottom: 30px; }
.section-head .section-num { grid-column: 1; grid-row: 1; }
.section-head h2 { grid-column: 2; grid-row: 1; }
.section-head > .mono.muted { grid-column: 3; grid-row: 1; }
.section-head-inline { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
h2 { font-size: 1.45rem; }

/* METRICS */
.metric-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 14px; }
@media (min-width: 640px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .metric-grid { grid-template-columns: repeat(4, 1fr); } }
.metric-card { background: #fff; border: 1px solid var(--mist); border-radius: 6px; padding: 20px; }
.metric-chip { width: 30px; height: 30px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-family: 'JetBrains Mono'; font-size: 11px; font-weight: 600; margin-bottom: 16px; }
.metric-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: rgba(20,33,44,.5); font-weight: 600; margin-bottom: 8px; }
.metric-value-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.metric-value { font-family: 'PT Serif'; font-size: 1.55rem; }
.metric-delta { font-family: 'JetBrains Mono'; font-size: 12px; font-weight: 500; }
.metric-delta.down { color: var(--brick); }
.metric-delta.up { color: var(--neva); }

/* KEY RATE */
.rate-grid { display: grid; grid-template-columns: 1fr; gap: 36px; }
@media (min-width: 1024px) { .rate-grid { grid-template-columns: 280px 1fr; } }
.label-accent { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--neva); font-weight: 600; display: block; margin-top: 4px; }
.label-accent-light { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); }
.rate-big-row { display: flex; align-items: baseline; gap: 12px; margin: 18px 0 4px; }
.rate-big { font-family: 'PT Serif'; font-size: 2.3rem; }
.rate-delta { font-family: 'JetBrains Mono'; font-size: 12px; color: var(--neva); background: rgba(45,110,126,.1); padding: 3px 10px; border-radius: 3px; font-weight: 500; }
.divider { border-top: 1px solid var(--mist); margin: 18px 0 14px; }
.note { display: flex; gap: 8px; font-size: 11px; color: rgba(20,33,44,.45); margin-top: 18px; line-height: 1.5; }
.chart-holder { height: 300px; }

/* CALCULATOR */
.calc-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 26px; }
@media (min-width: 1024px) { .calc-grid { grid-template-columns: 1fr 320px; } }
.calc-panel { background: #fff; border: 1px solid var(--mist); border-radius: 6px; padding: 26px; display: flex; flex-direction: column; gap: 20px; }
.calc-row-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.calc-row-head span:first-child { color: rgba(20,33,44,.7); font-weight: 500; }
.calc-row-head span:last-child { font-family: 'JetBrains Mono'; font-weight: 500; }
input[type="range"] { width: 100%; accent-color: var(--neva); }
.calc-result { background: var(--ink); color: var(--paper); border-radius: 6px; padding: 26px; display: flex; flex-direction: column; justify-content: space-between; }
.result-big { font-family: 'JetBrains Mono'; font-weight: 500; font-size: 2rem; margin: 8px 0 18px; }
.result-line { display: flex; justify-content: space-between; font-size: 13px; color: rgba(233,238,240,.65); padding: 8px 0; border-top: 1px solid rgba(233,238,240,.14); }
.result-line .mono { color: var(--paper); }
.result-note { font-size: 11px; color: rgba(233,238,240,.4); margin-top: 18px; line-height: 1.5; }

/* DISTRICTS TABLE */
.tabs { display: flex; gap: 8px; margin: 18px 0; }
.tab { border: 1px solid var(--mist); background: transparent; color: rgba(20,33,44,.6); padding: 7px 18px; border-radius: 3px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: 'Manrope'; }
.tab.active { background: var(--neva); border-color: var(--neva); color: #fff; }
.table-wrap { border: 1px solid var(--mist); border-radius: 6px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: rgba(20,33,44,.03); border-bottom: 1px solid var(--mist); }
th { text-align: left; font-family: 'JetBrains Mono'; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(20,33,44,.5); font-weight: 500; padding: 12px 16px; }
th.right, td.right { text-align: right; }
td { padding: 14px 16px; border-bottom: 1px solid rgba(20,33,44,.07); }
td.mono, td.right { font-family: 'JetBrains Mono'; }
tr:last-child td { border-bottom: none; }
tr.top-city { background: rgba(180,145,91,.08); }
.rank-delta.up { color: var(--neva); }
.rank-delta.down { color: var(--brick); }

/* JOURNAL */
.journal-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .journal-grid { grid-template-columns: 1fr 1fr; } }
.journal-card { background: #fff; border: 1px solid var(--mist); border-radius: 6px; padding: 20px; text-decoration: none; color: inherit; display: block; transition: .15s; }
.journal-card:hover { border-color: var(--gold); }
.journal-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.journal-tag { font-family: 'JetBrains Mono'; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; padding: 4px 10px; border-radius: 3px; font-weight: 600; }
.journal-date { font-family: 'JetBrains Mono'; font-size: 11px; color: rgba(20,33,44,.4); }
.journal-title { font-family: 'PT Serif'; font-weight: 700; font-size: 1.05rem; line-height: 1.35; margin-bottom: 8px; }
.journal-excerpt { font-size: 13px; color: rgba(20,33,44,.6); line-height: 1.55; }
.link-accent { font-size: 13px; font-weight: 600; color: var(--gold); text-decoration: none; }

/* ABOUT */
.about { background: var(--ink); color: var(--paper); padding: 52px 0; }
.about-grid { display: grid; grid-template-columns: 1fr; gap: 36px; }
@media (min-width: 1024px) { .about-grid { grid-template-columns: 1fr 1fr; } }
.about h2 { margin: 8px 0 18px; color: var(--paper); }
.about p { font-size: 14px; color: rgba(233,238,240,.72); line-height: 1.6; margin-bottom: 16px; }
.about-list { display: flex; flex-direction: column; gap: 10px; }
.about-item { background: rgba(233,238,240,.06); border-radius: 4px; padding: 15px; font-size: 14px; color: rgba(233,238,240,.82); line-height: 1.5; }

/* FOOTER */
.footer { padding: 36px 20px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
@media (min-width: 640px) { .footer { flex-direction: row; align-items: center; justify-content: space-between; } }
.footer p { max-width: 420px; margin: 0; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,33,44,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--paper); border-radius: 6px; width: 100%; max-width: 380px; padding: 28px; position: relative; box-shadow: 0 20px 50px rgba(20,33,44,.3); border: 1px solid var(--mist); }
.modal-close { position: absolute; top: 14px; right: 14px; border: none; background: transparent; font-size: 16px; cursor: pointer; padding: 6px; border-radius: 4px; }
.modal-close:hover { background: rgba(20,33,44,.06); }
.modal-icon { width: 36px; height: 36px; border-radius: 4px; background: var(--ink); color: var(--gold); display: flex; align-items: center; justify-content: center; font-size: 15px; margin-bottom: 16px; }
.modal h3 { font-size: 1.25rem; margin-bottom: 4px; }
.modal-sub { font-size: 13px; color: rgba(20,33,44,.55); margin: 0 0 20px; }
#auth-form { display: flex; flex-direction: column; gap: 12px; }
#auth-form input { padding: 11px 14px; border-radius: 4px; border: 1px solid var(--mist); background: #fff; font-size: 14px; font-family: 'Manrope'; }
#auth-form input:focus { outline: none; border-color: var(--neva); }
.auth-error { font-size: 13px; color: var(--brick); background: rgba(147,73,58,.08); border-radius: 4px; padding: 8px 12px; }
.link-switch { width: 100%; text-align: center; background: none; border: none; color: var(--neva); font-size: 13px; font-weight: 600; margin-top: 16px; cursor: pointer; font-family: 'Manrope'; }
.link-switch:hover { text-decoration: underline; }
