/* =========================================================
   Policy Workbench-specific CSS
   ========================================================= */

.workbench-panel--main #policy-table tbody tr.is-row-error td:not(.table-editor__rownum):not(.table-editor__actions):not(.table-editor__end-gutter) {
  background: rgba(255, 255, 255, 0.98);
}

.workbench-panel--main #policy-table tbody tr.is-row-error:hover td:not(.table-editor__rownum):not(.table-editor__actions):not(.table-editor__end-gutter) {
  background: rgba(254, 242, 242, 0.92);
}

.workbench-panel--main #policy-table tbody tr.is-row-warning td:not(.table-editor__rownum):not(.table-editor__actions):not(.table-editor__end-gutter) {
  background: rgba(255, 255, 255, 0.98);
}

.workbench-panel--main #policy-table tbody tr.is-row-warning:hover td:not(.table-editor__rownum):not(.table-editor__actions):not(.table-editor__end-gutter) {
  background: rgba(255, 251, 235, 0.92);
}

.workbench-panel--main #policy-table .table-editor__rownum.is-row-error:not(.is-row-dragging):not(.is-row-drop-target):not(.is-row-drop-target-before):not(.is-row-drop-target-after) {
  background: #ffffff;
  box-shadow: inset 2px 0 0 rgba(239, 68, 68, 0.72), 1px 0 0 rgba(226, 232, 240, 0.88);
}

.workbench-panel--main #policy-table .table-editor__actions.is-row-error:not(.is-row-dragging):not(.is-row-drop-target):not(.is-row-drop-target-before):not(.is-row-drop-target-after) {
  box-shadow: inset 1px 0 0 rgba(239, 68, 68, 0.18);
}

.workbench-panel--main #policy-table .table-editor__rownum.is-row-warning:not(.is-row-dragging):not(.is-row-drop-target):not(.is-row-drop-target-before):not(.is-row-drop-target-after) {
  background: #ffffff;
  box-shadow: inset 2px 0 0 rgba(245, 158, 11, 0.62), 1px 0 0 rgba(226, 232, 240, 0.88);
}

.workbench-panel--main #policy-table .table-editor__actions.is-row-warning:not(.is-row-dragging):not(.is-row-drop-target):not(.is-row-drop-target-before):not(.is-row-drop-target-after) {
  box-shadow: inset 1px 0 0 rgba(245, 158, 11, 0.16);
}

.workbench-panel--main #policy-table tbody tr:hover .table-editor__rownum {
  background: #eef4ff;
}

.workbench-panel--main #policy-table tbody tr:hover .table-editor__actions {
  background: rgba(226, 232, 240, 0.46);
}

.workbench-panel--main #policy-table tbody tr.is-row-error:hover .table-editor__rownum:not(.is-row-dragging):not(.is-row-drop-target):not(.is-row-drop-target-before):not(.is-row-drop-target-after) {
  background: #fff7f7;
  box-shadow: inset 2px 0 0 rgba(239, 68, 68, 0.72), 1px 0 0 rgba(226, 232, 240, 0.88);
}

.workbench-panel--main #policy-table tbody tr.is-row-error:hover .table-editor__actions:not(.is-row-dragging):not(.is-row-drop-target):not(.is-row-drop-target-before):not(.is-row-drop-target-after) {
  background: rgba(254, 242, 242, 0.82);
  box-shadow: inset 1px 0 0 rgba(239, 68, 68, 0.18);
}

.workbench-panel--main #policy-table tbody tr.is-row-warning:hover .table-editor__rownum:not(.is-row-dragging):not(.is-row-drop-target):not(.is-row-drop-target-before):not(.is-row-drop-target-after) {
  background: #fffaf0;
  box-shadow: inset 2px 0 0 rgba(245, 158, 11, 0.62), 1px 0 0 rgba(226, 232, 240, 0.88);
}

.workbench-panel--main #policy-table tbody tr.is-row-warning:hover .table-editor__actions:not(.is-row-dragging):not(.is-row-drop-target):not(.is-row-drop-target-before):not(.is-row-drop-target-after) {
  background: rgba(255, 251, 235, 0.84);
  box-shadow: inset 1px 0 0 rgba(245, 158, 11, 0.16);
}

/* Policy Workbench section rows. */
.table-editor__section-row {
  background: linear-gradient(90deg, rgba(238, 242, 255, 0.98), rgba(248, 250, 252, 0.98));
}

#policy-table .table-editor__section-cell {
  position: sticky;
  left: 0;
  z-index: 5;
  padding: 0;
  border-top: 1px solid rgba(99, 102, 241, 0.24);
  border-bottom: 1px solid rgba(100, 116, 139, 0.22);
  border-left: 3px solid rgba(99, 102, 241, 0.42);
  background: linear-gradient(90deg, rgba(238, 242, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.table-editor__section-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 14px;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.table-editor__section-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.table-editor__section-toggle::before {
  content: "▾";
  margin-right: 6px;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1;
  transition: transform 0.16s ease;
}

.table-editor__section-row.is-section-collapsed .table-editor__section-toggle::before {
  transform: rotate(-90deg);
}

.table-editor__section-toggle:hover .table-editor__section-number,
.table-editor__section-toggle:focus-visible .table-editor__section-number {
  background: rgba(79, 70, 229, 0.14);
  color: #3730a3;
}

.table-editor__section-toggle:focus-visible {
  outline: 2px solid rgba(79, 70, 229, 0.35);
  outline-offset: 2px;
}

.table-editor__section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
  color: #4338ca;
  font-size: 0.76rem;
  font-weight: 700;
}

.table-editor__section-label-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1e293b;
  font-weight: 700;
  cursor: text;
}

.table-editor__section-label-input {
  min-width: 220px;
  max-width: min(520px, 42vw);
  height: 28px;
  padding: 3px 8px;
  border: 1px solid rgba(79, 70, 229, 0.42);
  border-radius: 8px;
  background: #ffffff;
  color: #1e293b;
  font: inherit;
  font-weight: 600;
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.table-editor__section-label-input.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.table-editor__section-row.is-section-label-invalid .table-editor__section-hint {
  color: #dc2626;
}

.table-editor__section-row.is-section-label-editing .table-editor__section-hint {
  color: #6366f1;
}

.table-editor__section-hint {
  margin-left: auto;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
}

#policy-table .table-editor__section-row.is-section-collapsed .table-editor__section-cell {
  background: linear-gradient(90deg, rgba(224, 231, 255, 0.98), rgba(248, 250, 252, 0.98));
}
