/* Applogin dashboard — shadcn/ui-flavored tokens in the Captain X (captain_cal)
   style: neutral base + blue accent, light + dark, mobile-first. */

:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --muted: #f5f5f5;
  --muted-foreground: #6b7280;
  --border: #e5e7eb;
  --primary: #0a0a0a;
  --primary-foreground: #fafafa;
  --accent: #2563eb;
  --ring: #2563eb;
  --danger: #dc2626;
  --radius: 0.5rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --foreground: #e5e7eb;
    --card: #111214;
    --muted: #16181c;
    --muted-foreground: #9ca3af;
    --border: #262626;
    --primary: #e5e7eb;
    --primary-foreground: #0a0a0a;
    --accent: #60a5fa;
    --ring: #60a5fa;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--background);
  color: var(--foreground);
}
button { font: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted-foreground); }

/* ---------- layout ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.5rem 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--background); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; letter-spacing: -0.02em; }
.icon { width: 1.15em; height: 1.15em; flex: none; }
.brand .icon { color: var(--accent); }
.brand small { color: var(--muted-foreground); font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; flex-wrap: wrap; }
.docs-link { font-size: 0.85rem; text-decoration: none; }
.docs-link:hover { text-decoration: underline; }
.user-chip { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--muted-foreground); }
.avatar { width: 1.75rem; height: 1.75rem; border-radius: 50%; }

.container { max-width: 56rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.login-card { max-width: 24rem; width: 100%; text-align: center; }
.login-card .brand { justify-content: center; font-size: 1.15rem; margin-bottom: 0.25rem; }

/* ---------- cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.card + .card { margin-top: 1rem; }
.card h2 { margin: 0 0 .25rem; font-size: 1.05rem; }
.card .sub { margin: 0 0 1rem; color: var(--muted-foreground); font-size: .9rem; }

/* ---------- forms ---------- */

label { display: block; font-size: .82rem; font-weight: 500; margin: .9rem 0 .35rem; }
.input {
  width: 100%; font: inherit; color: var(--foreground);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .7rem; min-height: 2.5rem;
}
textarea.input { min-height: 4.5rem; resize: vertical; }
select.input { min-height: 2.75rem; }
.input:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.hint { font-size: .76rem; color: var(--muted-foreground); margin-top: .3rem; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: var(--radius); border: 1px solid transparent;
  padding: 0.4rem 0.9rem; min-height: 2.75rem; min-width: 2.75rem;
  background: transparent; color: var(--foreground); cursor: pointer;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
a.btn { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { border-color: var(--border); }
.btn-outline:hover { background: var(--muted); }
.btn-ghost { color: var(--muted-foreground); min-height: 2.25rem; }
.btn-ghost:hover { background: var(--muted); }
.btn-sm { min-height: 2rem; padding: 0.2rem 0.6rem; font-size: 0.85rem; }
.block { width: 100%; }

.google-icon { width: 18px; height: 18px; }

/* ---------- app rows ---------- */

.app-row { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--card); }
.app-row + .app-row { margin-top: .75rem; }
.app-row .head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.app-row .name { font-weight: 600; }
.row-actions { display: flex; align-items: center; gap: .5rem; }
.badge {
  font-size: .72rem; padding: .12rem .55rem; border-radius: 999px;
  background: var(--muted); color: var(--muted-foreground);
}
.badge.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

.edit-row label { margin-top: .4rem; }
.edit-actions { display: flex; gap: .5rem; margin-top: 1rem; }

.kv { margin-top: .75rem; display: grid; gap: .5rem; }
.secret {
  display: flex; align-items: center; gap: .5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem; background: var(--muted); border-radius: calc(var(--radius) - 2px);
  padding: .45rem .6rem; overflow-x: auto; white-space: nowrap;
}
.secret .lbl { color: var(--muted-foreground); font-family: inherit; flex: none; }
.secret code { flex: 1; }
.secret .btn { flex: none; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  background: var(--foreground); color: var(--background);
  padding: .6rem 1rem; border-radius: var(--radius); font-size: .85rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 50; max-width: 90vw;
}
.toast.err { background: var(--danger); color: #fff; }

.mt { margin-top: 1rem; }

@media (max-width: 480px) {
  .topbar { padding: 0.5rem 0.75rem; }
  .user-chip span { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
}
