/* Loaded after page styles. Desktop presentation stays in the existing stylesheets. */
.mobile-nav-toggle,.mobile-table-sort{display:none}

@media(max-width:900px){
    html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
    body{font-size:16px;line-height:1.6}
    .cabinet-shell{display:block;min-width:0}
    .sidebar{position:sticky;inset:auto;top:0;z-index:100;width:100%;height:auto;min-height:68px;padding:12px 18px;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:0 16px;box-shadow:0 2px 12px #14253916}
    .sidebar .brand{font-size:29px;min-height:44px}
    .sidebar .brand-symbol{width:31px;height:31px;font-size:27px}
    .sidebar-caption,.sidebar-note,.sidebar-footer{display:none}
    .mobile-nav-toggle{display:none;align-items:center;justify-content:center;gap:9px;min-width:98px;min-height:44px;border:1px solid #ffffff40;border-radius:9px;background:#243951;color:white;font:inherit;font-size:15px;cursor:pointer}
    .acb-mobile-ready .mobile-nav-toggle{display:inline-flex}
    .mobile-nav-toggle>span:first-child{font-size:21px;line-height:1}
    .cabinet-nav{display:grid;grid-template-columns:1fr 1fr;flex-basis:100%;width:100%;gap:8px;padding:14px 0 2px;margin-top:12px;border-top:1px solid #ffffff22}
    .acb-mobile-ready .cabinet-nav{display:none}
    .acb-mobile-ready .mobile-nav-open .cabinet-nav{display:grid}
    .cabinet-nav .nav-link{min-width:0;min-height:48px;padding:10px 12px!important;justify-content:flex-start;gap:9px;font-size:15px;line-height:1.4;white-space:normal}
    .cabinet-nav .nav-link.active{background:#304966!important}
    .cabinet-nav .nav-link span{font-size:21px;flex-shrink:0}
    .workspace{margin:0;width:100%;min-width:0}
    .topbar{min-height:52px;height:auto;padding:8px 18px;justify-content:flex-end;gap:12px}
    .topbar-title{display:none}
    .topbar-user{width:100%;justify-content:space-between;gap:14px}
    .topbar-account{max-width:calc(100% - 72px);font-size:14px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
    .topbar a{font-size:14px;min-height:36px;display:inline-flex;align-items:center;flex-wrap:wrap}
    .main-content{width:100%;max-width:760px;padding:24px 16px 36px;min-width:0}
    .page-footer{max-width:760px;padding:12px 16px 24px;font-size:12px;gap:16px}
    .main-content h1,.main-content .compact-heading{font-size:29px;line-height:1.22;letter-spacing:-.7px;overflow-wrap:anywhere}
    .main-content h2{font-size:21px;line-height:1.35}
    .main-content h3{font-size:18px;line-height:1.45}
    .main-content .eyebrow{font-size:12px;letter-spacing:1.1px;line-height:1.6}
    .main-content .page-lead,.main-content p{font-size:16px;line-height:1.65}
    .main-content label{font-size:15px;line-height:1.5}
    .main-content input:not([type=checkbox]):not([type=hidden]),.main-content select,.main-content textarea{font-size:16px!important;min-height:50px;min-width:0;max-width:100%;padding:12px;border-radius:9px}
    .main-content input::placeholder{font-size:15px}
    .main-content input[type=checkbox]{width:22px;height:22px;flex-shrink:0;accent-color:var(--blue)}
    .main-content .checkbox-field label,.main-content .offer-consent{min-height:44px;align-items:flex-start;gap:11px;font-size:15px}
    .main-content .button{font-size:16px;min-height:48px;height:auto;line-height:1.4;padding:13px 16px;gap:10px;white-space:normal;text-align:center}
    .main-content .field-hint,.main-content .privacy-note,.main-content .field-error,.main-content .section-marker,.main-content .section-description{font-size:14px;line-height:1.65}
    .main-content .notice,.main-content .form-message,.main-content .account-ready{font-size:15px;line-height:1.65;padding:14px 16px;border-radius:10px;overflow-wrap:anywhere}
    .main-content .back-link,.main-content .offer-download{font-size:15px;min-height:44px;display:inline-flex;align-items:center}
    .card{border-radius:14px}
    .main-content .form-card,.main-content .lookup-card,.main-content .offer-summary{padding:22px 18px}
    .intro-grid,.company-grid,.two-columns,.kkm-two-columns,.goods-fields,.settings-columns,.settings-user-grid,.settings-grid,.egov-grid{grid-template-columns:minmax(0,1fr)}
    .intro-grid{gap:22px}
    .intro-aside{padding:0 2px}
    .intro-aside .info-line{font-size:15px;gap:12px;margin-top:16px}
    .illustration{display:none}
    .fields{gap:22px}
    .section-title{gap:12px;margin-bottom:23px}
    .section-title h2{font-size:20px}
    .section-title p{font-size:14px}
    .section-number{width:36px;min-width:36px;height:36px;font-size:13px}
    .heading-row{align-items:flex-start;flex-direction:column;gap:16px}
    .company-code{font-size:13px;white-space:normal}
    .company-code strong{font-size:17px}
    .steps{margin:24px 0;flex-wrap:wrap;gap:10px 0}
    .steps li{font-size:13px;gap:7px}
    .steps li>span{width:27px;height:27px;font-size:12px}
    .steps li+li:before{width:12px;margin:0 7px}
    .source-grid{grid-template-columns:1fr;gap:8px}
    .source-card{display:flex;align-items:center;gap:12px;padding:11px 13px}
    .source-icon{width:28px;height:28px;margin:0;font-size:15px}
    .source-card>div{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:1;min-width:0}
    .source-card strong{font-size:14px}
    .source-card div>span{font-size:13px;margin:0;text-align:right}
    .lookup-notices,.address-hint,.address-status{font-size:14px;line-height:1.65}
    .lookup-notices summary{min-height:44px;padding:8px 0}
    .suggestions{top:calc(100% + 5px);max-height:280px}
    .suggestions button,.suggestion-note{font-size:16px;line-height:1.5;padding:13px;min-height:48px}
    .save-row{display:block}
    .save-row .button{width:100%;justify-content:center}
    .offer-grid .summary-card{position:static}
    .offer-summary dt,.offer-summary dd{font-size:15px}
    .offer-preview{height:65vh;min-height:330px;max-height:620px}
    .connection-row{display:block;padding:20px 0}
    .connection-row>div:first-of-type{min-width:0}
    .connection-row .button{width:100%;margin-top:14px}
    .connection-row small,.connection-details dt,.connection-details dd{font-size:15px}
    .xml-preview pre{font-size:14px;overflow-wrap:anywhere}

    /* Overview and filters */
    .dashboard-heading,.kkm-heading,.sales-heading,.goods-heading,.settings-heading,.egov-heading{align-items:stretch;flex-direction:column;gap:18px;margin-bottom:24px}
    .dashboard-connect,.kkm-heading-actions,.goods-heading>.button{width:100%}
    .kkm-heading-actions{display:grid;grid-template-columns:1fr;gap:10px}
    .dashboard-period,.sales-filter,.goods-filter{display:grid;grid-template-columns:minmax(0,1fr);gap:18px;padding:20px 18px;margin:24px 0}
    .period-title strong{font-size:16px}
    .period-title>div>span{font-size:14px}
    .period-fields{display:grid;grid-template-columns:minmax(0,1fr);gap:18px;width:100%}
    .period-fields label{font-size:15px}
    .period-fields input{width:100%}
    .period-separator{display:none}
    .period-fields .button,.sales-filter .button,.goods-filter .button{grid-column:auto;grid-row:auto;width:100%;min-height:48px}
    .sales-filter>label,.sales-filter .sales-cashbox-field,.sales-filter .sales-rows-field,.goods-filter>label,.goods-filter .goods-rows{grid-column:auto;grid-row:auto;min-width:0;font-size:15px}
    .dashboard-panel,.settings-company,.settings-details,.settings-users{padding:22px 18px}
    .dashboard-panel-title h2,.kkm-list-heading h2,.sales-list-heading h2,.goods-list-heading h2,.settings-section-title h2{font-size:20px}
    .dashboard-panel-title p,.kkm-list-heading p,.sales-list-heading p,.goods-list-heading p,.settings-section-title p{font-size:14px}
    .kpi-top{font-size:14px}
    .kpi-caption{font-size:13px}
    .kpi-value{font-size:30px;white-space:normal;overflow-wrap:anywhere;letter-spacing:-.5px}
    .kpi-value small{font-size:20px}
    .dashboard-summary dt,.dashboard-summary dd,.payment-description,.payment-description strong{font-size:15px}
    .dashboard-summary>div,.payment-description{flex-wrap:wrap}
    .payment-meter>span{font-size:14px;min-width:48px}
    .kkm-counters{gap:12px}
    .kkm-counters>div{padding:17px 15px;gap:10px}
    .kkm-counters span{font-size:14px}
    .kkm-counters strong{font-size:27px}
    .kkm-list-heading,.sales-list-heading,.goods-list-heading{padding:22px 18px;align-items:flex-start;gap:14px}
    .sales-list-heading,.goods-list-heading{flex-direction:column}
    .kkm-refresh,.sales-back,.egov-back{font-size:15px;min-height:44px;display:inline-flex;align-items:center}
    .sales-exports,.goods-tools{display:flex;width:100%;flex-wrap:wrap;gap:10px}
    .sales-exports form,.goods-tools form{flex:1;min-width:120px}
    .sales-exports .button,.goods-tools .button{width:100%;font-size:15px;min-height:46px;padding:12px}
    .goods-tools>button{flex:1;min-width:130px}
    .sales-pagination,.goods-pagination{padding:18px;display:block;font-size:14px}
    .sales-pagination nav,.goods-pagination nav{display:flex;flex-wrap:wrap;gap:7px;margin-top:14px}
    .sales-page-link,.goods-pagination a{width:44px;height:44px;font-size:15px}
    .main-content .kkm-page-note,.main-content .sales-page-note,.main-content .goods-page-note,.main-content .settings-page-note{font-size:14px;line-height:1.7}
    .settings-field dt,.settings-user dt{font-size:14px;margin-bottom:8px}
    .settings-field dd,.settings-user dd,.settings-login{font-size:16px}
    .settings-company-name{font-size:23px}
    .settings-role,.settings-user-state,.settings-current{font-size:13px}
    .settings-user-heading{gap:12px;flex-wrap:wrap}
    .settings-password-toggle{font-size:14px;min-width:88px;min-height:48px}
    .main-content .settings-account-date,.settings-password-missing{font-size:14px}
    .settings-view-badge{font-size:13px;align-self:flex-start}
    .egov-document,.egov-signing{padding:22px 18px}
    .egov-document dt{font-size:14px}
    .egov-document dd{font-size:16px}
    .egov-document .egov-iin{font-size:24px}
    .egov-state strong{font-size:17px}
    .main-content .egov-note,.main-content .egov-state p,.main-content .egov-expiry{font-size:14px}
    .egov-stop,.egov-recheck,.egov-new,.egov-business,.egov-files a{font-size:15px;min-height:44px;display:inline-flex;align-items:center}
    .egov-files{gap:16px}
    .egov-signing #egov-mobile-link{font-size:16px;max-width:none}

    /* Dialogs remain scrollable above the on-screen keyboard. */
    .kkm-modal,.goods-modal{padding:12px;align-items:flex-start;overflow-y:auto;overscroll-behavior:contain}
    .kkm-modal-card,.goods-dialog{width:100%;max-width:600px;padding:24px 18px;margin:12px auto;max-height:calc(100vh - 48px);max-height:calc(100dvh - 48px)}
    .kkm-modal-title h2,.goods-dialog h2{font-size:23px;padding-right:30px}
    .kkm-close,.goods-close{width:44px;min-width:44px;height:44px;min-height:44px;font-size:29px}
    .kkm-submit-form label,.goods-fields label,.goods-upload{font-size:15px}
    .goods-fields{gap:20px}
    .kkm-modal-footer,.goods-dialog-buttons{display:flex;flex-direction:column-reverse;gap:10px}
    .kkm-modal-footer .button,.goods-dialog-buttons .button{width:100%;font-size:16px;min-height:48px}
    .main-content .kkm-model-note p,.main-content .goods-dialog-note{font-size:14px}
    .kkm-model-note strong{font-size:15px}
}

@media(max-width:760px){
    /* One source of data and actions: table rows become cards, without cloning forms. */
    .kkm-table-scroll,.goods-table-scroll,.sales-table-scroll,.dashboard-table-scroll{overflow:visible}
    .kkm-table,.goods-table,.sales-table,.dashboard-table,.kkm-table tbody,.goods-table tbody,.sales-table tbody,.dashboard-table tbody{display:block;width:100%;min-width:0}
    .kkm-table thead,.goods-table thead,.sales-table thead,.dashboard-table thead{display:none}
    .kkm-table tbody,.goods-table tbody,.sales-table tbody,.dashboard-table tbody{padding:0 14px 14px}
    .kkm-table tbody tr,.goods-table tbody tr,.sales-table tbody tr,.dashboard-table tbody tr{display:flex;flex-direction:column;min-width:0;margin:0 0 14px;padding:18px 15px;background:#fff;border:1px solid #dce4ef;border-radius:12px}
    .kkm-table td,.goods-table td,.sales-table td,.dashboard-table td{display:block;position:relative;padding:9px 0 9px 112px!important;border:0;font-size:15px;text-align:left;min-width:0!important;max-width:none!important;white-space:normal;overflow-wrap:anywhere}
    .kkm-table td:before,.goods-table td:before,.sales-table td:before,.dashboard-table td:before{content:attr(data-label);position:absolute;left:0;top:10px;width:101px;color:#75849a;font-size:13px;line-height:1.5;font-weight:400}
    .kkm-table td:first-child,.goods-table td:nth-child(2),.sales-table td:nth-child(2){padding:0 0 13px!important;margin-bottom:7px;border-bottom:1px solid #edf1f7;order:-1}
    .kkm-table td:first-child:before,.goods-table td:nth-child(2):before,.sales-table td:nth-child(2):before{display:none}
    .kkm-table td>strong,.goods-product strong,.sales-product strong{font-size:18px;line-height:1.45;min-width:0;max-width:none}
    .kkm-table .kkm-store-name{font-size:15px;min-width:0}
    .kkm-cell-note,.kkm-default-good,.goods-note,.sales-note{font-size:14px;line-height:1.6;max-width:none;min-width:0;white-space:normal}
    .kkm-default-good{align-items:flex-start;margin-top:10px}
    .kkm-edit-name{min-width:44px;min-height:44px;font-size:22px;border:1px solid #dce5f7;border-radius:8px;background:#f4f7ff;flex-shrink:0}
    .kkm-serial,.kkm-ofd,.sales-date,.sales-fiscal,.sales-mark,.goods-actions{font-size:15px;min-width:0;max-width:none;white-space:normal}
    .kkm-status,.goods-tag,.sales-payment{font-size:13px;padding:6px 9px;white-space:normal}
    .kkm-table td:last-child,.goods-table td:last-child{padding:14px 0 0!important;border-top:1px solid #edf1f7;margin-top:8px}
    .kkm-table td:last-child:before,.goods-table td:last-child:before{display:none}
    .kkm-row-actions{display:flex;flex-direction:column;gap:10px;min-width:0}
    .kkm-row-button,.kkm-passport,.goods-actions button{display:flex;align-items:center;justify-content:center;width:100%;min-height:46px;white-space:normal;text-align:center;padding:11px 13px;font-size:15px;border:1px solid #dce5f7;border-radius:8px;background:#f4f7ff;margin:0}
    .goods-actions button+button{margin-top:10px}
    .goods-actions .goods-delete{background:#fff8f6;border-color:#f1dfdc}
    .kkm-row-actions form{margin:0}
    .dashboard-table tbody th{display:block;font-size:18px;text-align:left;padding:0 0 12px!important;min-width:0;max-width:none;border-bottom:1px solid #edf1f7;margin-bottom:6px}
    .mobile-table-sort{display:block;margin:0 18px 18px;font-size:15px}
    .mobile-table-sort summary{cursor:pointer;min-height:44px;padding:10px 12px;background:#f4f7fc;border:1px solid #e0e7f2;border-radius:8px;color:#3c5aa4}
    .mobile-table-sort>div{display:flex;flex-wrap:wrap;gap:8px;padding-top:12px}
    .mobile-table-sort a{display:inline-flex;align-items:center;min-height:44px;padding:9px 12px;font-size:14px;border:1px solid #e0e7f2;border-radius:8px;white-space:normal}
}

@media(max-width:600px){
    .dashboard-kpis{grid-template-columns:1fr;gap:12px}
    .dashboard-kpi{padding:20px 18px}
    .dashboard-kpi:not(.kpi-revenue){display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 12px;align-items:center}
    .dashboard-kpi:not(.kpi-revenue) .kpi-top{grid-column:1;grid-row:1}
    .dashboard-kpi:not(.kpi-revenue) .kpi-symbol{display:none}
    .dashboard-kpi:not(.kpi-revenue) .kpi-value{grid-column:2;grid-row:1/3;font-size:27px;margin:0;text-align:right}
    .dashboard-kpi:not(.kpi-revenue) .kpi-caption{grid-column:1;grid-row:2;font-size:13px;margin:0}
    .kpi-revenue .kpi-value{font-size:34px;margin-top:14px}
    .dashboard-panel-title{align-items:flex-start}
    .dashboard-summary>div{align-items:flex-start}
    .settings-single,.settings-grid{grid-template-columns:1fr}
}

@media(max-width:350px){
    .main-content{padding-left:12px;padding-right:12px}
    .sidebar,.topbar{padding-left:14px;padding-right:14px}
    .main-content h1,.main-content .compact-heading{font-size:27px}
    .kkm-table tbody,.goods-table tbody,.sales-table tbody,.dashboard-table tbody{padding-left:10px;padding-right:10px}
    .kkm-table td,.goods-table td,.sales-table td,.dashboard-table td{padding-left:100px!important}
    .kkm-table td:before,.goods-table td:before,.sales-table td:before,.dashboard-table td:before{width:90px}
    .kkm-table td:first-child,.goods-table td:nth-child(2),.sales-table td:nth-child(2),.kkm-table td:last-child,.goods-table td:last-child{padding-left:0!important}
    .steps li{font-size:12px;gap:5px}
    .steps li+li:before{width:6px;margin:0 5px}
}
