[hidden] {
    display: none !important;
}
.unit-badge {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 8px;
    padding: 2px 7px;
    border: 1px solid #d6e7db;
    border-radius: 6px;
    background: #edf6ef;
    color: #426b53;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
    font-variant-numeric: normal;
}
:root {
    font-family: Manrope, Arial, sans-serif;
    color: #20322f;
    background: #f6f8f6;
    font-size: 14px;
    font-synthesis: none;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
button,
input,
select {
    font: inherit;
}
button {
    cursor: pointer;
}
a {
    text-decoration: none;
    color: inherit;
}
.app {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 258px;
    flex: none;
    background: #132a28;
    color: #d1dfda;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 32px 16px 20px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    color: #fff;
    font-size: 17px;
    letter-spacing: -0.05em;
    font-weight: 800;
    line-height: 1.1;
}
.brand-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #c6f0a8;
    color: #18342b;
    letter-spacing: -0.08em;
    font-size: 16px;
}
.brand small {
    display: block;
    font-size: 10px;
    color: #8ca9a0;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-top: 5px;
}
.side-caption {
    color: #66847b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    margin: 59px 12px 17px;
}
.nav {
    display: grid;
    gap: 5px;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 46px;
    padding: 0 13px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    transition: 0.15s;
}
.nav a:hover {
    background: #24433e;
    color: #fff;
}
.nav a.active {
    background: #d5f3bd;
    color: #203c32;
}
.nav-symbol {
    font-size: 19px;
    font-weight: 400;
    width: 23px;
    text-align: center;
}
.side-bottom {
    margin-top: auto;
    border-top: 1px solid #305049;
    padding: 22px 10px 4px;
}
.side-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar {
    width: 36px;
    height: 36px;
    background: #32544b;
    color: #e0ffc9;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-weight: 800;
}
.side-user strong {
    display: block;
    color: #fff;
    font-size: 12px;
}
.side-user small {
    display: block;
    font-size: 10px;
    color: #91aaa0;
    margin-top: 4px;
}
.logout {
    background: none;
    border: 0;
    color: #adc6bb;
    padding: 18px 0 0;
    font-size: 11px;
}
.logout:hover {
    color: white;
}
.main {
    flex: 1;
    min-width: 0;
    padding: 0 45px 65px;
    max-width: 1800px;
}
.topline {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e3eae5;
    color: #879b91;
    font-size: 10px;
    letter-spacing: 0.13em;
    font-weight: 800;
}
.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #70bb76;
    margin-right: 7px;
}
.divider {
    margin: 0 10px;
    color: #c1cfc5;
}
.toprole {
    letter-spacing: 0;
    background: #e9f3e8;
    color: #528160;
    border-radius: 6px;
    padding: 8px 12px;
}
.heading {
    margin: 42px 0 25px;
}
.eyebrow {
    font-size: 10px;
    letter-spacing: 0.19em;
    font-weight: 800;
    color: #488264;
    margin: 0 0 10px;
}
.heading h1 {
    font-size: 32px;
    line-height: 1.2;
    letter-spacing: -0.055em;
    margin: 0 0 9px;
    color: #172d28;
}
.muted,
.heading p.muted {
    color: #879690;
    font-size: 12px;
    line-height: 1.6;
    margin: 0;
}
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.city-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e5ebe7;
    border-radius: 10px;
    padding: 5px 12px 5px 16px;
    box-shadow: 0 3px 12px #21453108;
}
.city-picker label {
    color: #9aaba3;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
}
.city-picker select {
    background: transparent;
    border: 0;
    color: #213b32;
    font-weight: 800;
    font-size: 12px;
    min-height: 30px;
    outline: none;
    max-width: 230px;
}
.period-picker {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--color-line);
    border-radius: 10px;
    background: #fff;
}
.period-picker > label,
.period-create > label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: var(--color-muted);
    font-size: 12px;
}
.period-picker input[type="date"],
.period-create input[type="date"] {
    min-height: 40px;
    min-width: 160px;
    max-width: 100%;
    color: var(--color-ink);
    background: #fff;
    border-color: var(--color-line);
}
.period-picker input:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}
.period-range-hint {
    flex-basis: 100%;
    color: var(--color-muted);
    line-height: 1.5;
}
.period-picker[aria-busy="true"] {
    opacity: 0.7;
}
@media (max-width: 600px) {
    .period-picker > label,
    .period-picker > button {
        flex: 1 1 100%;
    }
    .period-picker input[type="date"] {
        width: 100%;
    }
}
.period-pill,
.readonly-pill {
    background: #fff;
    border: 1px solid #e5ebe7;
    padding: 13px 15px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #526d5e;
}
.readonly-pill {
    margin-left: auto;
    background: #eaf4e9;
    color: #578063;
    border: 0;
}
.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 25px;
}
.metric {
    background: white;
    border: 1px solid #e8ede9;
    border-radius: 14px;
    padding: 22px 23px;
    box-shadow: 0 6px 24px #1e4c2d05;
}
.metric-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #9eaca3;
    display: flex;
    justify-content: space-between;
}
.metric-label span {
    font-size: 18px;
    color: #7daa8b;
}
.metric strong {
    font-size: 24px;
    letter-spacing: -0.055em;
    display: block;
    margin: 16px 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.metric strong em {
    font-style: normal;
    color: #91a89a;
}
.metric-city {
    font-size: 21px !important;
}
.metric small {
    color: #92a099;
    font-size: 11px;
}
.table-panel,
.panel {
    background: #fff;
    border: 1px solid #e6ece7;
    border-radius: 15px;
    box-shadow: 0 8px 30px #1d3d2d07;
    overflow: hidden;
}
.table-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 26px 27px 21px;
}
.table-head h2 {
    font-size: 18px;
    letter-spacing: -0.04em;
    margin: 0 0 6px;
}
.table-head p:not(.eyebrow) {
    margin: 0;
    color: #899a90;
    font-size: 11px;
}
.table-badge {
    color: #55926a;
    border: 1px solid #cde9d4;
    background: #f0faf1;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 800;
    padding: 9px 11px;
}
.filter-bar {
    display: flex;
    align-items: center;
    gap: 19px;
    border-top: 1px solid #f0f3f0;
    padding: 12px 27px;
    flex-wrap: wrap;
}
.filter-title {
    color: #9eaaa1;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.13em;
}
.filters {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}
.filter input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.filter span {
    display: block;
    padding: 7px 12px;
    background: #f4f7f4;
    border-radius: 7px;
    font-size: 10px;
    color: #7b9082;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
}
.filter input:checked + span {
    color: #27714b;
    background: #e8f6e9;
    border-color: #cae8d0;
}
.filter input:focus-visible + span {
    outline: 2px solid #387f57;
    outline-offset: 2px;
}
.scroll-hint {
    color: #94a69b;
    text-align: right;
    padding: 8px 27px;
    font-size: 10px;
    background: #fafcf9;
}
.table-scroll {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    border-top: 1px solid #eef2ee;
}
.table-scroll:focus-visible {
    outline: 2px solid #69a981;
    outline-offset: -2px;
}
table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 980px;
    width: 100%;
    font-size: 11px;
}
thead th {
    text-align: center;
    white-space: nowrap;
    padding: 14px 18px;
    background: #eff6ef;
    border-bottom: 1px solid #dceadc;
    color: #51765c;
    font-size: 10px;
    font-weight: 800;
}
thead tr:nth-child(2) th {
    background: #f8fbf7;
    color: #9bad9d;
    border-bottom: 1px solid #e4ede4;
    padding: 10px 16px;
}
.label-head {
    text-align: left;
    min-width: 290px;
}
.sticky {
    position: sticky;
    left: 0;
    z-index: 2;
}
.annual {
    background: #e8f2e5 !important;
    min-width: 135px;
}
.value {
    min-width: 119px;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: #2c4236;
    font-weight: 700;
    padding: 12px 17px;
    border-bottom: 1px solid #edf1ed;
}
tbody tr:hover td,
tbody tr:hover th.row-label {
    background: #f6faf5;
}
.fact {
    color: #a6b6aa;
    font-weight: 500;
    background: #fbfcfa;
}
.empty {
    color: #cad5cb;
    font-weight: 400;
}
.row-label {
    background: #fff;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid #edf1ed;
    font-size: 11px;
    font-weight: 600;
    min-width: 290px;
    max-width: 335px;
    box-shadow: 5px 0 12px #243e2108;
}
.row-code {
    display: inline-block;
    min-width: 36px;
    color: #89a28e;
    font-size: 10px;
    font-weight: 800;
    margin-right: 7px;
}
.major td,
.major th.row-label {
    background: #f6faf5;
    font-weight: 800;
    color: #1e4a34;
}
.major .row-code {
    color: #347955;
}
.scenario th {
    text-align: left;
    background: #dff0df;
    color: #336849;
    padding: 12px 16px;
    font-size: 10px;
    letter-spacing: 0.07em;
}
.table-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 25px;
    color: #9caea0;
    font-size: 10px;
}
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.panel {
    padding: 24px;
}
.panel.wide {
    grid-column: 1/-1;
}
.panel-heading {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}
.panel-icon {
    width: 39px;
    height: 39px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #38915b;
    background: #e7f6e9;
    font-size: 20px;
}
.panel h2 {
    margin: 0 0 4px;
    font-size: 16px;
    letter-spacing: -0.03em;
}
.panel-heading p {
    margin: 0;
    font-size: 10px;
    color: #91a298;
}
.inline-form,
.manager-form,
.reset-form {
    display: flex;
    gap: 8px;
}
.stack-form {
    display: grid;
    gap: 9px;
}
.panel input,
.panel select,
.login-card input {
    min-width: 0;
    width: 100%;
    background: #fafcf9;
    border: 1px solid #e0e9e1;
    border-radius: 8px;
    padding: 11px 12px;
    color: #20362c;
    outline: none;
    font-size: 12px;
}
.panel input:focus,
.panel select:focus,
.login-card input:focus {
    border-color: #68af80;
    box-shadow: 0 0 0 3px #74ba8426;
}
.button {
    border: 0;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    padding: 11px 15px;
}
.primary {
    background: #276b4c;
    color: white;
}
.primary:hover {
    background: #19563b;
}
.list {
    margin-top: 19px;
    border-top: 1px solid #eef2ed;
}
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f3ef;
    font-size: 11px;
}
.list-item form {
    flex: none;
}
.text-button {
    border: 0;
    background: none;
    color: #558d6a;
    font-size: 10px;
    font-weight: 800;
}
.text-button:hover {
    text-decoration: underline;
}
.tag {
    display: inline-block;
    color: #558c65;
    background: #e9f6e9;
    border-radius: 5px;
    padding: 4px 6px;
    margin-left: 5px;
    font-size: 9px;
}
.subtext {
    display: block;
    color: #9aaa9f;
    font-size: 10px;
    margin-top: 4px;
}
.manager-form input,
.manager-form select {
    flex: 1;
}
.manager-item .reset-form {
    margin-left: auto;
}
.manager-item .reset-form input {
    width: 150px;
    padding: 8px;
}
.alert,
.success {
    margin-top: 16px;
    padding: 13px 16px;
    border-radius: 9px;
    background: #fff0ed;
    border: 1px solid #f5d1c8;
    color: #a64432;
    font-size: 12px;
}
.success {
    background: #eaf7ed;
    border-color: #cce9d2;
    color: #33734b;
}
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.login-brand {
    background: #132b27;
    color: #fff;
    padding: 9vh 10%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}
