:root {
  --bg: #f5f8fb;
  --card: #ffffff;
  --ink: #1a2b3b;
  --muted: #607286;
  --brand: #0f6bb5;
  --brand-2: #0b4c82;
  --ok: #117a3f;
  --warn: #9a5a00;
  --danger: #b42318;
  --border: #d9e3ee;
  --shadow: 0 10px 24px rgba(13, 35, 67, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.dashboard-page {
  max-width: 1320px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--brand-2);
  letter-spacing: 0.2px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(22, 98, 162, 0.24));
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

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

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

.title {
  margin: 4px 0 14px;
  font-size: 24px;
  line-height: 1.2;
}

.subtitle {
  margin: 0 0 14px;
  color: var(--muted);
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 107, 181, 0.25);
  border-color: var(--brand);
}

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

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

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

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

.dashboard-shortcuts {
  align-items: center;
}

.dashboard-shortcuts .button,
.dashboard-shortcuts button {
  padding: 7px 10px;
  font-size: 12px;
}

#active-account-quick-select {
  min-width: 260px;
}

button,
.button {
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

button.secondary,
.button.secondary {
  background: #fff;
  color: var(--brand-2);
  border-color: var(--border);
}

button.warn {
  background: #fff6ec;
  border-color: #f4d7a8;
  color: var(--warn);
}

button.danger {
  background: #fff1f1;
  border-color: #f7c3c3;
  color: var(--danger);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  margin-top: 8px;
  font-size: 13px;
}

.status.ok {
  color: var(--ok);
}

.status.error {
  color: var(--danger);
}

.warn-text {
  color: var(--warn);
  font-weight: 600;
}

.ok-text {
  color: var(--ok);
  font-weight: 600;
}

.error-text {
  color: var(--danger);
  font-weight: 600;
}

.card-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.pill {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  background: #f7fbff;
  color: var(--brand-2);
}

.readiness-pill {
  min-width: 58px;
  text-align: center;
  font-weight: 700;
}

.readiness-ok {
  background: #eefbf3;
  border-color: #bee9cc;
  color: var(--ok);
}

.readiness-warn {
  background: #fff6ec;
  border-color: #f4d7a8;
  color: var(--warn);
}

.readiness-error {
  background: #fff1f1;
  border-color: #f7c3c3;
  color: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 8px 6px;
  vertical-align: top;
}

#hq-section table th,
#hq-section table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

#hq-section .mono,
#hq-section .status-panel {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.audit-table {
  table-layout: fixed;
}

.audit-table th,
.audit-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1) {
  width: 14%;
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
  width: 14%;
}

.audit-table th:nth-child(3),
.audit-table td:nth-child(3) {
  width: 21%;
}

.audit-table th:nth-child(4),
.audit-table td:nth-child(4) {
  width: 19%;
}

.audit-table th:nth-child(5),
.audit-table td:nth-child(5) {
  width: 32%;
}

.simulator-date-row td {
  background: #f3f8ff;
  color: var(--brand-2);
  font-weight: 700;
  border-top: 1px solid #d5e4f5;
}

.table-scroll {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.table-scroll table {
  margin: 0;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7fbff;
}

.hq-directory-scroll {
  max-height: 460px;
}

.hq-env-catalog-scroll {
  max-height: 360px;
}

.compact-scroll {
  max-height: 280px;
}

.simulator-scroll {
  max-height: 420px;
}

.advanced-panel.is-collapsed {
  display: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.status-active {
  color: var(--ok);
  background: #eefbf3;
  border: 1px solid #bee9cc;
}

.status-badge.status-disabled {
  color: var(--danger);
  background: #fff1f1;
  border: 1px solid #f7c3c3;
}

.subpanel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f8fbff;
}

.hq-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #f7fbff;
}

.kpi-value {
  margin: 5px 0 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-2);
}

.sub-title {
  margin: 0 0 10px;
  font-size: 15px;
}

.expandable summary {
  cursor: pointer;
  list-style: none;
}

.expandable summary::-webkit-details-marker {
  display: none;
}

.expandable summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
}

.expandable:not([open]) summary::after {
  content: "▸";
}

.detail-help {
  margin-bottom: 10px;
}

.compact-grid input,
.compact-grid select {
  padding-top: 8px;
  padding-bottom: 8px;
}

.checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 0;
  color: var(--ink);
  font-size: 13px;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.compact-check {
  margin-top: 8px;
  font-size: 12px;
}

.status-panel {
  margin: 10px 0 0;
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  color: var(--brand-2);
}

.row-selected td {
  background: #eef7ff;
}

.danger-zone {
  margin-top: 10px;
  border: 1px solid #f7c3c3;
  background: #fff8f8;
  border-radius: 10px;
  padding: 10px;
}

.danger-zone summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--danger);
}

.danger-zone .meta {
  margin: 8px 0;
}

@media (max-width: 920px) {
  .grid,
  .grid-3,
  .row,
  .row-2,
  .row-3 {
    grid-template-columns: 1fr;
  }

  #active-account-quick-select {
    min-width: 0;
    width: 100%;
  }

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

/* Login page only */
.login-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: #122840;
  background:
    radial-gradient(circle at 12% 12%, rgba(94, 190, 255, 0.35) 0, transparent 45%),
    radial-gradient(circle at 88% 88%, rgba(108, 255, 198, 0.3) 0, transparent 42%),
    radial-gradient(circle at 72% 18%, rgba(66, 112, 255, 0.2) 0, transparent 52%),
    linear-gradient(160deg, #f2f7ff 0%, #eaf3ff 50%, #e8f8f0 100%);
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
}

