#seguridad.phase6-admin-workspace,
#configuracion.phase6-admin-workspace,
#catalogos.phase6-admin-workspace {
  --phase6-primary: var(--brand-primary, var(--yellow, #F2D200));
  --phase6-secondary: var(--brand-secondary, var(--black, #171717));
  --phase6-surface: var(--brand-surface, var(--white, #FFFFFF));
  --phase6-canvas: var(--brand-bg, var(--bg, #F5F5F5));
  --phase6-ink: var(--brand-text, #1E1E1E);
  --phase6-muted: var(--text, #555555);
  --phase6-border: var(--border, #D9D9D9);
  --phase6-success: var(--success, #1F8B4C);
  --phase6-warning: var(--warning, #B7791F);
  --phase6-error: var(--error, #B42318);
}

#seguridad.phase6-admin-workspace.content-section.active,
#configuracion.phase6-admin-workspace.content-section.active,
#catalogos.phase6-admin-workspace.content-section.active {
  display: grid;
  gap: 18px;
}

#seguridad.phase6-admin-workspace > .section-head,
#configuracion.phase6-admin-workspace > .section-head,
#catalogos.phase6-admin-workspace > .section-head {
  align-items: flex-start;
  margin: 0;
  padding: 24px;
  border: 1px solid var(--phase6-border);
  border-radius: 14px;
  background: var(--phase6-surface);
  box-shadow: var(--shadow);
}

#seguridad.phase6-admin-workspace > .section-head > div,
#configuracion.phase6-admin-workspace > .section-head > div,
#catalogos.phase6-admin-workspace > .section-head > div {
  display: grid;
  gap: 8px;
}

#seguridad.phase6-admin-workspace > .section-head h2,
#configuracion.phase6-admin-workspace > .section-head h2,
#catalogos.phase6-admin-workspace > .section-head h2 {
  margin: 0;
  color: var(--phase6-ink);
  font-size: 24px;
  line-height: 1.2;
}

.phase6-section-description {
  max-width: 72ch;
  margin: 0;
  color: var(--phase6-muted);
  font-size: 14px;
  line-height: 1.45;
}

.phase6-admin-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 86px;
  padding: 18px 24px;
  border: 1px solid var(--phase6-border);
  border-radius: 12px;
  background: var(--phase6-surface);
}

.phase6-overview-copy {
  display: grid;
  gap: 8px;
  min-width: 220px;
  max-width: 58ch;
}

.phase6-overview-copy strong {
  color: var(--phase6-ink);
  font-size: 16px;
}

.phase6-overview-copy span {
  color: var(--phase6-muted);
  font-size: 13px;
  line-height: 1.45;
}

.phase6-summary-list {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  min-width: 0;
}

.phase6-summary-item {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 116px;
  padding: 0 18px;
  border-left: 1px solid var(--phase6-border);
}

.phase6-summary-item:first-child {
  border-left: 0;
}

.phase6-summary-item span,
.phase6-summary-item small {
  color: var(--phase6-muted);
  font-size: 12px;
}

.phase6-summary-item strong {
  color: var(--phase6-ink);
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#seguridad.phase6-admin-workspace > .tabs,
#catalogos.phase6-admin-workspace > .tabs {
  display: flex;
  gap: 0;
  margin: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--phase6-border);
  background: transparent;
}

#seguridad.phase6-admin-workspace > .tabs .tab,
#catalogos.phase6-admin-workspace > .tabs .tab {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 10px 18px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--phase6-muted);
  font-size: 13px;
  font-weight: 700;
  transform: none;
}

#seguridad.phase6-admin-workspace > .tabs .tab:hover,
#catalogos.phase6-admin-workspace > .tabs .tab:hover {
  background: color-mix(in srgb, var(--phase6-primary) 8%, var(--phase6-surface));
  color: var(--phase6-ink);
}

#seguridad.phase6-admin-workspace > .tabs .tab.active,
#catalogos.phase6-admin-workspace > .tabs .tab.active {
  border-bottom-color: var(--phase6-secondary);
  background: color-mix(in srgb, var(--phase6-primary) 12%, var(--phase6-surface));
  color: var(--phase6-ink);
}

#seguridad.phase6-admin-workspace > .tabs .tab:focus-visible,
#catalogos.phase6-admin-workspace > .tabs .tab:focus-visible,
.phase6-search-field input:focus-visible,
.phase6-admin-workspace .btn:focus-visible,
.phase6-admin-workspace input:focus-visible,
.phase6-admin-workspace select:focus-visible,
.phase6-admin-workspace textarea:focus-visible {
  outline: 3px solid var(--phase6-secondary);
  outline-offset: 3px;
}

.phase6-security-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid var(--phase6-border);
  border-radius: 12px;
  background: var(--phase6-surface);
}

.phase6-search-field {
  width: min(480px, 100%);
  color: var(--phase6-ink);
}

.phase6-search-field span {
  font-size: 12px;
}

.phase6-search-field input {
  min-height: 40px;
}

.phase6-search-result {
  color: var(--phase6-muted);
  font-size: 13px;
  text-align: right;
}

.phase6-security-panel,
.phase6-config-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.phase6-panel-context {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--phase6-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--phase6-canvas) 70%, var(--phase6-surface));
}

.phase6-panel-context > div {
  display: grid;
  gap: 6px;
}

.phase6-panel-context h3 {
  margin: 0;
  color: var(--phase6-ink);
  font-size: 16px;
}

.phase6-panel-context p {
  max-width: 70ch;
  margin: 0;
  color: var(--phase6-muted);
  font-size: 13px;
  line-height: 1.45;
}

.phase6-context-status {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--phase6-border);
  border-radius: 999px;
  background: var(--phase6-surface);
  color: var(--phase6-ink);
  font-size: 12px;
  font-weight: 700;
}

