:root {
    --blue: #004bff;
    --blue-dark: #0038c7;
    --ink: #252933;
    --muted: #727c8d;
    --line: #e6ebf2;
    --surface: #f3f6fb;
    --white: #ffffff;
    --success: #18a66a;
    --danger: #d94452;
    --radius: 22px;
    --shadow: 0 18px 60px rgba(30, 54, 103, 0.1);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--surface);
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "Proxima Nova", Inter, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

.brand {
    color: var(--ink);
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -0.055em;
    text-decoration: none;
    white-space: nowrap;
}

.brand span {
    padding: 1px 5px;
    border-radius: 2px;
    background: var(--blue);
    color: var(--white);
    letter-spacing: -0.03em;
}

.brand-light {
    color: var(--white);
}

.brand-light span {
    background: var(--white);
    color: var(--blue);
}

.eyebrow {
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.eyebrow-blue {
    color: var(--blue);
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.button-primary {
    background: var(--blue);
    color: var(--white);
}

.button-primary:hover:not(:disabled) {
    background: var(--blue-dark);
}

.button-quiet {
    border-color: var(--line);
    background: var(--white);
    color: var(--ink);
}

.button-white {
    background: var(--white);
    color: var(--blue);
}

.button-danger {
    border-color: rgba(217, 68, 82, 0.25);
    background: rgba(217, 68, 82, 0.07);
    color: var(--danger);
}

.button-large {
    min-height: 54px;
    border-radius: 14px;
    font-size: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field > span,
.field-label {
    color: #515a6b;
    font-size: 13px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea,
.control {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 1px solid #dfe5ee;
    border-radius: 12px;
    outline: none;
    background: var(--white);
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea,
textarea.control {
    min-height: 92px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 75, 255, 0.1);
}

.field-dark > span {
    color: rgba(255, 255, 255, 0.72);
}

.field-dark input {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.11);
    color: var(--white);
}

.field-dark input::placeholder {
    color: rgba(255, 255, 255, 0.48);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #eef3fb;
}

.login-shell {
    width: min(1080px, 100%);
    min-height: 650px;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    overflow: hidden;
    border-radius: 30px;
    background: var(--white);
    box-shadow: 0 30px 100px rgba(20, 46, 102, 0.16);
}

.login-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    background-color: var(--blue);
    background-image: radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.16), transparent 36%), radial-gradient(circle at 80% 80%, rgba(105, 168, 255, 0.32), transparent 38%), linear-gradient(145deg, #004bff 0%, #0028bc 100%);
    color: var(--white);
}

.login-brand-panel h1 {
    max-width: 520px;
    margin: 0 0 24px;
    font-size: clamp(44px, 5.5vw, 74px);
    line-height: 0.94;
    letter-spacing: -0.055em;
}

.login-lead {
    max-width: 500px;
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 20px;
    line-height: 1.45;
}

.login-form-panel {
    display: grid;
    place-items: center;
    padding: 48px;
}

.login-form {
    width: min(360px, 100%);
    display: grid;
    gap: 20px;
}

.login-form h2 {
    margin: -4px 0 16px;
    font-size: 34px;
    letter-spacing: -0.035em;
}

.scope-link {
    color: var(--blue);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.form-error {
    padding: 13px 15px;
    border: 1px solid rgba(217, 68, 82, 0.2);
    border-radius: 12px;
    background: rgba(217, 68, 82, 0.07);
    color: #b82f3c;
    font-size: 14px;
}

.topbar {
    height: 82px;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
}

.topbar-title {
    display: grid;
    gap: 2px;
    padding-left: 28px;
    border-left: 1px solid var(--line);
}

.topbar-title strong {
    font-size: 15px;
}

.topbar-title span {
    color: var(--muted);
    font-size: 12px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip > span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(0, 75, 255, 0.1);
    color: var(--blue);
    font-weight: 800;
}

.user-chip div {
    display: grid;
    gap: 2px;
}

.user-chip strong {
    max-width: 190px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip a {
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
}

.workspace-page {
    height: 100vh;
    overflow: hidden;
    background: var(--surface);
}

.estimator-layout {
    height: calc(100vh - 82px);
    display: grid;
    grid-template-columns: minmax(310px, 0.86fr) minmax(410px, 1.24fr) minmax(310px, 0.76fr);
    gap: 18px;
    padding: 18px;
}

.service-panel,
.parameter-panel,
.result-panel {
    min-height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 10px 35px rgba(30, 54, 103, 0.055);
}

.service-panel,
.parameter-panel {
    display: flex;
    flex-direction: column;
}

.panel-heading {
    padding: 28px 28px 20px;
}

.panel-heading h1,
.panel-heading h2 {
    margin: 0 0 9px;
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.panel-heading p:not(.eyebrow) {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 28px 16px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--muted);
}

.search-field input {
    width: 100%;
    height: 46px;
    border: 0;
    outline: 0;
    background: transparent;
}

.service-list,
.parameter-list {
    min-height: 0;
    overflow-y: auto;
    padding: 0 20px 26px;
    scrollbar-width: thin;
    scrollbar-color: #cfd7e4 transparent;
}

.service-category {
    margin-top: 16px;
}

.service-category:first-child {
    margin-top: 0;
}

.service-category h3 {
    margin: 0 8px 8px;
    color: #8b94a4;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.service-option {
    position: relative;
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 11px;
    align-items: start;
    padding: 13px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.service-option:hover {
    background: var(--surface);
}

.service-option input {
    position: absolute;
    opacity: 0;
}

.service-check {
    width: 21px;
    height: 21px;
    display: grid;
    place-items: center;
    border: 1.5px solid #cbd4e1;
    border-radius: 7px;
    background: var(--white);
    color: transparent;
    font-size: 13px;
    font-weight: 900;
}

.service-option input:checked + .service-check {
    border-color: var(--blue);
    background: var(--blue);
    color: var(--white);
}

.service-copy {
    display: grid;
    gap: 4px;
}

.service-copy strong {
    font-size: 14px;
    line-height: 1.25;
}

.service-copy small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.parameter-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.selection-counter {
    flex: 0 0 auto;
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(0, 75, 255, 0.08);
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

.parameter-list {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 4px 28px 30px;
}

.parameter-card {
    display: grid;
    gap: 11px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfcfe;
}

.parameter-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    font-weight: 800;
}

.parameter-label small {
    color: var(--blue);
    font-size: 11px;
}

.parameter-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.parameter-input-wrap .control {
    flex: 1;
}

.parameter-input-wrap > span {
    min-width: 44px;
    color: var(--muted);
    font-size: 13px;
}

.range-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: center;
}

.range-row .field {
    min-width: 0;
}

.boolean-control {
    display: flex;
    align-items: center;
    gap: 11px;
}

.boolean-control input {
    width: 40px;
    height: 22px;
    accent-color: var(--blue);
}

.empty-state,
.loading-state {
    min-height: 220px;
    display: grid;
    place-items: center;
    padding: 32px;
    border: 1px dashed #d8e0eb;
    border-radius: 18px;
    color: var(--muted);
    text-align: center;
}

.result-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow-y: auto;
    background-color: var(--blue);
    background-image: radial-gradient(circle at 110% 0, rgba(255, 255, 255, 0.22), transparent 36%), linear-gradient(155deg, #0757ff, #0034ca);
    color: var(--white);
}

.result-panel h2 {
    margin: 0 0 42px;
    font-size: 28px;
    letter-spacing: -0.035em;
}

.result-metric span,
.result-amount span {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.result-metric strong {
    display: inline;
    font-size: clamp(64px, 6vw, 94px);
    line-height: 0.9;
    letter-spacing: -0.06em;
}

.result-metric small {
    margin-left: 8px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 16px;
}

.result-metric strong.is-range {
    font-size: clamp(28px, 3vw, 46px);
    overflow-wrap: anywhere;
}

.result-amount strong.is-range {
    font-size: clamp(20px, 2vw, 28px);
    overflow-wrap: anywhere;
}

.result-divider {
    height: 1px;
    margin: 34px 0 26px;
    background: rgba(255, 255, 255, 0.2);
}

.result-amount strong {
    display: block;
    margin-bottom: 34px;
    font-size: 34px;
    letter-spacing: -0.04em;
}

.result-panel .field {
    margin-top: auto;
    margin-bottom: 14px;
}

.result-note {
    margin: 16px 0 0;
    color: rgba(255, 255, 255, 0.58);
    font-size: 12px;
    line-height: 1.4;
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(16, 25, 45, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.history-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 21;
    width: min(500px, 94vw);
    padding: 30px;
    overflow-y: auto;
    background: var(--white);
    box-shadow: -20px 0 70px rgba(20, 40, 80, 0.16);
    transform: translateX(102%);
    transition: transform 0.24s ease;
}

.history-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.drawer-header h2 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -0.04em;
}

.icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    color: var(--ink);
    cursor: pointer;
    font-size: 25px;
}

.icon-button:disabled {
    cursor: default;
    opacity: 0.32;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fbfcfe;
    cursor: pointer;
}

.history-card:hover {
    border-color: rgba(0, 75, 255, 0.35);
}

.history-card strong {
    display: block;
    margin-bottom: 5px;
}

.history-card small {
    color: var(--muted);
}

.history-card span {
    color: var(--blue);
    font-weight: 800;
    text-align: right;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 100;
    max-width: min(500px, calc(100vw - 32px));
    padding: 13px 18px;
    border-radius: 12px;
    background: #202632;
    color: var(--white);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.error {
    background: var(--danger);
}

.admin-page {
    min-height: 100vh;
    background: var(--surface);
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-shell {
    min-height: calc(100vh - 82px);
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
}

.admin-nav {
    position: sticky;
    top: 82px;
    height: calc(100vh - 82px);
    display: grid;
    align-content: start;
    gap: 5px;
    padding: 22px 16px;
    border-right: 1px solid var(--line);
    background: var(--white);
}

.admin-nav button {
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #596273;
    cursor: pointer;
    font-weight: 700;
    text-align: left;
}

.admin-nav button:hover,
.admin-nav button.active {
    background: rgba(0, 75, 255, 0.08);
    color: var(--blue);
}

.admin-content {
    min-width: 0;
    padding: 28px;
}

.admin-view {
    width: min(1280px, 100%);
    margin: 0 auto;
}

.admin-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.admin-heading h1 {
    margin: 0 0 6px;
    font-size: 36px;
    letter-spacing: -0.045em;
}

.admin-heading p {
    margin: 0;
    color: var(--muted);
}

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

.admin-list-search {
    max-width: 560px;
    margin-bottom: 18px;
}

.admin-list-toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(220px, 0.45fr);
    gap: 14px;
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--white);
}

.admin-item-list {
    display: grid;
    gap: 8px;
}

.admin-item-row {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(260px, 1.7fr) minmax(150px, 0.8fr) minmax(190px, 1fr) auto auto;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--white);
    box-shadow: 0 6px 20px rgba(30, 54, 103, 0.035);
}

.admin-item-main,
.admin-item-meta,
.admin-item-order {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.admin-item-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.admin-item-title h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.3;
    text-overflow: ellipsis;
}

.admin-item-main p,
.admin-item-meta,
.admin-item-order > span {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.admin-item-main p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-item-category {
    color: #465064;
    font-size: 13px;
    font-weight: 700;
}

.admin-item-order > div {
    display: flex;
    gap: 5px;
}

.admin-item-order .icon-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 17px;
}

.admin-grid-empty {
    grid-column: 1 / -1;
}

.admin-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--white);
    box-shadow: 0 8px 28px rgba(30, 54, 103, 0.04);
}

