/* API keys. Only what is particular to this page — its surfaces come from
   platform-kit.css.

   The one-time secret gets a panel of its own rather than a toast: it is the
   only moment the credential exists, and a message that fades after five
   seconds is the wrong place for something that cannot be shown again. */

.pk-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.pk-page .pk-head { margin-bottom: 0; }
.pk-page .pk-secret,
.pk-page .pk-help { margin-top: 0; margin-bottom: 0; }
.pk-page .pk-detail { margin: 0; }
.pk-page .pk-empty { margin: 0; }

.pk-banner[hidden] { display: none !important; }

.pk-field-wide input,
.pk-field-wide select { max-width: none; width: 100%; }

.pk-owner-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(54, 126, 245, .08);
  border: 1px solid rgba(54, 126, 245, .22);
  color: var(--sd-ink);
  font-size: 13px;
  line-height: 1.55;
}

.pk-mono {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--sd-mut);
  margin-top: 2px;
}

.pk-row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.pk-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.pk-detail-head h3 { margin: 0 0 5px; font-size: 18px; letter-spacing: -.01em; }
.pk-detail-head p { margin: 0; color: var(--sd-mut); font-size: 12.5px; max-width: 70ch; line-height: 1.55; }
.pk-dismiss { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 12px; opacity: .75; text-decoration: underline; }

/* the secret, shown once */
.pk-secret {
  border: 1px solid rgba(22, 163, 74, .35);
  background: #f2fbf5;
  border-radius: 18px;
  box-shadow: var(--sd-shadow-sm);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.pk-secret h3 { margin: 0 0 6px; font-size: 17px; color: #146c37; }
.pk-secret p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.6; color: #1a5c33; max-width: 78ch; }
.pk-secret-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #146c37;
  margin: 0 0 6px;
}
.pk-secret-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.pk-secret-row code {
  flex: 1 1 380px;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: 10px;
  background:var(--paper,#fff);
  border: 1px solid rgba(22, 163, 74, .3);
  word-break: break-all;
  line-height: 1.5;
}

/* the create / edit form */
.pk-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.pk-field > span { font-size: 12.5px; font-weight: 700; color: var(--sd-ink); }
.pk-field > small { font-size: 12px; color: var(--sd-mut); line-height: 1.5; }
.pk-field input, .pk-field select {
  padding: 10px 12px; border-radius: 10px; font: inherit; font-size: 13.5px;
  border: 1px solid var(--sd-line); background:var(--paper,#fff); color: var(--sd-ink); max-width: 420px;
}
.pk-field input:focus, .pk-field select:focus {
  outline: none; border-color: var(--sd-blue); box-shadow: 0 0 0 3px rgba(54, 126, 245, .15);
}

.pk-scopes {
  border: 1px solid var(--sd-line);
  border-radius: 12px;
  padding: 10px 12px 8px;
  margin: 10px 0 0;
  background: var(--sd-card);
}
.pk-scopes legend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--sd-mut); padding: 0 6px;
}
.pk-scope-all {
  border: 0;
  background: transparent;
  color: var(--sd-blue, #367ef5);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
}
.pk-scope-all:hover { text-decoration: underline; }
.pk-scope-master { margin: 10px 0 2px; border: 1px solid var(--sd-line); background: var(--sd-card); }
.pk-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  transition: background .15s ease, box-shadow .15s ease, transform .16s ease;
}
.pk-scope:hover { background: var(--sd-sunk, #eef2f8); }
.pk-scope.on {
  background: rgba(54, 126, 245, .08);
  box-shadow: inset 0 0 0 1px rgba(54, 126, 245, .28);
}
.pk-scope.flash { animation: pk-flash .32s ease; }
@keyframes pk-flash {
  0% { transform: scale(1); }
  40% { transform: scale(1.012); }
  100% { transform: scale(1); }
}
.pk-scope b {
  display: block; font-size: 12.5px; font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pk-scope small { display: block; font-size: 12px; color: var(--sd-mut); margin-top: 1px; }
.pk-switch {
  flex: none;
  width: 42px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  background: var(--sd-sunk, #e8edf5);
}
.pk-switch i {
  display: block;
  width: 18px;
  height: 18px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(10, 22, 51, .25);
}
.pk-scope.on .pk-switch { background: var(--sd-blue, #367ef5); }
.pk-scope.on .pk-switch i { transform: translateX(18px); }
.pk-switch:focus-visible { outline: 2px solid var(--sd-blue, #367ef5); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .pk-switch i { transition: transform .16s ease; }
}
.pk-form-actions { display: flex; justify-content: flex-end; margin-top: 8px; padding-top: 4px; }

.pk-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(440px, 92vw);
  padding: 11px 16px;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  font: 600 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 10px 30px rgba(8, 16, 32, .28);
  animation: pk-toast-in .16s ease-out;
}
@keyframes pk-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .pk-scope.flash, .pk-toast { animation: none; }
}

html[data-theme="dark"] .pk-scope:hover { background: rgba(77, 127, 255, .1); }
html[data-theme="dark"] .pk-scope.on {
  background: rgba(77, 127, 255, .18);
  box-shadow: inset 0 0 0 1px rgba(77, 127, 255, .4);
}
html[data-theme="dark"] .pk-owner-note {
  background: #14224a;
  border-color: #23344d;
  color: var(--ink, #e6ecfb);
}

/* how to use it */
.pk-help {
  background: var(--sd-card);
  border: 1px solid var(--sd-line);
  border-radius: 18px;
  box-shadow: var(--sd-shadow-sm);
  padding: 18px 20px;
  margin-top: 18px;
}
.pk-help h3 { margin: 0 0 10px; font-size: 15px; }
.pk-code {
  margin: 0 0 10px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
}
.pk-help code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background:var(--sd-sunk,#eef2f8);
  padding: 1px 5px;
  border-radius: 5px;
}

@media (max-width: 760px) {
  .pk-row-actions { justify-content: flex-start; }
  .pk-secret { padding: 16px; }
}
