:root {
    --ink: #132235;
    --muted: #617087;
    --line: #dce4ec;
    --surface: #ffffff;
    --surface-soft: #f5f8fb;
    --navy: #071522;
    --accent: #f4a340;
    --success: #168a68;
    --danger: #c8464e;
    --shadow: 0 16px 44px rgba(11, 34, 54, .1);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
    min-height: 100vh; margin: 0; color: var(--ink); background: #eef3f7;
    font: 15px/1.5 'Manrope', Arial, sans-serif; -webkit-font-smoothing: antialiased;
}
body::before {
    position: fixed; z-index: -1; inset: 0 0 auto; height: 360px; content: '';
    background: linear-gradient(120deg, rgba(14,44,69,.7), rgba(7,21,34,.98)), repeating-linear-gradient(135deg, transparent 0 24px, rgba(255,255,255,.025) 24px 25px);
}
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.site-shell { display: flex; min-height: 100vh; flex-direction: column; }

.site-header { min-height: 76px; background: rgba(7,21,34,.92); border-bottom: 1px solid rgba(210,230,246,.14); backdrop-filter: blur(16px); }
.header-inner, .site-main, .site-footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.header-inner { display: flex; min-height: 76px; align-items: center; gap: 42px; }
.brand { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 10px; color: #fff; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-decoration: none; }
.brand > span:last-child span { color: var(--accent); }
.brand-mark { display: flex; width: 25px; height: 24px; flex-direction: column; justify-content: center; gap: 3px; }
.brand-mark i { display: block; height: 5px; border-radius: 1px; background: #d9e6f1; transform: skewX(-25deg); }
.brand-mark i:nth-child(2) { width: 20px; background: var(--accent); }
.brand-mark i:nth-child(3) { width: 16px; }
.primary-nav { display: flex; align-self: stretch; align-items: center; gap: 7px; }
.primary-nav a, .text-link, .user-link, .icon-link, .header-cta { text-decoration: none; transition: .18s ease; }
.primary-nav a { padding: 8px 12px; color: #b6c5d3; border-radius: 7px; font-size: 13px; font-weight: 700; }
.primary-nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.primary-nav a.active { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.text-link { color: #d5e1eb; font-size: 13px; font-weight: 700; }
.text-link:hover { color: var(--accent); }
.header-cta, .btn-1c { border: 0; color: #19120a; background: var(--accent); font-size: 13px; font-weight: 800; }
.header-cta { padding: 10px 15px; border-radius: 7px; }
.header-cta:hover, .btn-1c:hover { background: #ffbb60; transform: translateY(-1px); }
.user-link { display: flex; align-items: center; gap: 9px; color: #e1edf6; font-size: 13px; font-weight: 700; }
.user-link:hover, .user-link.active { color: var(--accent); }
.avatar { display: grid; width: 29px; height: 29px; place-items: center; color: #182535; background: #d5e6f5; border-radius: 50%; font-size: 12px; }
.icon-link { display: grid; width: 31px; height: 31px; place-items: center; color: #c9d7e2; border: 1px solid rgba(221,234,244,.23); border-radius: 7px; font-size: 17px; font-weight: 700; }
.icon-link:hover { color: var(--accent); border-color: var(--accent); }

.site-main { flex: 1; padding: 52px 0 44px; }
.site-footer { display: flex; justify-content: space-between; gap: 12px; padding: 22px 0; color: #718095; border-top: 1px solid #dce4ec; font-size: 12px; }
.site-footer span:first-child { color: #34485c; font-weight: 800; letter-spacing: .08em; }
.flash-message, .alert { padding: 13px 16px; margin: 0 0 20px; border: 1px solid; border-radius: 9px; font-size: 14px; font-weight: 600; }
.alert-success { color: #0d674c; background: #e8f8f2; border-color: #bfe8d9; }
.alert-error { color: #9f2731; background: #fff0f1; border-color: #f3c8cd; }
.alert-warning { color: #845510; background: #fff8e8; border-color: #f7dfa6; }
.alert-info { color: #175f87; background: #e8f5fb; border-color: #c6e5f4; }

/* Main calculator */
.hero { display: flex; justify-content: space-between; gap: 30px; margin-bottom: 31px; color: #f7fbfe; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 11px; color: #9eb9ce; font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow::before { width: 26px; height: 2px; content: ''; background: var(--accent); }
.hero h1 { max-width: 680px; margin: 0; font-size: clamp(30px, 4vw, 48px); font-weight: 800; letter-spacing: -.055em; line-height: 1.1; }
.hero p { max-width: 620px; margin: 15px 0 0; color: #b8c8d5; font-size: 15px; }
.hero-facts { display: grid; width: 280px; flex: 0 0 auto; grid-template-columns: 1fr 1fr; gap: 9px; align-self: flex-end; }
.fact { padding: 12px; background: rgba(255,255,255,.07); border: 1px solid rgba(219,235,246,.16); border-radius: 9px; }
.fact strong { display: block; color: var(--accent); font: 600 16px 'Roboto Mono', monospace; }
.fact span { display: block; margin-top: 2px; color: #b6c8d6; font-size: 11px; }
.workspace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.container, .card, .panel, .auth-card { background: var(--surface); border: 1px solid #dce5ed; border-radius: 14px; box-shadow: var(--shadow); }
.container { padding: 27px; }
.calculator-card { grid-column: span 2; }
.header { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; padding-bottom: 20px; margin-bottom: 23px; border-bottom: 1px solid var(--line); }
.header h1, .header h2 { margin: 0; color: var(--ink); font-size: 20px; font-weight: 800; letter-spacing: -.035em; }
.card-kicker { color: var(--muted); font-size: 12px; font-weight: 600; }
.material-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; color: #d9821d; background: #fff4e5; border-radius: 9px; font-size: 19px; }
.form-content { padding: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-group { margin-bottom: 17px; }
label { display: block; margin-bottom: 7px; color: #43536a; font-size: 12px; font-weight: 800; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 48px; }
.unit { position: absolute; top: 50%; right: 13px; color: #8a98a9; font-size: 12px; font-weight: 700; pointer-events: none; transform: translateY(-50%); }
input, select { width: 100%; height: 46px; padding: 0 13px; color: var(--ink); outline: 0; background: #fbfcfe; border: 1px solid #cfd9e3; border-radius: 8px; font-size: 14px; font-weight: 600; transition: .18s ease; }
input::placeholder { color: #a0adba; font-weight: 500; }
input:focus, select:focus { background: #fff; border-color: #4b83af; box-shadow: 0 0 0 3px rgba(75,131,175,.13); }
.btn-1c { display: inline-flex; width: 100%; min-height: 47px; align-items: center; justify-content: center; gap: 8px; margin-top: 3px; border-radius: 8px; transition: .18s ease; }
.btn-1c::after { content: '→'; font-size: 18px; line-height: 0; }
.form-note { margin: 13px 0 0; color: #8b98a7; font-size: 11px; }
.form-note a { color: #3c789f; font-weight: 700; text-decoration: none; }
.result, .error { display: none; padding: 15px 16px; margin-top: 17px; border-radius: 8px; }
.result { color: #0a664a; background: #eaf8f3; border: 1px solid #bae5d6; }
.result h3 { margin: 0 0 3px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.result p { margin: 0; }
.result strong { font: 600 25px 'Roboto Mono', monospace; }
.error { color: #9d3038; background: #fff0f1; border: 1px solid #f4c8cd; font-weight: 600; }

.calc-layout { display: grid; grid-template-columns: minmax(220px, .66fr) minmax(390px, 1.34fr); gap: 25px; align-items: stretch; }
.calc-intro { display: flex; flex-direction: column; justify-content: space-between; padding: 22px; color: #dce8f2; background: linear-gradient(145deg, #102a40, #0b1b2b); border-radius: 10px; }
.calc-intro h3 { margin: 0 0 9px; color: #fff; font-size: 19px; letter-spacing: -.025em; }
.calc-intro p { margin: 0; color: #a9bece; font-size: 13px; }
.key-hint { display: inline-flex; margin-top: 26px; color: #b8cad7; font-size: 11px; }
.key-hint kbd { padding: 2px 6px; margin: 0 3px; color: #fff; background: rgba(255,255,255,.1); border-radius: 3px; font: 600 10px 'Roboto Mono', monospace; }
.calc-display { position: relative; margin-bottom: 12px; }
.calc-display::before { position: absolute; z-index: 1; top: 9px; left: 12px; color: #8b9aac; content: 'РАСЧЁТ'; font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.calc-display input { height: 71px; padding: 20px 17px 3px; text-align: right; color: #eff8ff; background: #11283c; border-color: #11283c; border-radius: 9px; font: 600 27px 'Roboto Mono', monospace; letter-spacing: -.04em; }
.calc-buttons { display: flex; flex-direction: column; gap: 7px; }
.calc-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.calc-btn { height: 47px; padding: 0; color: #1c2b3d; background: #f5f8fb; border: 1px solid #dce4ec; border-radius: 7px; font-size: 16px; font-weight: 800; transition: .13s ease; }
.calc-btn:hover { background: #e9f0f5; border-color: #bbc9d5; }
.calc-btn:active { transform: scale(.96); }
.calc-btn-orange { color: #9b5711; background: #fff4e4; border-color: #f8dbb6; }
.calc-btn-orange:hover { background: #ffe9c9; }
.calc-btn-red { color: #b0343c; background: #fff1f1; border-color: #f3d1d3; }
.calc-btn-red:hover { background: #ffe3e4; }
.calc-btn-equal { color: #fff; background: #1c6694; border-color: #1c6694; }
.calc-btn-equal:hover { background: #12577f; border-color: #12577f; }
.calculator-card #calcResult { margin-top: 12px; }

/* Secondary pages */
.page-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 22px; color: #fff; }
.page-heading h1 { margin: 0; font-size: clamp(26px, 3.5vw, 36px); font-weight: 800; letter-spacing: -.05em; }
.page-heading p { margin: 6px 0 0; color: #b8c8d5; font-size: 14px; }
.panel { padding: 28px; }
.panel .header { margin-bottom: 22px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.nav-btn, .secondary-btn { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; padding: 0 14px; color: #35536d; background: #fff; border: 1px solid #cbd7e1; border-radius: 7px; font-size: 12px; font-weight: 800; text-decoration: none; transition: .18s ease; }
.nav-btn:hover, .secondary-btn:hover { color: #18364f; background: #edf3f7; }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; margin-bottom: 25px; }
.search-form .form-group { margin: 0; }
.search-form .btn-1c { width: 150px; margin: 0; }
.stats-area, .profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin: 0 0 24px; }
.stat-card { min-height: 104px; padding: 18px; background: var(--surface-soft); border: 1px solid #e0e8ee; border-radius: 9px; }
.stat-card h3, .stat-card .label { margin: 0 0 8px; color: #7e8da0; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.stat-card .value { color: #1d3348; font: 600 23px 'Roboto Mono', monospace; letter-spacing: -.05em; }
.table-container { overflow-x: auto; border: 1px solid #dee6ed; border-radius: 9px; }
.data-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.data-table th { padding: 13px 15px; color: #65748a; background: #f5f8fb; border-bottom: 1px solid #dce5ec; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 15px; color: #35475a; border-bottom: 1px solid #e5ebf0; font-size: 13px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .16s ease; }
.data-table tbody tr:hover { background: #f7fafc; }
.data-table strong { color: #1f364c; font-family: 'Roboto Mono', monospace; }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 5px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge-sheet { color: #26638b; background: #e8f5fb; }
.badge-round { color: #5a5eb4; background: #eeefff; }
.badge-arithmetic { color: #996019; background: #fff3df; }
.btn-delete { width: 31px; height: 31px; padding: 0; color: var(--danger); background: transparent; border: 1px solid transparent; border-radius: 6px; transition: .16s ease; }
.btn-delete:hover { background: #fff0f1; border-color: #f2d2d5; }
.nav-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.no-results { padding: 42px 20px; color: #7f8d9e; text-align: center; }
.no-results p { margin: 4px 0; }
.no-results strong { color: #39526a; }
.no-results a { color: #2d6e99; font-weight: 800; }

.auth-layout { display: grid; min-height: 530px; place-items: center; }
.auth-card { width: min(100%, 458px); padding: 31px; }
.auth-brand { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 29px; color: #53677a; font-size: 12px; font-weight: 800; text-decoration: none; letter-spacing: .06em; }
.auth-brand::before { width: 19px; height: 4px; content: ''; background: var(--accent); transform: skewX(-25deg); }
.auth-card h1 { margin: 0; color: #17283a; font-size: 27px; letter-spacing: -.05em; }
.auth-card .intro { margin: 8px 0 25px; color: #78889a; font-size: 13px; }
.auth-card .btn-1c { margin-top: 5px; }
.text-center { margin-top: 21px; color: #718094; text-align: center; font-size: 13px; }
.text-center a { color: #1c6e9e; font-weight: 800; text-decoration: none; }
.field-help { display: block; margin-top: 6px; color: #8897a6; font-size: 11px; }
.profile-card { width: min(100%, 720px); margin: 0 auto; }
.profile-summary { display: flex; gap: 20px; align-items: center; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.profile-avatar { display: grid; width: 62px; height: 62px; flex: 0 0 auto; place-items: center; color: #fff; background: linear-gradient(135deg, #2e648a, #18344d); border-radius: 11px; font-size: 23px; font-weight: 800; }
.profile-summary h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.profile-summary p { margin: 4px 0 0; color: #7b8b9d; font-size: 13px; }
.profile-stats { grid-template-columns: repeat(2, 1fr); margin-bottom: 25px; }
.toolbar { display: none; }

@media (max-width: 760px) {
    .header-inner, .site-main, .site-footer { width: min(100% - 30px, 1180px); }
    .header-inner { min-height: 68px; gap: 15px; }
    .site-header { min-height: 68px; }
    .primary-nav { display: none; }
    .header-actions { gap: 10px; }
    .user-link-name { display: none; }
    .header-cta { padding: 9px 11px; font-size: 11px; }
    .site-main { padding: 36px 0 30px; }
    .hero { display: block; margin-bottom: 24px; }
    .hero-facts { width: 100%; margin-top: 22px; }
    .workspace-grid, .calc-layout { grid-template-columns: 1fr; gap: 16px; }
    .calculator-card { grid-column: span 1; }
    .container, .panel, .auth-card { padding: 21px; border-radius: 11px; }
    .calc-intro { padding: 18px; }
    .key-hint { margin-top: 15px; }
    .page-heading { display: block; }
    .page-actions { margin-top: 17px; }
    .search-form { grid-template-columns: 1fr; }
    .search-form .btn-1c { width: 100%; }
    .stats-area { grid-template-columns: 1fr; }
    .site-footer { display: block; }
    .site-footer span { display: block; margin: 5px 0; }
}
@media (max-width: 440px) {
    .brand { font-size: 14px; }
    .text-link { display: none; }
    .form-row, .profile-stats { grid-template-columns: 1fr; }
    .calc-row { gap: 5px; }
    .calc-btn { height: 43px; font-size: 14px; }
    .page-heading h1 { font-size: 27px; }
}
