/* Standalone PAN pages: new, correction, API token, profile */
/* Hide the legacy fallback header completely to eliminate the top navbar pop-up glitch on tab navigation */
.pg-top {
  display: none !important;
}

/* Base page container — utilizes full workspace width inside .main */
.pg {
  max-width: none;
  margin: 0;
  padding: 0 0 48px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.pg-head { margin-bottom: 20px; }
.pg-head .code { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted); }
.pg-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--navy); margin: 4px 0 6px; }

.pg-head p { color: var(--muted); margin: 0; font-size: 13.5px; max-width: 72ch; }

/* Grid layouts */
.pg-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; align-items: start; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.grid-two-col, .api-branding-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@media (min-width: 769px) {
  .grid-two-col, .api-branding-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.pg-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); box-sizing: border-box; min-width: 0; max-width: 100%; overflow: hidden; }
.pg-card h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 16px; }

/* Form fields & inputs - strictly constrained */
.pg-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.pg-field input,
.pg-field select,
.pg-field textarea {
  box-sizing: border-box !important;
  max-width: 100% !important;
  width: 100% !important;
  min-width: 0 !important;
}

.pg-field input,
.pg-field select,
.pg-field textarea {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.pg-field input:focus,
.pg-field select:focus,
.pg-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11, 95, 165, .12); outline: none; }

/* Field label head with hint/subtext */
.pg-field-head,
.field-label-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  margin-bottom: 4px;
  width: 100%;
  min-width: 0;
}
@media (min-width: 769px) {
  .pg-field-head,
  .field-label-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
  }
}
.pg-field-label { font-weight: 500; color: var(--ink); word-break: break-word; }
.pg-field-hint { color: var(--muted); font-size: 11px; word-break: break-word; line-height: 1.35; }

.pg-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.pg-opt { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; min-width: 0; box-sizing: border-box; }
.pg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pg-opt strong { font-size: 14px; font-weight: 500; word-break: break-word; }
.pg-opt span { font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums; }
.pg-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pg-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 4px 0 16px; }
.pg-sum { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); margin-bottom: 16px; font-size: 14px; }
.pg-sum strong { font-variant-numeric: tabular-nums; }

.pg-btn {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.pg-btn:hover { background: var(--ink-soft); }
.pg-btn:disabled { opacity: .6; cursor: default; }
.pg-btn.ghost {
  width: auto;
  height: 36px;
  padding: 0 14px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 13px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.pg-msg { font-size: 13px; margin-top: 12px; }
.pg-msg.bad { color: var(--danger); }
.pg-msg.ok { color: var(--success); }

.pg-steps { list-style: none; padding: 0; margin: 0; counter-reset: s; font-size: 13px; color: var(--muted); }
.pg-steps li { counter-increment: s; display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pg-steps li:last-child { border-bottom: 0; }
.pg-steps li::before { content: counter(s, decimal-leading-zero); font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--accent); padding-top: 2px; }
.pg-steps b { color: var(--ink); font-weight: 500; }

/* Table responsive wrapper */
.pg-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-sizing: border-box;
}

.pg-table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 13px; margin: 0; }
.pg-table th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px; background: var(--surface-soft); white-space: nowrap; }
.pg-table td { padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pg-table tr:last-child td { border-bottom: 0; }
.pg-table .mono { font-family: "IBM Plex Mono", monospace; font-size: 12px; }
.pg-list { margin-top: 32px; width: 100%; max-width: 100%; box-sizing: border-box; }
.pg-list h2 { font-size: 16px; font-weight: 600; margin: 0; }

.st { font-size: 12px; }
.st-Success { color: var(--success); }
.st-Failure, .st-Reversal, .st-Expired { color: var(--danger); }
.st-Held, .st-Pending { color: var(--warning); }

.pg pre { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-family: "IBM Plex Mono", monospace; font-size: 12px; overflow-x: auto; white-space: pre; margin: 8px 0 16px; }
.pg code { font-family: "IBM Plex Mono", monospace; font-size: 12px; }

.key-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); margin-bottom: 8px; }
.key-box code { flex: 1; word-break: break-all; min-width: 0; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .pg-grid, .pg-opts, .grid-two-col, .api-branding-grid { grid-template-columns: minmax(0, 1fr) !important; }
}

@media (max-width: 640px) {
  .pg {
    padding: 16px 12px 64px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .pg-head { margin-bottom: 18px; }
  .pg-head h1 { font-size: 22px; }
  .pg-card { padding: 14px; border-radius: 10px; max-width: 100%; box-sizing: border-box; }
  .pg-field-head, .field-label-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .pg-btn {
    height: 42px;
    font-size: 14px;
  }
  .pg-table-wrap {
    margin-left: -2px;
    margin-right: -2px;
    width: calc(100% + 4px);
    max-width: calc(100% + 4px);
  }
}

/* One font everywhere (matches home page) */
.pg-note { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.pg-grid + .pg-grid { margin-top: 24px; }
.pg-head a, .pg-note a { color: var(--accent); font-weight: 600; }
.key-box[hidden] { display: none; }

/* Password Toggle Eye Button */
.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-field-wrap input {
  width: 100%;
  padding-right: 40px !important;
}
.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #71717a);
  border-radius: 4px;
  transition: color 0.15s ease;
  z-index: 2;
}
.password-toggle-btn:hover {
  color: var(--ink, #09090b);
}

.password-toggle-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}