.admin-card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.admin-card h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
}

.admin-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.admin-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--surface);
    color: #687284;
    font-size: 11px;
    font-weight: 800;
}

.badge-active {
    background: rgba(24, 166, 106, 0.1);
    color: var(--success);
}

.badge-inactive {
    background: rgba(217, 68, 82, 0.08);
    color: var(--danger);
}

.text-button {
    margin-top: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--blue);
    cursor: pointer;
    font-weight: 800;
}

html.modal-open {
    overflow: hidden;
    scrollbar-gutter: stable;
}

html.modal-open body {
    position: fixed;
    top: var(--modal-scroll-top, 0);
    width: 100%;
    overflow: hidden;
}

.editor-dialog {
    width: min(980px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 22px;
    background: var(--white);
    box-shadow: 0 30px 100px rgba(15, 35, 75, 0.28);
}

.editor-dialog-compact {
    width: min(720px, calc(100vw - 32px));
}

.editor-dialog::backdrop {
    background: rgba(14, 24, 45, 0.52);
    backdrop-filter: blur(3px);
}

.dialog-shell {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
}

.dialog-header,
.dialog-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.04em;
}

.dialog-alert {
    flex-shrink: 0;
    margin: 18px 24px 0;
    padding: 13px 15px;
    border: 1px solid rgba(217, 68, 82, 0.22);
    border-radius: 12px;
    background: rgba(217, 68, 82, 0.08);
    color: #b82f3c;
    font-size: 14px;
    font-weight: 700;
}

