.cf-app {
    --cf-ink: #172331;
    --cf-muted: #506072;
    --cf-line: #d4dde5;
    --cf-blue: #144fa4;
    --cf-paper: #fff;
    color: var(--cf-ink);
    font: 15px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;
    max-width: 1320px;
    min-width: 0;
    margin: 22px 20px 48px 0;
    overflow-wrap: anywhere;
}

.cf-app * {
    box-sizing: border-box;
}

.cf-app a {
    color: var(--cf-blue);
    text-underline-offset: 3px;
}

.cf-app h1,.cf-app h2,.cf-app h3,.cf-app h4 {
    color: var(--cf-ink);
    margin: 0;
    font-family: inherit;
    letter-spacing: -.025em;
    line-height: 1.2;
    text-transform: none;
}

.cf-app h1,.cf-app h2 {
    font-size: clamp(25px,3vw,38px);
    font-weight: 670;
    padding: 0;
}

.cf-app h3 {
    font-size: 21px;
}

.cf-app h4 {
    font-size: 18px;
}

.cf-mast,.cf-heading,.cf-actions,.cf-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.cf-mast {
    border-bottom: 2px solid var(--cf-ink);
    padding: 4px 0 18px;
}

.cf-demo,.cf-pill {
    display: inline-block;
    border-radius: 20px;
    background: #eaf1fb;
    color: #204877;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 640;
    white-space: nowrap;
}

.cf-demo {
    background: #edf0f3;
    color: #475463;
}

.cf-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 5px;
    margin: 12px 0 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--cf-line);
}

.cf-tabs a {
    display: block;
    padding: 8px 11px;
    text-decoration: none;
    color: var(--cf-muted);
    font-weight: 550;
    font-size: 14px;
    border-radius: 5px;
}

.cf-tabs a[aria-current=page] {
    color: #fff;
    background: #213346;
}

.cf-app a:hover {
    text-decoration: underline;
}

.cf-tabs a:hover {
    background: #e7eff9;
    color: var(--cf-ink);
}

.cf-section {
    margin: 20px 0 13px;
}

.cf-section p,.cf-muted,.cf-empty {
    color: var(--cf-muted);
}

.cf-section p {
    margin: .4em 0;
}

.cf-heading {
    margin: 16px 0 12px;
}

.cf-tiles {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 12px;
}

.cf-app .cf-tile,.cf-panel {
    background: var(--cf-paper);
    border: 1px solid var(--cf-line);
    border-radius: 9px;
    padding: clamp(14px,2vw,24px);
}

.cf-app .cf-tile {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--cf-ink);
    border-top: 3px solid var(--cf-blue);
}

.cf-tile strong {
    font-size: 32px;
    line-height: 1.3;
}

.cf-tile small {
    color: var(--cf-blue);
}

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

.cf-panel {
    margin: 12px 0;
}

.cf-two>.cf-panel {
    margin: 0;
}

.cf-panel>.cf-section:first-child,.cf-panel>.cf-heading:first-child {
    margin-top: 0;
}

.cf-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(min(100%,145px),1fr));
    gap: 14px;
    margin: 12px 0 16px;
}

.cf-pair {
    margin: 5px 0 11px;
}

.cf-pair span,.cf-field,.cf-app td small,.cf-log small {
    display: block;
    color: var(--cf-muted);
    font-size: 13px;
}

.cf-pair strong {
    font-size: 15px;
    color: var(--cf-ink);
    font-weight: 620;
}

.cf-app .cf-primary,.cf-action,.cf-app button.button,.cf-app .button[type=submit] {
    min-height: 36px;
    border-radius: 5px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}

.cf-app .cf-primary,.cf-app button.button-primary {
    background: var(--cf-blue);
    color: white;
    text-decoration: none;
    border: 1px solid var(--cf-blue);
}

.cf-app button.button {
    background: #edf3fa;
    border: 1px solid #9eafc4;
    color: #173d6e;
    font-family: inherit;
    font-size: 14px;
}

.cf-app .cf-primary,.cf-action,.cf-line,.cf-back {
    display: inline-block;
}