.login-brand:after {
    content: "";
    position: absolute;
    width: 650px;
    height: 650px;
    border: 1px solid #42765666;
    border-radius: 50%;
    right: -280px;
    bottom: -360px;
    box-shadow:
        0 0 0 90px #30584725,
        0 0 0 180px #30584725;
    pointer-events: none;
}
.logo {
    font-size: 35px;
    font-weight: 800;
    letter-spacing: -0.09em;
    margin-bottom: 80px;
}
.logo span {
    color: #c4efa8;
    font-size: 18px;
    vertical-align: top;
    margin-left: 7px;
}
.login-brand .eyebrow {
    color: #b9e9a6;
}
.login-brand h1 {
    font-size: clamp(35px, 4vw, 64px);
    letter-spacing: -0.07em;
    line-height: 1.14;
    margin: 14px 0 20px;
}
.login-brand > p:not(.eyebrow) {
    font-size: 14px;
    line-height: 1.8;
    max-width: 380px;
    color: #b1cabe;
}
.login-foot {
    margin-top: 90px;
    color: #82a79a;
    font-size: 11px;
}
.login-card {
    align-self: center;
    justify-self: center;
    width: min(390px, 80%);
}
.login-icon {
    width: 54px;
    height: 54px;
    background: #e5f5e5;
    color: #32774d;
    border-radius: 15px;
    display: grid;
    place-items: center;
    font-size: 28px;
    margin-bottom: 38px;
}
.login-card h2 {
    font-size: 30px;
    letter-spacing: -0.06em;
    margin: 0 0 8px;
}
.login-card .muted {
    margin-bottom: 36px;
}
.login-card label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 18px;
    color: #4c6052;
}
.login-card input {
    display: block;
    margin-top: 8px;
    padding: 14px;
}
.login-card .button {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-top: 28px;
    padding: 15px 18px;
    font-size: 13px;
}
@media (max-width: 1000px) {
    .sidebar {
        width: 215px;
    }
    .main {
        padding: 0 24px 40px;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .panel.wide {
        grid-column: auto;
    }
    .manager-form {
        flex-wrap: wrap;
    }
    .manager-form > * {
        min-width: 42% !important;
    }
}
@media (max-width: 700px) {
    .app {
        display: block;
    }
    .sidebar {
        height: auto;
        position: relative;
        width: 100%;
        padding: 14px 16px;
    }
    .brand {
        font-size: 14px;
    }
    .brand-icon {
        width: 32px;
        height: 32px;
    }
    .side-caption {
        display: none;
    }
    .side-bottom {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 11px 0 0;
        padding: 7px 4px 0;
    }
    .side-user .avatar {
        display: none;
    }
    .logout {
        padding: 0;
    }
    .nav {
        display: flex;
        overflow-x: auto;
        padding-top: 15px;
        gap: 3px;
    }
    .nav a {
        white-space: nowrap;
        min-height: 37px;
        font-size: 10px;
        padding: 0 9px;
    }
    .nav-symbol {
        font-size: 14px;
        width: 16px;
    }
    .main {
        padding: 0 14px 30px;
    }
    .topline {
        height: 46px;
    }
    .toprole {
        display: none;
    }
    .heading {
        margin: 27px 0 20px;
    }
    .heading h1 {
        font-size: 25px;
    }
    .metrics {
        gap: 7px;
    }
    .metric {
        padding: 12px;
    }
    .metric-label {
        font-size: 8px;
    }
    .metric strong {
        font-size: 17px;
        margin-top: 12px;
    }
    .metric-city {
        font-size: 14px !important;
    }
    .metric small {
        font-size: 9px;
    }
    .readonly-pill {
        margin-left: 0;
    }
    .table-head {
        padding: 20px 16px;
    }
    .filter-bar {
        padding: 12px 16px;
    }
    .table-footer {
        padding: 12px 16px;
    }
    .login-shell {
        display: block;
    }
    .login-brand {
        padding: 30px 9%;
        min-height: 245px;
        justify-content: flex-start;
    }
    .login-brand .logo {
        margin: 0 0 16px;
        font-size: 22px;
    }
    .login-brand h1 {
        font-size: 32px;
        margin: 5px 0;
    }
    .login-brand > p:not(.eyebrow) {
        font-size: 11px;
        margin: 0;
    }
    .login-foot {
        display: none;
    }
    .login-card {
        width: auto;
        margin: 35px 9%;
    }
    .login-icon {
        display: none;
    }
    .manager-item {
        flex-wrap: wrap;
    }
    .manager-item .reset-form {
        margin-left: 0;
    }
}
@media (max-width: 420px) {
    .metrics {
        grid-template-columns: 1fr 1fr;
    }
    .metric:last-child {
        display: none;
    }
    .list-item {
        flex-wrap: wrap;
    }
}

/* Roboto, SIL Open Font License 1.1 (Roboto-OFL.txt); локальные переменные начертания. */
@font-face {
    font-family: Roboto;
    src: url("roboto-cyrillic.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: Roboto;
    src: url("roboto-latin.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    unicode-range:
        U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
        U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Сине-бежевый интерфейс: бежевая страница, белые поверхности и синие акценты. */
:root {
    font-family: Roboto, Arial, sans-serif;
    --color-blue: #0a0075;
    --color-beige: #f2efe9;
    --color-ink: #252044;
    --color-muted: #625d73;
    --color-line: #ded9e6;
    --color-tint: #f7f5fb;
    color: var(--color-ink);
    background: var(--color-beige);
}
.app {
    display: block;
    min-height: 100vh;
}
.site-header {
    background: var(--color-blue);
    color: #fff;
    padding: 0 clamp(14px, 2vw, 32px);
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 60px;
}
.brand {
    padding: 0;
    flex: none;
    color: #fff;
}
.brand-icon {
    background: var(--color-beige);
    color: var(--color-blue);
}
.brand small {
    color: #cbc8ed;
}
.header-account {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}
.header-account .side-user {
    min-width: 0;
}
.header-account .side-user > span:last-child {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.header-account .side-user strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-account form {
    flex: none;
}
.side-user strong {
    color: #fff;
}
.side-user small {
    color: #d3d0ee;
}
.header-account .side-user small {
    margin-top: 0;
    white-space: nowrap;
}
.avatar {
    background: #302795;
    color: #fff;
    display: none;
}
.logout {
    padding: 8px 0;
    color: #eceafb;
    white-space: nowrap;
}
.logout:hover {
    color: #fff;
    text-decoration: underline;
}
.nav {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #aaa4dc transparent;
}
.nav a {
    flex: none;
    white-space: nowrap;
    min-height: 44px;
    padding: 0 15px;
    border-radius: 9px 9px 0 0;
    color: #eceafb;
}
.nav a:hover {
    background: #302795;
    color: #fff;
}
.nav a.active {
    background: var(--color-beige);
    color: var(--color-blue);
}
.main {
    width: 100%;
    max-width: none;
    padding: 0 clamp(14px, 2vw, 32px) 48px;
}
.topline {
    height: 52px;
    border-color: var(--color-line);
    color: var(--color-muted);
}
.status-dot {
    background: var(--color-blue);
}
.divider {
    color: var(--color-muted);
}
.toprole,
.readonly-pill {
    background: #e9e6f5;
    color: var(--color-blue);
}
.heading {
    margin: 28px 0 20px;
}
.eyebrow {
    color: var(--color-blue);
}
.heading h1 {
    color: var(--color-blue);
}
.muted,
.heading p.muted,
.table-head p:not(.eyebrow) {
    color: var(--color-muted);
}
.toolbar {
    margin-bottom: 18px;
}
.city-picker,
.period-pill {
    border-color: var(--color-line);
    color: var(--color-ink);
    box-shadow: none;
}
.city-picker label,
.metric-label,
.filter-title {
    color: var(--color-muted);
}
.city-picker select {
    color: var(--color-blue);
}
.metrics {
    gap: 12px;
    margin-bottom: 18px;
}
.metric,
.table-panel,
.panel {
    border-color: var(--color-line);
    box-shadow: 0 4px 16px #0a00750a;
}
.calculation-table + .calculation-table {
    margin-top: 24px;
}
.metric {
    padding: 17px 20px;
}
.metric strong {
    margin: 10px 0 3px;
    color: var(--color-ink);
}
.metric:last-child strong {
    color: var(--color-blue);
}
.metric-label span,
.metric strong em,
.metric small {
    color: var(--color-muted);
}
.table-badge {
    color: var(--color-blue);
    border-color: var(--color-line);
    background: var(--color-beige);
}
.filter-bar {
    border-color: var(--color-line);
}
.filter span {
    background: var(--color-tint);
    color: var(--color-muted);
    border-color: var(--color-line);
    font-size: 11px;
}
.filter:hover span {
    background: #eeebf7;
    border-color: #bcb5da;
    color: var(--color-blue);
}
.filter input:checked + span {
    color: #fff;
    background: var(--color-blue);
    border-color: var(--color-blue);
}
.filter:hover input:checked + span {
    background: #302795;
    color: #fff;
}
.filter input:focus-visible + span {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}
.table-scroll:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: -2px;
}
.scroll-hint {
    color: var(--color-muted);
    background: var(--color-tint);
}
.table-scroll {
    border-color: var(--color-line);
}
thead th {
    background: #e9e6f5;
    color: var(--color-blue);
    border-color: var(--color-line);
}
thead tr:nth-child(2) th {
    background: #faf9fd;
    color: var(--color-ink);
    border-color: var(--color-line);
}
.annual {
    background: #eeebf7 !important;
    color: var(--color-ink);
}
thead .annual {
    color: var(--color-blue);
}
.value {
    color: var(--color-ink);
    border-color: #eeebf2;
}
.fact {
    color: var(--color-ink);
    background: #f8f7fc;
}
.empty {
    color: var(--color-muted);
    font-weight: 500;
}
.row-label {
    border-color: #eeebf2;
    box-shadow: 5px 0 12px #0a007508;
}
.code-head,
.code-cell {
    left: 0;
    width: 64px;
    min-width: 64px;
    max-width: 64px;
    text-align: center;
}
.code-head {
    padding: 14px 8px;
}
.code-cell {
    background: #fff;
    padding: 12px 8px;
    border-bottom: 1px solid #eeebf2;
    color: var(--color-muted);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.label-head,
.row-label {
    left: 64px;
    min-width: 226px;
    max-width: 271px;
}
.row-label {
    font-size: 12px;
}
.major td,
.major th.row-label,
.major .code-cell {
    background: var(--color-beige);
    font-weight: 700;
}
.major th.row-label {
    color: var(--color-blue);
}
.major td.value {
    color: var(--color-ink);
}
.major td.annual {
    background: #eeebf7 !important;
}
.scenario th {
    background: #e9e6f5;
    color: var(--color-blue);
    font-size: 11px;
}
.scenario + tr td,
.scenario + tr th.row-label {
    border-top: 1px solid #c9c4df;
}
tbody tr:hover td,
tbody tr:hover th.row-label {
    background: #f0eef8;
}
tbody tr:hover td.annual {
    background: #e4e0f2 !important;
}
.table-footer {
    color: var(--color-muted);
}
.unit-badge {
    border-color: #c9c4df;
    background: var(--color-beige);
    color: var(--color-blue);
}
.panel-icon,
.login-icon {
    color: var(--color-blue);
    background: var(--color-beige);
}
.panel-heading p,
.subtext {
    color: var(--color-muted);
}
.panel input,
.panel select,
.login-card input {
    background: #fff;
    border-color: var(--color-line);
    color: var(--color-ink);
}
.panel input::placeholder,
.login-card input::placeholder {
    color: var(--color-muted);
    opacity: 1;
}
.panel input:focus,
.panel select:focus,
.login-card input:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px #0a007526;
}
.primary {
    background: var(--color-blue);
}
.primary:hover {
    background: #302795;
}
.list,
.list-item {
    border-color: var(--color-line);
}
.text-button {
    color: var(--color-blue);
}
.tag {
    color: var(--color-blue);
    background: var(--color-beige);
}
.success {
    background: #eeedf8;
    border-color: #d5d0e9;
    color: var(--color-blue);
}
.login-brand {
    background: var(--color-blue);
}
.login-brand:after {
    border-color: #aaa4dc66;
    box-shadow:
        0 0 0 90px #ffffff0d,
        0 0 0 180px #ffffff0d;
}
.logo span,
.login-brand .eyebrow {
    color: var(--color-beige);
}
.login-brand > p:not(.eyebrow),
.login-foot {
    color: #d3d0ee;
}
.login-card label {
    color: var(--color-ink);
}
/* Состояния клавиатуры остаются видимыми на светлых и тёмных поверхностях. */
.brand:focus-visible,
.nav a:focus-visible,
.logout:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -3px;
}
.city-picker select:focus-visible,
.button:focus-visible,
.text-button:focus-visible,
.panel input:focus-visible,
.panel select:focus-visible,
.login-card input:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}
.text-button:hover {
    color: #302795;
    text-decoration: underline;
}
.primary:focus-visible {
    box-shadow: 0 0 0 3px #c9c4df;
}
@media (max-width: 700px) {
    .code-head,
    .code-cell {
        width: 46px;
        min-width: 46px;
        max-width: 46px;
    }
    .label-head,
    .row-label {
        left: 46px;
        min-width: 174px;
        max-width: 210px;
    }
    .label-head {
        padding: 12px 10px;
    }
    .row-label {
        padding: 12px 10px;
    }
    .site-header {
        padding: 0 14px;
    }
    .header-top {
        min-height: 62px;
        gap: 10px;
    }
    .header-account {
        gap: 10px;
    }
    .side-user {
        gap: 6px;
    }
    .side-user .avatar {
        display: none;
    }
    .nav {
        padding-top: 0;
        gap: 4px;
    }
    .nav a {
        min-height: 44px;
        font-size: 11px;
        padding: 0 10px;
    }
    .main {
        padding: 0 14px 30px;
    }
    .topline {
        height: 42px;
    }
    .heading {
        margin: 22px 0 18px;
    }
    .table-head {
        gap: 10px;
    }
    .table-badge {
        white-space: nowrap;
    }
}
@media (max-width: 420px) {
    .brand small {
        display: none;
    }
    .header-account .side-user small {
        display: inline;
    }
    .header-top {
        min-height: 56px;
    }
    .brand {
        font-size: 14px;
    }
    .header-account {
        font-size: 11px;
    }
    .logout {
        font-size: 11px;
    }
    .nav a {
        font-size: 10px;
        padding: 0 9px;
    }
    .table-head {
        flex-wrap: wrap;
    }
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .metric:last-child {
        display: block;
        grid-column: 1/-1;
    }
}
/* Plan directory controls, separate from login-account management. */
.plan-settings {
    margin-top: 18px;
    padding: 22px;
}
.plan-settings > .inline-form > .button {
    align-self: flex-end;
}
.plan-settings h3 {
    margin: 22px 0 10px;
    color: var(--color-blue);
}
.plan-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-line);
}
.plan-entry label {
    display: grid;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    min-width: 110px;
    flex: 1;
}
.plan-entry label:first-of-type {
    flex: 2;
    min-width: 210px;
}
.plan-entry input,
.plan-entry select {
    width: 100%;
    padding: 9px;
    border: 1px solid var(--color-line);
    border-radius: 6px;
}
.plan-entry .button {
    min-height: 38px;
}
@media (max-width: 700px) {
    .plan-settings {
        padding: 14px;
    }
    .plan-entry label {
        min-width: 45%;
    }
}
/* Decomposition: three unmerged identity columns and the source summary. */
.decomposition-table table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
}
.decomposition-table th,
.decomposition-table td {
    border-bottom: 1px solid #eeebf2;
    padding: 12px;
    text-align: left;
}
.decomposition-table thead th {
    white-space: nowrap;
    font-size: 11px;
}
.decomposition-table td.value {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 84px;
}
.decomposition-table .code-cell {
    width: 55px;
    min-width: 55px;
    max-width: 55px;
    text-align: left;
}
.decomposition-table .number-cell {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    white-space: nowrap;
    color: var(--color-muted);
}
.decomposition-table .row-label,
.decomposition-table .group-label {
    min-width: 245px;
    max-width: none;
    font-size: 12px;
    box-shadow: none;
}
.decomposition-table .group-label {
    color: var(--color-blue);
}
.decomposition-table .summary-row .row-label {
    white-space: normal;
    line-height: 1.7;
}
.decomposition-table .summary-row td.value .empty {
    visibility: hidden;
}
@media (max-width: 700px) {
    .decomposition-table .row-label,
    .decomposition-table .group-label {
        min-width: 220px;
    }
}

