.admin-topbar {
  z-index: 60;
}

.admin-user-menu {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mobile-menu-button {
  display: none;
}

.mobile-menu-button::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.mobile-menu-button[aria-expanded="true"]::before {
  content: "X";
  width: auto;
  height: auto;
  background: transparent;
  box-shadow: none;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(2px);
}

body.sidebar-drawer-open {
  overflow: hidden;
}

.danger-action {
  color: var(--danger) !important;
}

.admin-workspace {
  position: relative;
}

.sidebar-edge-toggle {
  position: sticky;
  top: 0;
  z-index: 6;
  justify-self: end;
  width: 34px;
  min-height: 40px;
  margin: -4px -4px -6px auto;
  padding: 0;
  border-color: #fecdd3;
  border-radius: 8px;
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 12px 26px rgba(193, 18, 31, 0.14);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.sidebar-edge-toggle:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.admin-workspace.sidebar-collapsed {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
}

.admin-workspace.sidebar-collapsed .admin-sidebar {
  display: grid;
  width: 42px;
  min-width: 42px;
  gap: 0;
  padding: 8px 4px;
  overflow: visible;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.admin-workspace.sidebar-collapsed .admin-sidebar > :not(.sidebar-edge-toggle) {
  display: none !important;
}

.admin-workspace.sidebar-collapsed .sidebar-edge-toggle {
  justify-self: center;
  margin: 0;
}

.workspace-toolbar {
  display: none;
}

.google-login {
  display: flex;
  justify-content: center;
  min-height: 42px;
  margin-top: 10px;
}

.user-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.admin-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.admin-filter-bar label:first-child {
  grid-column: span 2;
}

.doc-bulk-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff7f7;
}

.doc-bulk-toolbar[hidden] {
  display: none;
}

.doc-bulk-toolbar strong,
.doc-bulk-toolbar span {
  display: block;
}

.doc-bulk-toolbar strong {
  color: var(--brand-dark);
  font-size: 14px;
}

.doc-bulk-toolbar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.doc-bulk-actions {
  justify-content: flex-end;
  margin: 0;
}

.table-check-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.document-title-select {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
}

.doc-row-select,
.table-check-all input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--brand);
}

.page-editor-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.page-editor-shell {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.rich-text-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.toolbar-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  padding-right: 6px;
  border-right: 1px solid var(--line);
}

.toolbar-group:last-child {
  border-right: 0;
  padding-right: 0;
}

.toolbar-select {
  width: auto;
  min-width: 132px;
  min-height: 36px;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #fff;
  font-weight: 800;
}

.rich-text-toolbar .secondary-button {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
}

.rich-text-toolbar .icon-command {
  width: 38px;
  padding-inline: 0;
}

