html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  background: #f3f6f4;
  font-size: 15px;
}

input,
button,
select,
textarea {
  font-size: 16px;
}

#screen-auth {
  align-items: stretch;
  padding: 18px 12px 28px;
}

.auth-box {
  max-width: none;
  border-radius: 12px;
  padding: 24px 18px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
}

.auth-tabs {
  overflow-x: auto;
  padding-bottom: 2px;
}

.auth-tab {
  min-width: max-content;
  padding: 10px 8px;
}

#screen-app.on {
  min-height: 100dvh;
  padding-bottom: 74px;
}

.topbar {
  height: auto;
  min-height: 50px;
  padding: 8px 10px;
  gap: 8px;
  flex-wrap: nowrap;
}

.topbar-logo {
  min-width: 0;
  font-size: 14px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-version {
  display: inline;
  font-size: 10px;
  margin-left: 4px;
}

.topbar-user {
  display: none;
}

.header-menu {
  flex: 0 0 auto;
}

.header-menu-toggle {
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

.header-dropdown,
#cabinet-switch-dd {
  position: fixed;
  top: 52px;
  right: 8px;
  left: 8px;
  min-width: 0;
  max-width: none;
  max-height: calc(100dvh - 68px);
  border-radius: 10px;
}

.header-dropdown-item {
  min-height: 44px;
  padding: 12px 14px;
  font-size: 14px;
}

.tabs {
  position: fixed;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  height: 66px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  gap: 6px;
  border-top: 1px solid var(--c-border);
  border-bottom: 0;
  z-index: 950;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .12);
}

