/* ============================================================
   /{lang}/developers/feed: the feed API's developer portal
   (pages/developer-portal/feed-keys-shared.mjs, feed-keys.js).
   Sits on bot-portal.css (the session gate, the account chip).
   A key is drawn as a key tag: the dark tag carries its prefix in
   the docs' code colours, the card beside it what the key did.
   Rounded squares throughout, no pills.
   ============================================================ */

.fk [hidden], .fk-dialog [hidden] { display: none !important; }
.fk-inner { max-width: 1080px; margin: 0 auto; }
.fk-mono, .fk-prefix, .fk-endpoint, .fk-agent, .fk-tags li, .fk-secret-box code {
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
}
.fk-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- The head ---- */
.fk-head { max-width: 720px; margin-bottom: 26px; }
.fk-eyebrow { display: inline-block; margin-bottom: 10px; color: var(--green-700); font-size: 13.5px; font-weight: 700; letter-spacing: .02em; }
.fk-head h1 { margin: 0 0 14px; color: var(--w-ink); font-size: clamp(32px, 5vw, 46px) !important; line-height: 1.06 !important; }
.fk-lead { margin: 0; color: var(--w-mut); font-size: 17px; line-height: 1.65; }
.fk-gate { max-width: 480px; margin: 0 auto; }
.fk-gate h2 { margin: 0 0 8px; color: var(--w-ink); font-size: 24px; letter-spacing: -.02em; }

.fk-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.fk-account { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fk-account-label { color: var(--w-mut); font-size: 13px; font-weight: 600; }
.fk-account .bp-account { margin: 0; padding: 7px 12px 7px 8px; }
.fk-account .bp-account-avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.fk-new { margin-left: auto; }
.fk-new i, .fk-empty .btn-f i { margin-right: 2px; }

.fk-notice, .fk-alert {
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.45;
}
.fk-notice { border: 1px solid rgba(51, 117, 77, .25); background: rgba(51, 117, 77, .1); color: var(--green-700); font-weight: 600; }
.fk-alert { border: 1px solid rgba(179, 38, 30, .22); background: #fbe9e6; color: #8c1d18; }

.fk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 24px; }
.fk-col { min-width: 0; }
.fk-h2 { margin: 0 0 12px; color: var(--w-ink); font-size: 20px; letter-spacing: -.01em; }
.fk-hint { margin: 6px 0 0; color: var(--w-mut); font-size: 13px; line-height: 1.5; }
.fk-optional { color: var(--w-mut); font-weight: 500; }

/* ---- A key ---- */
.fk-keys { display: grid; gap: 14px; }
.fk-key {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--w-line2, rgba(50, 55, 30, .14));
  border-radius: 20px;
  background: #fffdf6;
  box-shadow: 0 10px 28px rgba(31, 35, 33, .06);
}
/* The tag: dark like a code sample, the prefix in the docs' string green,
   punched like a key tag at the top. */