.phase6-split-layout {
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 18px;
}

.phase6-admin-form {
  min-height: 0;
  border: 1px solid var(--phase6-border);
  border-radius: 12px;
  background: var(--phase6-surface);
  box-shadow: none;
}

.phase6-split-layout > .phase6-admin-form {
  position: sticky;
  top: 18px;
}

.phase6-admin-form h2 {
  color: var(--phase6-ink);
  font-size: 16px;
}

.phase6-form-help {
  margin: -8px 0 14px;
  color: var(--phase6-muted);
  font-size: 13px;
  line-height: 1.45;
}

.phase6-admin-workspace label {
  color: var(--phase6-ink);
}

.phase6-admin-workspace input,
.phase6-admin-workspace select,
.phase6-admin-workspace textarea {
  border-color: var(--phase6-border);
  background: var(--phase6-surface);
  color: var(--phase6-ink);
}

.phase6-admin-workspace input::placeholder,
.phase6-admin-workspace textarea::placeholder {
  color: var(--phase6-muted);
  opacity: 1;
}

.phase6-admin-table-wrap {
  min-width: 0;
  max-height: 68vh;
  border: 1px solid var(--phase6-border);
  border-radius: 12px;
  background: var(--phase6-surface);
  box-shadow: none;
}

.phase6-admin-table {
  min-width: 980px;
}

