/* Account management uses the window itself as its workspace. These rules
   stay on this page; reports and customer dashboards keep their own layout. */
.admin-workspace .admin-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px clamp(16px, 2.4vw, 48px) max(48px, env(safe-area-inset-bottom));
}
.admin-workspace .admin-wrap > .admin-header {
  gap: 16px 24px;
  min-height: 52px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: var(--hairline) solid var(--separator-quiet);
}
.admin-workspace .admin-wrap > .admin-header h1 { margin: 0; font-size: 26px; line-height: 1.25; letter-spacing: -.025em; }
.admin-workspace .admin-nav, .admin-workspace .admin-nav-secondary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.admin-workspace .admin-nav .btn { white-space: normal; text-align: center; }
.admin-workspace #main, .admin-workspace .row2 { min-width: 0; }
.admin-workspace .row2 { gap: 40px; }
.admin-workspace .row2 > .panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.admin-workspace #clientsTitle { margin-bottom: 6px; gap: 8px 16px; }
.admin-workspace #clientCount { font: var(--text-footnote); font-weight: 400; }
.admin-workspace .clients-panel > .field-help { margin: 0; max-width: 76ch; }
.admin-workspace #portalPollMsg:empty { display: none; }
.admin-workspace .table-scroll { overflow: visible; max-height: none; margin-top: 22px; }
.admin-workspace .tlist { min-width: 0; width: 100%; table-layout: fixed; }
.admin-workspace .tlist thead { position: static; background: transparent; }
.admin-workspace .tlist th, .admin-workspace .tlist td {
  min-width: 0;
  height: auto;
  padding: 14px 12px;
  white-space: normal;
  overflow-wrap: anywhere;
  border-bottom: var(--hairline) solid var(--separator-quiet);
}
.admin-workspace .tlist th { padding-block: 10px; }
.admin-workspace .tlist th:nth-child(1) { width: 24%; }
.admin-workspace .tlist th:nth-child(2) { width: 12%; }
.admin-workspace .tlist th:nth-child(3) { width: 12%; }
.admin-workspace .tlist th:nth-child(4) { width: 11%; }
.admin-workspace .tlist th:nth-child(5) { width: 7%; }
.admin-workspace .tlist th:nth-child(6) { width: 8%; }
.admin-workspace .tlist th:nth-child(7) { width: 26%; }
.admin-workspace .tlist td:first-child { min-width: 0; }
.admin-workspace .tlist td:last-child { min-width: 0; padding-block: 8px; }
.admin-workspace .tlist .btn-sm { max-width: 100%; height: auto; min-height: 32px; margin-block: 3px; padding: 5px 10px; white-space: normal; text-align: center; }
.admin-workspace .tlist .tenant-details-toggle { display: none; }
.admin-workspace .tlist .tenant-name { font-weight: 600; line-height: 1.45; }
.admin-workspace .tlist .tenant-chips { flex-wrap: wrap; margin-top: 5px; }
.admin-workspace .tlist .tenant-chips .chip { background: transparent; padding-inline: 0 7px; font-weight: 400; }
.admin-workspace .tlist .customer-portal-status { margin-top: 6px; font: var(--text-caption-1); line-height: 1.45; }
.admin-workspace .tlist .account-row td { background: var(--fill-4); }
.admin-workspace .tlist .account-row td:first-child { padding-inline-start: 24px; }
.admin-workspace .tlist .account-row .tenant-name { font-weight: 400; }

/* Editing stays in the document flow, with topic groups rather than a second
   enclosing card or a independently scrolling pane. */
.admin-workspace #editorPanel { padding-top: 28px; border-top: var(--hairline) solid var(--separator); }
.admin-workspace #editorPanel > .admin-header { margin-bottom: 24px; }
.admin-workspace #editorPanel .form-grid { align-items: start; gap: 28px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-workspace #editorPanel .form-section > h3 { color: var(--label); font-weight: 600; margin-bottom: 10px; }
.admin-workspace #editorPanel .group { border-radius: 14px; background: var(--fill-4); }
.admin-workspace #editorPanel .form-field { padding-block: 9px; }
.admin-workspace #editorPanel > .actions { padding-block: 20px; margin-top: 24px; border-top: var(--hairline) solid var(--separator-quiet); }
.admin-workspace #extraOps { margin-top: 24px; padding-top: 28px; }
.admin-workspace .userline > * { min-width: 0; overflow-wrap: anywhere; }

