.topbar-security-alert {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #91a5c2;
  border: 1px solid rgba(148, 163, 184, .15);
  border-radius: 50%;
  background: rgba(6, 12, 23, .52);
  cursor: pointer;
}

.topbar-security-alert:hover,
.topbar-security-alert.has-alerts {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, .42);
  background: rgba(190, 24, 93, .12);
}

.topbar-security-alert > span {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  color: #fff;
  border: 2px solid #080f1c;
  border-radius: 9px;
  background: #e11d48;
  font-size: 9px;
  font-weight: 800;
}

.security-alert-banner {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 72px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(52, 211, 153, .22);
  border-radius: 7px;
  background: rgba(5, 34, 30, .34);
  box-shadow: inset 3px 0 #34d399;
}

.security-alert-banner.is-high {
  border-color: rgba(251, 146, 60, .3);
  background: rgba(67, 29, 8, .32);
  box-shadow: inset 3px 0 #fb923c;
}

.security-alert-banner.is-critical,
.security-alert-banner.is-error {
  border-color: rgba(251, 113, 133, .34);
  background: rgba(72, 13, 30, .34);
  box-shadow: inset 3px 0 #f43f5e;
}

.security-alert-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, .24);
  border-radius: 50%;
  background: rgba(5, 150, 105, .1);
}

.is-high .security-alert-icon {
  color: #fdba74;
  border-color: rgba(251, 146, 60, .3);
  background: rgba(234, 88, 12, .12);
}

.is-critical .security-alert-icon,
.is-error .security-alert-icon {
  color: #fda4af;
  border-color: rgba(251, 113, 133, .32);
  background: rgba(225, 29, 72, .12);
  animation: security-alert-pulse 1.7s ease-in-out infinite;
}

@keyframes security-alert-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
  50% { box-shadow: 0 0 0 7px rgba(244, 63, 94, .1); }
}

.security-alert-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.security-alert-copy > span {
  color: #6ee7b7;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.is-high .security-alert-copy > span { color: #fdba74; }
.is-critical .security-alert-copy > span,
.is-error .security-alert-copy > span { color: #fda4af; }

.security-alert-copy strong {
  overflow: hidden;
  color: #edf5ff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-alert-copy small {
  overflow: hidden;
  color: #7f90a9;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-alert-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.security-alert-actions button {
  min-height: 34px;
}

.security-notification-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: #9cafc9;
  border: 1px solid rgba(148, 163, 184, .17);
  border-radius: 6px;
  background: rgba(6, 12, 23, .56);
  cursor: pointer;
}

.security-notification-toggle.is-enabled {
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, .3);
}

.security-clear-alerts {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  color: #fecdd3;
  border: 1px solid rgba(251, 113, 133, .3);
  border-radius: 6px;
  background: rgba(159, 18, 57, .15);
  cursor: pointer;
}

.security-clear-alerts:hover:not(:disabled) {
  color: #fff1f2;
  border-color: rgba(251, 113, 133, .58);
  background: rgba(190, 24, 93, .25);
}

.security-clear-alerts:disabled {
  opacity: .38;
  cursor: default;
}

.security-center {
  position: relative;
  overflow: visible;
  margin-bottom: 22px;
  border-color: rgba(82, 143, 242, .22);
  background: linear-gradient(145deg, rgba(13, 23, 42, .86), rgba(9, 16, 30, .78));
}

/* The admin security table is the widest surface on the page. Keep its full
   action column reachable on desktop instead of clipping it at the old card
   width. */
.admin-workspace {
  width: min(1680px, calc(100% - 48px));
  max-width: none;
}

.security-center::before {
  position: absolute;
  width: 420px;
  height: 240px;
  top: -150px;
  right: -80px;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, rgba(59, 130, 246, .16), transparent 68%);
}

.security-head,
.security-title,
.security-toolbar,
.security-subhead,
.security-ban-row,
.security-actions {
  display: flex;
  align-items: center;
}