.phase6-admin-table th {
  background: var(--phase6-secondary);
  color: var(--brand-on-secondary-safe, #FFFFFF);
  font-size: 12px;
  text-transform: none;
  white-space: nowrap;
}

.phase6-admin-table td {
  color: var(--phase6-muted);
}

.phase6-admin-table tbody tr:hover td {
  background: color-mix(in srgb, var(--phase6-primary) 8%, var(--phase6-surface));
}

.phase6-admin-table .row-actions {
  align-items: stretch;
  gap: 8px;
}

.phase6-admin-table .row-actions .btn {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 12px;
}

.phase6-danger-action {
  border-color: color-mix(in srgb, var(--phase6-error) 45%, var(--phase6-border)) !important;
  color: var(--phase6-error) !important;
}

.phase6-danger-action:hover {
  background: color-mix(in srgb, var(--phase6-error) 10%, var(--phase6-surface)) !important;
}

.phase6-sensitive-action {
  border-color: color-mix(in srgb, var(--phase6-warning) 45%, var(--phase6-border)) !important;
}

.phase6-permission-grid,
#seguridad .role-admin-panel .permission-grid[data-phase6-grouped="true"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.phase6-permission-group {
  min-width: 0;
  border: 1px solid var(--phase6-border);
  border-radius: 12px;
  background: var(--phase6-surface);
}

.phase6-permission-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--phase6-border);
}

.phase6-permission-heading strong {
  color: var(--phase6-ink);
  font-size: 14px;
}

.phase6-permission-heading span {
  color: var(--phase6-muted);
  font-size: 12px;
}

.phase6-permission-list {
  display: grid;
  gap: 0;
}

.phase6-permission-list .check-row {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--phase6-border);
  border-radius: 0;
  background: transparent;
}

.phase6-permission-list .check-row:last-child {
  border-bottom: 0;
}

.phase6-permission-list .check-row:hover,
.phase6-module-option:hover {
  background: color-mix(in srgb, var(--phase6-primary) 8%, var(--phase6-surface));
}

.phase6-policy-form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.phase6-policy-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr)) !important;
  gap: 14px !important;
}

.phase6-requirements-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
  margin: 0;
}

.phase6-config-panel {
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  align-items: start;
}

.phase6-config-panel > .phase6-panel-context {
  grid-column: 1 / -1;
}

.phase6-config-surface {
  min-height: 0;
  border-radius: 12px;
  box-shadow: none;
}

.phase6-branding-form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.phase6-branding-form > h2 {
  margin: 6px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--phase6-border);
}

.phase6-branding-form > .phase6-panel-context + h2 {
  display: none;
}

.phase6-scope-control {
  max-width: 560px;
  padding: 14px;
  border: 1px solid var(--phase6-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--phase6-canvas) 70%, var(--phase6-surface));
}

.phase6-branding-form > .catalog-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.phase6-color-control {
  position: relative;
  grid-template-columns: 1fr auto;
  align-items: end;
}

.phase6-color-control > input[type="color"] {
  grid-column: 1 / -1;
  min-height: 48px;
  padding: 6px;
}

.phase6-color-value {
  color: var(--phase6-muted);
  font-size: 12px;
  font-weight: 700;
}

.phase6-brand-preview {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 128px;
  padding: 18px;
  border: 1px solid var(--phase6-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--company-primary, var(--phase6-primary)) 12%, var(--phase6-surface));
  box-shadow: none;
}

.phase6-brand-preview > div {
  display: grid;
  gap: 6px;
}

.phase6-brand-preview span,
.phase6-brand-preview p {
  color: var(--phase6-muted);
  font-size: 13px;
}

.phase6-brand-preview strong {
  color: var(--phase6-ink);
  font-size: 16px;
}

.phase6-brand-preview p {
  margin: 0;
  line-height: 1.45;
}

.phase6-module-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.phase6-module-option {
  min-height: 52px;
  margin: 0;
  border-radius: 8px;
}

.phase6-save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 -24px -24px;
  padding: 14px 24px;
  border-top: 1px solid var(--phase6-border);
  background: var(--phase6-surface);
  z-index: 3;
}

.phase6-save-bar span {
  color: var(--phase6-muted);
  font-size: 13px;
}

.phase6-save-bar .btn {
  flex: 0 0 auto;
}

.phase6-catalog-meta {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 0;
  overflow-x: auto;
}

.phase6-catalog-meta .catalog-card {
  flex: 1 0 180px;
  min-height: 0;
  border-radius: 12px;
  box-shadow: none;
}

