.standard-grid {
  display: grid;
  gap: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: visible;
}
.standard-grid > .table-scroll,
.standard-grid > .report-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: auto;
}
.standard-grid-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #fafcfd;
}
.standard-grid-search { position: relative; display: flex; flex: 1 1 280px; min-width: 220px; max-width: 440px; }
.standard-grid-search input { width: 100%; min-width: 0; min-height: 40px; padding-right: 39px; background: #fff; }
.standard-grid-search button { position: absolute; right: 4px; top: 4px; width: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.standard-grid-tools { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-left: auto; }
.standard-grid-tools label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.standard-grid-tools select { min-width: 76px; min-height: 40px; padding: 7px 9px; }
.standard-grid-button, .standard-grid-columns > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font: 800 11px/1.1 inherit;
  cursor: pointer;
  list-style: none;
}
.standard-grid-button:hover, .standard-grid-columns > summary:hover { border-color: #9bb3c5; background: #f2f7f9; }
.standard-grid-button:disabled { opacity: .45; cursor: not-allowed; }
.standard-grid-columns { position: relative; }
.standard-grid-columns > summary::-webkit-details-marker { display: none; }
.standard-grid-columns[open] > summary { border-color: var(--teal); background: var(--teal-light); color: var(--teal-dark); }
.standard-grid-column-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  width: min(340px, calc(100vw - 32px));
  max-height: 430px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(7,31,59,.18);
}
.standard-grid-column-list { display: grid; gap: 5px; }
.standard-grid-column-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 6px; padding: 6px; border-radius: 7px; }
.standard-grid-column-row:hover { background: #f4f8fa; }
.standard-grid-column-row label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 11px; }
.standard-grid-column-row button { width: 28px; min-height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.standard-grid-column-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.standard-grid-selection { display: none; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; border-bottom: 1px solid #b9dfdc; background: var(--teal-light); color: var(--teal-dark); font-size: 11px; font-weight: 800; }
.standard-grid.has-selection .standard-grid-selection { display: flex; }
.standard-grid-selection .standard-grid-button { min-height: 30px; padding: 6px 8px; }
.standard-grid-selection span { margin-right: auto; }
.standard-grid .data-table { margin: 0; }
.standard-grid .data-table th {
  top: 0;
  z-index: 3;
  white-space: nowrap;
  user-select: none;
}
.standard-grid .data-table th[data-sortable="true"] { cursor: pointer; padding-right: 25px; }
.standard-grid .data-table th[data-sortable="true"]::after { content: '↕'; position: absolute; right: 8px; opacity: .48; font-size: 10px; }
.standard-grid .data-table th[aria-sort="ascending"]::after { content: '↑'; opacity: 1; }
.standard-grid .data-table th[aria-sort="descending"]::after { content: '↓'; opacity: 1; }
.standard-grid .data-table tbody tr.grid-selected { background: #eaf8f7; box-shadow: inset 3px 0 var(--teal); }
.standard-grid .data-table tbody tr[hidden] { display: none; }
.standard-grid .data-table mark { padding: 0 1px; border-radius: 2px; background: #fff0a8; color: inherit; }
.standard-grid-select-cell { width: 44px; min-width: 44px; text-align: center !important; }
.standard-grid-select-cell input { width: 16px; min-height: 16px; }
.standard-grid .grid-frozen {
  position: sticky;
  left: var(--grid-frozen-left, 0px);
  z-index: 2;
  box-shadow: 1px 0 #dce5eb;
}
.standard-grid tbody .grid-frozen { background: var(--surface); }
.standard-grid tbody tr:hover .grid-frozen { background: #f7fafb; }
.standard-grid tbody tr.grid-selected .grid-frozen { background: #eaf8f7; }
.standard-grid thead .grid-frozen { z-index: 5; background: var(--navy); }
.standard-grid-resize { position: absolute; top: 0; right: -3px; width: 8px; height: 100%; cursor: col-resize; z-index: 7; }
.standard-grid-resize:hover { background: rgba(255,255,255,.3); }
.standard-grid-action-menu { position: relative; min-width: 78px; }
.standard-grid-action-menu > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--navy); font-size: 11px; font-weight: 800; cursor: pointer; list-style: none; }
.standard-grid-action-menu > summary::-webkit-details-marker { display: none; }
.standard-grid-action-list { display: none; position: absolute; z-index: var(--ui-layer-popover,40); top: calc(100% + 4px); right: 0; min-width: 190px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 14px 35px rgba(7,31,59,.2); }
.standard-grid-action-menu[open] .standard-grid-action-list { display: grid; gap: 4px; }
.standard-grid-action-list.is-portaled { display:grid; position:fixed; right:auto; overflow-y:auto; overscroll-behavior:contain; z-index:var(--ui-layer-popover,40); gap:4px; }
.standard-grid-action-list .toolbar { display: grid; gap: 4px; margin: 0; }
.standard-grid-action-list .button { width: 100%; justify-content: flex-start; text-align: left; }
.standard-grid-footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.standard-grid-records { margin-right: auto; font-weight: 700; }
.standard-grid-pages { display: flex; align-items: center; gap: 5px; }
.standard-grid-pages .standard-grid-button { min-width: 34px; min-height: 32px; padding: 6px; }
.standard-grid-page-indicator { min-width: 92px; text-align: center; color: var(--ink); font-weight: 800; }
.standard-grid-empty { display: none; min-height: 130px; place-items: center; padding: 28px; color: var(--muted); text-align: center; }
.standard-grid.is-empty .standard-grid-empty { display: grid; }
.standard-grid.is-empty .table-scroll, .standard-grid.is-empty .report-table-wrap { display: none; }
.grid-skeleton { display: grid; gap: 9px; padding: 18px; }
.grid-skeleton span { height: 16px; border-radius: 6px; background: linear-gradient(90deg,#edf2f6 25%,#f7fafc 50%,#edf2f6 75%); background-size: 200% 100%; animation: grid-shimmer 1.3s infinite; }
@keyframes grid-shimmer { to { background-position: -200% 0; } }
.grid-error-state { display: grid; place-items: center; gap: 10px; min-height: 150px; padding: 24px; border: 1px dashed #e0aaa4; border-radius: 11px; background: #fff7f5; color: var(--danger); text-align: center; }
.notice.ui-toast { position: fixed; top: 92px; right: 20px; z-index: var(--ui-layer-toast,60); width: min(480px,calc(100vw - 40px)); max-height:calc(100vh - 116px); overflow:auto; overflow-wrap:anywhere; margin: 0; box-shadow: 0 16px 45px rgba(7,31,59,.18); animation: grid-toast-in .2s ease-out; }
@keyframes grid-toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* Administration table layout hotfix. Keep table geometry and controls inside
   the shared Workspace container without changing grid behavior. */
.workspace-content,
.workspace-content > *,
.workspace-content .card,
.workspace-content .standard-grid,
.workspace-content .table-scroll,
.workspace-content .report-table-wrap {
  min-width: 0;
  max-width: 100%;
}
.workspace-content .card:has(.standard-grid) {
  overflow: visible;
}
.workspace-content .card > .toolbar {
  position: static;
  top: auto;
  z-index: auto;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
}
.workspace-content .card > .toolbar > input {
  flex: 1 1 280px;
  width: auto;
  min-width: 220px;
  max-width: 440px;
}
.workspace-content .card > .toolbar > select {
  flex: 0 1 190px;
  width: auto;
  min-width: 145px;
  max-width: 240px;
}
.workspace-content .card > .toolbar > input,
.workspace-content .card > .toolbar > select,
.workspace-content .card > .toolbar > button,
.workspace-content .card > .toolbar > .button {
  min-height: 40px;
}
.workspace-content .card > .toolbar > .muted {
  margin-left: auto;
  align-self: center;
  white-space: nowrap;
}
.standard-grid .data-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
}
.standard-grid .data-table th,
.standard-grid .data-table td {
  height: auto;
  overflow: visible;
}

@media (max-width: 980px) {
  .standard-grid-toolbar { align-items: stretch; }
  .standard-grid-search { max-width: none; }
  .standard-grid-tools { width: 100%; margin-left: 0; }
  .standard-grid-tools label { flex: 1; }
  .standard-grid-tools select { flex: 1; }
  .notice.ui-toast { top: 16px; }
  .workspace-content .card > .toolbar > input,
  .workspace-content .card > .toolbar > select {
    flex: 1 1 220px;
    width: auto;
    min-width: 180px;
    max-width: none;
  }
  .workspace-content .card > .toolbar > .muted {
    width: 100%;
    margin-left: 0;
  }
}
@media (max-width: 680px) {
  .standard-grid-search { flex-basis: 100%; min-width: 0; }
  .standard-grid-tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .standard-grid-tools > *, .standard-grid-button, .standard-grid-columns > summary { width: 100%; }
  .standard-grid-footer { align-items: stretch; flex-direction: column; }
  .standard-grid-records { margin: 0; text-align: center; }
  .standard-grid-pages { justify-content: center; }
  .workspace-content .card > .toolbar > input,
  .workspace-content .card > .toolbar > select,
  .workspace-content .card > .toolbar > button,
  .workspace-content .card > .toolbar > .button {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .grid-skeleton span, .notice.ui-toast { animation: none; }
}

/* Shared Administration visibility and density enhancement. */
.standard-grid .data-table th,.standard-grid .data-table td{height:auto;min-width:110px;padding:11px 12px;line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.standard-grid .data-table th{min-width:130px}
.standard-grid .data-table .actions-cell{min-width:110px;white-space:nowrap}
.standard-grid .data-table td:has(.badge){min-width:125px}


.ui-toast-region{position:fixed;top:92px;right:20px;z-index:var(--ui-layer-toast,60);display:grid;gap:10px;width:min(480px,calc(100vw - 40px));max-height:calc(100vh - 116px);overflow:auto;pointer-events:none}
.ui-toast-region .notice.ui-toast{position:relative;inset:auto;width:100%;max-height:none;pointer-events:auto;cursor:pointer}
@media(max-width:980px){.ui-toast-region{top:16px;right:16px;width:min(480px,calc(100vw - 32px));max-height:calc(100vh - 32px)}}