/* Calculated workbook cells and the anchored, keyboard-accessible editor. */
.calculation-status {
    padding: 8px 26px;
    color: var(--color-blue);
    font-size: 12px;
    min-height: 32px;
}
.calculation-status:empty {
    display: none;
}
.calculation-failed {
    color: #a64432;
    background: #fff0ed;
}
.calculation-loading tbody td.value,
.calculation-loading tbody th.row-label,
.calculation-unavailable tbody td.value,
.calculation-unavailable tbody th.row-label {
    color: transparent !important;
}
.calculation-loading tbody td.value *,
.calculation-loading tbody th.row-label *,
.calculation-unavailable tbody td.value *,
.calculation-unavailable tbody th.row-label * {
    visibility: hidden;
}
.calculation-ready .value {
    position: relative;
}
.calculation-ready .row-label,
.calculation-ready .group-label {
    position: sticky;
}
.addressed-cell {
    padding-right: 38px !important;
}
.cell-formula,
.cell-formula-action {
    padding-right: 38px !important;
}
.semantic-addressed-cell {
    min-width: 155px;
}
.address-mark {
    position: absolute;
    left: 4px;
    top: 3px;
    padding: 1px 3px;
    border-radius: 3px;
    color: var(--color-muted);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
    opacity: 0.5;
}
.semantic-addressed-cell .address-mark {
    pointer-events: auto;
    font-size: 10px;
    opacity: 0.85;
}
.fx-mark {
    position: absolute;
    top: 3px;
    right: 4px;
    padding: 2px 5px;
    border: 0;
    border-radius: 30px;
    background: #e9e6f5;
    color: var(--color-blue);
    font-size: 11px;
    font-style: italic;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.04em;
    cursor: default;
}
.fx-mark:hover,
.fx-mark:focus-visible {
    background: #d9d3f4;
}
.fx-editable {
    cursor: pointer;
}
.fx-mark:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}
.formula-tooltip {
    position: fixed;
    z-index: 1100;
    width: max-content;
    max-width: min(340px, calc(100vw - 16px));
    max-height: min(50vh, 320px);
    overflow: auto;
    padding: 12px 15px;
    border: 1px solid #c9c4df;
    border-radius: 9px;
    background: #fff;
    color: var(--color-ink);
    box-shadow: 0 10px 32px #0a007533;
    font-size: 12px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    pointer-events: auto;
}
.cell-error .cell-text {
    color: #aa342a;
}
.cell-editable {
    cursor: pointer;
}
.cell-edit-button {
    display: block;
    width: 100%;
    min-height: 24px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-variant-numeric: inherit;
    font-weight: inherit;
    text-align: inherit;
    white-space: inherit;
    cursor: pointer;
}
.cell-editable:hover,
.cell-editable:focus-within {
    background: #e9e6fa !important;
}
.cell-edit-button:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
    border-radius: 3px;
}
.cell-selected,
.major td.cell-selected,
.decomposition-table td.cell-selected {
    background: #ded9fb !important;
    box-shadow: inset 0 0 0 3px var(--color-blue);
    color: var(--color-blue) !important;
}
.cell-editor {
    position: fixed;
    z-index: 1000;
    width: min(310px, calc(100vw - 16px));
    padding: 15px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 32px #0a007540;
    color: var(--color-ink);
    font-size: 12px;
}
/* .cell-editor:after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 24px;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
    background: #fff;
    border-right: 1px solid #fff;
    border-bottom: 1px solid #fff;
} */
.cell-editor.editor-clipped:after {
    display: none;
}
.cell-editor label {
    display: block;
    font-weight: 700;
}
.cell-editor input {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 10px;
    border: 1px solid var(--color-line);
    border-radius: 6px;
    font: inherit;
    font-size: 15px;
    color: var(--color-ink);
}
.formula-editor {
    width: min(440px, calc(100vw - 16px));
}
.formula-editor input {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 14px;
}
.cell-editor input:focus-visible,
.cell-editor button:focus-visible {
    outline: 1px solid var(--color-blue);
    outline-offset: 1px;
}
.cell-editor small {
    display: block;
    color: var(--color-muted);
    line-height: 1.4;
}
.cell-editor-error:not(:empty) {
    margin-top: 8px;
    color: #a64432;
    line-height: 1.4;
}
.cell-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.cell-editor button:disabled {
    cursor: wait;
    opacity: 0.65;
}
.editor-cancel {
    color: var(--color-blue);
    background: var(--color-beige);
}
.decomposition-table th.row-label.cell-formula {
    padding-right: 34px;
}
.decomposition-table th.row-label .cell-text {
    white-space: pre-line;
}
@media (max-width: 700px) {
    .calculation-status {
        padding: 8px 16px;
    }
    .cell-editor {
        padding: 12px;
    }
}