.toolbar-color-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.toolbar-color-label input[type="color"] {
  width: 28px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.page-content-editor,
.page-html-source {
  width: 100%;
  min-height: 280px;
  max-height: 56vh;
  padding: 14px;
  overflow: auto;
  border: 0;
  outline: none;
  background: #fff;
}

.page-content-editor:focus,
.page-html-source:focus {
  box-shadow: inset 0 0 0 2px rgba(200, 16, 46, 0.22);
}

.page-html-source {
  resize: vertical;
  font-family: Consolas, "Roboto Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.doc-table-wrap,
.category-table-wrap,
.review-table-wrap,
.permission-table-wrap,
.user-inner-table-wrap,
.organization-member-table-wrap,
.site-settings-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-doc-list,
.category-list,
.review-queue-list,
.user-table-wrap,
.permission-matrix,
.organization-member-list,
.site-settings-list,
.editor-form,
.menu-list,
.organization-sync-panel,
.admin-org-chart {
  min-width: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.document-table {
  min-width: 1720px;
  table-layout: fixed;
}

.document-table th,
.document-table td {
  overflow-wrap: normal;
}

.document-table th:nth-child(1),
.document-table td:nth-child(1) {
  position: sticky;
  left: 0;
  width: 460px;
  min-width: 460px;
  background: #fff;
  z-index: 2;
  box-shadow: 10px 0 18px rgba(15, 23, 42, 0.06);
}

.document-table th:nth-child(1) {
  z-index: 4;
  background: #f8fafc;
}

.document-table th:nth-child(2),
.document-table td:nth-child(2) {
  width: 170px;
}

.document-table th:nth-child(3),
.document-table td:nth-child(3) {
  width: 190px;
}

.document-table th:nth-child(4),
.document-table td:nth-child(4) {
  width: 126px;
}

.document-table th:nth-child(5),
.document-table td:nth-child(5) {
  width: 136px;
}

.document-table th:nth-child(6),
.document-table td:nth-child(6) {
  width: 118px;
}

.document-table th:nth-child(7),
.document-table td:nth-child(7) {
  width: 128px;
}

.document-table th:nth-child(8),
.document-table td:nth-child(8) {
  width: 128px;
}

.document-table th:nth-child(9),
.document-table td:nth-child(9) {
  position: sticky;
  right: 0;
  width: 260px;
  min-width: 260px;
  background: #fff;
  z-index: 2;
  box-shadow: -10px 0 18px rgba(15, 23, 42, 0.06);
}

.document-table td:nth-child(1) {
  vertical-align: top;
}

.document-table .table-title-cell strong {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  line-height: 1.38;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.document-table .table-title-cell span {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.document-table th:nth-child(9) {
  z-index: 4;
  background: #f8fafc;
}

.document-table th:nth-child(6),
.document-table td:nth-child(6),
.document-table th:nth-child(7),
.document-table td:nth-child(7),
.document-table th:nth-child(8),
.document-table td:nth-child(8),
.document-table th:nth-child(9),
.document-table td:nth-child(9) {
  overflow-wrap: normal;
  word-break: normal;
}

.review-queue-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.member-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.review-metric {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.member-metric {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.review-metric strong,
.review-metric span,
.member-metric strong,
.member-metric span {
  display: block;
}

.review-metric strong,
.member-metric strong {
  color: var(--brand);
  font-size: 24px;
  font-weight: 900;
}

.review-metric span,
.member-metric span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.member-create-form {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr minmax(160px, 0.9fr) minmax(180px, 1fr) minmax(160px, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff7f7;
}

.member-create-form > div:first-child {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
}

.member-create-form > div:first-child span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.member-create-form .dss-status {
  grid-column: 1 / -1;
}

.member-filter-bar {
  margin-top: 2px;
}

.review-table,
.user-table {
  min-width: 1040px;
}

.organization-member-table {
  min-width: 980px;
}

.site-settings-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.site-settings-table {
  min-width: 960px;
  table-layout: fixed;
}

.site-settings-table th:nth-child(1),
.site-settings-table td:nth-child(1) {
  width: 280px;
}

.site-settings-table th:nth-child(2),
.site-settings-table td:nth-child(2) {
  width: 260px;
}

.site-settings-table th:nth-child(5),
.site-settings-table td:nth-child(5) {
  width: 150px;
}

.organization-member-table th:nth-child(1),
.organization-member-table td:nth-child(1) {
  width: 250px;
}

.organization-member-table th:nth-child(2),
.organization-member-table td:nth-child(2) {
  width: 250px;
}

.organization-member-table th:nth-child(7),
.organization-member-table td:nth-child(7) {
  width: 150px;
}

.user-table {
  min-width: 1360px;
  table-layout: fixed;
}

.user-table th:nth-child(1),
.user-table td:nth-child(1) {
  position: sticky;
  left: 0;
  width: 280px;
  min-width: 280px;
  background: #fff;
  z-index: 2;
  box-shadow: 10px 0 18px rgba(15, 23, 42, 0.06);
}

.user-table th:nth-child(1) {
  z-index: 4;
  background: #f8fafc;
}

.user-table th:nth-child(2),
.user-table td:nth-child(2),
.user-table th:nth-child(3),
.user-table td:nth-child(3) {
  width: 170px;
}

.user-table th:nth-child(4),
.user-table td:nth-child(4) {
  width: 160px;
}

.user-table th:nth-child(5),
.user-table td:nth-child(5),
.user-table th:nth-child(6),
.user-table td:nth-child(6) {
  width: 190px;
}

.user-table th:nth-child(7),
.user-table td:nth-child(7) {
  width: 150px;
}

.user-table th:nth-child(8),
.user-table td:nth-child(8) {
  position: sticky;
  right: 0;
  width: 190px;
  min-width: 190px;
  background: #fff;
  z-index: 2;
  box-shadow: -10px 0 18px rgba(15, 23, 42, 0.06);
}

.user-table th:nth-child(8) {
  z-index: 4;
  background: #f8fafc;
}

.permission-table {
  min-width: 1120px;
}

.permission-table th:not(:first-child),
.permission-table td:not(:first-child) {
  text-align: center;
}

.permission-yes {
  color: var(--success);
  font-weight: 900;
}

.permission-no {
  color: var(--muted);
}

.user-table select {
  min-width: 150px;
}

.compact-check {
  min-width: max-content;
}

.member-status-cell,
.member-actions {
  display: grid;
  gap: 8px;
  align-content: start;
}

.member-actions button {
  width: 100%;
  justify-content: center;
}

.table-title-cell small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.permission-reference {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.permission-reference summary {
  cursor: pointer;
  padding: 13px 14px;
  color: var(--brand-dark);
  font-weight: 900;
}

.permission-reference .permission-matrix {
  padding: 0 14px 14px;
}

.admin-table th,
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:focus-visible {
  outline: 3px solid rgba(193, 18, 31, 0.2);
  outline-offset: -3px;
}

.clickable-row:hover td {
  background: #fff7f7;
}

.table-title-cell strong,
.table-title-cell span {
  display: block;
}

.table-title-cell strong {
  overflow-wrap: anywhere;
}

.table-title-cell span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.document-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(82px, 1fr));
  align-items: stretch;
}

.signature-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-start;
}

.signature-badge {
  background: #fff7f7;
  border-color: #fecdd3;
  color: var(--brand);
}

.row-actions button {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 12px;
}

.document-actions button {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
}

.file-download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  background: #fff7f7;
}

.file-download-link:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.file-download-error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.doc-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.doc-pagination .button-row {
  flex: 0 0 auto;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 80;
  width: min(720px, 100vw);
  height: 100vh;
  overflow-y: auto;
  padding: 22px;
  border: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -22px 0 54px rgba(17, 24, 39, 0.18);
}

.admin-drawer.document-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.34);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.44);
}

.dss-sign-dialog,
.upload-confirm-dialog {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(17, 24, 39, 0.24);
}

.upload-confirm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-confirm-grid div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.upload-confirm-grid span,
.upload-confirm-grid strong {
  display: block;
}

.upload-confirm-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.upload-confirm-grid strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.document-detail-dialog {
  width: min(1180px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(17, 24, 39, 0.24);
}

.document-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.document-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.document-detail-row {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.document-detail-row span,
.document-history-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.document-detail-row strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.document-detail-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.document-detail-history {
  display: grid;
  gap: 8px;
}

.document-history-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: var(--brand-soft);
}

.document-history-item > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.compact-empty {
  padding: 10px 12px;
}

.document-preview-shell {
  min-height: min(68vh, 720px);
  height: min(68vh, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.document-preview-shell iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  border: 0;
  background: #fff;
}

.dss-sign-dialog form {
  display: grid;
  gap: 12px;
}

.dss-sign-dialog .drawer-actions {
  position: static;
  margin: 0;
  padding: 0;
  border-top: 0;
  background: transparent;
}

.drawer-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin-bottom: 0;
}

.drawer-actions {
  position: sticky;
  bottom: -22px;
  z-index: 2;
  margin: 8px -22px -22px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.category-drawer {
  display: grid;
  gap: 12px;
}

.organization-sync-panel {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff7f7;
  overflow: hidden;
}

.organization-sync-panel > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.organization-sync-panel > div:first-child strong {
  color: var(--text);
}

.admin-org-chart {
  padding: 6px 0 0;
  overflow-x: auto;
}

.admin-org-chart .org-member-card {
  box-shadow: none;
}

.organization-member-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.organization-member-form .org-member-directory-field {
  grid-column: 1 / -1;
}

.organization-member-form .organization-member-actions,
.organization-member-form .dss-status {
  grid-column: 1 / -1;
}

.organization-member-list {
  display: grid;
  gap: 10px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
}

.inline-check input {
  width: 18px;
  min-height: 18px;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.5fr);
  gap: 14px;
}

.profile-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.profile-row:last-child {
  border-bottom: 0;
}

.profile-row span {
  color: var(--muted);
  font-weight: 700;
}

.profile-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.compact-dss-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-scope-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 1180px) {
  .admin-filter-bar,
  .review-queue-grid,
  .member-metrics,
  .member-create-form,
  .profile-grid,
  .compact-dss-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .admin-topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .admin-user-menu {
    display: none;
  }

  .mobile-menu-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    color: var(--brand);
    background: #fff;
    border-color: #fecdd3;
  }

  .user-card-actions,
  .admin-filter-bar,
  .review-queue-grid,
  .member-metrics,
  .member-create-form,
  .profile-grid,
  .compact-dss-grid {
    grid-template-columns: 1fr;
  }

  .admin-filter-bar label:first-child {
    grid-column: auto;
  }

  .doc-bulk-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .doc-bulk-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .doc-bulk-actions button {
    width: 100%;
  }

  .doc-table-wrap,
  .category-table-wrap,
  .review-table-wrap,
  .permission-table-wrap,
  .user-inner-table-wrap,
  .organization-member-table-wrap,
  .site-settings-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    background: #fff;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table {
    min-width: 860px;
    border-collapse: collapse;
    border-spacing: 0;
  }

  .document-table {
    min-width: 1560px;
  }

  .document-table th:nth-child(1),
  .document-table td:nth-child(1),
  .document-table th:nth-child(9),
  .document-table td:nth-child(9),
  .user-table th:nth-child(1),
  .user-table td:nth-child(1),
  .user-table th:nth-child(8),
  .user-table td:nth-child(8) {
    position: static;
    width: auto;
    min-width: 0;
    box-shadow: none;
  }

  .review-table,
  .user-table,
  .organization-member-table,
  .site-settings-table {
    min-width: 940px;
  }

  .permission-table,
  .category-table {
    min-width: 760px;
  }

  .document-table th:nth-child(1),
  .document-table td:nth-child(1) {
    width: 380px;
    min-width: 380px;
  }

  .document-table th:nth-child(9),
  .document-table td:nth-child(9) {
    width: 240px;
    min-width: 240px;
  }

  .user-table th:nth-child(1),
  .user-table td:nth-child(1) {
    width: 280px;
    min-width: 280px;
  }

  .user-table th:nth-child(8),
  .user-table td:nth-child(8) {
    width: 230px;
    min-width: 230px;
  }

  .section-title > button,
  .section-title > .primary-button,
  .section-title > .secondary-button {
    width: 100%;
    justify-self: stretch;
  }

  .admin-section .section-title {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-table thead {
    display: table-header-group;
  }

  .admin-table tr {
    display: table-row;
    background: #fff;
  }

  .admin-table td {
    display: table-cell;
    width: auto;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
  }

  .admin-table td::before {
    content: none;
  }

  .admin-table td:last-child {
    border-bottom: 1px solid var(--line);
  }

  .admin-table tr:last-child td {
    border-bottom: 0;
  }

  .doc-pagination {
    display: grid;
  }

  .admin-drawer {
    width: 100dvw;
    max-width: 100dvw;
    height: 100dvh;
    padding: 16px;
    border-left: 0;
  }

  .admin-drawer.document-form {
    grid-template-columns: 1fr;
  }

  .drawer-actions {
    bottom: -16px;
    margin: 8px -16px -16px;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr;
  }

  .upload-panel {
    grid-template-columns: 1fr;
  }

  .organization-sync-panel > div:first-child {
    display: grid;
  }

  .organization-member-form {
    grid-template-columns: 1fr;
  }

  .document-detail-dialog {
    width: 100%;
    height: calc(100dvh - 18px);
    max-height: calc(100dvh - 18px);
    grid-template-rows: auto auto auto minmax(0, auto) minmax(0, 1fr);
    overflow: hidden;
    padding: 12px;
  }

  .document-detail-actions {
    justify-content: stretch;
  }

  .document-detail-actions a,
  .document-detail-actions button {
    flex: 1 1 160px;
    width: 100%;
  }

  .document-detail-grid {
    grid-template-columns: 1fr;
  }

  #document-detail-body {
    max-height: 24dvh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .document-preview-shell {
    min-height: 320px;
    height: auto;
  }

  .document-preview-shell iframe {
    height: 100%;
    min-height: 0;
  }

  .admin-workspace {
    grid-template-columns: 1fr;
  }

  .admin-workspace.sidebar-collapsed {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .admin-workspace.sidebar-collapsed .admin-sidebar {
    display: grid;
  }

  .admin-sidebar {
    position: fixed;
    top: 74px;
    left: 10px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    z-index: 80;
    width: min(336px, calc(100vw - 20px));
    max-height: none;
    overflow-y: auto;
    padding: 14px;
    transform: translateX(-112%);
    opacity: 0;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease;
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.26);
  }

  .admin-workspace.sidebar-collapsed .admin-sidebar {
    width: min(336px, calc(100vw - 20px));
    min-width: 0;
    padding: 14px;
    overflow-y: auto;
    border-color: var(--line);
    background: var(--surface);
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.26);
  }

  .admin-workspace.sidebar-open .admin-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-edge-toggle {
    margin: -2px 0 0 auto;
  }

  .admin-nav {
    grid-template-columns: 1fr;
  }

  .admin-nav button {
    justify-content: flex-start;
    text-align: left;
  }
}

@media (max-width: 430px) {
  .admin-user-menu {
    display: none;
  }

  .user-card-actions,
  .button-row,
  .row-actions,
  .document-actions,
  .member-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-table {
    min-width: 820px;
  }

  .document-table {
    min-width: 1480px;
  }

  .document-detail-dialog,
  .dss-sign-dialog,
  .upload-confirm-dialog {
    border-radius: 8px;
  }

  .upload-confirm-grid {
    grid-template-columns: 1fr;
  }

  .document-preview-shell {
    min-height: 260px;
    height: auto;
  }

  .document-preview-shell iframe {
    height: 100%;
    min-height: 0;
  }
}