.phase6-catalog-meta .wide-card {
  flex-basis: 320px;
}

.phase6-catalog-filters {
  margin: 0;
  border-radius: 12px;
  box-shadow: none;
}

.phase6-catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid var(--phase6-border);
  border-radius: 12px;
  background: var(--phase6-surface);
}

.phase6-catalog-toolbar > div {
  display: grid;
  gap: 4px;
}

.phase6-catalog-toolbar strong {
  color: var(--phase6-ink);
  font-size: 14px;
}

.phase6-catalog-toolbar span {
  color: var(--phase6-muted);
  font-size: 12px;
}

.phase6-catalog-table-wrap {
  margin: 0;
}

#catalogos.phase6-density-compact .phase6-admin-table th,
#catalogos.phase6-density-compact .phase6-admin-table td {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 12px;
}

.phase6-admin-dialog .phase6-dialog-card {
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.phase6-admin-dialog .dialog-actions {
  position: sticky;
  bottom: 0;
  margin: 18px -22px -22px;
  padding: 14px 22px;
  border-top: 1px solid var(--phase6-border);
  background: var(--phase6-surface);
}

.phase6-admin-workspace .btn[disabled],
.phase6-admin-workspace input[disabled],
.phase6-admin-workspace select[disabled] {
  cursor: not-allowed;
  opacity: .48;
}

@media (max-width: 1100px) {
  .phase6-admin-overview,
  .phase6-security-tools,
  .phase6-panel-context,
  .phase6-catalog-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .phase6-summary-list {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .phase6-summary-item:first-child {
    padding-left: 0;
  }

  .phase6-search-result {
    text-align: left;
  }

  .phase6-split-layout,
  .phase6-config-panel {
    grid-template-columns: 1fr;
  }

  .phase6-split-layout > .phase6-admin-form {
    position: static;
  }

  .phase6-permission-grid,
  #seguridad .role-admin-panel .permission-grid[data-phase6-grouped="true"],
  .phase6-policy-grid,
  .phase6-requirements-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 680px) {
  #seguridad.phase6-admin-workspace,
  #configuracion.phase6-admin-workspace,
  #catalogos.phase6-admin-workspace {
    gap: 14px;
  }

  #seguridad.phase6-admin-workspace > .section-head,
  #configuracion.phase6-admin-workspace > .section-head,
  #catalogos.phase6-admin-workspace > .section-head,
  .phase6-admin-overview,
  .phase6-policy-form,
  .phase6-branding-form {
    padding: 18px;
  }

  .phase6-admin-overview,
  .phase6-security-tools,
  .phase6-panel-context,
  .phase6-catalog-toolbar,
  .phase6-save-bar {
    gap: 14px;
  }

  .phase6-summary-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  .phase6-summary-item {
    min-width: 0;
    padding: 10px 0;
    border-left: 0;
    border-top: 1px solid var(--phase6-border);
  }

  .phase6-summary-item:first-child {
    border-top: 0;
  }

  .phase6-context-status {
    align-self: flex-start;
  }

  .phase6-permission-grid,
  #seguridad .role-admin-panel .permission-grid[data-phase6-grouped="true"],
  .phase6-policy-grid,
  .phase6-requirements-grid,
  .phase6-branding-form > .catalog-form,
  .phase6-module-grid {
    grid-template-columns: 1fr !important;
  }

  .phase6-save-bar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    margin: 0 -18px -18px;
    padding: 14px 18px;
  }

  .phase6-save-bar .btn,
  .phase6-catalog-toolbar .btn,
  .phase6-security-tools .btn {
    width: 100%;
  }

  .phase6-brand-preview {
    align-items: flex-start;
    flex-direction: column;
  }

  .phase6-admin-table {
    min-width: 900px;
  }

  .phase6-admin-dialog .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.phase6-config-panel > *,
.phase6-split-layout > * {
  min-width: 0;
}