.dialog-alert[hidden] {
    display: none;
}

.dialog-body {
    min-height: 0;
    display: grid;
    gap: 18px;
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
}

.dialog-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field-wide {
    grid-column: 1 / -1;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
}

.checkbox-field input {
    width: 19px;
    height: 19px;
    accent-color: var(--blue);
}

.parameter-form {
    display: grid;
    gap: 14px;
}

.parameter-form-section {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfcfe;
}

.field[hidden],
.form-grid[hidden],
.parameter-form-section[hidden],
.parameter-unit-field[hidden] {
    display: none;
}

.parameter-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.parameter-section-heading h3 {
    margin: 0 0 4px;
    font-size: 17px;
}

.parameter-section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.parameter-default-field {
    max-width: 360px;
}

.parameter-active-field {
    min-height: 48px;
    align-self: end;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
}

.parameter-delete-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-color: rgba(217, 68, 82, 0.2);
    background: rgba(217, 68, 82, 0.035);
}

.parameter-delete-section h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.parameter-delete-section p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.parameter-option-list {
    display: grid;
    gap: 10px;
}

.parameter-option-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--white);
}

.parameter-option-index {
    width: 30px;
    height: 30px;
    align-self: center;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(0, 75, 255, 0.08);
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

.parameter-option-actions {
    display: flex;
    gap: 6px;
    align-self: end;
    margin-bottom: 3px;
}

.parameter-option-actions .icon-button {
    width: 40px;
    height: 42px;
}

.parameter-option-actions .move-parameter-option {
    font-size: 17px;
}

.parameter-option-actions .icon-button:disabled {
    opacity: 0.35;
    cursor: default;
}

.section-box {
    display: grid;
    gap: 12px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fbfcfe;
}

.section-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.section-box h3 {
    margin: 0;
    font-size: 16px;
}

.section-box-hint {
    margin: -2px 0 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.parameter-picker {
    display: grid;
    gap: 10px;
}

.selected-parameter-count {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.parameter-search-results {
    display: grid;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    box-shadow: 0 14px 30px rgba(23, 34, 59, 0.1);
}

.parameter-search-results[hidden] {
    display: none;
}

.parameter-search-result {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 11px 13px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.parameter-search-result:last-child {
    border-bottom: 0;
}

.parameter-search-result:hover,
.parameter-search-result:focus-visible {
    background: rgba(0, 75, 255, 0.06);
    outline: 0;
}

.parameter-search-empty {
    padding: 12px 13px;
    color: var(--muted);
    font-size: 12px;
}

.selected-parameters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-parameter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 6px 7px 6px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--white);
    font-size: 12px;
    font-weight: 700;
}

.selected-parameter span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-parameter .icon-button {
    width: 28px;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
}

.rule-list,
.dependency-list {
    display: grid;
    gap: 10px;
}

.calculation-base {
    background: rgba(0, 75, 255, 0.035);
}

.base-hours-list {
    display: grid;
    gap: 10px;
}

.base-hours-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) minmax(160px, 1fr) auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
}