.nav-tab {
  flex: 0 0 auto;
  min-width: 78px;
  max-width: 128px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  margin-bottom: 0;
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.nav-tab.active {
  border-color: rgba(74, 124, 89, .25);
  border-bottom-color: rgba(74, 124, 89, .25);
  border-radius: 10px;
}

.tab-icon {
  display: none;
}

.tab-label {
  display: inline;
  overflow-wrap: anywhere;
}

.app-body {
  padding: 10px;
  overflow: visible;
}

.card {
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.toolbar,
.dashboard-toolbar,
.platform-filters {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

.toolbar .tl,
.toolbar .tr,
.search-wrap,
.dashboard-toolbar label,
.dashboard-toolbar input,
.dashboard-toolbar select,
.platform-filters input,
.platform-filters select {
  width: 100%;
  min-width: 0;
}

.toolbar .tl,
.toolbar .tr {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.toolbar .tl .btn,
.toolbar .tr .btn,
.toolbar .tl .search-wrap,
.toolbar .tr .search-wrap {
  width: 100%;
}

.toolbar .tl .search-wrap,
.toolbar .tr .search-wrap {
  grid-column: 1 / -1;
}

.si,
.fi {
  width: 100% !important;
  min-width: 0;
  min-height: 44px;
}

.btn,
.pager-btn,
.doc-action-btn {
  min-height: 44px;
  touch-action: manipulation;
}

.tbl-wrap,
.platform-tree-wrap {
  overflow: visible;
}

table:not(.dashboard-table):not(.platform-tree),
table:not(.dashboard-table):not(.platform-tree) thead,
table:not(.dashboard-table):not(.platform-tree) tbody,
table:not(.dashboard-table):not(.platform-tree) tr,
table:not(.dashboard-table):not(.platform-tree) th,
table:not(.dashboard-table):not(.platform-tree) td {
  display: block;
  width: 100%;
}

table:not(.dashboard-table):not(.platform-tree) thead {
  display: none;
}

table:not(.dashboard-table):not(.platform-tree) tbody tr:not(.empty-row) {
  margin-bottom: 10px;
  border: 1px solid var(--c-border-light);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
  overflow: hidden;
}

table:not(.dashboard-table):not(.platform-tree) tbody tr:not(.empty-row):hover td {
  background: transparent;
}

table:not(.dashboard-table):not(.platform-tree) td {
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(108px, 38%) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px !important;
  border-bottom: 1px solid var(--c-border-light);
  color: var(--c-text);
  white-space: normal;
  word-break: break-word;
}

table:not(.dashboard-table):not(.platform-tree) td:last-child {
  border-bottom: 0;
}

table:not(.dashboard-table):not(.platform-tree) td::before {
  content: attr(data-label);
  color: var(--c-secondary);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: .3px;
}

table:not(.dashboard-table):not(.platform-tree) td[data-label=""] {
  grid-template-columns: 1fr;
}

table:not(.dashboard-table):not(.platform-tree) td[data-label=""]::before {
  content: none;
}

.empty-row td {
  display: block !important;
  text-align: center;
  padding: 24px 12px !important;
}

.acts-btns,
.doc-file-actions,
.pf-actions,
.pf-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.acts-btns .btn,
.doc-file-actions .btn,
.pf-actions .btn,
.pf-buttons .btn {
  flex: 1 1 auto;
}

.pager {
  gap: 8px;
  padding: 10px 0;
  flex-wrap: wrap;
}

.list-load-status {
  text-align: center;
}

.modal {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.modal-box,
.modal-box.modal-pick-list,
.platform-settlement-modal,
.linked-preview-modal {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0;
  border-radius: 0;
  padding: 16px;
}

.modal-title {
  padding-right: 46px;
  margin-bottom: 14px;
  font-size: 16px;
  line-height: 1.3;
}

.modal-title-row {
  align-items: flex-start;
  flex-direction: column;
}

.detail-hint-toggle {
  width: 100%;
}

.modal-close-x {
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
}

.modal-body,
.linked-preview-body {
  max-height: none;
  -webkit-overflow-scrolling: touch;
}

.modal-actions {
  gap: 8px;
  padding-top: 12px;
  flex-wrap: wrap;
  background: #fff;
}

.modal-actions .btn {
  flex: 1 1 140px;
}

.mf-grid,
.split-datetime {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.mf,
.mf.w-1,
.mf.w-2,
.mf.w-3,
.mf.w-4,
.mf.w-5,
.mf.w-6,
.mf.w-8,
.mf.w-10,
.mf.w-12,
.mf-grid .mf.full {
  grid-column: 1 / -1;
}

.mf input,
.mf select,
.mf textarea,
.platform-filters input,
.platform-filters select {
  min-height: 44px;
}

.mf.w-1 input[type="number"],
.mf.w-2 input[type="number"],
.mf.w-3 input[type="number"] {
  max-width: none;
}

.split-datetime .split-date-btn {
  width: 100%;
  height: 44px;
}

.seg-control {
  flex-direction: column;
}

.seg-option {
  width: 100%;
  min-height: 40px;
}

.docs-container {
  max-height: 50dvh;
}

.doc-type-header,
.doc-file-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.doc-file-row {
  padding-left: 0;
}

.doc-file-name,
.doc-file-name-inline {
  flex: 1 1 100%;
  white-space: normal;
}

.doc-upload-btn,
.doc-action-btn {
  width: 36px;
  height: 36px;
}

.grouped-list {
  padding: 8px 0;
  gap: 10px;
}

.group-filter-bar,
.group-header,
.group-item {
  grid-template-columns: 1fr;
}

.group-items {
  margin: 8px 0 10px 12px;
  padding-left: 10px;
}

.group-cell {
  grid-template-columns: 104px minmax(0, 1fr);
}

.dashboard {
  padding: 0;
}

.dashboard-cards,
.dashboard-visuals {
  grid-template-columns: 1fr;
}

.dashboard-card b {
  font-size: 22px;
}

.dashboard-pie-wrap {
  align-items: flex-start;
  flex-direction: column;
}

.dashboard-pie {
  width: 132px;
  height: 132px;
}

.dashboard-panel {
  padding: 10px;
}

.dashboard-table,
.platform-tree {
  min-width: 760px;
}

.platform-tree-wrap,
.dashboard-panel:has(.dashboard-table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.platform-summary {
  grid-template-columns: 1fr;
}

.linked-preview-card-head,
.linked-preview-line {
  flex-direction: column;
  gap: 3px;
}

.linked-preview-price,
.linked-preview-line-label {
  white-space: normal;
}

.static-info-block {
  font-size: 13px;
}

.pf-status-row,
.hint-flex {
  align-items: stretch;
  flex-direction: column;
}

.no-access,
.cabinet-select {
  padding: 32px 12px;
}

.access-denied-box {
  padding: 24px 12px;
}

.report-issue-btn {
  right: 10px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 12px;
}

@media (max-width: 420px) {
  .toolbar .tl,
  .toolbar .tr {
    grid-template-columns: 1fr;
  }

  table:not(.dashboard-table):not(.platform-tree) td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .group-cell {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .nav-tab {
    min-width: 70px;
    max-width: 104px;
    font-size: 10px;
  }
}