/* Tables grow with the page; the horizontal scrollport keeps identity columns pinned. */
.table-scroll .code-head,
.table-scroll .code-cell {
    z-index: 4;
}
.table-scroll .label-head,
.table-scroll .row-label {
    z-index: 3;
}
.decomposition-table .code-head,
.decomposition-table .code-cell {
    left: 0;
    width: 55px;
    min-width: 55px;
    max-width: 55px;
}
.decomposition-table .number-head,
.decomposition-table .number-cell {
    left: 55px;
    width: 52px;
    min-width: 52px;
    max-width: 52px;
}
.decomposition-table .label-head,
.decomposition-table .row-label {
    left: 107px;
}
.decomposition-table .group-label {
    left: 55px;
}
/* Shared WorkbookTables has only number + name, no legacy middle column. */
.workbook-table.decomposition-table .label-head,
.workbook-table.decomposition-table .row-label {
    left: 55px;
}
.decomposition-table .number-head,
.decomposition-table .number-cell {
    position: sticky;
    z-index: 3;
    background: #fff;
}
.decomposition-table .major .group-label,
.decomposition-table .major .number-cell {
    background: var(--color-beige);
}
.decomposition-table tbody tr:hover .number-cell,
.decomposition-table tbody tr:hover .group-label {
    background: #f0eef8;
}
.decomposition-table thead .number-head,
.decomposition-table thead .label-head,
.decomposition-table thead .code-head {
    background: #e9e6f5;
}
.decomposition-table .number-head,
.decomposition-table .label-head {
    white-space: nowrap;
}
.decomposition-table .group-label {
    z-index: 3;
    background: #fff;
}
.decomposition-table .semantic-fallback {
    padding: 10px 26px;
    background: #fff7e6;
    color: #755424;
    font-size: 12px;
    line-height: 1.5;
}
.decomposition-table.calculation-ready .semantic-fallback {
    display: none;
}
.decomposition-table .group-label .cell-text {
    white-space: pre-line;
}
@media (max-width: 700px) {
    .decomposition-table .semantic-fallback {
        padding: 10px 16px;
    }
}