.cf-line {
    display: block;
    padding: 9px 0;
    border-bottom: 1px solid var(--cf-line);
}

.cf-app .cf-actions,.cf-app .cf-pager {
    justify-content: flex-start;
    margin: 14px 0;
}

.cf-scroll {
    max-width: 100%;
    overflow: auto;
}

.cf-app table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    margin: 0;
}

.cf-app th,.cf-app td {
    text-align: left;
    vertical-align: top;
    border: 0;
    border-bottom: 1px solid var(--cf-line);
    padding: 10px 12px;
    font: inherit;
    line-height: 1.45;
}

.cf-app th {
    color: var(--cf-muted);
    background: #ecf1f6;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.cf-app td {
    font-size: 14px;
}

.cf-app td:first-child a {
    font-weight: 620;
}

.cf-app .cf-form,.cf-filters {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: 12px 0;
}

.cf-filters .cf-field:first-child {
    flex: 1 1 240px;
}

.cf-app input:not([type=checkbox]):not([type=hidden]),.cf-app select,.cf-app textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 36px;
    padding: 6px 8px;
    background: #fff;
    color: var(--cf-ink);
    border: 1px solid #9eacba;
    border-radius: 4px;
    font: inherit;
    line-height: 1.35;
}

.cf-app label {
    margin: 0;
}

.cf-app textarea {
    min-width: min(340px,100%);
    min-height: 80px;
}

.cf-app fieldset {
    flex: 1 0 100%;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--cf-line);
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cf-app fieldset>div {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    width: 100%;
}

.cf-app legend {
    font-weight: 650;
    padding: 0 6px;
}

.cf-app summary {
    color: var(--cf-blue);
    cursor: pointer;
    padding: 5px 0;
}

.cf-log>div {
    display: grid;
    grid-template-columns: minmax(130px,1fr) 2fr 1fr 1fr;
    gap: 12px;
    align-items: start;
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid var(--cf-line);
}

.cf-log time {
    color: var(--cf-muted);
    font-size: 13px;
}

.cf-app [role=status] {
    padding: 12px;
    background: #e9f2fb;
    border-left: 3px solid var(--cf-blue);
}

.cf-app :focus-visible {
    outline: 2px solid #136bd1;
    outline-offset: 2px;
}