.login-card {
  position: relative;
  width: min(500px, 100%);
  border-radius: 24px;
  border: 1px solid #c6d8ea;
  background: #ffffff;
  box-shadow:
    0 28px 72px rgba(15, 38, 70, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
  animation: login-card-rise 320ms ease-out;
}

.login-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, #0f7ac6, #1a9cb6 45%, #44b879);
}

.login-form-panel {
  padding: 34px 32px 28px;
}

.login-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter:
    drop-shadow(0 10px 18px rgba(20, 87, 153, 0.24))
    drop-shadow(0 0 8px rgba(82, 171, 239, 0.2));
}

.login-heading-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 6px;
}

.login-heading h1 {
  margin: 1px 0 0;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 48px;
  line-height: 1;
  color: #102a45;
}

.login-eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: #496884;
  font-weight: 700;
}

.login-subtitle {
  margin: 12px 0 20px;
  color: #4f6982;
  font-size: 16px;
  line-height: 1.3;
}

.login-field {
  margin-bottom: 15px;
}

.login-field label {
  margin-bottom: 7px;
  font-size: 14px;
  color: #3f5d7a;
  font-weight: 600;
}

.login-form-panel input {
  border-radius: 13px;
  border: 1px solid #c2d4e8;
  background: #f8fbff;
  min-height: 48px;
  padding: 11px 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.login-form-panel input:focus {
  background: #ffffff;
  border-color: #1a7ccc;
  box-shadow: 0 0 0 4px rgba(22, 123, 204, 0.15);
  outline: none;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 72px;
}

.toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 56px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
  border: 1px solid #bccfe3;
  background: linear-gradient(180deg, #ffffff, #edf4fc);
  color: #1e4f79;
}

.toggle-password:hover {
  border-color: #9eb8d3;
  background: #ffffff;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 20px;
}

.remember-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #465f78;
  margin: 0;
}

.remember-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #0f7bc8;
}

.forgot-link {
  font-size: 13px;
  font-weight: 600;
  color: #0b679f;
  text-decoration: none;
}

.forgot-link:hover {
  text-decoration: underline;
}

.login-submit {
  width: 100%;
  min-height: 48px;
  border-radius: 13px;
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(120deg, #0d76c1, #2287c4 38%, #2ca17d 70%, #40b26f 100%);
  box-shadow: 0 12px 24px rgba(16, 117, 173, 0.3);
  transition: transform 140ms ease, box-shadow 160ms ease, filter 140ms ease;
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(15, 111, 171, 0.34);
  filter: brightness(1.02);
}

.login-submit:active {
  transform: translateY(0);
  box-shadow: 0 10px 20px rgba(15, 111, 171, 0.3);
}

.login-footnote {
  margin-top: 18px;
  font-size: 13px;
  color: #4f6780;
  line-height: 1.45;
}

.login-footnote a {
  color: #0d6da8;
  text-decoration: none;
  font-weight: 600;
}

.login-footnote a:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .login-form-panel {
    padding: 26px 20px 20px;
  }

  .login-heading h1 {
    font-size: 38px;
  }

  .login-subtitle {
    font-size: 15px;
  }

  .login-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@keyframes login-card-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Signup page */
.signup-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 16px 38px;
}

.signup-card {
  width: min(1020px, 100%);
  border: 1px solid rgba(149, 174, 202, 0.48);
  border-radius: 24px;
  background: #ffffff;
  box-shadow:
    0 26px 64px rgba(14, 40, 70, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  padding: 30px;
}

.signup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.signup-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.signup-brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter:
    drop-shadow(0 10px 18px rgba(20, 87, 153, 0.24))
    drop-shadow(0 0 8px rgba(82, 171, 239, 0.2));
}

.signup-header h1 {
  margin: 0 0 8px;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 33px;
  line-height: 1.15;
  color: #0f2b43;
}

.signup-header p {
  margin: 0;
  color: #5d7187;
}

.signup-login-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid #bcd0e5;
  border-radius: 12px;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 600;
  color: #1f4f74;
  background: linear-gradient(180deg, #ffffff, #eef5fd);
}

.signup-login-link:hover {
  border-color: #9fbbd8;
}

.signup-form {
  display: grid;
  gap: 14px;
}

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

.signup-field label {
  display: block;
  margin-bottom: 6px;
}

.signup-panel {
  border: 1px solid #d3e2ef;
  border-radius: 14px;
  padding: 14px;
  background: #f9fcff;
}

.signup-panel h2 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #143a5b;
}

.signup-panel p {
  margin: 0 0 10px;
  color: #61758b;
  font-size: 13px;
}

.signup-success {
  margin-top: 16px;
  border: 1px solid #d3e2ef;
  border-radius: 14px;
  padding: 16px;
  background: #f9fcff;
}

.signup-success h2 {
  margin: 0 0 8px;
  font-size: 22px;
  color: #143a5b;
}

.signup-success p {
  margin: 0 0 14px;
  color: #607487;
}

.signup-credentials {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.signup-credential-item {
  border: 1px solid #d4e2f0;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.signup-credential-item label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #5d7187;
}

.signup-credential-item code {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  color: #0f2b43;
}

.signup-code {
  margin: 0 0 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #d4e2f0;
  background: #fff;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .signup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .signup-credentials {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .signup-header {
    flex-direction: column;
  }

  .signup-grid {
    grid-template-columns: 1fr;
  }
}
