/* REGISTRY_CONTROLS_V1
   Shared interaction contract for registry pages. Calculations are the visual reference. */

.pc-grid-host .k-grid-toolbar { flex-wrap: wrap; }
/* Telerik's zero-width height spacer must not wrap into an empty first row. */
.pc-grid-host .k-grid-toolbar:has(> .pc-grid-filter-note)::before { display: none; }
.pc-grid-filter-note {
    grid-column: 1 / -1;
    flex: 0 0 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 10px 12px;
    border: 1px solid var(--pc-border, #dbe4ed);
    border-radius: 10px;
    color: var(--pc-text, #173149);
    background: var(--pc-surface, #fff);
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.pc-registry-load-state {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    text-align: center;
    color: var(--pc-text, #173149);
    background: var(--pc-surface, #fff);
    border-radius: inherit;
}

.pc-orders-table-surface { height: min(680px, 70vh); min-height: 360px; }

.pc-data-page :where(button, input, select, textarea),
.pc-orders-workspace :where(button, input, select, textarea),
.pc-calculations-workspace :where(button, input, select, textarea) {
    font-family: inherit;
}

.pc-registry-controls {
    display: grid;
    grid-template-columns: auto minmax(280px, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-width: 0;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--pc-border, #dbe4ed);
    border-radius: 18px;
    background: var(--pc-surface, #fff);
    box-shadow: 0 8px 28px rgba(18, 48, 76, .06);
}

.pc-registry-controls--search-only {
    grid-template-columns: minmax(280px, 1fr) auto;
}

.pc-segmented {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    padding: 3px;
    border: 0;
    border-radius: 11px;
    background: #eef3f6;
}

.pc-segmented .pc-segment-button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 15px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #52687a;
    font-family: inherit;
    font-size: 14px;
    font-weight: 750;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.pc-segmented .pc-segment-button:hover {
    color: #18334b;
    background: rgba(255, 255, 255, .58);
}

.pc-segmented .pc-segment-button.is-active {
    background: #fff;
    color: #18334b;
    box-shadow: 0 2px 8px rgba(18, 48, 76, .12);
}

.pc-segmented .pc-segment-button:focus-visible,
.pc-registry-refresh:focus-visible {
    outline: 3px solid var(--pc-focus-ring, rgba(255, 115, 16, .28));
    outline-offset: 2px;
}

.pc-registry-search {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    min-width: 0;
    height: 48px;
    overflow: hidden;
    border: 1px solid #d4e0ea;
    border-radius: 14px;
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.pc-registry-search:focus-within {
    border-color: #ff8b3d;
    box-shadow: 0 0 0 3px var(--pc-focus-shadow);
}

.pc-registry-search > .pc-icon {
    margin-left: 15px;
    color: #587189;
}

.pc-registry-search input {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #173149;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.2;
}

.pc-registry-search input::placeholder {
    color: #7b8b99;
    opacity: 1;
}

.pc-registry-search input::-webkit-search-cancel-button {
    display: none;
}

.pc-registry-search__clear,
.pc-registry-search__submit,
.pc-registry-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
}

.pc-registry-search__clear {
    width: 40px;
    height: 46px;
    padding: 0;
    background: transparent;
    color: #718496;
}

.pc-registry-search__clear:focus-visible {
    outline: 3px solid var(--pc-focus-ring, rgba(255, 115, 16, .32));
    outline-offset: -3px;
    border-radius: 10px;
}

.pc-registry-search__clear:hover {
    color: #c34f0c;
    background: #fff5ef;
}

.pc-registry-search__submit {
    align-self: stretch;
    min-width: 87px;
    padding: 0 19px;
    border-left: 1px solid #ff7417;
    background: linear-gradient(135deg, #ff861f, #ff6b0b);
    color: #fff;
    box-shadow: -5px 0 15px rgba(255, 116, 23, .08);
}

.pc-registry-search__submit:hover {
    background: linear-gradient(135deg, #f97a13, #ec5f05);
}

.pc-registry-refresh {
    min-height: 48px;
    gap: 7px;
    padding: 0 17px;
    border: 1px solid #d4e0ea;
    border-radius: 14px;
    background: #fff;
    color: #24445f;
    white-space: nowrap;
    transition: color .16s ease, border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.pc-registry-refresh:hover {
    border-color: #ff9a52;
    background: #fff8f3;
    color: #b8490c;
    box-shadow: 0 5px 16px rgba(255, 116, 23, .09);
}

.pc-registry-refresh:disabled,
.pc-registry-search button:disabled,
.pc-segmented button:disabled {
    cursor: wait;
    opacity: .6;
}

.pc-finance-sections.pc-segmented,
.pc-company-tabs.pc-segmented {
    width: max-content;
    max-width: 100%;
    margin: 0 0 18px;
}

.pc-company-tabs.pc-segmented .pc-segment-button > span {
    min-width: 22px;
    padding: 4px 6px;
    border-radius: 999px;
    background: #fff;
    font-size: 11px;
}

.pc-tabbed-surface .k-tabstrip-items-wrapper {
    width: max-content;
    max-width: 100%;
    padding: 3px;
    border: 0;
    border-radius: 11px;
    background: #eef3f6;
    box-shadow: none;
}

.pc-tabbed-surface .k-tabstrip-items {
    gap: 3px;
}

.pc-tabbed-surface .k-tabstrip-items > .k-item {
    min-height: 38px;
    margin: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #52687a;
    font-family: inherit;
    font-size: 14px;
    font-weight: 750;
    line-height: 1;
    transition: color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.pc-tabbed-surface .k-tabstrip-items > .k-item .k-link {
    min-height: 38px;
    padding: 0 15px;
}

.pc-tabbed-surface .k-tabstrip-items > .k-item:hover {
    color: #18334b;
    background: rgba(255, 255, 255, .58);
}

.pc-tabbed-surface .k-tabstrip-items > .k-item.k-active {
    background: #fff;
    color: #18334b;
    box-shadow: 0 2px 8px rgba(18, 48, 76, .12);
}

.pc-tabbed-surface .k-tabstrip-items > .k-item:focus-visible {
    outline: 3px solid var(--pc-focus-ring, rgba(255, 115, 16, .28));
    outline-offset: 2px;
}

.pc-finance-filter-bar {
    display: flex;
    margin: -4px 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--pc-border, #dbe4ed);
    border-radius: 14px;
    background: var(--pc-surface, #fff);
}

.pc-finance-result-count {
    margin: -6px 2px 14px;
    color: var(--pc-text-muted, #687b8d);
    font-size: 12px;
    font-weight: 700;
}

.pc-finance-filters button,
.pc-finance-state button,
.pc-finance-allocation button,
.pc-company-state button,
.pc-company-user__edit,
.pc-company-modal > footer button {
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.pc-finance-filters button,
.pc-finance-state button,
.pc-company-state button,
.pc-company-user__edit {
    min-height: 40px;
    border-radius: 10px;
}

/* Telerik table-mode registries use the same scale and typography. */
.pc-data-page .k-grid .k-grid-toolbar {
    gap: 9px;
    padding: 12px 14px;
}

.pc-data-page .k-grid .k-grid-toolbar .k-button {
    min-height: 42px;
    border-radius: 11px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
}

.pc-data-page .k-grid .k-grid-search,
.pc-data-page .k-grid .k-searchbox {
    width: min(100%, 360px);
    min-width: 280px;
    flex: 0 1 360px;
    min-height: 42px;
    margin-left: auto;
    border-color: #d4e0ea;
    border-radius: 11px;
    font-family: inherit;
}

@media (max-width: 900px) {
    .pc-registry-controls:not(.pc-registry-controls--search-only) {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .pc-registry-controls:not(.pc-registry-controls--search-only) > .pc-segmented {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .pc-registry-controls,
    .pc-registry-controls--search-only {
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
        padding: 10px;
        border-radius: 15px;
    }

    .pc-registry-controls > .pc-segmented,
    .pc-finance-sections.pc-segmented,
    .pc-company-tabs.pc-segmented {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pc-segmented .pc-segment-button {
        min-width: 0;
        padding-inline: 9px;
        white-space: normal;
    }

    .pc-registry-search {
        width: 100%;
    }

    .pc-registry-search > .pc-icon {
        margin-left: 12px;
    }

    .pc-registry-search input {
        padding-inline: 9px;
        font-size: 16px;
    }

    .pc-registry-search__submit {
        min-width: 76px;
        padding-inline: 13px;
    }

    .pc-registry-refresh {
        width: 100%;
        grid-column: 1 / -1;
    }

    .pc-finance-filter-bar {
        overflow-x: auto;
    }

    .pc-tabbed-surface .k-tabstrip-items-wrapper {
        width: 100%;
        overflow-x: auto;
    }

    .pc-data-page .k-grid .k-grid-toolbar .k-grid-search,
    .pc-data-page .k-grid .k-grid-toolbar .k-searchbox {
        width: 100%;
        min-width: 0;
        flex-basis: 100%;
        margin-left: 0;
    }
}

@media (max-width: 430px) {
    .pc-administration-tabs .k-tabstrip-items-wrapper {
        width: 100%;
        overflow: visible;
    }

    .pc-administration-tabs .k-tabstrip-items {
        display: grid;
        width: 100%;
        min-width: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pc-administration-tabs .k-tabstrip-items > .k-item,
    .pc-administration-tabs .k-tabstrip-items > .k-item .k-link {
        min-width: 0;
        width: 100%;
    }

    .pc-administration-tabs .k-tabstrip-items > .k-item .k-link {
        justify-content: center;
        padding-inline: 8px;
    }

    .pc-registry-search {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .pc-registry-search > .pc-icon {
        display: none;
    }

    .pc-registry-search input {
        padding-left: 13px;
    }

    .pc-registry-search__submit {
        min-width: 72px;
        padding-inline: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pc-registry-search,
    .pc-registry-refresh,
    .pc-segmented .pc-segment-button {
        transition: none;
    }
}

/* LOAD_ERROR_STATE_V1: единое состояние ошибки загрузки (расчёты, компания, настройки). */
.pc-load-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 220px;
    padding: 28px 24px;
    border: 1px solid var(--pc-error-border, #efcaca);
    border-radius: 16px;
    color: var(--pc-error-text, #8d4444);
    background: var(--pc-error-surface, #fff8f8);
    text-align: center;
}

.pc-load-error__icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: inherit;
    background: rgba(181, 75, 75, .12);
}

.pc-load-error__copy {
    display: grid;
    gap: 4px;
    max-width: 520px;
}

.pc-load-error__copy strong {
    color: var(--pc-text, #173149);
    font-size: 17px;
    line-height: 1.3;
}

.pc-load-error__copy span {
    font-size: 13px;
    line-height: 1.45;
}

.pc-load-error__retry {
    margin-top: 2px;
}

.pc-load-error__retry:disabled {
    cursor: wait;
    opacity: .7;
}

.pc-settings-load-error {
    margin-top: 18px;
}
