/* Shared screen theme. Print/document layouts and application behaviour stay local. */
@media screen {
    :root {
        --app-bg: #f3f6fb;
        --app-surface: #fff;
        --app-ink: #24344d;
        --app-muted: #66758b;
        --app-line: #dce4ef;
        --app-blue: #0d4cd3;
        --app-soft-blue: #edf3ff;
        --app-radius: 12px;
        --app-button-radius: 8px;
        --app-button-blue: #0d4cd3;
        --app-button-blue-hover: #103ea5;
        --app-button-line: #cbd7e7;
        --app-button-text: #24416b;
        --app-button-focus: #0d4cd3;
    }
    html, body { background: var(--app-bg); color: var(--app-ink); }
    body { font-family: 'Tinkoff Sans', Arial, sans-serif; font-size: 14px; line-height: 1.5; }
    a { color: var(--app-blue); }
    a:hover, a:focus { color: #103ea5; }
    h1, h2, h3, h4, legend { color: var(--app-ink); }
    h2 { font-size: 26px; line-height: 1.25; }
    h3 { font-size: 21px; line-height: 1.3; }
    hr { border-top-color: var(--app-line); }
    body .hint, body .text-muted, body .help-block { color: var(--app-muted); }

    /* The rail is a stable, compact work queue; the right-hand area takes the rest. */
    body.app-workspace-layout > .app-main-shell { padding: 16px 22px 14px; }
    body .app-workspace-frame { grid-template-columns: 270px minmax(0, 1fr); gap: 20px; }
    body .app-workspace-rail { background: transparent; }
    body .app-brand {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        flex: 0 0 auto; min-height: 74px; padding: 14px 12px 10px;
        border: 1px solid var(--app-line); border-radius: var(--app-radius);
        background: var(--app-surface);
    }
    body .app-brand:hover, body .app-brand:focus { background: #fff; }
    body .app-brand-logo { max-width: 232px; }
    .app-brand-caption { margin-top: 7px; color: var(--app-muted); font-size: 12px; }
    body .app-work-panel { margin-top: 12px; border: 1px solid var(--app-line); border-radius: var(--app-radius); background: #fff; }
    body .app-work-section { background: #fff; }
    body .app-work-section + .app-work-section { border-top: 1px solid var(--app-line); }
    body .app-work-section-head { min-height: 40px; padding: 9px 12px; background: #f7f9fd; color: var(--app-ink); font-size: 15px; }
    body .app-work-section-head > :last-child:not(button):not(a) { color: var(--app-blue); }
    body .app-work-section-body { padding: 3px 10px 8px; }
    body .app-work-item { padding: 10px 1px; border-bottom: 1px solid #edf1f6; }
    body .app-work-client { color: var(--app-blue); font-size: 14px; }
    body .app-work-state { font-size: 13px; line-height: 1.45; color: var(--app-muted); }
    body .app-work-today-task { padding: 9px 12px; font-size: 13px; background: #fafbfe; }
    body .app-work-item.has-document-error .app-work-state { border-radius: 8px; background: #fff2f2; border-color: #f2caca; }
    body .app-work-item.is-current { background: #eef8f1; }

    /* Never shrink the header to make room for a long page: it caused overlap. */
    body .app-workspace-main > :is(.app-topbar, .app-page-head, .app-page-divider) { flex-shrink: 0; }
    body .app-topbar {
        display: flex; flex-flow: row wrap; align-items: center; gap: 0;
        min-height: 54px; margin: 0 0 18px; padding: 4px 8px;
        border: 1px solid var(--app-line); border-radius: var(--app-radius);
        background: var(--app-surface); position: relative; z-index: 30;
    }
    body .app-main-nav { order: 0; flex: 1 1 auto; flex-wrap: wrap; overflow: visible; border: 0; }
    body .app-main-nav-item { min-height: 42px; padding: 9px 12px; font-size: 14px; color: var(--app-ink); background: transparent; }
    body .app-main-nav-item:not(.app-main-nav-action) { background: transparent; color: var(--app-ink); }
    body .app-main-nav-item:not(.app-main-nav-action):hover,
    body .app-main-nav-dropdown.open > .app-main-nav-item { background: transparent; color: var(--app-blue); }
    body .app-user-toolbar { order: 1; flex: 0 0 auto; min-height: 40px; padding: 4px 8px; border: 0; font-size: 13px; }
    body .app-user-greeting { font-size: 14px; }
    body .app-user-pin { border: 0; border-radius: 6px; background: var(--app-soft-blue); color: #244579; }
    body .app-kassa-count { background: var(--app-soft-blue); color: var(--app-blue); }
    body .app-page-head { margin: 0 0 16px; }
    body .app-page-title-row { margin-bottom: 0; }
    body .app-page-title { font-size: 28px; font-weight: 700; line-height: 1.25; color: var(--app-ink); }
    body .app-page-title-row + .app-client-card { margin-top: 14px; }
    body .app-page-divider { display: none; }
    body .app-workspace-main > .app-content-column {
        padding: 20px; border: 1px solid var(--app-line); border-radius: var(--app-radius);
        background: var(--app-surface); min-width: 0;
    }
    body.app-workspace-layout .app-workspace-main > .app-content-column { overflow-x: auto; }
    body.app-list-layout .app-workspace-main > .app-content-column { overflow: hidden; }
    body .app-client-card { background: #fff; border: 1px solid var(--app-line); border-radius: var(--app-radius); padding: 16px 18px; }
    body .app-client-name { color: var(--app-ink); font-size: 22px; }
    body .app-client-name:hover { color: var(--app-blue); }
    body .app-client-edit { border-radius: 8px; color: var(--app-blue); border-color: var(--app-line); }
    body .app-client-meta { color: var(--app-ink); font-size: 13px; }

    /* Common forms. Local widths and inline/stacked field layout are preserved. */
    body :is(.form-control, input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="tel"], select, textarea):not([type="hidden"]) {
        border: 1px solid #cbd7e7; border-radius: 8px;
        background-color: #fff; color: var(--app-ink); box-shadow: none;
        font-family: 'Tinkoff Sans', Arial, sans-serif; font-size: 14px;
    }
    body .form-control { border-color: #cbd7e7 !important; border-radius: 8px !important; box-shadow: none !important; }
    body input.form-control, body select.form-control { height: 36px; padding: 6px 10px; }
    body select:not([multiple]):not([size]) { min-height: 36px; padding: 6px 10px; vertical-align: middle; }
    body input:is([type="date"], [type="datetime-local"]):not(.form-control) { min-height: 36px; padding: 5px 9px; }
    body textarea.form-control { padding: 9px 11px; min-height: 72px; resize: vertical; }
    body :is(.form-control, input, select, textarea):focus {
        border-color: var(--app-blue) !important;
        outline-color: var(--app-blue);
    }
    body .form-control:focus { box-shadow: 0 0 0 3px #0d4cd31a !important; }
    body .form-control:disabled, body .form-control[readonly] { background: #f0f3f8; color: #65758a; }
    body input:is([type="checkbox"], [type="radio"]) { accent-color: var(--app-blue); }
    body label { color: var(--app-ink); }
    body .input-group .form-control:not(:last-child) { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
    body .input-group-addon { background: #f2f5fa; border-color: #cbd7e7; color: var(--app-muted); }
    body .has-error .form-control { border-color: #c73f3f !important; }
    body .has-success .form-control { border-color: #338547 !important; }

    /* Shared surfaces for lists, reports, service forms and client/order sections. */
    body :is(.app-panel, .app-filter, .app-section, .reporting-rules-hero, .reporting-rules-filters, .reporting-rules-links-panel, .reporting-rules-table-panel, .service-catalog-filter, .cogroups-list-toolbar) {
        border: 1px solid var(--app-line); border-radius: var(--app-radius);
        background: #f8faff; box-shadow: none;
    }
    body .app-section { background: #fff; }
    body .app-panel-success { border-color: #c9e2d3; background: #f4faf6; }
    body :is(.app-toolbar-title, .app-filter-title, .service-catalog-title) { color: var(--app-ink); }
    body :is(.reporting-rules-summary, .income-report-card) { border: 1px solid var(--app-line); border-radius: 10px; background: #fff; }
    body .income-report-card-total { border-color: #c1d5fb; background: var(--app-soft-blue); }
    body .income-report-card strong, body .reporting-rules-summary strong { color: var(--app-blue); }
    body .reporting-rules-filter-grid .form-group { min-width: 0; }
    body .reporting-rules-page { grid-template-columns: minmax(0, 1fr); }
    body .reporting-rules-page > * { min-width: 0; }
    body .reporting-rules-filter-grid { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
    body .app-content-column > .app-panel:first-child { margin-bottom: 0; }
    body .nav-tabs { border-bottom-color: var(--app-line); }
    body .TabbedPanelsContentGroup { border-color: var(--app-line); border-radius: 10px; background: #fff; }
    body .TabbedPanelsContent { padding: 16px; }
    body .contractor-finance-tabs { border-bottom-color: var(--app-line); }
    body .contractor-finance-tab-panel { border-color: var(--app-line); border-radius: 10px; }

    /* Keep status-specific row colours and numeric formatting intact. */
    body .table { border-color: var(--app-line); background-color: #fff; font-size: 14px; }
    body .table > :is(thead, tbody, tfoot) > tr > :is(th, td) { border-color: var(--app-line); padding: 9px 11px; line-height: 1.45; }
    body .table > thead > tr > th { background: #eef3fb; color: #3f536d; font-size: 13px; font-weight: 700; border-bottom-width: 1px; }
    body .contractors-list-table > thead > tr > th { padding: 5px 8px; line-height: 1.2; }
    body .contractors-list-table .contractor-select-stack-head { gap: 0; }
    body .contractors-list-name-heading { white-space: nowrap; }
    body .table-striped > tbody > tr:nth-of-type(odd) { background-color: #fafcff; }
    body .table-condensed > :is(thead, tbody, tfoot) > tr > :is(th, td) { padding: 5px 8px; }
    body .table-responsive { border-radius: 9px; }
    body #contractors-list-table > :is(thead, tbody) > tr > :last-child { width: 86px; min-width: 86px; white-space: nowrap; text-align: center; }
    body .app-table th, body .app-table td { border-color: var(--app-line); }
    body .order-view .order-services-table > tbody.order-service-block-body > tr > td { border-color: var(--app-line); }
    body .order-view .order-services-table :is(.order-service-price-line, .order-service-line-total) { border-left-color: var(--app-line); }
    body .pagination > li > a, body .pagination > li > span { border-color: var(--app-line); color: var(--app-blue); }
    body .pagination > .active > a, body .pagination > .active > span { background: var(--app-blue); border-color: var(--app-blue); color: #fff; }
    body .pagination > .disabled > a, body .pagination > .disabled > span { color: #8995a5; }

    /* Search in the clients directory follows the same field/action pattern. */
    .clients-directory-filter { padding: 14px 16px; margin: 0 0 18px; background: #f8faff; border: 1px solid var(--app-line); border-radius: var(--app-radius); }
    .clients-directory-filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
    .clients-directory-filter-row > label { margin: 0; }
    .clients-directory-filter-row > .form-control { flex: 1 1 230px; width: auto; min-width: 120px; }
    .clients-directory-filter-row > .app-primary-action { margin-left: auto; }
    .clients-directory-search-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; margin-top: 10px; color: var(--app-muted); font-size: 13px; }
    #set-filter .clients-directory-search-scope label { margin: 0; }

    /* Menus and overlays use the same cards and typographic hierarchy. */
    body .dropdown-menu { padding: 6px; border: 1px solid var(--app-line); border-radius: 10px; box-shadow: 0 8px 24px #2137541a; }
    body .dropdown-menu > li > a { padding: 8px 11px; border-radius: 6px; color: var(--app-ink); }
    body .dropdown-menu > li > a:hover, body .dropdown-menu > li > a:focus { background: var(--app-soft-blue); color: var(--app-blue); }
    body .dropdown-menu > .active > a { color: #fff; background: var(--app-blue); }
    body .modal-content { border: 1px solid var(--app-line); border-radius: 16px; box-shadow: 0 16px 50px #16315a33; }
    body .modal-header, body .modal-footer { border-color: var(--app-line); padding: 16px 20px; }
    body .modal-body { padding: 20px; }
    body :is(.app-drawer-head, .app-drawer-footer, .app-document-drawer-head, .order-offer-drawer-head) { border-color: var(--app-line); background: #f8faff; }
    body :is(.app-drawer-close, .app-drawer-back, .app-client-edit) { border-radius: 8px; }
    body :is(.app-order-action-choice, .order-offer-drawer-action, .app-user-notice) { border-radius: 10px; border-color: var(--app-line); color: #24416b; }
    body .app-order-action-choice:hover { color: var(--app-blue); background: var(--app-soft-blue); }
    body .app-filter-pill:has(input:checked), body .app-filter-pill.is-selected { border-color: var(--app-blue); background: var(--app-soft-blue); color: var(--app-blue); box-shadow: inset 0 0 0 1px var(--app-blue); }
    body .alert { border-radius: 10px; padding: 12px 16px; }
    body .alert-info { color: #244579; background: #edf3ff; border-color: #ccdcfa; }
    body .alert-warning { color: #725216; background: #fff8e8; border-color: #efddb2; }
    body .alert-danger { color: #a42d35; background: #fff0f1; border-color: #efcbd0; }
    body .alert-success { color: #256c3f; background: #edf8f1; border-color: #c4e1ce; }

    /* Standalone reports and the cash desk share the application identity. */
    .app-standalone-shell { margin: 24px; color: var(--app-ink); }
    .app-standalone-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 20px; }
    .app-standalone-brand { display: inline-flex; flex-direction: column; gap: 2px; font-size: 18px; font-weight: 700; color: var(--app-ink); }
    .app-standalone-brand small { font-size: 12px; font-weight: 400; color: var(--app-muted); }
    .app-standalone-header h1 { margin: 0; font-size: 26px; }
    .app-standalone-menu { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--app-line); border-radius: 12px; background: #fff; color: #a6b6cc; }
    .app-standalone-menu hr { display: none; }
    .app-standalone-menu a { padding: 4px 7px; border-radius: 6px; }
    .app-standalone-menu a:hover { background: var(--app-soft-blue); }
    .app-standalone-content { padding: 20px; background: #fff; border: 1px solid var(--app-line); border-radius: var(--app-radius); overflow-x: auto; }
    .app-standalone-content form[name="debtPeriodFilter"] { display: flex !important; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 0; }
    .app-standalone-content form[name="debtPeriodFilter"] label { margin-bottom: 0; }
    .app-standalone-content .table { width: 100%; }
    body.app-cash-desk { padding: 24px !important; }
    body.app-cash-desk fieldset { margin: 18px 0; padding: 18px; background: #fff; border: 1px solid var(--app-line); border-radius: var(--app-radius); }
    body.app-cash-desk legend { width: auto; margin-bottom: 0; padding: 0 8px; font-size: 20px; border: 0; }
    body.app-cash-desk .kkm-shift-status-panel { background: #fff; border: 1px solid var(--app-line); border-radius: var(--app-radius); }
    /* Calm, focused employee sign-in screens. */
    body.app-page-login,
    body.app-page-pin {
        min-height: 100vh;
        background:
            radial-gradient(circle at 12% 14%, rgba(45, 104, 230, .13), transparent 30%),
            radial-gradient(circle at 88% 86%, rgba(69, 167, 212, .12), transparent 32%),
            linear-gradient(145deg, #f7f9fd 0%, #edf3fb 100%);
    }
    body.app-page-login .app-main-shell,
    body.app-page-pin .app-main-shell {
        width: calc(100% - 32px); max-width: 720px;
        margin: max(28px, 6vh) auto 32px; padding: 24px;
        min-height: 0 !important;
        border: 0; border-radius: 0; background: transparent; box-shadow: none;
    }
    body .app-auth-layout { width: 100%; max-width: 620px; margin: 0 auto; }
    body .app-auth-content { width: 100%; }
    body .app-auth-brand {
        display: flex; flex-direction: column; align-items: center;
        margin: 0 0 28px; text-align: center;
    }
    body .app-auth-brand img { display: block; width: min(100%, 300px); height: auto; }
    body .app-auth-brand span {
        margin-top: 9px; color: #718198; font-size: 12px; font-weight: 500;
        letter-spacing: .12em; text-transform: uppercase;
    }
    body .app-auth-card {
        overflow: visible; border: 1px solid rgba(203, 215, 231, .9); border-radius: 24px;
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 24px 70px rgba(35, 63, 105, .14);
    }
    body .app-auth-tabs {
        display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
        padding: 8px; border-bottom: 1px solid #e5ebf4; border-radius: 24px 24px 0 0;
        background: #f4f7fb;
    }
    body .app-auth-tab {
        display: flex; align-items: center; justify-content: center;
        min-width: 0; min-height: 48px; padding: 9px 10px;
        border: 0; border-radius: 12px; background: transparent;
        color: #718198; font-size: 14px; font-weight: 600; line-height: 1.25;
        text-align: center; white-space: normal;
    }
    body .app-auth-tab.is-active {
        background: #fff; color: var(--app-blue);
        box-shadow: 0 3px 12px rgba(49, 78, 121, .11);
    }
    body button.app-auth-tab[disabled] {
        opacity: .58; color: #7f8b9d; cursor: default; pointer-events: none;
    }
    body .app-auth-card-body { padding: 34px 38px 38px; }
    body .app-auth-eyebrow {
        display: block; margin-bottom: 8px; color: var(--app-blue);
        font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    }
    body .app-auth-title {
        margin: 0; color: #1f3048; font-size: 29px; font-weight: 700;
        line-height: 1.2; letter-spacing: -.02em;
    }
    body .app-auth-description {
        max-width: 470px; margin: 10px 0 0; color: #66758b;
        font-size: 15px; line-height: 1.55;
    }
    body .app-auth-form { margin-top: 26px; }
    body .app-auth-form .form-group { margin-bottom: 19px; }
    body .app-auth-form label {
        margin-bottom: 7px; color: #2c3d55; font-size: 14px; font-weight: 600;
    }
    body .app-auth-form input.form-control {
        height: 50px; padding: 10px 14px;
        border-color: #c9d5e5 !important; border-radius: 12px !important;
        background: #fbfcff; font-size: 15px;
    }
    body .app-auth-form input.form-control::placeholder { color: #9aa8ba; }
    body .app-auth-form input.form-control:focus { background: #fff; }
    body .app-auth-submit {
        min-height: 50px; margin-top: 5px; border: 0; border-radius: 12px;
        background: linear-gradient(135deg, #1758df 0%, #0d45bd 100%);
        color: #fff; font-size: 15px; font-weight: 600;
        box-shadow: 0 10px 24px rgba(13, 76, 211, .22);
    }
    body .app-auth-submit:hover,
    body .app-auth-submit:focus {
        background: linear-gradient(135deg, #124dcc 0%, #0a399f 100%);
        color: #fff; transform: translateY(-1px);
    }
    body .app-auth-alert {
        margin: 20px 0 -4px; padding: 12px 14px;
        border: 1px solid #efcbd0; border-radius: 10px;
        background: #fff2f3; color: #9b2d38; line-height: 1.45;
    }
    body .app-auth-card-heading {
        display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
    }
    body .app-auth-card-heading > div { min-width: 0; }
    body .app-auth-icon-action {
        position: relative; display: inline-flex; align-items: center; justify-content: center;
        flex: 0 0 44px; width: 44px; height: 44px;
        border: 1px solid #d6e0ec; border-radius: 12px;
        background: #f7f9fc; color: #5b6d84; font-size: 17px;
        text-decoration: none; transition: border-color .15s ease, background .15s ease, color .15s ease;
    }
    body .app-auth-icon-action:hover,
    body .app-auth-icon-action:focus {
        border-color: #b9c9df; background: #edf3ff; color: var(--app-blue); text-decoration: none;
        outline: none; box-shadow: 0 0 0 3px rgba(13, 76, 211, .12);
    }
    body .app-auth-icon-action::before {
        content: ""; position: absolute; top: calc(100% + 5px); right: 15px;
        border: 6px solid transparent; border-bottom-color: #24344d;
        opacity: 0; transform: translateY(-4px); pointer-events: none;
        transition: opacity .15s ease, transform .15s ease;
    }
    body .app-auth-icon-action::after {
        content: attr(data-tooltip); position: absolute; z-index: 5;
        top: calc(100% + 16px); right: 0; width: max-content; max-width: 240px;
        padding: 8px 10px; border-radius: 8px; background: #24344d; color: #fff;
        font-size: 12px; font-weight: 500; line-height: 1.35; white-space: nowrap;
        box-shadow: 0 8px 20px rgba(31, 48, 72, .2);
        opacity: 0; transform: translateY(-4px); pointer-events: none;
        transition: opacity .15s ease, transform .15s ease;
    }
    body .app-auth-icon-action:hover::before,
    body .app-auth-icon-action:hover::after,
    body .app-auth-icon-action:focus::before,
    body .app-auth-icon-action:focus::after { opacity: 1; transform: translateY(0); }
    body .app-pin-keypad-label {
        display: block; margin-bottom: 7px; color: #2c3d55;
        font-size: 14px; font-weight: 600;
    }
    body .app-pin-display {
        display: flex; align-items: center; justify-content: center;
        min-height: 58px; padding: 10px 16px;
        border: 1px solid #c9d5e5; border-radius: 12px;
        background: #fbfcff; color: #1f3048;
        font-size: 24px; font-variant-numeric: tabular-nums;
        letter-spacing: .28em; text-align: center;
    }
    body .app-pin-display.is-empty {
        color: #8a99ad; font-size: 14px; letter-spacing: 0;
    }
    body .app-pin-keys {
        display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px;
        max-width: 320px; margin: 14px auto 0;
    }
    body .app-pin-key {
        min-height: 52px; padding: 8px;
        border: 1px solid #cbd7e7; border-radius: 12px;
        background: #fff; color: #24364f;
        font-size: 20px; font-weight: 700;
        box-shadow: 0 3px 9px rgba(38, 65, 102, .07);
        transition: border-color .12s ease, background .12s ease, transform .12s ease, box-shadow .12s ease;
    }
    body .app-pin-key:hover,
    body .app-pin-key:focus {
        border-color: #9db7df; background: #f1f6ff; outline: none;
        box-shadow: 0 0 0 3px rgba(13, 76, 211, .1);
    }
    body .app-pin-key:active { transform: translateY(1px); }
    body .app-pin-key-action { color: #65758c; font-size: 17px; font-weight: 600; }
    body .app-pin-keypad .help-block { margin: 10px 0 0; text-align: center; }
    @media (max-width: 520px) {
        body.app-page-login .app-main-shell,
        body.app-page-pin .app-main-shell {
            width: calc(100% - 24px); margin: 24px auto; padding: 0;
        }
        body .app-auth-brand { margin-bottom: 22px; }
        body .app-auth-brand img { width: min(100%, 255px); }
        body .app-auth-card { border-radius: 20px; }
        body .app-auth-tabs { gap: 4px; padding: 6px; border-radius: 20px 20px 0 0; }
        body .app-auth-tab { min-height: 46px; padding: 7px 5px; font-size: 12px; }
        body .app-auth-card-body { padding: 26px 22px 28px; }
        body .app-auth-title { font-size: 25px; }
        body .app-auth-description { font-size: 14px; }
        body .app-auth-card-heading { gap: 12px; }
        body .app-auth-icon-action { flex-basis: 42px; width: 42px; height: 42px; }
        body .app-auth-icon-action::after { max-width: 215px; white-space: normal; }
        body .app-pin-keys { max-width: none; }
        body .app-pin-key { min-height: 50px; }
    }

    @media (max-width: 1599px) {
        body .app-main-nav { flex: 1 0 100%; }
        body .app-user-toolbar { margin-left: auto; min-height: 34px; }
    }
    @media (max-width: 1199px) {
        body .app-workspace-frame { grid-template-columns: 230px minmax(0, 1fr); gap: 14px; }
        body.app-workspace-layout > .app-main-shell { padding: 12px 16px; }
        body .app-workspace-main > .app-content-column { padding: 16px; overflow-x: auto; }
        body .app-work-panel { height: 680px; min-height: 0; }
        body .app-client-card { flex-wrap: wrap; }
        body .app-client-group { min-width: 150px; }
    }
    @media (max-width: 767px) {
        body .app-workspace-frame { display: flex; flex-direction: column; gap: 14px; }
        body.app-workspace-layout > .app-main-shell { padding: 10px; }
        body .app-brand { min-height: 62px; padding: 10px; }
        body .app-brand-logo { max-width: 200px; }
        body .app-work-panel { display: flex; flex-direction: column; height: 320px; min-height: 0; }
        body .app-work-section.app-work-new { max-height: none; }
        body .app-work-section + .app-work-section { border-top: 1px solid var(--app-line); border-left: 0; }
        body .app-work-section-head { padding: 8px; font-size: 13px; }
        body .app-work-section-body { padding: 3px 6px; }
        body .app-work-client { font-size: 13px; }
        body .app-topbar { margin-bottom: 14px; }
        body .app-main-nav-item { padding: 8px 9px; font-size: 13px; }
        body .app-user-greeting { font-size: 13px; }
        body .app-user-toolbar { justify-content: flex-start; flex-wrap: wrap; margin-left: 0; }
        body .app-page-title { font-size: 24px; }
        body .app-workspace-main > .app-content-column { padding: 12px; }
        body .app-client-title-line { flex-wrap: wrap; }
        body .clients-directory-filter-row > .form-control { flex-basis: calc(100% - 80px); }
        body .clients-directory-filter-row > .app-primary-action { margin-left: 0; }
        body .app-filter-grid { grid-template-columns: minmax(0, 1fr); }
        .app-standalone-shell { margin: 12px; }
        .app-standalone-header { align-items: flex-start; flex-direction: column; }
        .app-standalone-content { padding: 14px; }
    }

    /* Readable screen typography. Print and generated document layouts are unchanged. */
    body { font-size: 17px; line-height: 1.55; }
    body .app-brand-caption { font-size: 15px; }
    body .app-work-section-head { font-size: 17px; }
    body .app-work-client,
    body .app-main-nav-item,
    body .app-user-greeting { font-size: 16px; }
    body .app-work-state,
    body .app-work-today-task,
    body .app-user-toolbar { font-size: 15px; }
    body .app-page-title { font-size: 32px; }
    body .app-client-name { font-size: 26px; }
    body .app-client-meta { font-size: 16px; }

    body :is(.form-control, input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="tel"], select, textarea):not([type="hidden"]) {
        font-size: 17px;
    }
    body input.form-control,
    body select.form-control,
    body select:not([multiple]):not([size]) { min-height: 42px; }
    body label { font-size: 16px; }
    body :is(small, .hint, .help-block, .text-muted) { font-size: 15px !important; }

    body .table { font-size: 16px; }
    body .table > thead > tr > th { font-size: 15px; }
    body .table > :is(thead, tbody, tfoot) > tr > :is(th, td) { line-height: 1.5; }
    body .clients-directory-search-scope { font-size: 15px; }
    body .dropdown-menu > li > a { font-size: 16px; }

    body :is(.btn, .ui-button, .kassa-fns-upload-button, :where(button:not([class]), input[type="submit"], input[type="button"], input[type="reset"])),
    body :is(.nav-tabs > li > a, .TabbedPanelsTab, .contractor-finance-tab-button, .kassa-tab-button) {
        min-height: 40px !important;
        font-size: 16px !important;
        line-height: 20px !important;
    }
    body :is(.btn-sm, .btn-group-sm > .btn) { font-size: 15px !important; }
    body :is(.btn-xs, .btn-group-xs > .btn) { font-size: 14px !important; }
    body :is(.btn-lg, .btn-group-lg > .btn) { font-size: 18px !important; }

    .app-standalone-brand { font-size: 21px; }
    .app-standalone-brand small { font-size: 15px !important; }
    .app-standalone-header h1 { font-size: 30px; }

    body .app-auth-tab { font-size: 16px; }
    body .app-auth-description,
    body .app-auth-form input.form-control,
    body .app-auth-submit { font-size: 17px; }
    body .app-auth-form label,
    body .app-pin-keypad-label { font-size: 16px; }

    @media (max-width: 767px) {
        body .app-work-section-head,
        body .app-work-client,
        body .app-main-nav-item,
        body .app-user-greeting { font-size: 15px; }
        body .app-page-title { font-size: 28px; }
    }
}