/* Авторизация: одна компактная форма по центру экрана на любой ширине. */
.login-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: 24px;
}
.login-shell .login-card {
    width: min(100%, 380px);
    margin: 0;
    padding: 32px;
    background: #fff;
    border: 1px solid var(--color-line);
    border-radius: 12px;
    box-shadow: 0 4px 16px #0a00750a;
}
.login-card h1 {
    margin: 0 0 24px;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.login-card label {
    margin-bottom: 16px;
}
.login-card .button {
    justify-content: center;
    margin-top: 24px;
}
@media (max-width: 420px) {
    .login-shell {
        padding: 16px;
    }
    .login-shell .login-card {
        padding: 24px;
    }
}

/* Цветовые роли: холодные нейтрали, индиго для действий, teal для факта, янтарный для плана. */
:root {
    --color-blue: #2845a7;
    --color-beige: #f3f6fa;
    --color-ink: #202a3a;
    --color-muted: #536174;
    --color-line: #dce3ec;
    --color-tint: #edf1fc;
    --color-teal: #0b6963;
    --color-teal-tint: #eaf7f4;
    --color-amber: #855713;
    --color-amber-tint: #fff5e5;
    --color-error: #b42332;
    --color-shadow: rgba(27, 46, 79, 0.07);
    color: var(--color-ink);
    background: var(--color-beige);
}
body {
    line-height: 1.5;
}
.site-header {
    background: #fff;
    color: var(--color-ink);
    border-bottom: 1px solid var(--color-line);
    box-shadow: 0 2px 14px var(--color-shadow);
}
.header-top {
    min-height: 64px;
    justify-content: space-between;
    gap: 16px;
}
.company-name {
    flex: none;
    color: #223b89;
    font-size: 21px;
    font-weight: 900;
    letter-spacing: -0.045em;
    line-height: 1;
}
.company-name:before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 20px;
    margin-right: 10px;
    border-radius: 3px;
    background: var(--color-teal);
    vertical-align: -3px;
}
.header-account {
    gap: 16px;
}
.header-account .side-user {
    gap: 10px;
}
.header-account .side-user > span:last-child {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}
.header-account .side-user strong {
    color: var(--color-ink);
    font-size: 13px;
}
.header-account .side-user small {
    color: var(--color-muted);
    font-size: 11px;
}
.header-account .avatar {
    display: grid;
    background: var(--color-tint);
    color: var(--color-blue);
    border-radius: 50%;
}
.logout {
    color: var(--color-blue);
    font-size: 12px;
    font-weight: 700;
    padding: 9px 12px;
    border: 1px solid var(--color-line);
    border-radius: 8px;
}
.logout:hover {
    color: var(--color-blue);
    background: var(--color-tint);
    text-decoration: none;
}
.nav {
    scrollbar-color: var(--color-line) transparent;
}
.nav a {
    position: relative;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 0;
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 600;
}
.nav a:hover {
    background: var(--color-beige);
    color: var(--color-blue);
}
.nav a.active {
    background: var(--color-tint);
    color: var(--color-blue);
}
.nav a.active:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 18px;
    right: 18px;
    height: 3px;
    background: var(--color-blue);
    border-radius: 3px 3px 0 0;
}
/* Одноцветные CSS-иконки не требуют внешних ресурсов и не меняют текст ссылок. */
.nav a:before,
.panel-icon:before {
    content: "";
    display: block;
    width: 17px;
    height: 17px;
    flex: none;
}
.nav a:first-child:before {
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    background:
        linear-gradient(currentColor, currentColor) 3px 8px/2px 6px no-repeat,
        linear-gradient(currentColor, currentColor) 8px 3px/2px 11px no-repeat,
        linear-gradient(currentColor, currentColor) 13px 6px/2px 8px no-repeat;
}
.nav a:nth-child(2):before {
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    background:
        linear-gradient(currentColor, currentColor) 5px 0/2px 6px no-repeat,
        linear-gradient(currentColor, currentColor) 11px 8px/2px 6px no-repeat;
}
.main {
    padding-bottom: 64px;
}
.heading {
    margin: 32px 0 22px;
}
.heading h1 {
    font-size: clamp(25px, 2.5vw, 32px);
    letter-spacing: -0.035em;
    color: var(--color-ink);
}
.toolbar {
    margin-bottom: 20px;
}
.city-picker {
    box-shadow: none;
    border-color: var(--color-line);
    border-radius: 10px;
    min-height: 44px;
}
.city-picker select {
    color: var(--color-blue);
    font-size: 13px;
}
.city-picker select:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 3px;
}
.readonly-pill {
    background: var(--color-tint);
    color: var(--color-blue);
}
.table-panel,
.panel,
.login-shell .login-card {
    border-color: var(--color-line);
    border-radius: 12px;
    box-shadow: 0 8px 28px var(--color-shadow);
}
.calculation-table + .calculation-table {
    margin-top: 20px;
}
.table-head {
    padding: 22px 24px 18px;
}
.table-head h2 {
    font-size: 17px;
    letter-spacing: -0.02em;
    color: var(--color-ink);
}
.table-head p:not(.eyebrow) {
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.5;
}
.filter-bar {
    padding: 12px 24px;
    gap: 12px;
    border-color: var(--color-line);
}
.filter-title {
    font-size: 10px;
    color: var(--color-muted);
}
.filters {
    gap: 8px;
}
.filter span {
    border-radius: 7px;
    padding: 7px 12px;
    background: var(--color-beige);
    border-color: var(--color-line);
    color: var(--color-muted);
    font-size: 11px;
}
.filter:hover span {
    background: var(--color-tint);
    border-color: #b8c7e8;
    color: var(--color-blue);
}
.filter input:checked + span {
    background: var(--color-tint);
    border-color: #b8c7e8;
    color: var(--color-blue);
}
.filter:hover input:checked + span {
    background: #e2e9fa;
    color: var(--color-blue);
}
.filter input:focus-visible + span {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}
.table-scroll {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    border-color: var(--color-line);
    scrollbar-color: #a9b9cf var(--color-beige);
}
.table-scroll:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: -2px;
}
table {
    font-size: 12px;
}
thead th {
    background: #e9eff8;
    color: #263c71;
    border-color: var(--color-line);
    font-size: 11px;
}
thead tr:nth-child(2) th {
    background: #f4f7fc;
    color: var(--color-muted);
    border-color: var(--color-line);
}
.table-scroll th,
.table-scroll td {
    border-bottom: 1px solid #c3cedd;
    border-right: 1px solid #c3cedd;
}
.value {
    color: var(--color-ink);
}
.fact {
    background: #f5faf9;
    color: var(--color-teal);
}
.empty {
    color: var(--color-muted);
}
.row-label {
    box-shadow: 5px 0 12px var(--color-shadow);
}
.code-cell {
    color: var(--color-muted);
}
.annual,
.major td.annual {
    background: #f1f4f9 !important;
}
.major td,
.major th.row-label,
.major .code-cell,
.decomposition-table .major .number-cell,
.decomposition-table .major .group-label {
    background: #f4f7fb;
}
.major th.row-label,
.decomposition-table .group-label {
    color: var(--color-blue);
}
.major td.fact {
    color: var(--color-teal);
}
.scenario th {
    background: var(--color-amber-tint);
    color: var(--color-amber);
}
.scenario + tr td,
.scenario + tr th.row-label {
    border-top-color: #e8d4ad;
}
tbody tr:hover td,
tbody tr:hover th.row-label,
.decomposition-table tbody tr:hover .number-cell,
.decomposition-table tbody tr:hover .group-label {
    background: #edf3f9;
}
tbody tr:hover td.annual {
    background: #e7edf6 !important;
}
/* RGB and semantic tokens come from the shared browser/PDF model. These
   selectors deliberately outrank annual/fact/sticky/hover legacy rules. */