.calculation-rule {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
}

.calculation-rule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.calculation-rule-header strong {
    font-size: 14px;
}

.calculation-rule-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.rule-quantity-settings {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 12px;
}

.role-dependencies {
    display: grid;
    gap: 20px;
    margin-top: 28px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--white);
    box-shadow: 0 8px 28px rgba(30, 54, 103, 0.04);
}

.role-dependencies-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.role-dependencies-heading h2 {
    margin: 0 0 6px;
    font-size: 26px;
    letter-spacing: -0.035em;
}

.role-dependencies-heading p:not(.eyebrow) {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.dependency-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 150px 44px minmax(180px, 1fr) auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfcfe;
}

.dependency-factor {
    display: grid;
    gap: 8px;
}

.dependency-factor > span {
    color: #515a6b;
    font-size: 13px;
    font-weight: 700;
}

.dependency-factor label {
    position: relative;
    display: block;
}

.dependency-factor input {
    padding-right: 38px;
}

.dependency-factor strong {
    position: absolute;
    top: 50%;
    right: 14px;
    color: var(--muted);
    transform: translateY(-50%);
}

.dependency-arrow {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    margin-bottom: 4px;
    border-radius: 50%;
    background: rgba(0, 75, 255, 0.08);
    color: var(--blue);
    font-size: 22px;
    font-weight: 800;
}