.fk-tag {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 40px 16px 18px;
  background: #15181c;
  color: #a6adb7;
}
.fk-tag-hole {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 14px;
  height: 14px;
  border-radius: 5px;
  background: #ebe4d3;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .45);
}
.fk-tag-icon { display: inline-flex; color: #f3d57c; }
.fk-prefix {
  color: #a5d6a0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.fk-scopes { display: flex; flex-wrap: wrap; gap: 5px; margin: auto 0 0; padding: 0; list-style: none; }
.fk-scopes li {
  padding: 2px 7px;
  border: 1px solid #343a41;
  border-radius: 6px;
  color: #c9d1d9;
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
}
.fk-scopes-h { margin: auto 0 -6px; color: #8d969f; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.fk-body { min-width: 0; padding: 18px 20px 16px; }
.fk-key-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.fk-label {
  min-width: 0;
  margin: 0;
  color: var(--w-ink);
  font: 700 19px/1.25 var(--font-display, 'Bricolage Grotesque', sans-serif);
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}
.fk-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: none; }
.fk-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.fk-badge-active { background: rgba(51, 117, 77, .13); color: #1f5c36; }
.fk-badge-active::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: #2f8a50; }
.fk-badge-limited { background: #fbecc8; color: #6e4300; box-shadow: inset 0 0 0 1px rgba(170, 110, 0, .28); }
.fk-badge-expired { background: #fbe3e1; color: #a1241b; }
.fk-badge-revoked { background: rgba(50, 55, 30, .08); color: var(--w-mut); }

.fk-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.fk-tags li {
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid rgba(51, 117, 77, .2);
  border-radius: 6px;
  background: rgba(51, 117, 77, .07);
  color: #1f4f34;
  font-size: 12.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.fk-limited, .fk-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 11px;
  font-size: 13.5px;
  line-height: 1.45;
}
.fk-limited { background: #fdf3dc; color: #6e4300; }
.fk-limited i, .fk-warn i { margin-top: 3px; }
.fk-warn { background: #fdf3dc; color: #6e4300; }
.fk-warn.is-over { background: #fbe9e6; color: #8c1d18; }

.fk-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 14px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--w-line, rgba(50, 55, 30, .1));
}
.fk-facts > div { min-width: 0; }
.fk-facts dt { margin: 0 0 3px; color: var(--w-mut); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.fk-facts dd { margin: 0; color: var(--w-ink2); font-size: 14.5px; line-height: 1.4; }
.fk-facts .fk-fact-wide { grid-column: 1 / 3; grid-row: 2; }
.fk-facts .fk-fact-count dd { color: var(--w-ink); font: 700 21px/1.1 var(--font-display, 'Bricolage Grotesque', sans-serif); font-variant-numeric: tabular-nums; }
.fk-facts .is-soon dd { color: #8a5300; font-weight: 700; }
.fk-facts .is-over dd { color: #a1241b; font-weight: 700; }
.fk-sub { display: block; color: var(--w-mut); font-size: 12.5px; }
.fk-muted { color: var(--w-mut) !important; }
.fk-endpoint {
  display: inline-block;
  margin: 0 0 0 8px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(51, 117, 77, .1);
  color: #1f3d29;
  font-size: 12.5px;
}
.fk-agent {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--w-mut);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.fk-act {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--w-line2, rgba(50, 55, 30, .14));
  border-radius: 10px;
  background: transparent;
  color: var(--w-ink2);
  font: 600 13.5px/1 var(--font-sans);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.fk-act:hover { border-color: rgba(51, 117, 77, .4); background: rgba(51, 117, 77, .07); }
.fk-act:focus-visible { outline: 3px solid var(--w-focus, rgba(51, 117, 77, .45)); outline-offset: 2px; }
.fk-act-danger { margin-left: auto; color: #a1241b; }
.fk-act-danger:hover { border-color: rgba(161, 36, 27, .4); background: #fbe9e6; }

/* A revoked key: its tag goes grey, its prefix is struck through. */
.fk-key.is-revoked { background: rgba(255, 253, 246, .6); box-shadow: none; }
.fk-key.is-revoked .fk-tag { background: #2a2e34; }
.fk-key.is-revoked .fk-prefix { color: #8d969f; text-decoration: line-through; }
.fk-key.is-revoked .fk-tag-icon { color: #8d969f; }
.fk-key.is-limited .fk-tag { box-shadow: inset 4px 0 0 #e2a63b; }

/* ---- Forms ---- */
.fk-form { margin: 0 0 16px; }
.fk-create {
  padding: 20px;
  border: 1px solid var(--w-line2, rgba(50, 55, 30, .14));
  border-radius: 20px;
  background: #fffdf6;
  box-shadow: 0 10px 28px rgba(31, 35, 33, .06);
}
.fk-create h2 { margin: 0 0 14px; color: var(--w-ink); font-size: 20px; }
.fk-edit { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--w-line, rgba(50, 55, 30, .1)); }
.fk-field { margin: 0 0 14px; }
.fk-field label { display: block; margin-bottom: 6px; color: var(--w-ink2); font-size: 13px; font-weight: 600; }
.fk-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--w-input-line, rgba(50, 55, 30, .18));
  border-radius: 12px;
  background: rgba(255, 255, 255, .75);
  color: var(--w-ink);
  font: 400 15.5px var(--font-sans);
}
.fk-field input:focus { border-color: #2f6e48; outline: none; box-shadow: 0 0 0 3px rgba(51, 117, 77, .2); }
.fk-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- No keys yet ---- */
.fk-empty {
  padding: 34px 24px;
  border: 1px dashed var(--w-dash, rgba(50, 55, 30, .24));
  border-radius: 20px;
  text-align: center;
}
.fk-empty h2 { margin: 16px 0 6px; color: var(--w-ink); font-size: 22px; }
.fk-empty p { max-width: 460px; margin: 0 auto 16px; color: var(--w-mut); font-size: 15px; line-height: 1.55; }
.fk-empty-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  border-radius: 14px;
  background: #15181c;
  color: #f3d57c;
  transform: rotate(-4deg);
}
.fk-empty-tag .fk-mono { color: #a5d6a0; font-weight: 700; }

/* ---- Revoked keys ---- */
.fk-revoked { margin-top: 22px; }
.fk-revoked summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--w-ink2);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.fk-revoked summary::-webkit-details-marker { display: none; }
.fk-revoked summary::before { content: '›'; display: inline-block; font-size: 18px; line-height: 1; transition: transform .15s ease; }
.fk-revoked[open] summary::before { transform: rotate(90deg); }
.fk-revoked summary:hover { background: rgba(51, 117, 77, .07); }
.fk-revoked summary:focus-visible { outline: 3px solid var(--w-focus, rgba(51, 117, 77, .45)); }
.fk-revoked > .fk-hint { margin: 2px 0 12px 12px; }

/* ---- The side: activity and limits ---- */
.fk-side { position: sticky; top: 96px; display: grid; gap: 14px; }
.fk-panel {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 253, 244, .66);
  box-shadow: 0 10px 30px rgba(31, 35, 33, .07), 0 0 0 1px rgba(50, 55, 30, .07);
}
.fk-panel h2 { margin: 0 0 12px; color: var(--w-ink); font-size: 17px; letter-spacing: -.01em; }
.fk-log { display: grid; gap: 2px; max-height: 360px; margin: 0; padding: 0 2px 0 0; overflow-y: auto; list-style: none; scrollbar-width: thin; }
.fk-ev { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--w-line, rgba(50, 55, 30, .1)); }
.fk-ev:last-child { border-bottom: 0; }
.fk-ev-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(51, 117, 77, .1);
  color: #2f6e48;
  font-size: 12px;
}
.fk-ev-limited .fk-ev-icon { background: #fbecc8; color: #8a5300; }
.fk-ev-revoked .fk-ev-icon { background: #fbe3e1; color: #a1241b; }
.fk-ev-rotated .fk-ev-icon, .fk-ev-refreshed .fk-ev-icon { background: rgba(23, 92, 184, .1); color: #175cb8; }
.fk-ev p { margin: 0; color: var(--w-ink2); font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.fk-ev b { color: var(--w-ink); }
.fk-ev time { color: var(--w-mut); font-size: 12px; }
.fk-limits dl { display: grid; gap: 8px; margin: 0; }
.fk-limit { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: baseline; gap: 10px; }
.fk-limit dt { color: var(--w-ink); font: 700 18px/1.2 var(--font-display, 'Bricolage Grotesque', sans-serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fk-limit dd { margin: 0; color: var(--w-ink2); font-size: 13.5px; line-height: 1.4; }
.fk-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; color: #1f4f34; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.fk-link:hover { color: #175cb8; }

/* ---- Dialogs: the secrets once, and are-you-sure ---- */
/* Centred: the site's reset takes the dialog's own auto margins away. */
.fk-dialog {
  position: fixed;
  inset: 0;
  width: min(560px, calc(100% - 32px));
  height: fit-content;
  max-height: calc(100% - 32px);
  margin: auto;
  overflow-y: auto;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: #fffdf6;
  color: var(--w-ink);
  box-shadow: 0 30px 80px rgba(20, 28, 22, .35);
}
.fk-dialog::backdrop { background: rgba(26, 32, 24, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.fk-dialog-in { padding: 24px; }
.fk-dialog h2 { margin: 0 0 10px; color: var(--w-ink); font-size: 22px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.fk-dialog p { margin: 0 0 12px; color: var(--w-ink2); font-size: 15px; line-height: 1.55; }
.fk-dialog-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; border-radius: 12px; background: #15181c; color: #f3d57c; }
.fk-warn-strong { margin: 0 0 16px; font-weight: 600; }
.fk-secret-row { margin: 0 0 14px; }
.fk-secret-name { margin: 0 0 6px !important; color: var(--w-ink) !important; font-size: 13px !important; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.fk-secret-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: 12px;
  background: #15181c;
}
.fk-secret-box code {
  flex: 1;
  min-width: 0;
  color: #a5d6a0;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-all;
  user-select: all;
}
.fk-copy {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #343a41;
  border-radius: 9px;
  background: transparent;
  color: #e3e6ea;
  font: 600 13px/1 var(--font-sans);
  cursor: pointer;
}
.fk-copy:hover { background: #262b31; }
.fk-copy.is-copied { border-color: #2f8a50; color: #a5d6a0; }
.fk-copy:focus-visible { outline: 2px solid #6fd39b; outline-offset: 2px; }
.fk-secret-row .fk-hint { margin-top: 6px !important; font-size: 13px !important; color: var(--w-mut) !important; }
.fk-check { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; color: var(--w-ink); font-size: 15px; font-weight: 600; cursor: pointer; }
.fk-check input { width: 18px; height: 18px; accent-color: #2f6e48; }
.fk-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.fk-dialog .btn-f[disabled] { opacity: .5; cursor: not-allowed; }
.fk-btn-danger { background: #b3261e; color: #fff; }
.fk-btn-danger:hover { background: #962018; }

@media (max-width: 960px) {
  .fk-grid { grid-template-columns: minmax(0, 1fr); }
  .fk-side { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 640px) {
  .fk-side { grid-template-columns: minmax(0, 1fr); }
  .fk-key { grid-template-columns: minmax(0, 1fr); }
  .fk-tag { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px 12px 40px; }
  .fk-scopes-h { display: none; }
  .fk-scopes { margin: 0 0 0 auto; }
  .fk-tag-hole { top: 50%; left: 14px; margin-top: -7px; }
  .fk-body { padding: 16px; }
  .fk-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fk-facts .fk-fact-wide { grid-column: 1 / -1; grid-row: auto; }
  .fk-key-head { flex-direction: column; }
  .fk-badges { justify-content: flex-start; }
  .fk-dialog-in { padding: 20px 18px; }
  .fk-secret-box { flex-direction: column; align-items: stretch; }
  .fk-copy { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .fk-revoked summary::before, .fk-act { transition: none; }
}
