html { scroll-padding-top: 96px; }
.report-progress {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 12; margin-bottom: 16px; padding: 12px 16px;
  border-block: 1px solid var(--line); background: var(--bg-main);
}
.report-save-status, .summary .save-state { display: flex; align-items: center; gap: 10px; }
.save-status-icon { display: inline-flex; flex-shrink: 0; color: #b8b8c4; }
.save-status-copy { display: grid; gap: 4px; min-width: 0; }
.save-status-copy strong { font-size: 12px; font-weight: 600; }
.save-status-copy small { font-size: 11px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
[data-phase=saved] .save-status-icon, [data-phase=submitted] .save-status-icon { color: #86efac; }
[data-phase=dirty] .save-status-icon, [data-phase=saving] .save-status-icon,
[data-phase=sending] .save-status-icon { color: #fde68a; }
[data-phase=error] .save-status-icon, [data-phase=error] strong { color: #fca5a5; }
.expense-list { border-top: 1px solid var(--line); }
.safe-note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.safe-section:empty { display: none; }
.safe-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-block: 20px; }
.safe-metrics span,.safe-number > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.safe-metrics strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.safe-number { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding-block: 16px; border-block: 1px solid var(--line); margin-bottom: 20px; }
.safe-number > span { margin: 0; }.safe-number > strong { overflow-wrap: anywhere; font-size: 14px; }
.safe-number button { min-height: 44px; }
.safe-left { display: flex; flex-wrap: wrap; gap: 12px; padding-block: 20px; font-size: 12px; }
.safe-left > span { color: var(--muted); }
.safe-confirm { display: flex; align-items: center; gap: 12px; min-height: 48px; line-height: 1.5; padding-block: 10px; cursor: pointer; }
.safe-confirm input { flex-shrink: 0; }.safe-confirm span { font-size: 14px; }
.safe-overview-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; border-bottom: 1px solid var(--line); padding-block: 20px; }
.safe-overview-row small { display: block; color: var(--muted); font-size: 12px; line-height: 1.7; margin-top: 6px; }
.safe-limit-warning { grid-column: 1 / -1; color: #fde68a; font-size: 13px; }
.expense-picker { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: end; margin-bottom: 20px; }
.expense-picker .field { min-width: 0; }
.expense-picker select { width: 100%; min-height: 44px; font-size: 16px; }
.expense-picker button { min-height: 44px; white-space: nowrap; }
.expense-empty { color: var(--muted); font-size: 13px; padding-block: 10px; }
.expense-remove { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.expense-remove button { min-height: 44px; color: var(--muted); }
.expense-remove small { color: var(--muted); }
@media (max-width: 380px) { .expense-picker { grid-template-columns: minmax(0,1fr); } .expense-picker button { justify-self: start; } }
.expense-item { border-bottom: 1px solid var(--line); }
.expense-item > summary {
  display: grid; grid-template-columns: minmax(0,1fr) auto 20px; align-items: center;
  gap: 14px; min-height: 64px; padding: 14px 0; list-style: none; cursor: pointer;
}
.expense-item > summary::-webkit-details-marker { display: none; }
.expense-item > summary:hover { color: #fff; }
.expense-item > summary > svg { color: var(--muted); width: 18px; }
.expense-item[open] > summary > svg { transform: rotate(180deg); }
.expense-title { font-size: 14px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.expense-badges { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 11px; font-weight: 400; color: var(--muted); }
.expense-badges span:empty { display: none; }
.expense-amount { font-size: 14px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.expense-body { padding: 4px 0 20px; }
.expense-money { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.expense-comment { margin-top: 16px; }
.expense-comment textarea { width: 100%; min-height: 72px; resize: vertical; }
.expense-receipts { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.expense-receipts > span, .expense-auto { font-size: 12px; color: var(--muted); line-height: 1.5; }
.expense-auto { margin-top: 12px; }
.receipt-button { min-height: 44px; }
.receipt-gallery { display: grid; grid-template-columns: repeat(auto-fill,minmax(56px,72px)); gap: 10px; margin-top: 14px; }
.receipt-gallery a { display: block; aspect-ratio: 1; border: 1px solid #41414c; border-radius: 5px; overflow: hidden; }
.receipt-gallery img { width: 100%; height: 100%; object-fit: cover; }
.context-title { min-width: 0; }
.report-grid input, .report-grid textarea, .expense-item summary { scroll-margin-top: 100px; }
dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
.correction-field { margin-top: 16px; }
@media (max-width: 700px) {
  body { -webkit-text-size-adjust: 100%; }
  button, .icon { min-height: 44px; }
  .icon { width: 44px; min-width: 44px; }
  input:not([type=checkbox]), select, textarea { font-size: 16px; min-height: 44px; }
  .field label, .context-row .field label { font-size: 12px; line-height: 1.5; }
  .topbar { min-height: 64px; height: auto; padding-block: 10px; }
  .context-title { flex: 1; font-size: 12px; gap: 8px; }
  .context-title strong { overflow-wrap: anywhere; line-height: 1.4; }
  .profile { flex-shrink: 0; }
  .profile select { max-width: 112px; font-size: 12px; min-height: 44px; }
  .content { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 18px; }
  .report-progress { top: 0; padding: 10px 8px; gap: 8px; margin-bottom: 12px; }
  .report-save-status { min-width: 0; gap: 8px; }
  .save-status-copy strong { font-size: 13px; }
  .save-status-copy small { font-size: 11px; }
  .report-progress > .icon { flex-shrink: 0; }
  .section-head { flex-wrap: wrap; gap: 7px; }
  .section-head h2 { line-height: 1.5; }
  .context-row { gap: 14px; }
  .context-row .segmented { height: 46px; }
  .segmented button { min-height: 40px; }
  .expense-item > summary { min-height: 68px; gap: 10px; grid-template-columns: minmax(0,1fr) auto 18px; }
  .expense-title { font-size: 14px; }
  .expense-badges { font-size: 11px; gap: 2px 8px; }
  .expense-amount { font-size: 13px; }
  .expense-money { gap: 12px; }
  .expense-money input, .money-grid input { font-size: 16px; min-height: 46px; }
  .expense-receipts { flex-wrap: wrap; }
  .expense-receipts > span { font-size: 12px; }
  .expense-receipts button { flex-shrink: 0; }
  .summary { display: block; padding: 20px 16px; }
  .summary h2 { font-size: 16px; margin-bottom: 18px; }
  .summary .sum-line, .summary .sum-line strong { font-size: 12px; }
  .summary .sum-main strong { font-size: 28px; }
  .summary .sum-diff { font-size: 12px; }
  .summary .primary, .summary .secondary-save { min-height: 48px; font-size: 14px; }
  .summary .save-state { margin-top: 16px; }
  .summary .save-status-copy strong { font-size: 12px; }
  .sidebar { height: calc(72px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--bg-card); }
  .nav button { min-width: 0; white-space: normal; overflow-wrap: anywhere; font-size: 10px; line-height: 1.2; }
  .nav button.active svg { color: #ef6477; }
  body.input-active .sidebar { display: none; }
  body.input-active .content { padding-bottom: 28px; }
  body.input-active #toast { bottom: 12px; }
  dialog { width: calc(100% - 24px); max-width: 460px; padding: 20px 16px; }
  dialog .actions { display: grid; grid-template-columns: 1fr 1fr; }
  dialog .actions button { white-space: normal; min-width: 0; }
  dialog input[type=file] { width: 100%; min-width: 0; font-size: 13px; }
  dialog p { overflow-wrap: anywhere; }
  .history-view .data-table { min-width: 0; table-layout: fixed; }
  .history-view .data-table thead { display: none; }
  .history-view .data-table tbody { display: block; }
  .history-view .data-table tr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 0 16px; padding: 16px; border-bottom: 1px solid var(--line); }
  .history-view .data-table td { min-width: 0; padding: 8px 0; border: 0; overflow-wrap: anywhere; }
  .history-view .data-table td:first-child { grid-column: 1; grid-row: 1; }
  .history-view .data-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; line-height: 1.6; }
  .history-view .data-table td:nth-child(3) { grid-column: 1; grid-row: 3; }
  .history-view .data-table td:nth-child(4) { grid-column: 2; grid-row: 3; }
  .history-view .data-table td:nth-child(3)::before { content: 'Факт ИП до сейфа'; }
  .history-view .data-table td:nth-child(4)::before { content: 'Факт ООО до сейфа'; }
  .history-view .data-table td:nth-child(3)::before, .history-view .data-table td:nth-child(4)::before { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
  .history-view .data-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 4; }
  .history-view .data-table td:last-child { grid-column: 2; grid-row: 1; justify-self: end; }
}