@media(max-width:950px) {
    .cf-tiles {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}

@media(max-width:680px) {
    .cf-app {
        margin: 12px 0 28px;
    }
    .cf-two {
        grid-template-columns: 1fr;
    }
    .cf-tabs {
        gap: 2px;
    }
    .cf-tabs a {
        padding: 7px 8px;
    }
    .cf-app td,.cf-app th {
        padding: 8px;
    }
    .cf-log>div {
        grid-template-columns: 1fr 1fr;
    }
    .cf-form .cf-field,.cf-filters .cf-field {
        width: 100%;
    }
    .cf-panel {
        padding: 14px;
    }
    .cf-app .cf-facts {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}

.cf-app .cf-item {
    display: grid;
    grid-template-columns: minmax(150px,2fr) minmax(80px,.65fr) minmax(120px,1fr);
    gap: 12px;
    width: 100%;
    border-bottom: 1px solid var(--cf-line);
    padding: 8px 0;
}

.cf-item small {
    display: block;
    color: var(--cf-muted);
    font-weight: 400;
}

.cf-total {
    flex: 1 0 100%;
    font-size: 17px;
}

.cf-total strong {
    margin-left: 12px;
}

.cf-app [hidden] {
    display: none!important;
}

.cf-app .cf-editor details {
    width: 100%;
}

.cf-app .cf-editor details .cf-item {
    margin-top: 6px;
}

.cf-log details {
    grid-column: 1/-1;
}

@media(max-width:600px) {
    .cf-app .cf-item {
        grid-template-columns: minmax(60px,1fr) minmax(90px,2fr);
    }
    .cf-item>strong {
        grid-column: 1/-1;
    }
}
.cf-app .cf-warning, .cf-app tr.cf-warning td { background:#fff1bd; color:#4c3915; padding:8px; }
.cf-app .cf-scroll { overflow-x:auto; margin:12px 0; }

.wrap.cf-app { max-width: none; container: coffee-admin / inline-size; }
#cf-registry-filters { container-type: inline-size; }
.cf-reg-toolbar {
    position: relative; display: flex; align-items: center; flex-wrap: wrap;
    gap: 8px 14px; margin: 12px 0;
}
.cf-reg-toolbar h3 { margin-right: auto; }
.cf-reg-toolbar summary, .cf-date-filter summary { cursor: pointer; color: var(--cf-blue); }
.cf-reg-toolbar .cf-column-toggle { display: none; }
.cf-extra-fields, .cf-date-filter > div {
    position: absolute; z-index: 3; background: white; border: 1px solid var(--cf-line);
    border-radius: 6px; padding: 14px; box-shadow: 0 4px 16px #17233120;
}
.cf-extra-fields {
    right: 0; width: min(680px,100%); margin-top: 5px; display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px;
}
.cf-extra-fields > :first-child { grid-column: 1/-1; }
.cf-app .cf-registry { table-layout: fixed; width: 100%; }
.cf-col-select { width: 2.5%; }
.cf-col-customer { width: 12%; }
.cf-col-email { width: 12%; }
.cf-col-number, .cf-col-bitrix_id, .cf-col-monthly { width: 5%; }
.cf-col-order_no, .cf-col-previous, .cf-col-next_due { width: 7%; }
.cf-col-contents { width: 15%; }
.cf-col-tariff_name { width: 10%; }
.cf-col-pay_status { width: 7%; }
.cf-col-state { width: 7.5%; }
.cf-app .cf-registry :is(th,td) {
    padding: 8px clamp(4px,.4cqw,10px); white-space: normal; overflow-wrap: break-word;
}
.cf-registry th { vertical-align: bottom; }
.cf-registry th > a { display: block; line-height: 1.2; text-decoration: none; }
.cf-registry th > label, .cf-date-filter { display: block; margin-top: 6px; }
.cf-registry th > label input, .cf-registry th > label select, .cf-date-filter summary {
    width: 100%; min-width: 0; min-height: 30px !important; font-size: 13px !important;
}
.cf-date-filter { position: relative; font-weight: 400; }
.cf-date-filter summary {
    border: 1px solid #9eacba; border-radius: 4px; background: white; padding: 4px;
}
.cf-date-filter > div { right: 0; width: 170px; text-align: left; }
.cf-date-filter label + label { margin-top: 6px; }
.cf-registry td:nth-child(2) { word-break: normal; overflow-wrap: normal; }
.cf-registry td:nth-child(2) a { hyphens: auto; }
.cf-registry tbody tr:hover td { background: #f6f9fc; }
@container (max-width: 1050px) {
    .cf-reg-toolbar .cf-column-toggle:not([hidden]) { display: inline-block; }
    .cf-reg-toolbar:has(.cf-column-toggle[aria-expanded=false]:not([hidden])) ~ table thead { display: none; }
    .cf-registry, .cf-registry :is(thead,tbody) { display: block; }
    .cf-registry colgroup, .cf-registry th:first-child, .cf-registry td.cf-reg-select:empty { display: none; }
    .cf-registry tr {
        display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,135px),1fr));
        gap: 8px 14px; padding: 12px; border-bottom: 1px solid var(--cf-line);
    }
    .cf-registry thead tr { background: #ecf1f6; align-items: end; }
    .cf-registry tbody tr { grid-template-columns: repeat(4,minmax(0,1fr)); }
    .cf-app .cf-registry :is(th,td) { min-width: 0; padding: 0; border: 0; }
    .cf-registry td[data-label]::before {
        content: attr(data-label); display: block; color: var(--cf-muted); font-size: 12px;
    }
    .cf-registry td.cf-reg-select:not(:empty) { grid-column: 1/-1; }
    .cf-registry td[colspan] { grid-column: 1/-1; }
    .cf-registry tbody tr:hover td { background: transparent; }
    .cf-date-filter > div { position: static; width: 100%; }
}
@container (max-width: 560px) {
    .cf-reg-toolbar h3 { width: 100%; }
    .cf-registry tbody tr, .cf-extra-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

.cf-reg-footer, .cf-reg-size { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cf-reg-footer { justify-content: space-between; gap: 8px 20px; margin: 12px 0; }
.cf-reg-size span { margin-right: 4px; }
.cf-reg-size .button[aria-pressed="true"] { background: var(--cf-ink); color: white; border-color: var(--cf-ink); }

.cf-reg-toolbar h3 { margin-right: 0; }
.cf-reg-toolbar .cf-page-selection { margin-right: auto; cursor: pointer; }
.cf-tariff-filter > div { width: min(320px,90vw); max-height: 320px; overflow-y: auto; }
.cf-tariff-filter > div label { display: flex; align-items: baseline; gap: 6px; cursor: pointer; }
.cf-tariff-filter input[type=checkbox] { flex: none; }
@container (max-width: 1050px) {
    .cf-tariff-filter > div { width: 100%; }
}

.cf-card-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(min(100%,420px),1fr));
    gap: 14px;
    margin: 16px 0;
}
.cf-card-layout > .cf-two { display: contents; }
.cf-card-layout .cf-panel { min-width: 0; margin: 0; }
.wrap.cf-app .cf-filters > label {
    flex: 1 1 150px;
    min-width: 0;
}
.wrap.cf-app .cf-filters > label:has(input[type=text]) { flex: 2 1 230px; }
.wrap.cf-app .cf-form .cf-field { min-width: 0; flex: 1 1 180px; }
.wrap.cf-app .cf-editor fieldset > .cf-field { flex: 1 1 220px; min-width: 0; }
.wrap.cf-app .cf-scroll th { white-space: normal; }
@container coffee-admin (min-width: 1360px) {
    .cf-card-layout { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .cf-card-client { grid-column: span 2; }
}
@container coffee-admin (max-width: 780px) {
    .cf-two { grid-template-columns: 1fr; }
    .cf-tiles { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .cf-responsive-table, .cf-responsive-table tbody { display: block; }
    .cf-responsive-table thead {
        position: absolute; width: 1px; height: 1px; overflow: hidden;
        clip-path: inset(50%);
    }
    .cf-responsive-table tbody tr {
        display: grid;
        grid-template-columns: repeat(auto-fit,minmax(min(100%,145px),1fr));
        gap: 8px 14px; border-bottom: 1px solid var(--cf-line); padding: 12px;
    }
    .wrap.cf-app .cf-responsive-table td { display: block; min-width: 0; padding: 0; border: 0; }
    .cf-responsive-table td::before {
        content: attr(data-label); display: block; color: var(--cf-muted); font-size: 12px;
    }
    .wrap.cf-app .cf-filters > label { width: auto; }
}
@container coffee-admin (max-width: 480px) {
    .cf-tiles { grid-template-columns: 1fr; }
    .cf-log > div { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .cf-app .cf-facts { grid-template-columns: repeat(auto-fit,minmax(min(100%,120px),1fr)); }
}

.cf-card-status { display:inline-block; padding:3px 7px; border-radius:4px; background:#edf0f3; color:#304354; font-weight:600; line-height:1.3; }
.cf-card-active { background:#e0f1e8; color:#165439; }
.cf-card-error { background:#fae3e4; color:#8d222d; }
.cf-card-review, .cf-card-pending { background:#fff0ce; color:#724b0b; }
.cf-card-legacy, .cf-card-test { background:#e7eef8; color:#294b73; }
.cf-col-card_status { width:8%; }

.cf-card-bar { display:flex; flex-wrap:wrap; gap:6px 14px; align-items:center; margin:0 0 12px; }
.cf-card-bar [aria-current] { font-weight:700; }

/* The admin checkbox skin draws checked inputs only. Keep partial page selections visible. */
.cf-app #sbcs-period-all:indeterminate {
    position: relative;
    color: #fff;
    background-color: #3457eb;
    border-color: #3457eb;
}
.cf-app #sbcs-period-all:indeterminate::before {
    content: "";
    position: absolute;
    inset: calc(50% - 1px) 20% auto;
    margin: 0;
    width: auto;
    height: 0;
    border-top: 2px solid currentColor;
}
