/* ===== PHALANX CONSOLE ===== */
.user-area {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-2);
}
.user-area .clerk-button {
  cursor: pointer;
}

.console {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
}

.auth-card {
  display: flex;
  justify-content: center;
  padding: clamp(2.5rem, 6vw, 5rem) 1rem;
}
.auth-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: clamp(1.2rem, 3vw, 2.5rem);
  max-width: 980px;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.75fr);
  gap: 1.4rem;
  align-items: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.auth-copy {
  text-align: left;
  padding: 0.5rem;
}
.big-shield {
  font-size: 2.6rem;
  color: var(--primary);
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 24px rgba(0, 255, 136, 0.4));
}
.auth-inner h1 {
  font-family: var(--tech);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.05;
  margin-bottom: 0.5rem;
}
.auth-inner p {
  color: var(--text-2);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}
#clerkSignIn {
  display: flex;
  justify-content: center;
  width: 100%;
}
.auth-panel {
  min-width: 0;
  background: rgba(255, 253, 250, 0.82);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}
.auth-logo {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 18px;
  margin: 0 auto 1rem;
}
.auth-terminal {
  margin-top: 1rem;
  background: #0d1117;
  border: 1px solid rgba(255, 103, 17, 0.22);
  border-radius: 12px;
  padding: 1rem;
  display: grid;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
}
.auth-terminal b {
  color: #fff;
  font-weight: 500;
}
.auth-terminal em {
  color: #ffd2bd;
  font-style: normal;
}