@media (min-width: 1700px) {
  .admin-workspace #editorPanel .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Compact rows lead with identity and the two everyday actions. Technical
   metadata and account operations expand in place, without copied controls. */
@media (max-width: 1100px) {
  .admin-workspace .tlist, .admin-workspace .tlist tbody { display: block; }
  .admin-workspace .tlist thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .admin-workspace .tlist tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 20px;
    padding: 14px 0;
    border-top: var(--hairline) solid var(--separator-quiet);
  }
  .admin-workspace .tlist td, .admin-workspace .tlist td:first-child, .admin-workspace .tlist td:last-child {
    display: block; min-width: 0; padding: 6px 0; border: 0; text-align: start; direction: rtl;
  }
  .admin-workspace .tlist td:nth-child(n+2):nth-child(-n+6) { display: none; order: 2; }
  .admin-workspace .tlist tr[data-details-open="true"] td:nth-child(n+2):nth-child(-n+6) { display: block; }
  .admin-workspace .tlist td:nth-child(2), .admin-workspace .tlist td:nth-child(3), .admin-workspace .tlist td:nth-child(4) { unicode-bidi: plaintext; }
  .admin-workspace .tlist td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--label-secondary); font: var(--text-caption-1); direction: rtl; }
  .admin-workspace .tlist td:first-child, .admin-workspace .tlist td:last-child { grid-column: 1 / -1; }
  .admin-workspace .tlist td:first-child::before, .admin-workspace .tlist td:last-child::before { display: none; }
  .admin-workspace .tlist td:last-child { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; order: 1; padding-top: 8px; }
  .admin-workspace .tlist .btn-sm { margin: 0; min-height: 44px; }
  .admin-workspace .tlist .tenant-primary-action { order: 0; background: var(--fill-4); box-shadow: none; }
  .admin-workspace .tlist tr[data-editable="false"] .tenant-primary-action { grid-column: 1 / 3; }
  .admin-workspace .tlist .tenant-details-toggle { display: inline-flex; order: 1; grid-column: 3; gap: 7px; color: var(--label-secondary); background: transparent; box-shadow: none; }
  .admin-workspace .tenant-details-toggle::after { content: ""; width: 6px; height: 6px; border-inline-end: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-top: -3px; }
  .admin-workspace .tenant-details-toggle[aria-expanded="true"]::after { transform: rotate(225deg); margin-top: 3px; }
  .admin-workspace .tlist .tenant-secondary-action { display: none; }
  .admin-workspace .tlist tr[data-details-open="true"] .tenant-secondary-action { display: inline-flex; order: 2; grid-column: 1 / -1; justify-content: flex-start; text-align: start; background: transparent; box-shadow: none; border-radius: 0; border-top: var(--hairline) solid var(--separator-quiet); }
  .admin-workspace .tlist tr[data-portal-status="ready"]:not([data-details-open="true"]) .customer-portal-status { display: none; }
  .admin-workspace .tlist .tenant-name { font-size: 16px; line-height: 1.4; }
  .admin-workspace .tlist .tenant-chips { margin-top: 3px; }
  .admin-workspace .tlist .account-row { padding-inline: 12px; margin-inline-start: 12px; border-inline-start: 2px solid var(--separator); background: transparent; }
  .admin-workspace .tlist .account-row td { background: transparent; }
  .admin-workspace .tlist tbody tr:hover td { background: transparent; }
  .admin-workspace #editorPanel .form-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .admin-workspace .admin-wrap { padding: 16px 14px max(32px, env(safe-area-inset-bottom)); }
  .admin-workspace .admin-wrap > .admin-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-bottom: 20px; padding-bottom: 12px; }
  .admin-workspace .admin-wrap > .admin-header h1 { font-size: 24px; }
  .admin-workspace .admin-nav { display: contents; }
  .admin-workspace .admin-nav-secondary { grid-column: 1 / -1; gap: 0 2px; }
  .admin-workspace .admin-nav .btn { min-height: 44px; height: auto; padding-inline: 10px; font-size: 13px; }
  .admin-workspace #newClientBtn { grid-row: 1; grid-column: 2; margin: 0; }
  .admin-workspace #clientsTitle { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 18px; }
  .admin-workspace #clientCount { font-size: 12px; }
  .admin-workspace .clients-panel > .field-help { font-size: 12px; line-height: 1.5; }
  .admin-workspace .table-scroll { margin-top: 14px; }
  .admin-workspace .tlist tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .admin-workspace .tlist .btn-sm { min-height: 44px; padding-inline: 12px; }
  .admin-workspace .tlist .account-row { padding-inline: 10px; margin-inline-start: 8px; }
  .admin-workspace #editorPanel .form-field { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px; }
  .admin-workspace #editorPanel .form-field > input,
  .admin-workspace #editorPanel .form-field > select,
  .admin-workspace #editorPanel .form-field > .select-control,
  .admin-workspace #editorPanel .form-field > .field-inline { grid-column: 1; }
  .admin-workspace #editorPanel .form-field > label { font: var(--text-footnote); color: var(--label-secondary); }
  .admin-workspace #editorPanel .form-field input { font-size: 16px; }
  .admin-workspace #editorPanel .form-field .select-trigger { min-height: 44px; }
  .admin-workspace #editorPanel .domain-row { grid-template-columns: minmax(0, 1fr); padding-inline: 12px; }
  .admin-workspace #editorPanel > .actions { gap: 8px; }
}

@media (pointer: coarse) {
  .admin-workspace .tlist .btn-sm { min-height: 44px; }
}