.security-head {
  position: relative;
  justify-content: space-between;
  gap: 18px;
  padding: 21px 22px 17px;
}

.security-title {
  gap: 12px;
}

.security-title h2,
.security-subhead h3 {
  margin: 0;
  color: #eaf1ff;
}

.security-title h2 {
  font-size: 18px;
}

.security-title p,
.security-subhead p {
  margin: 4px 0 0;
  color: #788aa7;
  font-size: 12px;
}

.security-emblem {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #7db4ff;
  border: 1px solid rgba(96, 165, 250, .34);
  border-radius: 12px;
  background: rgba(37, 99, 235, .12);
  box-shadow: 0 0 22px rgba(59, 130, 246, .12);
}

.security-sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  color: #8ea0ba;
  border: 1px solid rgba(125, 211, 252, .13);
  border-radius: 999px;
  background: rgba(6, 12, 24, .46);
  font-size: 10px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.security-sync span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, .1);
}

.security-sync.synced span {
  background: #34d399;
  box-shadow: 0 0 9px rgba(52, 211, 153, .6);
}

.security-sync.pending span,
.security-sync.local-only span {
  background: #fbbf24;
  box-shadow: 0 0 9px rgba(251, 191, 36, .5);
}

.security-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 22px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, .11);
  border-radius: 12px;
  background: rgba(148, 163, 184, .08);
}

.security-metrics > div {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 16px;
  background: rgba(8, 15, 28, .82);
}

.security-metrics span {
  color: #70819a;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.security-metrics strong {
  color: #dce9ff;
  font-size: 21px;
}

.security-toolbar {
  align-items: end;
  gap: 10px;
  padding: 18px 22px;
}

.security-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 126px;
}

.security-toolbar label > span {
  color: #6f819d;
  font-size: 10px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.security-toolbar select,
.security-toolbar input {
  height: 37px;
  color: #d5e2f6;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 9px;
  outline: none;
  background: rgba(5, 11, 22, .68);
}

.security-toolbar select {
  padding: 0 30px 0 11px;
}

.security-toolbar input {
  width: 100%;
  padding: 0 12px;
}

.security-toolbar select:focus,
.security-toolbar input:focus {
  border-color: rgba(96, 165, 250, .58);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}

.security-search {
  flex: 1;
}

.security-toolbar .ghost {
  height: 37px;
}

.security-ban-panel {
  margin: 0 22px 18px;
  overflow: hidden;
  border: 1px solid rgba(248, 113, 113, .14);
  border-radius: 12px;
  background: rgba(48, 14, 21, .16);
}

.security-subhead {
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid rgba(248, 113, 113, .1);
}

.security-subhead h3 {
  font-size: 13px;
}

.security-subhead > span {
  color: #fda4af;
  font-size: 11px;
}

.security-ban-list {
  display: grid;
}

.security-ban-row {
  justify-content: space-between;
  gap: 15px;
  padding: 11px 15px;
  border-top: 1px solid rgba(148, 163, 184, .08);
}

.security-ban-row:first-child {
  border-top: 0;
}

.security-ban-address {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.security-ban-address strong {
  color: #f5dce2;
  font: 600 12px ui-monospace, SFMono-Regular, Consolas, monospace;
}

.security-ban-address span {
  color: #937886;
  font-size: 11px;
}

.security-unban {
  min-height: 30px;
  padding: 0 10px;
  color: #ffd9df;
  border: 1px solid rgba(251, 113, 133, .28);
  border-radius: 8px;
  background: rgba(190, 24, 93, .11);
  cursor: pointer;
}

.security-unban:hover {
  border-color: rgba(251, 113, 133, .55);
  background: rgba(190, 24, 93, .19);
}

.security-table-wrap {
  margin: 0 22px 22px;
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, .1);
  border-radius: 12px;
}

.security-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 11px;
}

