/* SaaS dashboard additions on top of admin.css */
.hidden { display: none !important; }

#login-panel {
  max-width: 480px;
  margin: 12vh auto 3rem;
  padding: var(--space-lg);
  background: var(--surface-card);
  border: 3px solid #1a140f;
  border-radius: 0;
  box-shadow: 6px 6px 0 #1a140f;
}

#login-panel h2 {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
}

.login-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.login-google {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--hairline);
  box-shadow: 2px 2px 0 #1a140f;
  cursor: pointer;
}

.login-google:hover:not(:disabled) {
  background: var(--surface-soft);
}

.login-x {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: #f5f5f5;
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  box-shadow: 2px 2px 0 #1a140f;
  cursor: pointer;
}

.login-x:hover:not(:disabled) {
  background: #1a1a1a;
}

#mode-warn {
  margin-bottom: var(--space-md);
  padding: 12px 14px;
  background: rgba(232, 165, 90, 0.12);
  border: 1px solid rgba(232, 165, 90, 0.45);
  border-radius: var(--radius-md);
  color: var(--body-strong);
  font-size: 13px;
}

#project-select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  margin-top: 0;
  padding: 8px 10px;
  background: var(--canvas);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

#project-select option {
  font-size: 13px;
  line-height: 1.5;
  padding: 6px 8px;
}

.project-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline-soft);
}

.project-bar input[type="text"] {
  flex: 1 1 140px;
  min-width: 120px;
  height: 40px;
  padding: 0 12px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
}

.top-nav__wallet {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

#keys-list {
  list-style: none;
  margin: var(--space-xs) 0 0;
  padding: 0;
}

#keys-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 12px;
}

.mkey-box {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0;
}

.mkey-box #mkey-out {
  flex: 1 1 280px;
  min-width: 0;
  margin: 0;
}

#mkey-out {
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
  white-space: pre-wrap;
  color: var(--muted);
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline-soft);
}

.mkey-copy {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 14px;
  align-self: stretch;
}

.preflight-panel {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--hairline-soft);
  background: var(--surface-soft);
}

.preflight-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.preflight-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.preflight-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 9.5rem) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 6px 0;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 13px;
}

.preflight-item__label,
.preflight-item__detail {
  min-width: 0;
}

.preflight-item__detail {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.preflight-item:last-child {
  border-bottom: 0;
}

.preflight-item__mark {
  font-weight: 700;
}

.preflight-item--ok .preflight-item__mark {
  color: var(--green, #2d6a4f);
}

.preflight-item--fail .preflight-item__mark {
  color: var(--danger, #9b2226);
}

.preflight-item__label {
  font-weight: 600;
}

.preflight-item__detail {
  color: var(--muted);
}

.preflight-summary--ok {
  color: var(--green, #2d6a4f);
}

.preflight-summary--warn {
  color: var(--danger, #9b2226);
}

@media (max-width: 720px) {
  .preflight-panel {
    padding: 10px 12px;
    overflow-x: clip;
  }

  .preflight-panel__head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .preflight-panel__head .panel-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .preflight-panel__head button {
    flex: 0 0 auto;
  }

  .preflight-item {
    grid-template-columns: 1.25rem minmax(0, 1fr);
    grid-template-areas:
      "mark label"
      ". detail";
    gap: 4px 8px;
  }

  .preflight-item__mark {
    grid-area: mark;
  }

  .preflight-item__label {
    grid-area: label;
  }

  .preflight-item__detail {
    grid-area: detail;
    padding-left: 0;
  }

  #preflight-summary {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

.mtest-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline-soft);
}

.mtest-code {
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
}

.mtest-status {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.mtest-status--ok {
  color: var(--ok, #3d8f5c);
}

.mtest-status--err {
  color: var(--danger, #c44);
}

#mtest-out {
  max-height: 280px;
  overflow: auto;
}

.metrics-key-input {
  font-family: var(--font-mono);
  font-size: 11px;
}

#cred-detail {
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--body);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

.cred-detail__row {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) minmax(0, 1fr);
  gap: 0.2rem 0.5rem;
  align-items: start;
}

.cred-detail__row + .cred-detail__row {
  margin-top: 0.45rem;
}

.cred-detail__label {
  color: var(--muted, inherit);
}

.cred-detail__val {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cred-detail__val--break {
  word-break: break-all;
}

#p-mode { display: none; }
