/* Kaptain Account dialog (account-ui.js). Obsidian + one mint accent, per DESIGN.md. */
.kac-overlay {
  position: fixed; inset: 0; z-index: 100050; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.kac-overlay[hidden] { display: none; }
.kac-panel {
  position: relative; width: min(100%, 460px); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 28px 28px 24px; border-radius: 16px; color: hsl(0 0% 98%);
  background: hsl(240 10% 7%); border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 50px rgba(0,0,0,0.6); font: 400 0.95rem/1.5 'Inter', -apple-system, 'Segoe UI', sans-serif;
  animation: kac-in 0.3s cubic-bezier(0.2,0,0,1);
}
@keyframes kac-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: none; } }
.kac-close {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: none; color: hsl(240 5% 75%); font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.kac-close:hover { background: rgba(255,255,255,0.06); color: #fff; }
.kac-title { margin: 0 40px 12px 0; font: 700 1.3rem/1.2 'Outfit', 'Inter', sans-serif; }
.kac-lead { margin: 0 0 16px; color: hsl(240 5% 75%); }
.kac-lead strong { color: hsl(0 0% 98%); font-weight: 600; }
.kac-msg { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 0.88rem; border: 1px solid rgba(255,255,255,0.1); }
.kac-msg.is-error { color: hsl(0 80% 78%); background: rgba(229,57,53,0.1); border-color: rgba(229,57,53,0.35); }
.kac-msg.is-ok { color: hsl(142 70% 62%); background: rgba(var(--k-mint-rgb, 0, 245, 160), 0.08); border-color: rgba(var(--k-mint-rgb, 0, 245, 160), 0.3); }
.kac-label { display: block; margin: 14px 0 6px; font: 600 0.88rem/1.3 'Inter', sans-serif; color: hsl(240 5% 75%); }
.kac-input {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; color: inherit; font: inherit;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.12);
}
select.kac-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #9aa 50%), linear-gradient(135deg, #9aa 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.kac-input:focus-visible, .kac-btn:focus-visible, .kac-mini:focus-visible, .kac-link:focus-visible, .kac-row-btn:focus-visible, .kac-tab:focus-visible {
  outline: 2px solid #6dfac4; outline-offset: 2px;
}
.kac-pw { display: flex; gap: 8px; }
.kac-pw .kac-input { flex: 1 1 auto; min-width: 0; }
.kac-mini {
  flex: none; min-width: 56px; min-height: 44px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); color: hsl(240 5% 75%); font: 600 0.88rem 'Inter', sans-serif;
}
.kac-mini:hover { background: rgba(255,255,255,0.07); color: #fff; }
.kac-hint { margin: 6px 0 0; font-size: 0.8rem; color: hsl(240 5% 62%); }
.kac-check { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 0; color: hsl(240 5% 75%); cursor: pointer; min-height: 44px; }
.kac-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--k-mint, #00f5a0); flex: none; }
.kac-check small { display: block; color: hsl(240 5% 58%); font-size: 0.8rem; }
.kac-actions { display: flex; gap: 10px; margin-top: 20px; }
.kac-actions.kac-row { margin-top: 12px; }
.kac-btn {
  flex: 1 1 0; min-height: 44px; padding: 0 18px; border-radius: 8px; cursor: pointer; font: 600 0.9rem 'Inter', sans-serif;
  color: hsl(240 5% 75%); background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.15s cubic-bezier(0.2,0,0,1), background 0.15s cubic-bezier(0.2,0,0,1);
}
.kac-btn:hover:not(:disabled) { background: rgba(255,255,255,0.07); color: #fff; transform: translateY(-1.5px); }
.kac-btn:disabled { opacity: 0.5; cursor: default; }
.kac-btn.kac-primary { color: #04130d; background: var(--k-mint, #00f5a0); border-color: transparent; box-shadow: 0 14px 34px -10px rgba(var(--k-mint-rgb, 0, 245, 160), 0.55); }
.kac-btn.kac-primary:hover:not(:disabled) { background: #6dfac4; color: #04130d; }
.kac-btn.kac-danger { color: hsl(0 80% 78%); border-color: rgba(229,57,53,0.4); }
.kac-link {
  background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer; font: 500 0.88rem 'Inter', sans-serif;
  color: hsl(240 5% 75%); text-decoration: underline; text-underline-offset: 3px;
}
.kac-link:hover { color: #6dfac4; }
.kac-foot { margin: 14px 0 0; font-size: 0.88rem; color: hsl(240 5% 58%); text-align: center; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 10px; }
.kac-sep { opacity: 0.5; }
@media (max-width: 480px) { .kac-sep { display: none; } .kac-foot { flex-direction: column; gap: 0; } }
.kac-code {
  margin: 4px 0 4px; padding: 16px; border-radius: 12px; text-align: center; user-select: all;
  font: 600 1.2rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.06em;
  background: rgba(var(--k-mint-rgb, 0, 245, 160), 0.06); border: 1px dashed rgba(var(--k-mint-rgb, 0, 245, 160), 0.4); color: #6dfac4; overflow-wrap: anywhere;
}
.kac-tabs { display: flex; gap: 4px; margin: 0 0 16px; padding: 4px; border-radius: 10px; background: rgba(255,255,255,0.03); }
.kac-tab { flex: 1; min-height: 40px; border: 0; border-radius: 8px; cursor: pointer; background: none; color: hsl(240 5% 70%); font: 600 0.88rem 'Inter', sans-serif; }
.kac-tab.is-on { background: rgba(255,255,255,0.08); color: #fff; }
.kac-h3 { margin: 22px 0 0; font: 600 1rem 'Outfit', 'Inter', sans-serif; }
.kac-h3 small { color: hsl(240 5% 58%); font-weight: 400; }
.kac-list { display: flex; flex-direction: column; gap: 8px; }
.kac-row-btn {
  display: flex; flex-direction: column; gap: 2px; text-align: left; min-height: 56px; padding: 12px 14px; cursor: pointer;
  border-radius: 12px; color: hsl(0 0% 98%); background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.08);
  font: 400 0.88rem/1.4 'Inter', sans-serif;
}
.kac-row-btn:hover { border-color: rgba(var(--k-mint-rgb, 0, 245, 160), 0.25); }
.kac-row-btn span { color: hsl(240 5% 62%); }
.kac-row-btn.is-danger strong { color: hsl(0 80% 78%); }
.kac-list-plain { margin: 0; padding-left: 20px; color: hsl(240 5% 75%); display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 480px) {
  .kac-panel { padding: 24px 18px 20px; }
  .kac-actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .kac-panel { animation: none; } .kac-btn { transition: none; } .kac-btn:hover:not(:disabled) { transform: none; } }

/* Wizard banner links (index.html wizard) */
.wiz-acct-banner .wiz-link { background: none; border: 0; padding: 0; min-height: 0; font: inherit; color: #6dfac4; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.wiz-acct-banner svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; color: #6dfac4; }

/* Turnstile challenge: invisible unless Cloudflare needs a click, then it sits above the dialog. */
.kac-captcha { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100070; }
.kac-captcha.is-visible { top: 50%; bottom: auto; transform: translate(-50%, -50%); padding: 12px; border-radius: 12px; background: hsl(240 10% 7%); border: 1px solid rgba(var(--k-mint-rgb, 0, 245, 160), 0.4); box-shadow: 0 20px 50px rgba(0,0,0,0.6); }

/* Privacy & data panel */
.kac-priv-list { display: flex; flex-direction: column; gap: 14px; }
.kac-priv { padding: 14px 16px; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; background: rgba(255,255,255,0.02); }
.kac-priv .kac-h3 { margin-top: 0; }
.kac-priv .kac-btn { margin-top: 12px; }
.kac-priv-cats { margin: 8px 0 0; font-size: 0.85rem; }
.kac-priv-confirm { margin-top: 10px; }
.kac-priv-confirm[hidden] { display: none; }
.kac-btn.kac-danger:hover:not(:disabled) { background: rgba(229,57,53,0.14); color: hsl(0 90% 86%); border-color: rgba(229,57,53,0.6); }

/* ---- Saved keys: grouped fields, collapsible AIO logins, sticky save bar ---- */
.kac-panel { --kac-pb: 24px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent; }
.kac-panel.kac-panel-wide { width: min(100%, 680px); }
.kac-sec { margin-top: 26px; }
.kac-sec > .kac-h3 { margin: 0 0 12px; }
.kac-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kac-grid.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kac-field { min-width: 0; }
.kac-field .kac-label { margin: 0 0 6px; }
/* Show lives inside the field, full height, so three keys fit on one row */
.kac-grid .kac-pw { position: relative; display: block; }
.kac-grid .kac-pw .kac-input { padding-right: 70px; }
.kac-grid .kac-pw .kac-mini { position: absolute; top: 0; right: 0; bottom: 0; min-width: 62px; min-height: 0; border: 0; border-left: 1px solid rgba(255,255,255,0.08); border-radius: 0 10px 10px 0; background: transparent; }
.kac-grid .kac-pw .kac-mini:hover { background: rgba(255,255,255,0.06); }

.kac-fold { margin-top: 26px; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; background: rgba(255,255,255,0.02); }
.kac-fold > summary { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; cursor: pointer; list-style: none; font: 600 1rem 'Outfit', 'Inter', sans-serif; }
.kac-fold > summary::-webkit-details-marker { display: none; }
.kac-fold > summary small { margin-left: auto; font: 400 0.85rem 'Inter', sans-serif; color: hsl(240 5% 62%); text-align: right; }
.kac-fold > summary::after { content: ''; flex: none; width: 8px; height: 8px; border-right: 2px solid hsl(240 5% 62%); border-bottom: 2px solid hsl(240 5% 62%); transform: rotate(45deg); transition: transform 0.15s cubic-bezier(0.2,0,0,1); }
.kac-fold[open] > summary::after { transform: rotate(-135deg); }
.kac-fold > summary:focus-visible { outline: 2px solid #6dfac4; outline-offset: 2px; border-radius: 12px; }
.kac-fold-body { display: flex; flex-direction: column; gap: 20px; padding: 0 16px 18px; }
.kac-fold-body > .kac-hint { margin: 0; }
.kac-login-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kac-login-head h4 { margin: 0; font: 600 0.95rem 'Outfit', 'Inter', sans-serif; }
.kac-login .kac-hint { margin: 2px 0 6px; }
.kac-kvs { margin: 0; }
.kac-kv { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.kac-kv dt { font-size: 0.85rem; color: hsl(240 5% 62%); }
.kac-kv dd { margin: 0; min-width: 0; }
.kac-kv code { display: block; overflow-wrap: anywhere; font: 500 0.85rem/1.4 ui-monospace, Menlo, Consolas, monospace; }
.kac-kv-act { display: flex; gap: 8px; }
.kac-mini.kac-open { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap; }
.kac-open svg { width: 14px; height: 14px; margin-left: 6px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (pointer: fine) { .kac-fold .kac-mini { min-height: 36px; } }

.kac-savebar { position: sticky; bottom: calc(-1 * var(--kac-pb)); z-index: 1; margin: 22px -28px calc(-1 * var(--kac-pb)); padding: 14px 28px 20px; background: hsl(240 10% 7%); border-top: 1px solid rgba(255,255,255,0.06); }
.kac-savebar .kac-btn { min-width: 160px; }

@media (max-width: 600px) {
  .kac-grid, .kac-grid.is-3 { grid-template-columns: minmax(0, 1fr); }
  .kac-kv { grid-template-columns: minmax(0, 1fr) auto; }
  .kac-kv dt { grid-column: 1 / -1; }
  .kac-panel { --kac-pb: 20px; }
  .kac-savebar { margin: 22px -18px calc(-1 * var(--kac-pb)); padding: 12px 18px 16px; }
  .kac-savebar .kac-btn { width: 100%; }
  .kac-fold > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; row-gap: 0; min-height: 56px; padding: 8px 14px; }
  .kac-fold > summary small { grid-column: 1; margin: 0; text-align: left; }
  .kac-fold > summary::after { grid-column: 2; grid-row: 1 / span 2; }
  .kac-fold-body { padding: 0 14px 16px; }
  /* a row with two buttons puts them under the value, so a UUID never breaks mid-string */
  .kac-kv:has(.kac-kv-act > :nth-child(2)) { grid-template-columns: minmax(0, 1fr); }
  .kac-kv:has(.kac-kv-act > :nth-child(2)) .kac-kv-act { justify-content: flex-start; }
}
