/* Global readability + mobile control normalization - 2026-10-02 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, input, select, textarea, button { font-size: 15px; }
small, label, .small, .muted, .note, .hint, .help-text, .summary, .badge, .pill, .chip,
.table th, .table td, table th, table td, .btn, button, a.btn, input, select, textarea {
  font-size: max(15px, 1em);
}
button, .btn, a.btn, input[type="submit"], input[type="button"], input[type="reset"] {
  box-sizing: border-box;
  min-height: 42px !important;
  padding: 9px 14px;
  border-radius: 10px;
  line-height: 1.25;
  vertical-align: middle;
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
input, select, textarea { min-height: 42px; line-height: 1.35; }
textarea { min-height: 90px; }

@media (max-width: 700px) {
  body { font-size: 15px; }
  button, .btn, a.btn, input[type="submit"], input[type="button"], input[type="reset"] {
    min-height: 44px !important;
    height: auto !important;
    font-size: 15px !important;
    padding: 10px 13px;
    border-radius: 10px;
    max-width: 100%;
  }
  .actions, .toolbar, .form-actions, .activity-filter-actions, .audit-toolbar-actions,
  .prod-card-actions, .smart-note-actions {
    align-items: stretch;
    gap: 8px;
    flex-wrap: wrap;
  }
  .actions > button, .actions > .btn, .actions > a.btn,
  .form-actions > button, .form-actions > .btn,
  .activity-filter-actions > button, .activity-filter-actions > .btn,
  .audit-toolbar-actions > button, .audit-toolbar-actions > .btn {
    flex: 1 1 auto;
    min-width: 110px;
  }
  table button, table .btn, .table button, .table .btn {
    min-height: 44px !important;
    height: auto !important;
    padding: 8px 10px;
  }
  input, select, textarea { font-size: 15px !important; max-width: 100%; }
}

/* Mobile compact layout v2 — keeps text >=15px but removes oversized spacing */
@media (max-width: 700px) {
  html, body { max-width:100%; overflow-x:hidden; }
  body { line-height:1.35; }

  .main, .dash-main {
    width:100% !important;
    max-width:100% !important;
    padding:8px !important;
    overflow-x:hidden !important;
  }

  .top, .appbar {
    min-height:58px !important;
    margin-bottom:9px !important;
    padding:9px 11px !important;
    border-radius:14px !important;
    gap:8px !important;
  }
  .top h1, .title h1 { font-size:20px !important; line-height:1.2 !important; }
  .top .muted, .title p, .appbar-eyebrow { font-size:15px !important; margin-top:2px !important; }
  .top:after { display:none !important; }

  .help-strip {
    padding:8px 10px !important;
    margin-bottom:9px !important;
    border-radius:10px !important;
    gap:7px !important;
    line-height:1.35 !important;
  }
  .help-icon { width:26px !important; height:26px !important; flex:0 0 26px !important; }

  .panel, .card, .glass, .content-card, .premium-card, .table-card {
    padding:10px !important;
    margin-bottom:10px !important;
    border-radius:14px !important;
  }
  .panel h3, .card h3 { margin:0 0 9px !important; line-height:1.3 !important; }

  .form, .form-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
    align-items:end !important;
  }
  .field { min-width:0 !important; }
  .field label { margin-bottom:4px !important; line-height:1.25 !important; }
  .field:has(textarea), .field.full, .field.full-width,
  .form > textarea, .form-grid > textarea,
  .form > .debt-live, .form-grid > .debt-live {
    grid-column:1 / -1 !important;
  }
  .form > button, .form > .btn, .form-grid > button, .form-grid > .btn,
  .form-actions { grid-column:1 / -1 !important; }

  input, select, textarea, .search,
  .field input, .field select, .field textarea {
    min-height:42px !important;
    height:42px !important;
    padding:7px 10px !important;
    border-radius:10px !important;
    font-size:15px !important;
    line-height:1.25 !important;
  }
  textarea, .field textarea {
    height:68px !important;
    min-height:68px !important;
    resize:vertical;
  }

  button, .btn, a.btn, input[type="submit"], input[type="button"], input[type="reset"] {
    min-height:40px !important;
    height:auto !important;
    padding:7px 11px !important;
    border-radius:9px !important;
    font-size:15px !important;
    line-height:1.2 !important;
  }
  .btn.small, button.small, table .btn, table button {
    min-height:36px !important;
    padding:6px 9px !important;
  }

  .toolbar, .table-tools, .table-tools-left, .table-tools-right {
    padding:8px !important;
    gap:6px !important;
    border-radius:11px !important;
    margin-bottom:8px !important;
  }

  .kpis, .ref-kpis { gap:7px !important; margin-bottom:9px !important; }
  .kpi, .ref-kpi { min-height:66px !important; padding:9px 11px !important; border-radius:12px !important; }

  /* Mobile menu: compact and away from page content */
  .menu-btn {
    position:fixed !important;
    left:10px !important;
    right:auto !important;
    bottom:10px !important;
    top:auto !important;
    width:42px !important;
    height:42px !important;
    min-width:42px !important;
    min-height:42px !important;
    padding:0 !important;
    border-radius:11px !important;
    font-size:19px !important;
    line-height:1 !important;
    display:grid !important;
    place-items:center !important;
    z-index:4900 !important;
  }

  /* Card tables: compact rows and tidy action buttons */
  table.v67-card-table tbody tr {
    margin-bottom:8px !important;
    border-radius:12px !important;
  }
  table.v67-card-table tbody td {
    grid-template-columns:minmax(92px,32%) minmax(0,1fr) !important;
    gap:7px !important;
    min-height:38px !important;
    padding:6px 9px !important;
    line-height:1.3 !important;
    font-size:15px !important;
  }
  table.v67-card-table tbody td:last-child {
    grid-template-columns:minmax(82px,28%) minmax(0,1fr) minmax(0,1fr) !important;
    gap:6px !important;
  }
  table.v67-card-table tbody td:last-child::before { align-self:center !important; }
  table.v67-card-table tbody td:last-child > .btn,
  table.v67-card-table tbody td:last-child > button,
  table.v67-card-table tbody td:last-child > a.btn {
    width:100% !important;
    min-width:0 !important;
    margin:0 !important;
  }

  .company-debt-row { padding:9px 11px !important; margin-bottom:7px !important; border-radius:12px !important; }
  .company-debt-row .company-name:before { width:27px !important; height:27px !important; border-radius:8px !important; }
  .debt-live { padding:9px 10px !important; border-radius:11px !important; gap:8px !important; }
}

@media (max-width: 360px) {
  .form, .form-grid { grid-template-columns:1fr !important; }
  .field, .form > button, .form > .btn, .form-grid > button, .form-grid > .btn { grid-column:1 !important; }
  table.v67-card-table tbody td:last-child {
    grid-template-columns:minmax(82px,30%) minmax(0,1fr) !important;
  }
  table.v67-card-table tbody td:last-child::before { grid-row:1 / span 2; }
}
