.gate-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  margin-bottom: 22px;
  padding: 34px;
  border: 1px solid #513061;
  border-radius: 18px;
  background:
    radial-gradient(
      circle at 85% 20%,
      rgba(238,77,255,.17),
      transparent 34%
    ),
    radial-gradient(
      circle at 65% 100%,
      rgba(143,92,255,.16),
      transparent 40%
    ),
    #100a16;
}

.gate-hero h1 {
  margin: 5px 0 9px;
  font-size: 42px;
  letter-spacing: -.04em;
}

.gate-hero p {
  color: #a99ab5;
}

.gate-eyebrow {
  color: #ee4dff !important;
}

.gate-hero-mark {
  font-size: 54px;
  font-weight: 900;
  letter-spacing: .08em;
  color: rgba(238,77,255,.13);
}

.gate-heading {
  margin-bottom: 22px;
}

.gate-heading h2 {
  margin-top: 4px;
}

.gate-workspace-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
}

.gate-standard-policy,
.gate-policy-card {
  padding: 17px;
  border: 1px solid #3c2748;
  border-radius: 12px;
  background: #0c0810;
}

.gate-standard-policy,
.gate-policy-card-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.gate-standard-policy strong,
.gate-policy-card strong {
  display: block;
}

.gate-standard-policy span,
.gate-policy-card-header div > span {
  display: block;
  margin-top: 4px;
  color: #9586a1;
  font-size: 12px;
}

.gate-policy-list {
  display: grid;
  gap: 11px;
  margin-top: 11px;
}

.gate-policy-state {
  flex: none;
  padding: 5px 8px;
  border: 1px solid #513061;
  border-radius: 999px;
  color: #d8b6ff !important;
  background: #180d20;
  font-size: 11px !important;
}

.gate-policy-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.gate-policy-rules span {
  padding: 6px 8px;
  border-radius: 7px;
  background: #1b1022;
  color: #bda7cc;
  font-size: 11px;
}

.gate-rule-picker {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid #392448;
  border-radius: 10px;
}

.gate-rule-picker legend {
  padding: 0 6px;
  color: #b8a9c4;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
}

.gate-rule-picker label,
.gate-enabled {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #d9cce2;
  font-size: 13px;
}

.gate-rule-picker input,
.gate-enabled input {
  accent-color: #ee4dff;
}

.gate-decision-panel {
  border-color: #513061;
}

.gate-decision-badge {
  padding: 8px 12px;
  border: 1px solid #513061;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
}

.gate-allow {
  border-color: #7654a8;
  background: rgba(143,92,255,.13);
  color: #d8b6ff;
}

.gate-block {
  border-color: #a34f79;
  background: rgba(238,77,255,.11);
  color: #ffb8e8;
}

.gate-metrics {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.gate-metric {
  padding: 15px;
  border: 1px solid #34213e;
  border-radius: 11px;
  background: #0c0810;
}

.gate-metric small {
  display: block;
  color: #8f7d9c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

.gate-metric strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.gate-rules {
  display: grid;
  gap: 10px;
}

.gate-rule {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 15px;
  border: 1px solid #382343;
  border-radius: 11px;
  background: #0c0810;
}

.gate-rule-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #1d1125;
  color: #d8b6ff;
  font-weight: 900;
}

.gate-rule-result {
  margin-left: 8px;
  color: #ee4dff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

.gate-rule p {
  margin: 6px 0 0;
  color: #9586a1;
  font-size: 12px;
}

.gate-explanation {
  margin-top: 18px;
  padding: 16px;
  border-left: 2px solid #ee4dff;
  background: rgba(238,77,255,.04);
}

.gate-explanation small {
  color: #b8a9c4;
  font-weight: 800;
}

.gate-explanation p {
  margin: 7px 0 0;
}

.gate-scope,
.gate-disclaimer {
  color: #8e7e9a;
  font-size: 12px;
  line-height: 1.6;
}

.gate-scope {
  margin-top: 16px;
}

.gate-disclaimer {
  margin: 18px 2px 0;
}

@media(max-width:900px) {
  .gate-workspace-grid,
  .gate-metrics {
    grid-template-columns: 1fr;
  }

  .gate-hero {
    align-items: flex-start;
  }

  .gate-hero-mark {
    display: none;
  }
}

/* Gate primary action */
#policy-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  border: 1px solid rgba(238, 77, 255, 0.45);
  border-radius: 12px;
  background:
    linear-gradient(
      135deg,
      #7c4dff 0%,
      #b54cff 52%,
      #ee4dff 100%
    );
  box-shadow:
    0 8px 24px rgba(181, 76, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

#policy-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    0 11px 30px rgba(181, 76, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

#policy-submit:active:not(:disabled) {
  transform: translateY(0);
}

#policy-submit:focus-visible {
  outline: 2px solid #f3b4ff;
  outline-offset: 3px;
}

#policy-submit:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

/* Advanced Policy Builder */

.gate-builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gate-builder-grid select,
#policy-description {
  width: 100%;
  box-sizing: border-box;
}

#policy-description {
  width: 100%;
  min-height: 110px;
  padding: 13px 14px;
  box-sizing: border-box;
  resize: vertical;

  border: 1px solid rgba(209, 137, 255, 0.25);
  border-radius: 12px;

  background:
    linear-gradient(
      145deg,
      rgba(25, 13, 34, 0.92),
      rgba(10, 5, 16, 0.88)
    );

  color: #ffffff;
  font: inherit;
  line-height: 1.55;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    0 8px 28px rgba(0, 0, 0, 0.14);

  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

#policy-description::placeholder {
  color: rgba(220, 203, 231, 0.48);
}

#policy-description:hover {
  border-color: rgba(218, 145, 255, 0.42);
}

#policy-description:focus {
  outline: none;
  border-color: rgba(238, 77, 255, 0.72);

  background:
    linear-gradient(
      145deg,
      rgba(31, 15, 42, 0.96),
      rgba(12, 6, 19, 0.94)
    );

  box-shadow:
    0 0 0 3px rgba(190, 88, 255, 0.12),
    0 12px 32px rgba(134, 54, 190, 0.15);
}

.gate-field-help {
  display: block;
  margin-top: 6px;
  color: #8f7d9c;
  font-size: 11px;
  line-height: 1.45;
}

.gate-builder-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid #392448;
  border-radius: 10px;
  background: rgba(238, 77, 255, .025);
}

.gate-builder-section strong {
  display: block;
  color: #e7d9ee;
  font-size: 13px;
}

.gate-builder-section div > span {
  display: block;
  margin-top: 4px;
  color: #9586a1;
  font-size: 11px;
  line-height: 1.45;
}

.gate-builder-count {
  flex: none;
  padding: 5px 8px;
  border: 1px solid #513061;
  border-radius: 999px;
  background: #180d20;
  color: #d8b6ff;
  font-size: 10px;
  font-weight: 800;
}

.gate-policy-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.gate-policy-metadata span {
  padding: 5px 8px;
  border: 1px solid #392448;
  border-radius: 999px;
  color: #a996b7;
  font-size: 10px;
}

.gate-policy-description {
  margin: 12px 0 0;
  color: #b8a9c4;
  font-size: 12px;
  line-height: 1.55;
}

.gate-policy-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.gate-policy-tags span {
  color: #d8b6ff;
  font-size: 10px;
  font-weight: 700;
}

.gate-policy-change {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid #2d1c36;
  color: #8f7d9c;
  font-size: 11px;
  line-height: 1.5;
}

@media(max-width:900px) {
  .gate-builder-grid {
    grid-template-columns: 1fr;
  }

  .gate-builder-section {
    flex-direction: column;
  }
}
