/* Saved LLM keys: the /dashboard/llm-keys list (renderLLMKeys), the add /
   rotate dialogs (lkOpenAddDialog / lkOpenRotateDialog, on top of the
   .keys-modal look in app-keys.css). The composers' model picker
   lists the same keys (cmpPicker, styled in app-composer.css). Tokens from app.css only, so light and dark follow
   the :root[data-theme] swaps. */

/* ---- Page: toolbar ---- */
.lk-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.lk-count { font-size: 13px; color: var(--vercel-muted); font-variant-numeric: tabular-nums; }
.lk-count strong { color: var(--vercel-text); font-weight: 600; }
.lk-add-btn { flex-shrink: 0; }
.lk-add-btn:disabled { opacity: .55; cursor: not-allowed; }
.lk-full { margin: -6px 0 14px; font-size: 12.5px; color: var(--amber); }

/* ---- Page: key rows ---- */
.lk-list { display: flex; flex-direction: column; gap: 10px; }
.lk-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px 14px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--vercel-surface);
  box-shadow: inset 0 0 0 1px var(--vercel-border);
}
.lk-mark {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font: 650 13px/1 var(--font-mono);
  color: var(--vercel-text);
  background: var(--vercel-elevated);
  box-shadow: inset 0 0 0 1px var(--vercel-border);
}
.lk-mark-anthropic { color: #d97757; background: color-mix(in srgb, #d97757 12%, var(--vercel-elevated)); }
.lk-mark-openai { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 11%, var(--vercel-elevated)); }
.lk-mark-google { color: #4f8df5; background: color-mix(in srgb, #4f8df5 12%, var(--vercel-elevated)); }
.lk-mark-openai_compatible { font-size: 12px; }

.lk-main { min-width: 0; }
.lk-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.lk-name {
  min-width: 0;
  font-size: 14px; font-weight: 600;
  color: var(--vercel-text);
  overflow-wrap: anywhere;
}
.lk-badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  color: var(--accent, var(--emerald));
  background: var(--accent-faint, color-mix(in srgb, var(--emerald) 10%, transparent));
  box-shadow: inset 0 0 0 1px var(--border-accent, color-mix(in srgb, var(--emerald) 30%, transparent));
}
.lk-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.lk-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.lk-pill-ok { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 13%, transparent); }
.lk-pill-bad { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.lk-pill-warn { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }

.lk-sub {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
  margin-top: 4px;
  font-size: 12.5px; color: var(--vercel-muted);
}
.lk-masked {
  font-family: var(--font-mono); font-size: 12px;
  background: none; padding: 0;
  color: var(--vercel-text);
}
.lk-host {
  min-width: 0;
  font-family: var(--font-mono); font-size: 11.5px;
  overflow-wrap: anywhere;
}
.lk-detail { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--vercel-muted); }
.lk-detail-bad { color: var(--red); }
.lk-detail-warn { color: var(--amber); }
.lk-dates {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
  margin-top: 6px;
  font-size: 12px; color: var(--vercel-muted);
}
.lk-never { color: var(--vercel-disabled); }

.lk-actions {
  display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
  max-width: 330px;
}
.lk-actions .lk-btn {
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
  white-space: nowrap;
}
.lk-actions .lk-btn:disabled { opacity: .6; cursor: progress; }
/* A quiet Delete; it still confirms first. */
.lk-actions .lk-del {
  color: var(--red);
  background: transparent;
  border: 0;
  border-radius: var(--radius-lg);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--vercel-border-strong);
}
.lk-actions .lk-del:hover {
  transform: none;
  background: color-mix(in srgb, var(--red) 9%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 35%, transparent);
}

/* ---- Page: not enabled on this server ---- */
.lk-notice {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--amber) 8%, var(--vercel-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 30%, transparent);
  font-size: 13.5px; color: var(--vercel-text);
}
.lk-notice strong { font-weight: 600; }
.lk-notice p { margin: 4px 0 0; font-size: 13px; color: var(--vercel-muted); }
.lk-notice a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.lk-notice-dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--amber); }

/* ---- Trust facts (page footer and add dialog) ---- */
.lk-trust {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--vercel-elevated);
}
.lk-trust-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--vercel-text); }
.lk-trust ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.lk-trust li {
  position: relative;
  padding-left: 18px;
  font-size: 12.5px; line-height: 1.5;
  color: var(--vercel-muted);
}
.lk-trust li::before {
  content: "";
  position: absolute; left: 2px; top: .5em;
  width: 8px; height: 4px;
  border-left: 1.5px solid var(--emerald);
  border-bottom: 1.5px solid var(--emerald);
  transform: rotate(-45deg);
}
.lk-trust-compact { margin-top: 16px; padding: 12px 14px; }
.lk-trust-compact li { font-size: 12px; }

/* ---- Dialogs ---- */
.lk-modal { width: min(480px, calc(100vw - 32px)); }
.lk-form .keys-lbl { margin-top: 14px; }
.lk-form > .keys-lbl:first-child { margin-top: 0; }
.lk-select {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2394a3b8' stroke-width='1.5'><path d='M3 4.5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}
.lk-secret { font-family: var(--font-mono); font-size: 13px; letter-spacing: .02em; }
.lk-secret::placeholder { font-family: var(--font-sans); letter-spacing: 0; }
.lk-opt { font-weight: 400; color: var(--vercel-muted); }
.lk-check {
  display: flex; align-items: flex-start; gap: 9px;
  margin-top: 16px;
  font-size: 13px; color: var(--vercel-text);
  cursor: pointer;
}
.lk-check input { margin: 2px 0 0; width: 15px; height: 15px; accent-color: var(--emerald); flex: none; }
.lk-check-hint { margin-left: 24px; }
.lk-busy {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0 0;
  font-size: 12.5px; color: var(--vercel-muted);
}
.lk-busy[hidden] { display: none; }
.lk-spin {
  width: 12px; height: 12px; flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--vercel-border-strong);
  border-top-color: var(--emerald);
  animation: lk-spin 700ms linear infinite;
}
@keyframes lk-spin { to { transform: rotate(360deg); } }
.lk-modal .confirm-body code { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }

/* ---- Phones ---- */
@media (max-width: 640px) {
  .lk-toolbar { flex-wrap: wrap; }
  .lk-row {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 12px;
  }
  .lk-actions {
    grid-column: 1 / -1;
    max-width: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin-top: 8px;
  }
  .lk-actions .lk-btn { flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 8px; }
  
  
}

@media (prefers-reduced-motion: reduce) {
  .lk-spin { animation-duration: 2s; }
}
