.mobile-label { display: none; }
nav button b { margin-right: 6px; }

@media (max-width: 600px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  aside { padding: 13px 12px 9px; }
  .brand { padding: 0 4px 11px; border-bottom: 0; }
  .brand .logo { font-size: 21px; }
  .brand b { font-size: 14px; }
  .brand small { font-size: 7px; }
  aside nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 3px; overflow: visible; }
  nav button { display: grid; place-items: center; gap: 4px; min-width: 0; padding: 8px 3px; text-align: center; font-size: 10px; line-height: 1.15; }
  nav button b { margin: 0; font-size: 15px; }
  nav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  nav button.active, nav button:hover { box-shadow: inset 0 -3px #4ebce6; }

  header { position: sticky; top: 0; height: auto; min-height: 58px; padding: 8px 12px; gap: 8px; }
  header select { min-width: 0; max-width: 124px; font-size: 12px; }
  header > div { display: flex; gap: 6px; min-width: 0; }
  header .primary, header .secondary { margin: 0; padding: 9px 10px; border-radius: 8px; font-size: 11px; white-space: nowrap; }
  .wide-label { display: none; }
  .mobile-label { display: inline; }

  .content { padding: 20px 12px 55px; }
  .heading { align-items: flex-start; gap: 10px; margin-bottom: 17px; }
  .heading p { font-size: 8px; }
  .heading h1 { font-size: 25px; line-height: 1.05; }
  .heading span { font-size: 11px; line-height: 1.4; }
  .heading em { flex: 0 0 auto; padding: 6px 8px; font-size: 9px; }

  .metrics { gap: 8px; margin-bottom: 12px; }
  .metric { min-width: 0; padding: 12px 11px; border-radius: 10px; }
  .metric small, .metric span { font-size: 9px; line-height: 1.25; }
  .metric b { margin: 5px 0; font-size: 17px; overflow-wrap: anywhere; }
  .panel { border-radius: 11px; }
  .panel-head { align-items: flex-start; padding: 13px; gap: 8px; }
  .panel-head h2 { font-size: 13px; }
  .panel-head p { font-size: 9px; line-height: 1.4; }
  .panel-head > b { font-size: 11px; text-align: right; }

  #currentView .table-wrap { overflow: visible; }
  #currentView table { display: block; width: 100%; min-width: 0; }
  #currentView thead { display: none; }
  #expenseRows { display: grid; gap: 9px; padding: 10px; background: #f7f9fc; }
  #expenseRows tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; padding: 12px; border: 1px solid #e1e6ee; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px #17213d0a; }
  #expenseRows td { min-width: 0; padding: 0; border: 0; font-size: 11px; }
  #expenseRows td:nth-child(1) { grid-column: 1; }
  #expenseRows td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; font-size: 12px; }
  #expenseRows td:nth-child(2), #expenseRows td:nth-child(3) { grid-column: 1 / -1; }
  #expenseRows td:nth-child(3) { padding-top: 6px; border-top: 1px solid #eef1f5; color: #59667a; }
  #expenseRows td:nth-child(3)::before { content: "Descriere"; display: block; margin-bottom: 3px; color: #929cac; font-size: 8px; font-weight: bold; text-transform: uppercase; letter-spacing: .08em; }
  #expenseRows td:nth-child(5) { grid-column: 1; }
  #expenseRows td:nth-child(6) { grid-column: 2; text-align: right; }
  #expenseRows td:nth-child(7) { grid-column: 1 / -1; text-align: right; }
  #expenseRows .edit-row { min-height: 34px; padding: 7px 10px; }
  #expenseRows .center { width: 100%; max-width: 190px; font-size: 10px; }

  #registerView .panel-head { display: grid; }
  #registerView .panel-head input { width: 100%; }
  #registerView .table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
  #registerView table { min-width: 760px; }
  .sheet { padding: 15px; }
  .notice { left: 12px; right: 12px; top: 12px; text-align: center; }

  .backdrop { align-items: end; padding: 8px; }
  .modal { width: 100%; max-height: calc(100dvh - 16px); border-radius: 15px 15px 10px 10px; }
  .modal-head { padding: 15px 15px 11px; }
  .modal-head h2 { font-size: 18px; }
  .modal-head button { width: 32px; height: 32px; font-size: 22px; }
  form { padding: 14px 15px 16px; }
  .actions { position: sticky; bottom: -16px; margin: 14px -15px -16px; padding: 11px 15px 16px; background: #fff; border-top: 1px solid var(--line); }
  .actions button { flex: 1; }
  .confirm-modal .actions { position: static; bottom: auto; margin-bottom: 0; padding-bottom: 0; }
  #confirmSaveBtn { min-height: 48px; touch-action: manipulation; }
  #editSaveBtn { min-height: 48px; touch-action: manipulation; }
  .viewer-modal { max-height: calc(100dvh - 16px); }
  .viewer-body { padding: 8px; }
  .viewer-stage { min-height: 54vh; max-height: 64vh; }
  .viewer-stage img { max-height: 64vh; }
  .viewer-stage iframe { height: 64vh; }
  .viewer-controls button { padding: 8px; font-size: 10px; }
}

@media (max-width: 370px) {
  header select { max-width: 105px; font-size: 11px; }
  header .primary, header .secondary { padding: 8px; font-size: 10px; }
  .heading h1 { font-size: 22px; }
  .metric b { font-size: 15px; }
}