.security-table th {
  padding: 10px 12px;
  color: #657691;
  background: rgba(5, 11, 22, .64);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-align: left;
  text-transform: uppercase;
}

.security-table td {
  padding: 11px 12px;
  color: #a7b6cd;
  border-top: 1px solid rgba(148, 163, 184, .08);
  vertical-align: middle;
}

.security-table tr:hover td {
  background: rgba(59, 130, 246, .035);
}

.security-risk,
.security-state {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.security-risk.info { color: #93c5fd; border-color: rgba(96, 165, 250, .22); background: rgba(37, 99, 235, .1); }
.security-risk.low { color: #6ee7b7; border-color: rgba(52, 211, 153, .2); background: rgba(5, 150, 105, .09); }
.security-risk.medium { color: #fde68a; border-color: rgba(251, 191, 36, .22); background: rgba(217, 119, 6, .09); }
.security-risk.high { color: #fdba74; border-color: rgba(251, 146, 60, .25); background: rgba(234, 88, 12, .1); }
.security-risk.critical { color: #fda4af; border-color: rgba(251, 113, 133, .28); background: rgba(225, 29, 72, .11); }

.security-state { color: #8496b1; border-color: rgba(148, 163, 184, .14); background: rgba(71, 85, 105, .09); }
.security-state.open { color: #fda4af; border-color: rgba(251, 113, 133, .23); }
.security-state.reviewed { color: #fde68a; border-color: rgba(251, 191, 36, .2); }
.security-state.resolved { color: #6ee7b7; border-color: rgba(52, 211, 153, .2); }

.security-event-name {
  color: #d8e5f8;
  font-weight: 600;
}

.security-event-detail {
  display: block;
  max-width: 260px;
  margin-top: 3px;
  overflow: hidden;
  color: #687a95;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-ip {
  color: #a8c7f5;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.security-actions {
  gap: 6px;
}

.security-table th:last-child,
.security-table td:last-child {
  position: sticky;
  right: 0;
  border-left: 1px solid rgba(96, 165, 250, .08);
  background: linear-gradient(90deg, rgba(17, 31, 52, .72), rgba(22, 41, 68, .84));
  box-shadow: -8px 0 18px rgba(4, 9, 18, .16);
  backdrop-filter: blur(14px);
  z-index: 1;
}

.security-table th:last-child {
  color: #8296b5;
  background: linear-gradient(90deg, rgba(20, 37, 62, .82), rgba(27, 49, 80, .9));
}

.security-table tr:hover td:last-child {
  background: linear-gradient(90deg, rgba(25, 46, 75, .8), rgba(31, 57, 91, .9));
}

.security-action {
  min-height: 27px;
  padding: 0 8px;
  color: #91a5c2;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 7px;
  background: rgba(15, 23, 42, .54);
  cursor: pointer;
}

.security-action:hover {
  color: #dbeafe;
  border-color: rgba(96, 165, 250, .38);
}

.security-empty {
  padding: 20px !important;
  color: #65758e !important;
  text-align: center !important;
}

@media (max-width: 820px) {
  .admin-workspace { width: min(100% - 20px, 1680px); }
  .security-alert-banner {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .security-alert-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .security-head,
  .security-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .security-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .security-toolbar label,
  .security-toolbar .ghost {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .security-alert-banner {
    align-items: start;
  }

  .security-alert-copy strong,
  .security-alert-copy small {
    white-space: normal;
  }

  .security-alert-actions {
    justify-content: stretch;
  }

  .security-alert-actions button {
    flex: 1;
  }

  .security-head { padding: 17px 15px 14px; }
  .security-metrics,
  .security-ban-panel,
  .security-table-wrap { margin-right: 15px; margin-left: 15px; }
  .security-toolbar { padding: 15px; }
  .security-title p { line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  .is-critical .security-alert-icon,
  .is-error .security-alert-icon {
    animation: none;
  }
}