.dependency-preview {
    grid-column: 1 / -1;
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(0, 75, 255, 0.06);
    color: #405071;
    font-size: 13px;
    font-weight: 700;
}

.role-dependencies-actions {
    display: flex;
    justify-content: flex-end;
}

.settings-card {
    max-width: 620px;
    display: grid;
    gap: 18px;
    padding: 24px;
    border-radius: 18px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.simple-state {
    width: min(620px, 100%);
    display: grid;
    justify-items: start;
    gap: 18px;
    padding: 46px;
    border-radius: 24px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.simple-state > strong {
    margin-top: 40px;
    color: var(--blue);
    font-size: 88px;
    line-height: 0.8;
}

.simple-state h1 {
    margin: 0 0 20px;
}

@media (max-width: 1200px) {
    .workspace-page {
        height: auto;
        overflow: auto;
    }

    .estimator-layout {
        height: auto;
        grid-template-columns: minmax(300px, 0.9fr) minmax(400px, 1.1fr);
    }

    .result-panel {
        grid-column: 1 / -1;
        min-height: 420px;
    }

    .result-panel .field {
        margin-top: 24px;
    }

    .admin-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-item-row {
        grid-template-columns: minmax(240px, 1.5fr) minmax(160px, 1fr) auto auto;
    }

    .admin-item-category {
        display: none;
    }

    .form-grid-four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .login-page {
        padding: 0;
    }

    .login-shell {
        min-height: 100vh;
        grid-template-columns: 1fr;
        border-radius: 0;
    }

    .login-brand-panel {
        min-height: 320px;
        padding: 30px;
    }

    .login-brand-panel h1 {
        font-size: 48px;
    }

    .login-form-panel {
        padding: 40px 28px;
    }

    .topbar {
        height: auto;
        flex-wrap: wrap;
        padding: 16px 18px;
    }

    .topbar-title {
        display: none;
    }

    .topbar-actions {
        gap: 8px;
    }

    .user-chip div {
        display: none;
    }

    .estimator-layout {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .service-panel,
    .parameter-panel {
        min-height: 520px;
    }

    .result-panel {
        grid-column: auto;
    }

    .admin-shell {
        display: block;
    }

    .admin-nav {
        position: sticky;
        top: 74px;
        z-index: 8;
        height: auto;
        display: flex;
        overflow-x: auto;
        padding: 10px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .admin-nav button {
        flex: 0 0 auto;
    }

    .admin-content {
        padding: 18px 12px;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-list-toolbar,
    .admin-item-row {
        grid-template-columns: 1fr;
    }

    .admin-item-row > .button {
        justify-self: start;
    }

    .admin-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .calculation-rule-grid,
    .rule-quantity-settings,
    .base-hours-row {
        grid-template-columns: 1fr;
    }

    .base-hours-row .icon-button {
        justify-self: end;
    }

    .role-dependencies-heading,
    .parameter-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .parameter-delete-section {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .topbar-actions .button {
        min-height: 40px;
        padding: 0 12px;
        font-size: 13px;
    }

    .panel-heading,
    .result-panel {
        padding: 24px 20px;
    }

    .search-field {
        margin-right: 20px;
        margin-left: 20px;
    }

    .parameter-list {
        padding-right: 20px;
        padding-left: 20px;
    }

    .parameter-heading {
        display: block;
    }

    .selection-counter {
        display: inline-flex;
        margin-top: 14px;
    }

    .dialog-header,
    .dialog-body,
    .dialog-actions {
        padding: 18px;
    }

    .form-grid-four,
    .parameter-option-row {
        grid-template-columns: 1fr;
    }

    .parameter-option-index {
        display: none;
    }

    .dependency-row {
        grid-template-columns: 1fr auto;
    }

    .dependency-role-field,
    .dependency-factor,
    .dependency-preview {
        grid-column: 1 / -1;
    }

    .dependency-arrow {
        display: none;
    }

    .role-dependencies {
        padding: 18px;
    }
}
