/* ==========================================================================
   KilgoreAI — shared component primitives
   --------------------------------------------------------------------------
   These three families were duplicated between styles.css and landing.css:
   the dialog system, the account chip + account modal, and the status dot.
   The two copies had drifted (8px vs 6px dot glow, r-pill vs r-sm dialog
   buttons, a stray outline:none on the account input, --on-solid vs #fff),
   so a fix applied to the chat app silently missed the landing page.

   Load order is tokens.css -> components.css -> the page sheet, so a page
   can still override a primitive when its context genuinely differs. The
   landing topbar does exactly that for .theme-btn and .logo.

   Consumers: index.html, landing.html, share.html.
   ========================================================================== */

/* ============ status dot ============ */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 6px rgb(var(--ok-rgb) / 0.5); }
.dot.warn { background: var(--warn); box-shadow: 0 0 6px rgb(var(--warn-rgb) / 0.5); }
.dot.err { background: var(--err); box-shadow: 0 0 6px rgb(var(--err-rgb) / 0.5); }
.dot.busy { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ============ dialog ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgb(var(--shadow-rgb) / 0.62); backdrop-filter: blur(3px);
  display: none; place-items: center; padding: var(--sp-6);
}
.modal-backdrop.open { display: grid; }
.modal {
  width: min(560px, 100%); background: var(--bg-elev);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--e3); padding: var(--sp-5);
  animation: modalIn var(--dur) var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.modal h3 { font-size: var(--fs-body); margin: 0 0 var(--sp-1); }
.modal .m-desc { font-size: var(--fs-xs); color: var(--text-faint); margin: 0 0 var(--sp-3); }
.modal .m-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-3); }
.modal .m-actions button {
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-pill);
  font: var(--wt-semi) var(--fs-xs) var(--font); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--bg-elev-2); color: var(--text);
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.modal .m-actions button:hover { background: var(--bg-hover); border-color: var(--accent-border); }
.modal .m-actions button:active { transform: translateY(1px); }
.modal .m-actions button.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.modal .m-actions button.primary:hover { background: var(--accent-strong); }
.modal .m-actions button.ghost { color: var(--text-faint); border-color: transparent; background: none; }
.modal .m-actions button.ghost:hover { color: var(--text); background: var(--bg-hover); }
.modal .m-actions button.ghost-danger { color: var(--err); border-color: transparent; background: none; }
.modal .m-actions button.ghost-danger:hover { background: var(--err-soft); }

/* ============ account chip (topbar) ============ */
.acct-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 34px; padding: 0 var(--sp-3) 0 var(--sp-1-5); border-radius: var(--r-pill);
  background: var(--bg-elev); border: 1px solid var(--border-strong);
  color: var(--text); cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast),
              border-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.acct-chip:hover { color: var(--accent-strong); border-color: var(--accent-border); background: var(--bg-hover); }
.acct-chip:active { transform: scale(0.97); }
.acct-chip .acct-av {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  color: var(--accent-strong); font-size: var(--fs-micro); font-weight: var(--wt-bold); line-height: 1;
}
.acct-chip .acct-av.has { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.acct-chip .acct-txt {
  font-size: var(--fs-xs); font-weight: var(--wt-semi); color: inherit;
  max-width: 130px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

/* ============ account modal ============ */
.acct-modal { width: min(420px, 100%); }
.acct-tabs {
  display: flex; gap: var(--sp-05); padding: var(--sp-1); margin: var(--sp-05) 0 var(--sp-1-5);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md);
}
.acct-tab {
  flex: 1; padding: var(--sp-2) 0; border: none; border-radius: var(--r-sm);
  background: none; color: var(--text-faint);
  font: var(--wt-semi) var(--fs-xs) var(--font); cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.acct-tab:hover { color: var(--text); }
.acct-tab.on { background: var(--bg-elev-2); color: var(--text); }
.acct-field { margin-top: var(--sp-2-5); }
.acct-field label {
  display: block; font-size: var(--fs-micro); font-weight: var(--wt-semi); color: var(--text-dim);
  margin-bottom: var(--sp-1-5);
}
.acct-input {
  width: 100%; box-sizing: border-box; padding: var(--sp-2-5) var(--sp-3);
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font: var(--fs-sm) var(--font);
  transition: border-color var(--dur-fast);
}
/* Border tint for mouse focus; the keyboard ring is the global contract in
   tokens.css. The landing copy used to kill the outline here. */
.acct-input:focus { border-color: var(--accent); }
.acct-merge {
  display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3);
  font-size: var(--fs-xs); color: var(--text-dim); cursor: pointer;
}
.acct-merge input { accent-color: var(--accent); }
.acct-who { display: flex; align-items: center; gap: var(--sp-2-5); margin: var(--sp-2) 0 var(--sp-05); }
.acct-who-av {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
  font-size: var(--fs-sm); font-weight: var(--wt-bold);
}
.acct-who-id { display: flex; flex-direction: column; min-width: 0; }
.acct-who-id b { font-size: var(--fs-sm); }
.acct-who-id span { font-size: var(--fs-micro); color: var(--text-faint); }
.acct-sec {
  margin: var(--sp-4) 0 var(--sp-05); padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  font-size: var(--fs-label); font-weight: var(--wt-bold); letter-spacing: var(--tr-label);
  text-transform: uppercase; color: var(--text-faint);
}
.acct-sec.danger { color: var(--err); border-top-color: var(--err-border); }
.acct-del-desc { font-size: var(--fs-micro); color: var(--text-dim); line-height: 1.5; margin: var(--sp-1-5) 0 0; }
.acct-delrow { margin-top: var(--sp-2-5); }
.acct-del {
  padding: var(--sp-2) var(--sp-3-5); border-radius: var(--r-sm);
  border: 1px solid var(--err-border); background: var(--err-soft);
  color: var(--err); font: var(--wt-semi) var(--fs-xs) var(--font); cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.acct-del:hover { background: var(--err); color: var(--on-solid); }
.acct-del-confirm { margin-top: var(--sp-2-5); }
.acct-toast {
  position: fixed; left: 50%; bottom: var(--sp-6); transform: translateX(-50%);
  background: var(--bg-elev); border: 1px solid var(--border-strong);
  color: var(--text); padding: var(--sp-2-5) var(--sp-4); border-radius: var(--r-md);
  font: var(--fs-sm) var(--font); z-index: var(--z-toast); box-shadow: var(--e3);
  transition: opacity var(--dur-slow);
}
.acct-toast.err { border-color: var(--err-border); color: var(--err); }
.acct-toast.out { opacity: 0; }

@media (pointer: coarse) {
  .acct-chip, .acct-tab, .acct-del, .modal .m-actions button { min-height: var(--tap); }
}

/* ============ Google AdSense slots (consent-gated) ============ */
/* Containers stay zero-height until adsense.js boots (visitor consented and
   ADSENSE_CLIENT is set) — no reserved gaps when ads are off. Once html.ads-on
   is set, a min-height on the inner unit avoids layout shift while the
   creative loads. */
.ad-slot { overflow: hidden; }
.ad-slot[hidden] { display: none !important; }
.ads-on .ad-slot ins.adsbygoogle { min-height: 90px; display: block !important; }
.ads-on .ad-sidebar ins.adsbygoogle { min-height: 250px; }