.workbook-table.calculation-table table tr > [data-workbook-tone] {
    background: var(--workbook-fill) !important;
    color: var(--workbook-ink) !important;
    font-weight: var(--workbook-weight);
}
.workbook-table table tr > [data-workbook-align="left"] {
    text-align: left;
}
.workbook-table table tr > [data-workbook-align="center"] {
    text-align: center;
    /* Equal gutters keep the content midpoint at the cell midpoint, even
       with A1/semantic badges, fx actions, editable buttons and selection. */
    padding-left: 38px !important;
    padding-right: 38px !important;
}
.workbook-table [data-workbook-align="center"] .cell-edit-button {
    text-align: center;
}
.cell-div0 .cell-text {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    color: inherit;
    line-height: 0;
}
.cell-div0 .cell-text svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.workbook-table table tr > .cell-selected[data-workbook-tone] {
    box-shadow: inset 0 0 0 3px var(--color-blue);
}
.period-create > label { min-width: 0; max-width: 100%; }
.date-control { display: flex; gap: 6px; min-width: 0; max-width: 100%; align-items: center; }
.date-control input { flex: 1 1 150px; min-width: 0; width: 150px; }
.date-control + small { display: block; max-width: 290px; font-size: 11px; }
.calendar-toggle { flex: 0 0 auto; padding: 8px; }
.calendar-popup {
    position: fixed; z-index: 100; top: 0; left: 0;
    width: min(310px, calc(100vw - 16px)); padding: 12px;
    overflow: auto; overscroll-behavior: contain;
    background: white; color: #172b46; border: 1px solid #a9b9cf;
    border-radius: 8px; box-shadow: 0 8px 28px #0003;
}
.calendar-heading { display: grid; grid-template-columns: 28px minmax(0, 1fr) 76px 28px; gap: 4px; align-items: center; }
.calendar-heading select,
.calendar-heading input { width: 100%; min-width: 0; min-height: 32px; padding: 4px; border: 1px solid #c3cedd; border-radius: 4px; background: white; color: inherit; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin: 10px 0; }
.calendar-grid > span { text-align: center; font-size: 12px; }
.calendar-popup button { min-width: 0; min-height: 32px; padding: 4px; color: inherit; cursor: pointer; border: 1px solid #c3cedd; background: #f4f7fb; border-radius: 4px; }
.calendar-popup button[aria-current="date"] { background: #d9ead5; }
.calendar-popup :is(button, input, select):focus-visible { outline: 2px solid #263c71; outline-offset: 1px; }
.unit-badge {
    background: var(--color-beige);
    border-color: var(--color-line);
    color: var(--color-muted);
}
.settings-grid {
    gap: 18px;
    margin-top: 18px;
}
.heading + .panel > .inline-form > label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.heading + .panel > .inline-form > label > input,
.heading + .panel > .inline-form > label > select {
    height: 40px;
}
.period-create > .period-create-actions {
    flex: 0 0 100%;
}
.period-create-actions > button[value="period_create"] {
    height: 40px;
}
.panel {
    padding: 24px;
}
.panel-heading {
    gap: 12px;
}
.panel-heading h2 {
    color: var(--color-ink);
}
.panel-heading p,
.subtext {
    color: var(--color-muted);
    font-size: 11px;
}
.panel-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--color-tint);
    color: var(--color-blue);
    font-size: 0;
}
.panel-icon:before {
    width: 20px;
    height: 20px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    background:
        linear-gradient(currentColor, currentColor) center 5px/10px 1.5px
            no-repeat,
        linear-gradient(currentColor, currentColor) center 9px/10px 1.5px
            no-repeat,
        linear-gradient(currentColor, currentColor) center 13px/10px 1.5px
            no-repeat;
}
.panel input,
.panel select,
.login-card input {
    min-height: 40px;
    background: #fff;
    border-color: var(--color-line);
    color: var(--color-ink);
    font-size: 13px;
}
.panel input::placeholder,
.login-card input::placeholder {
    color: var(--color-muted);
    opacity: 1;
}
.panel input:focus,
.panel select:focus,
.login-card input:focus,
.plan-entry input:focus,
.plan-entry select:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(40, 69, 167, 0.18);
    outline: none;
}
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 12px;
    transition:
        background 0.15s,
        border-color 0.15s,
        box-shadow 0.15s;
}
.primary {
    background: var(--color-blue);
    color: #fff;
}
.primary:hover {
    background: #203886;
}
.button:disabled {
    opacity: 0.6;
    cursor: wait;
}
.list,
.list-item {
    border-color: var(--color-line);
}
.list-item {
    font-size: 12px;
    min-width: 0;
}
.list-item > span {
    min-width: 0;
    overflow-wrap: anywhere;
}
/* City membership has a full-width attachment area, not an inflexible list action. */
.city-period-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
}
.city-period-summary {
    line-height: 1.5;
}
.city-period-item > .city-attach-form,
.city-attach-unavailable {
    grid-column: 1 / -1;
    min-width: 0;
}
.city-attach-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    align-items: end;
    gap: 12px;
}
.city-attach-form > label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: var(--color-muted);
    font-size: 12px;
}
.city-attach-form > .button {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}
.city-attach-help {
    grid-column: 1 / -1;
}
.city-attach-help,
.city-attach-unavailable {
    margin: 0;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.periods-panel > .panel-heading {
    align-items: flex-start;
}
.periods-panel > .panel-heading > div {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}
.periods-panel .panel-heading p {
    line-height: 1.5;
}
/* Shared action/status rows keep independent period forms aligned. */
.periods-panel .list-item > div { min-width: 0; width: 100%; }
.period-management {
    display: grid;
    grid-template-columns: minmax(0, max-content) minmax(0, max-content);
    grid-template-rows: auto auto auto;
    gap: 8px;
}
.period-edit-form {
    grid-area: 1 / 1 / 4 / 3;
    display: grid;
    grid-template-columns: subgrid;
    grid-template-rows: subgrid;
}
.period-edit-dates { grid-column: 1 / -1; min-width: 0; }
.period-edit-form > .button { grid-area: 2 / 1; }
.main[data-section="settings"] .period-edit-form > .settings-form-status {
    grid-column: 1;
    grid-row: 3;
}
.period-prepare-form {
    grid-area: 2 / 2 / 4 / 3;
    display: grid;
    grid-template-rows: subgrid;
    min-width: 0;
}
.period-prepare-form > .settings-form-status { grid-row: 2; }
.period-management .button {
    align-self: start;
    min-width: 0;
    white-space: normal;
}
.period-delete-unavailable { grid-area: 3 / 1 / 4 / 3; margin: 0; }
.periods-panel input[name="confirm_delete"] { width: auto; }
@media (max-width: 420px) {
    .city-period-item {
        grid-template-columns: minmax(0, 1fr);
    }
    .city-period-toggle {
        justify-self: start;
    }
}
.text-button {
    padding: 7px 4px;
    color: var(--color-blue);
    font-size: 11px;
}
.text-button:hover {
    color: #203886;
}
.manager-item .reset-form {
    align-items: center;
}
.alert,
.success {
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}
.alert {
    background: #fff0f1;
    border-color: #f2c9ce;
    color: var(--color-error);
}
.success {
    background: var(--color-teal-tint);
    border-color: #b9ded7;
    color: var(--color-teal);
}
.plan-settings {
    margin-top: 20px;
    padding: 24px;
}
.plan-settings h3 {
    margin: 26px 0 10px;
    color: var(--color-ink);
    font-size: 14px;
}
.plan-entry {
    gap: 12px;
    border-color: var(--color-line);
}
.plan-entry label {
    color: var(--color-muted);
    font-size: 11px;
}
.plan-entry input,
.plan-entry select {
    min-height: 40px;
    border-color: var(--color-line);
    border-radius: 8px;
    color: var(--color-ink);
    background: #fff;
    font-size: 13px;
}
.plan-entry .employee-archive-confirm {
    display: flex;
    align-items: center;
    gap: 8px;
}
.plan-entry .employee-archive-confirm input[type="checkbox"] {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    min-height: 0;
    margin: 0;
    padding: 0;
}
.plan-settings .employee-archive-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}
.plan-settings .employee-archive-filter input[type="checkbox"] {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    min-height: 0;
    margin: 0;
    padding: 0;
}
.decomposition-table .number-cell {
    color: var(--color-muted);
}
.decomposition-table thead .number-head,
.decomposition-table thead .label-head,
.decomposition-table thead .code-head {
    background: #e9eff8;
}
.decomposition-table .semantic-fallback {
    background: var(--color-amber-tint);
    color: var(--color-amber);
    border-bottom: 1px solid #e8d4ad;
}
.calculation-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 24px;
    color: var(--color-muted);
    background: #f4f7fb;
    font-size: 12px;
}
.calculation-status:empty {
    display: none;
}
.calculation-loading .calculation-status:before {
    content: "";
    width: 12px;
    height: 12px;
    flex: none;
    border: 2px solid #b8c7e8;
    border-top-color: var(--color-blue);
    border-radius: 50%;
    animation: calculation-spin 0.8s linear infinite;
}
@keyframes calculation-spin {
    to {
        transform: rotate(360deg);
    }
}
.calculation-failed {
    color: var(--color-error);
    background: #fff0f1;
}
.calculation-failed:before {
    display: none;
}
.fx-mark {
    background: var(--color-tint);
    color: var(--color-blue);
}
.fx-mark:hover,
.fx-mark:focus-visible {
    background: #e2e9fa;
    outline-color: var(--color-blue);
}
.fx-mark.fx-add {
    background: #f0f1f3;
    color: #737b86;
    font-weight: 600;
    font-style: normal;
}
.fx-mark.fx-add:hover,
.fx-mark.fx-add:focus-visible {
    background: #e1e4e8;
    color: #4b5563;
    outline-color: #737b86;
}
.formula-tooltip {
    border-color: var(--color-line);
    box-shadow: 0 12px 32px rgba(27, 46, 79, 0.17);
    color: var(--color-ink);
}
.cell-error .cell-text,
.cell-editor-error:not(:empty) {
    color: var(--color-error);
}
.cell-editable:hover,
.cell-editable:focus-within {
    background: #eaf1fc !important;
}
.cell-selected,
.major td.cell-selected,
.decomposition-table td.cell-selected {
    background: #dfe9fb !important;
    box-shadow: inset 0 -2px 0px 0px var(--color-blue);
    color: var(--color-blue) !important;
}
.cell-editor {
    border-color: var(--color-blue);
    box-shadow: 0 14px 36px rgba(27, 46, 79, 0.22);
}
.cell-editor input {
    border-color: var(--color-line);
}
.editor-cancel {
    background: var(--color-tint);
    color: var(--color-blue);
    border-color: #b8c7e8;
}
.editor-cancel:hover {
    background: #e2e9fa;
}
.login-shell {
    background: var(--color-beige);
}
.login-shell .login-card {
    padding: 34px;
    background: #fff;
}
.login-card h1 {
    color: var(--color-ink);
    font-size: 26px;
}
.login-card label {
    color: var(--color-ink);
    font-size: 12px;
}
.login-card .button {
    margin-top: 22px;
}
/* Фокус различим на светлой шапке, в формах и в таблицах. */
.nav a:focus-visible,
.logout:focus-visible,
.button:focus-visible,
.text-button:focus-visible,
.panel input:focus-visible,
.panel select:focus-visible,
.plan-entry input:focus-visible,
.plan-entry select:focus-visible,
.login-card input:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}
@media (max-width: 1000px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .panel.wide {
        grid-column: auto;
    }
    .manager-form {
        flex-wrap: wrap;
    }
    .manager-form > * {
        min-width: 0 !important;
        flex: 1 1 180px;
    }
}
@media (max-width: 700px) {
    .site-header {
        padding: 0 14px;
    }
    .header-top {
        min-height: 60px;
    }
    .header-account .avatar {
        display: grid;
        width: 32px;
        height: 32px;
    }
    .nav {
        gap: 5px;
        padding-top: 0;
    }
    .nav a {
        min-height: 43px;
        padding: 0 12px;
        font-size: 12px;
    }
    .nav a.active:after {
        left: 12px;
        right: 12px;
    }
    .main {
        padding: 0 14px 36px;
    }
    .heading {
        margin: 24px 0 18px;
    }
    .table-head {
        padding: 18px 16px;
    }
    .filter-bar {
        padding: 12px 16px;
    }
    .calculation-status {
        padding: 9px 16px;
    }
    .panel,
    .plan-settings {
        padding: 18px;
    }
    .inline-form,
    .reset-form {
        flex-wrap: wrap;
    }
    .inline-form > input,
    .inline-form > label,
    .reset-form input {
        flex: 1 1 170px;
    }
    .plan-entry label,
    .plan-entry label:first-of-type {
        min-width: min(100%, 210px);
        flex: 1 1 210px;
    }
    .plan-entry .button {
        flex: 1 1 100%;
    }
    .manager-item .reset-form {
        margin-left: 0;
    }
}
@media (max-width: 420px) {
    .company-name {
        font-size: 18px;
    }
    .company-name:before {
        height: 17px;
        margin-right: 6px;
        vertical-align: -2px;
    }
    .header-account {
        gap: 7px;
    }
    .header-account .side-user small {
        display: block;
    }
    .header-account .avatar {
        display: none;
    }
    .logout {
        padding: 7px 8px;
    }
    .nav a {
        padding: 0 10px;
        font-size: 11px;
    }
    .nav a.active:after {
        left: 10px;
        right: 10px;
    }
    .city-picker {
        max-width: 100%;
    }
    .city-picker select {
        max-width: min(230px, 60vw);
    }
    .list-item {
        flex-wrap: wrap;
    }
    .login-shell .login-card {
        padding: 26px 22px;
    }
}
/* Modern workbook: preserve long source notes without widening the whole page. */
.workbook-context {
    margin: 0 0 18px;
    padding: 12px 16px;
    border: 1px solid var(--color-line);
    border-radius: 10px;
    background: #fff;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.6;
}
.workbook-context strong {
    color: var(--color-blue);
}
.workbook-table .table-head p {
    line-height: 1.6;
}
.workbook-table .workbook-summary th {
    white-space: pre-line;
    text-align: left;
    line-height: 1.7;
}
.workbook-detail table {
    min-width: 700px;
}
.workbook-detail .row-label {
    min-width: 300px;
    max-width: 540px;
    white-space: pre-line;
    overflow-wrap: anywhere;
    line-height: 1.7;
    vertical-align: top;
}
.workbook-detail .value {
    vertical-align: top;
}
.workbook-detail .row-label .cell-text,
.workbook-detail .row-label .cell-edit-button {
    white-space: pre-line;
}
.workbook-table.calculation-unavailable tbody {
    visibility: hidden;
}
@media (max-width: 700px) {
    .workbook-detail .row-label {
        min-width: 220px;
        max-width: 300px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .calculation-loading .calculation-status:before {
        animation: none;
    }
    .button {
        transition: none;
    }
}

/* Settings-only layout: do not affect calendar controls or table toolbars. */
.settings-signatories-panel { margin-bottom: 18px; }
.signatories-page > .panel { margin-top: 18px; }
.signatories-page .inline-form { flex-wrap: wrap; align-items: flex-end; }
.signatories-page .inline-form > label { display: flex; flex-direction: column; gap: 6px; flex: 1 1 200px; min-width: 0; }
.signatories-page .signatory-form > label:has([name="sort_order"]) { flex: 0 1 130px; }
.signatories-page .inline-form > button { flex: 0 0 auto; align-self: flex-end; min-height: 40px; }
.signatories-page select { min-width: 0; width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--color-line); border-radius: 8px; background: var(--color-beige); color: var(--color-blue); }
.settings-form-status { display: block; flex: 1 0 100%; font-size: 12px; margin: 6px 0; overflow-wrap: anywhere; }
.settings-form-status[data-state="error"], .settings-form-status[data-state="unknown"] { color: #a64432; }
.settings-form-status[data-state="saved"] { color: #276b4c; }
form[data-settings-saving] { opacity: .8; }
@media (max-width: 600px) {
    .signatories-page .inline-form > label { flex-basis: 100%; }
    .signatories-page .inline-form > button { white-space: normal; }
}

.main[data-section="settings"] :is(.inline-form, .manager-form, .reset-form) { flex-wrap: wrap; }
.main[data-section="settings"] .settings-form-status { grid-column: 1 / -1; }
