.policy-page {
  min-height: calc(100vh - 58px);
  padding: 20px;
  background: #f3f6f7;
}

.policy-header,
.policy-panel,
.policy-kpis > div,
.policy-section,
.policy-tab-panel,
.policy-raw {
  border: 1px solid #dfe8ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(28, 45, 56, .05);
}

.policy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.policy-header h2 {
  margin: 0;
  color: #22313f;
  font-size: 24px;
  font-weight: 900;
}

.policy-header p,
.policy-panel p,
.section-head span,
.modal-subtitle {
  margin: 4px 0 0;
  color: #647681;
  font-size: 13px;
}

.policy-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.policy-actions select {
  width: 190px;
}

.policy-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.policy-kpis > div {
  padding: 13px;
}

.policy-kpis span,
.policy-kpis strong {
  display: block;
}

.policy-kpis span {
  color: #647681;
  font-size: 13px;
}

.policy-kpis strong {
  margin-top: 4px;
  color: #22313f;
  font-size: 25px;
}

.policy-panel {
  padding: 16px;
}

.policy-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.policy-panel-head h3,
.section-head h6 {
  margin: 0;
  color: #26333b;
  font-size: 17px;
  font-weight: 900;
}

.policy-panel-head input {
  max-width: 320px;
}

.policy-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

.policy-card {
  border: 1px solid #dfe8ec;
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

.policy-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.policy-card h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}

.policy-card small {
  color: #647681;
}

.policy-card p {
  min-height: 38px;
  margin: 10px 0 0;
}

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

.policy-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 8px;
  background: #e7f5f2;
  color: #197465;
  font-size: 12px;
  font-weight: 800;
}

.policy-chip.neutral {
  background: #ecf4fb;
  color: #285f91;
}

.policy-chip.off {
  background: #eef2f6;
  color: #465b69;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 26px;
  color: #647681;
  text-align: center;
}

.policy-modal .modal-header {
  align-items: flex-start;
}

.policy-modal .modal-title {
  margin: 0;
  color: #22313f;
  font-weight: 900;
}

#policyModal .modal-dialog {
  max-width: 1060px;
}

#policyModal .modal-body {
  padding: 14px;
}

.policy-section,
.policy-tab-panel,
.policy-raw {
  padding: 14px;
  margin-bottom: 14px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.policy-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.policy-form-grid label span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: #40545e;
  font-size: 13px;
  font-weight: 900;
}

.policy-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid #b8c7d0;
  border-radius: 50%;
  background: #f7fbfd;
  color: #2f6478;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.policy-help-icon:hover,
.policy-help-icon:focus {
  border-color: #168c78;
  background: #e7f5f2;
  color: #126b5c;
  outline: none;
}

.tooltip {
  --bs-tooltip-max-width: 320px;
  --bs-tooltip-bg: #172331;
  --bs-tooltip-opacity: 1;
  font-family: inherit;
}

.tooltip-inner {
  padding: 8px 10px;
  line-height: 1.6;
  text-align: start;
}

.policy-span-2 {
  grid-column: span 2;
}

.policy-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d8e2e7;
  border-radius: 8px;
  background: #fff;
}

.policy-check span {
  margin: 0 !important;
}

.policy-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 15px 0 10px;
}

.policy-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #d3dfe4;
  border-radius: 8px;
  background: #fff;
  color: #40545e;
  font-size: 13px;
  font-weight: 900;
}

.policy-tabs button.active {
  border-color: #168c78;
  background: #e7f5f2;
  color: #126b5c;
}

.policy-tab-panel {
  display: none;
}

.policy-tab-panel.active {
  display: block;
}

.policy-json {
  direction: ltr;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
}

@media (max-width: 900px) {
  .policy-header,
  .policy-panel-head,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .policy-kpis,
  .policy-form-grid {
    grid-template-columns: 1fr;
  }

  .policy-span-2 {
    grid-column: auto;
  }

  .policy-panel-head input {
    max-width: none;
  }

  #policyModal .modal-dialog {
    width: calc(100vw - 20px);
    max-width: none;
    margin: 10px auto;
  }
}