.welcome {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.welcome h1 {
  font-family: var(--tech);
  font-size: 2rem;
  margin: 0.5rem 0 0.25rem;
}
.console-logo {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid rgba(16, 24, 32, 0.14);
  box-shadow: 0 18px 46px rgba(16, 24, 32, 0.12);
}

.block {
  margin-bottom: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.6rem 1.6rem 1.4rem;
}
.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.block-head h2 {
  font-family: var(--tech);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
}
.block-head h2 i {
  color: var(--primary);
}

.profile-block {
  overflow: hidden;
  position: relative;
}
.profile-block::after {
  content: "";
  position: absolute;
  inset: auto -10% -55% auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 103, 17, 0.16),
    transparent 64%
  );
  pointer-events: none;
}
.hero-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  perspective: 1100px;
  position: relative;
  z-index: 1;
}
.hero-card {
  min-height: 220px;
  border: 1px solid rgba(16, 24, 32, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.64);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.35rem;
  color: var(--text-1);
  cursor: pointer;
  transform-style: preserve-3d;
  transition:
    transform 0.35s var(--ease),
    border-color 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
  box-shadow: 0 16px 42px rgba(16, 24, 32, 0.06);
}
.hero-card:hover,
.hero-card.active {
  transform: rotateX(7deg) rotateY(-8deg) translateY(-4px);
  border-color: rgba(255, 103, 17, 0.42);
  box-shadow: 0 26px 64px rgba(255, 103, 17, 0.14);
}
.hero-card b {
  font-family: var(--tech);
  font-weight: 400;
  font-size: 1.22rem;
  letter-spacing: 0;
  transform: translateZ(32px);
}
.hero-card small {
  color: var(--text-2);
  line-height: 1.35;
  transform: translateZ(24px);
}
.hero-model {
  width: 92px;
  height: 92px;
  margin-bottom: auto;
  position: relative;
  transform: translateZ(46px);
  filter: drop-shadow(0 24px 26px rgba(16, 24, 32, 0.18));
}
.hero-model::before {
  content: "";
  position: absolute;
  inset: 13px 21px;
  border-radius: 28px 28px 20px 20px;
  background: linear-gradient(145deg, #161d25, #424a50 42%, #ff6711);
  clip-path: polygon(50% 0, 86% 22%, 78% 80%, 50% 100%, 22% 80%, 14% 22%);
}
.hero-model::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  top: 45px;
  height: 12px;
  background: #05070a;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08) inset;
}
.hero-model i {
  position: absolute;
  left: 42px;
  top: 0;
  width: 10px;
  height: 34px;
  border-radius: 999px;
  background: #b91c1c;
  box-shadow:
    -14px 6px 0 -2px #7f1d1d,
    14px 6px 0 -2px #7f1d1d;
}
.hero-model.hoplite::before {
  background: linear-gradient(145deg, #171717, #7c6a43 48%, #d6b36a);
}
.hero-model.hoplite i {
  background: #ff6711;
  box-shadow:
    -13px 6px 0 -2px #ff8200,
    13px 6px 0 -2px #ff8200;
}
.hero-model.oracle::before {
  border-radius: 50%;
  background: radial-gradient(
    circle at 38% 35%,
    #fff,
    #ffb27a 34%,
    #101820 68%
  );
  clip-path: none;
}
.hero-model.oracle::after {
  left: 22px;
  right: 22px;
  top: 39px;
  height: 20px;
  background: radial-gradient(circle, #ff6711 0 28%, transparent 31%), #101820;
}
.hero-model.oracle i {
  display: none;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.inline-form input {
  padding: 0.55rem 0.8rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-1);
  outline: 0;
  min-width: 280px;
}
.inline-form input:focus {
  border-color: var(--primary);
}

.lic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.lic {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  transition: border-color 0.2s;
}
.lic:hover {
  border-color: var(--border-glow);
}
.lic-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.lic-plan {
  font-family: var(--tech);
  font-size: 0.78rem;
  letter-spacing: 2px;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
}
.lic-status {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  letter-spacing: 1px;
}
.lic-status.pending {
  color: #03130a;
  background: var(--warning);
}
.lic-status.active {
  color: #03130a;
  background: var(--success);
}
.lic-status.revoked {
  color: #fff;
  background: var(--danger);
}
.lic-status.expired {
  color: #fff;
  background: var(--text-3);
}
.lic-label {
  font-size: 0.95rem;
  color: var(--text-1);
  font-weight: 600;
}
.lic-machine {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  background: var(--bg-card);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border-left: 2px solid var(--secondary);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.lic-machine span {
  color: var(--text-3);
  font-size: 0.72rem;
}
.lic-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.lic-actions .btn {
  padding: 0.5rem 0.8rem;
  font-size: 0.8rem;
}
.lic-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
}

.sites-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.site-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: var(--bg-2);
  border-radius: 10px;
  border-left: 3px solid var(--primary);
}
.site-row .url {
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--text-1);
}
.site-row .meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
}
.site-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.site-row button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
}
.site-row button:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.site-row button[data-act="remove"]:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 420px;
  overflow: auto;
}
.history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.82rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.history-row b {
  display: block;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-1);
  word-break: break-all;
}
.history-row span,
.history-score small {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 0.2rem;
}
.history-score {
  text-align: right;
  min-width: 160px;
}
.history-score strong {
  display: block;
  font-family: var(--tech);
  font-size: 1.6rem;
  color: var(--primary);
  font-weight: 400;
  line-height: 1;
}
.history-diag {
  margin-top: 0.45rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 999px;
  padding: 0.32rem 0.62rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  cursor: pointer;
}
.history-diag:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.diagnostic-block {
  overflow: hidden;
}
.diag-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.diag-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}
.diag-terminal {
  min-width: 0;
  background: #0d1117;
  border: 1px solid rgba(255, 103, 17, 0.22);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.diag-terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.62rem 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.diag-terminal-bar span {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  background: #ff5f56;
}
.diag-terminal-bar span:nth-child(2) {
  background: #ffbd2e;
}
.diag-terminal-bar span:nth-child(3) {
  background: #27c93f;
}
.diag-terminal-bar b {
  margin-left: 0.25rem;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
}
.diag-terminal pre {
  min-height: 280px;
  max-height: 390px;
  overflow: auto;
  margin: 0;
  padding: 1rem;
  color: #d6e8d3;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.diagnostic-brief {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
}
.diagnostic-brief h3 {
  margin: 0 0 0.6rem;
  font-family: var(--tech);
  font-size: 1rem;
  color: var(--text-1);
}
.diagnostic-brief p {
  margin: 0 0 0.55rem;
  color: var(--text-2);
  line-height: 1.6;
}
.diag-note {
  margin-top: 0.75rem;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}
.alert-row {
  display: flex;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-2);
  border-radius: 10px;
  border-left: 3px solid var(--primary);
  font-size: 0.86rem;
}
.alert-row.WARNING {
  border-left-color: var(--warning);
}
.alert-row.CRITICAL {
  border-left-color: var(--danger);
}
.alert-row .when {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-3);
  min-width: 120px;
}
.alert-row .body {
  flex: 1;
  color: var(--text-2);
}
.alert-row .body b {
  color: var(--text-1);
  display: block;
  margin-bottom: 0.15rem;
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  position: relative;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-size: 1rem;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--danger);
}
.modal h3 {
  font-family: var(--tech);
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
.modal label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.modal label span {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-3);
}
.modal input,
.modal select {
  padding: 0.7rem 0.9rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-1);
  outline: 0;
}
.modal input:focus,
.modal select:focus {
  border-color: var(--primary);
}
.modal .token-display {
  padding: 1rem;
  background: var(--bg-0);
  border: 1px dashed var(--primary);
  border-radius: 10px;
  font-family: var(--mono);
  text-align: center;
  font-size: 1.1rem;
  color: var(--primary);
  margin: 1rem 0;
  letter-spacing: 1px;
  word-break: break-all;
  cursor: pointer;
}
.modal .copy-hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
  text-align: center;
  margin-bottom: 1rem;
}
.modal .actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .welcome {
    flex-direction: column;
    align-items: flex-start;
  }
  .console-logo {
    width: 64px;
    height: 64px;
  }
  .hero-picker {
    grid-template-columns: 1fr;
  }
  .inline-form {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .inline-form input {
    flex: 1;
    min-width: 0;
    width: 100%;
  }
  .inline-form .btn,
  .inline-form button {
    width: 100%;
    justify-content: center;
  }
  .block-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .diag-grid {
    grid-template-columns: 1fr;
  }
  .diag-actions {
    width: 100%;
  }
  .diag-actions .btn {
    flex: 1;
    justify-content: center;
  }
  .site-row,
  .history-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .history-score {
    text-align: left;
  }
  .auth-inner {
    grid-template-columns: 1fr;
  }
  .auth-copy {
    text-align: center;
  }
}
