@media (max-width: 760px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }

  .login { display: block; min-height: 100dvh; }
  .login-brand { min-height: 0; padding: 18px 20px; align-items: center; text-align: center; }
  .login-company-logo { width: min(300px, 82vw); padding: 6px; border-radius: 10px; }
  .login-brand h1 { margin: 12px 0 0; font-size: 28px; line-height: 1.05; }
  .login-brand p { display: none; }
  .login-panel { display: block; padding: 16px; }
  .login-panel form { width: 100%; padding: 22px; border-radius: 14px; box-shadow: 0 10px 35px #17362b18; }
  .login-panel form h2 { margin-bottom: 6px; font-size: 28px; }
  .login-panel form > p { margin-bottom: 14px; }

  .shell, .main, .content { width: 100%; max-width: 100vw; min-width: 0; }
  .sidebar { width: 100%; padding: 10px 12px; }
  .sidebar-company-logo { width: min(220px, 68vw); padding: 4px; }
  .brand > small { margin-top: 12px; font-size: 14px; font-weight: 800; }
  .nav { grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 4px; margin-top: 8px; }
  .nav button { min-width: 0; padding: 9px 2px; font-size: 11px; line-height: 1.15; white-space: nowrap; }
  .userbox { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 4px 2px; }
  .userbox strong { font-size: 13px; }
  .userbox small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  .userbox button { flex: 0 0 auto; margin: 0 0 0 auto; padding: 7px 10px; border: 1px solid #ffffff50; border-radius: 7px; }

  .topbar { display: grid; grid-template-columns: 1fr 1fr; width: 100%; height: auto; padding: 10px 12px; gap: 8px; }
  .global-search { display: block; width: 100%; max-width: none; min-width: 0; }
  .global-search input { display: none; }
  .global-search button, .topbar > .secondary { width: 100%; min-width: 0; min-height: 44px; padding: 10px 8px; white-space: normal; }
  .content { padding: 18px 12px; overflow-x: hidden; }
  .title-row { display: flex; align-items: stretch; flex-direction: column; gap: 10px; margin-bottom: 16px; }
  .title-row h1 { margin: 4px 0; font-size: 34px; line-height: 1.05; overflow-wrap: anywhere; }
  .title-row > button, .title-row > div:last-child:not(:first-child) { width: 100%; }
  .title-row > div:last-child:not(:first-child) { display: grid; gap: 8px; }
  .title-row > div:last-child:not(:first-child) button { width: 100%; }
  .title-row button { max-width: 100%; white-space: normal; }

  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters input, .filters select { grid-column: 1 / -1; width: 100%; min-width: 0; font-size: 16px; }
  .filters button { width: 100%; min-width: 0; padding: 10px 7px; }

  .panel { max-width: 100%; border-radius: 12px; }
  .modal-head { min-width: 0; gap: 10px; }
  .modal-head > div { min-width: 0; }
  .modal-head h2 { max-width: 100%; overflow-wrap: anywhere; }
  .actions { gap: 8px; }
  .actions > * { min-width: 0; max-width: 100%; white-space: normal; }
  .comment-form { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .comment-form input { min-width: 0; }
  .upload-grid { display: grid; grid-template-columns: 1fr; }
  .upload-grid label { width: 100%; text-align: center; }
  .permission-table { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .preview-backdrop .modal-head { align-items: stretch; flex-direction: column; }
  .preview-tools { display: grid; grid-template-columns: minmax(0,1fr) 48px 48px; width: 100%; }
  .preview-tools > * { min-width: 0; text-align: center; }
  .table-wrap { max-width: 100%; overflow: visible; }
  .table-wrap table { display: block; width: 100%; min-width: 0; }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: grid; gap: 9px; padding: 9px; }
  .table-wrap tr[data-history-row] { display: grid; grid-template-columns: 34px 98px minmax(0, 1fr); grid-template-rows: auto auto auto; align-items: center; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; padding: 9px 8px; }
  .table-wrap tr[data-history-row] td { display: block; min-width: 0; padding: 3px 5px; border: 0; font-size: 13px; line-height: 1.25; }
  .table-wrap tr[data-history-row] td:nth-child(1) { grid-column: 1; grid-row: 2; align-self: center; text-align: center; padding-left: 0; padding-right: 0; }
  .table-wrap tr[data-history-row] td:nth-child(2) { grid-column: 1; grid-row: 1; align-self: center; color: var(--muted); font-size: 12px; font-weight: 850; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; overflow-wrap: normal; word-break: keep-all; }
  .table-wrap tr[data-history-row] td:nth-child(3) { grid-column: 2; grid-row: 2; color: var(--ink); font-size: 12px; white-space: nowrap; overflow: hidden; }
  .table-wrap tr[data-history-row] td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; padding: 5px 5px 2px; }
  .table-wrap tr[data-history-row] td:nth-child(5),
  .table-wrap tr[data-history-row] td:nth-child(6) { display: none; }
  .table-wrap tr[data-history-row] td:nth-child(7) { grid-column: 3; grid-row: 2; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .table-wrap tr[data-history-row] td:nth-child(8) { grid-column: 2 / -1; grid-row: 1; padding-left: 4px; }
  .table-wrap .search-item { display: block; width: 100%; margin: 0; padding: 0; border: 0; color: var(--ink); background: transparent; overflow: hidden; text-align: left; }
  .table-wrap .search-item b { display: block; max-width: 100%; color: var(--ink); font-size: 14px; line-height: 1.18; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .table-wrap .search-item small { display: none; }
  .table-wrap tr[data-history-row] .badge { display: inline-block; max-width: 100%; padding: 4px 9px; font-size: 12px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .table-wrap input[type="checkbox"] { width: 20px; height: 20px; }

  .admin-user-card { display: grid; gap: 10px; margin: 0; padding: 15px 0; border-bottom: 1px solid var(--line); }
  .admin-user-info { display: grid; gap: 3px; min-width: 0; }
  .admin-user-info b { font-size: 17px; overflow-wrap: anywhere; }
  .admin-user-info span, .admin-user-info small { color: var(--muted); overflow-wrap: anywhere; }
  .admin-user-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .admin-user-actions button { width: 100%; min-width: 0; padding: 10px 6px; font-size: 13px; }
  .admin-user-actions .danger { grid-column: 1 / -1; }
  .content > .panel > .modal-body { padding: 16px; }
  #toast { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; text-align: center; }

  .check-grid { gap: 3px 8px; padding: 8px; }
  .check-grid label { min-height: 34px; gap: 6px; font-size: 13px; line-height: 1.15; }
  .field .check-grid input[type="checkbox"] { width: 19px; min-width: 19px; height: 19px; }

  body.mobile-editor-open { overflow: hidden; overscroll-behavior: none; }
  .mobile-field-editor { position: fixed; inset: auto; left: var(--editor-left,0); top: var(--editor-top,0); z-index: 200; width: var(--editor-width,100vw); height: var(--editor-height,100dvh); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; background: #f7f8f4; }
  .mobile-field-editor header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 16px 14px; border-bottom: 1px solid var(--line); background: #fff; }
  .mobile-field-editor header h2 { margin: 3px 0 0; font-size: 25px; }
  .mobile-field-editor header button { width: 46px; height: 46px; padding: 0; font-size: 25px; }
  .mobile-field-editor main { min-height: 0; overflow: hidden; padding: 10px 14px; }
  .mobile-field-editor textarea { width: 100%; height: 100%; min-height: 0; padding: 16px; resize: none; border: 1px solid #adbbb2; border-radius: 12px; outline: 0; background: #fff; color: var(--ink); font: 16px/1.55 Inter, system-ui, sans-serif; }
  .mobile-field-editor textarea:focus { border-color: var(--green2); box-shadow: 0 0 0 3px #1d674e20; }
  .mobile-field-editor footer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
  .mobile-field-editor footer button { min-height: 50px; }
  .mobile-field-editor.keyboard-open { grid-template-rows: 50px minmax(120px, 1fr) 54px; }
  .mobile-field-editor.keyboard-open header { min-height: 50px; padding: 5px 10px; }
  .mobile-field-editor.keyboard-open header .eyebrow { display: none; }
  .mobile-field-editor.keyboard-open header h2 { margin: 0; font-size: 19px; line-height: 1.1; }
  .mobile-field-editor.keyboard-open header button { width: 38px; height: 38px; font-size: 21px; }
  .mobile-field-editor.keyboard-open main { padding: 6px 10px; }
  .mobile-field-editor.keyboard-open textarea { padding: 10px 12px; border-radius: 9px; line-height: 1.4; }
  .mobile-field-editor.keyboard-open footer { gap: 8px; padding: 5px 10px; }
  .mobile-field-editor.keyboard-open footer button { min-height: 42px; padding: 7px 10px; }
}
