/* showcase dashboard — self-contained, no external fonts/assets (vendor-everything). */
:root {
  --bg: #0b1020;
  --bg-elev: #141a2e;
  --bg-elev-2: #1c2340;
  --border: #283154;
  --text: #e6e9ff;
  --muted: #9aa3c7;
  --primary: #6d8bff;
  --primary-ink: #0b1020;
  --danger: #ff6b8b;
  --ok: #57d9a3;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1100px 560px at 75% -12%, rgba(109, 139, 255, 0.12) 0, transparent 60%), var(--bg);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.view { min-height: 100vh; }
.view[hidden], [hidden] { display: none !important; }

/* ---- brand / logo ---- */
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.2px; }
.logo {
  width: 18px; height: 18px; border-radius: 5px; display: inline-block;
  background: linear-gradient(135deg, var(--primary), #b58bff);
  box-shadow: 0 0 0 3px rgba(109, 139, 255, 0.18);
}

/* ---- buttons ---- */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 10px;
  padding: 0.55rem 0.95rem; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform 0.04s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #88a0ff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-elev-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255, 107, 139, 0.4); }
.btn-danger:hover { background: rgba(255, 107, 139, 0.1); }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.85rem; border-radius: 8px; }
.icon-btn { padding: 0.3rem 0.55rem; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* ---- cards ---- */
.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.4rem; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.05rem; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--danger); }
code { background: rgba(127, 127, 127, 0.18); padding: 0.12em 0.4em; border-radius: 6px; font-size: 0.88em; }

/* ---- login ---- */
#view-login { display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 26rem; }
.auth-card h1 { margin: 0.8rem 0 0.4rem; font-size: 1.5rem; }
.auth-card form { display: grid; gap: 0.5rem; margin-top: 1rem; }
label { font-weight: 600; font-size: 0.85rem; color: var(--muted); }
input[type="email"], input[type="text"] {
  width: 100%; padding: 0.7rem 0.8rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
.auth-card .btn-primary { margin-top: 0.4rem; width: 100%; }
.auth-card #oauth-section { margin-top: 1rem; }
.auth-card #oauth-section .btn { width: 100%; }
.btn-github { background: #24292f; color: #fff; border-color: #30363d; }
.btn-github:hover { background: #30363d; }
.divider { display: flex; align-items: center; gap: 0.6rem; margin: 1rem 0 0.2rem; color: var(--muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.dev-note { margin-top: 1rem; font-size: 0.8rem; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 0.8rem; }

/* ---- topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 1.1rem; background: rgba(11, 16, 32, 0.8); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 0.65rem; }
.user-email { color: var(--muted); font-size: 0.88rem; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  text-transform: uppercase; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.5px;
  padding: 0.2rem 0.5rem; border-radius: 999px; background: var(--bg-elev-2); color: var(--muted);
  border: 1px solid var(--border);
}
.badge.pro { background: linear-gradient(135deg, var(--primary), #b58bff); color: var(--primary-ink); border-color: transparent; }

.container { max-width: 46rem; margin: 1.4rem auto; padding: 0 1.1rem 4rem; }

/* ---- quota ---- */
.quota { margin-top: 0.6rem; }
.quota-bar { height: 10px; border-radius: 999px; background: var(--bg-elev-2); overflow: hidden; border: 1px solid var(--border); }
.quota-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #b58bff); transition: width 0.3s ease; }
.quota-fill.full { background: linear-gradient(90deg, #ffb86b, var(--danger)); }
.quota-label { margin-top: 0.45rem; font-size: 0.9rem; color: var(--muted); }
.upsell {
  margin-top: 1rem; padding: 0.85rem 1rem; border-radius: 12px; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; background: rgba(255, 184, 107, 0.08);
  border: 1px solid rgba(255, 184, 107, 0.3);
}
.upsell-flex { display: flex; flex-direction: column; }

/* ---- lists ---- */
.list { margin-top: 0.8rem; display: grid; gap: 0.7rem; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  padding: 0.8rem 0.9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev-2);
}
.row-main { min-width: 0; }
.row-title { font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.row-sub { color: var(--muted); font-size: 0.82rem; margin-top: 0.15rem; word-break: break-all; }
.row-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.row.revoked { opacity: 0.55; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pill { font-size: 0.68rem; padding: 0.1rem 0.45rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: rgba(87, 217, 163, 0.4); }
.pill.revoked { color: var(--danger); border-color: rgba(255, 107, 139, 0.4); }
.empty { margin-top: 0.8rem; padding: 1.1rem; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); text-align: center; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.modal-card {
  position: relative; width: 100%; max-width: 30rem; max-height: 88vh; overflow: auto;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; box-shadow: var(--shadow);
}
.secret-box {
  display: flex; gap: 0.5rem; align-items: stretch; margin: 0.7rem 0;
}
.secret-box input { flex: 1; }
.codeblock {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem;
  white-space: pre; overflow-x: auto; color: var(--text); margin: 0.5rem 0;
}
.qr-wrap { display: grid; place-items: center; padding: 1rem; }
.qr-wrap svg { width: 220px; height: 220px; background: #fff; padding: 10px; border-radius: 12px; }
.warn { color: #ffb86b; font-size: 0.85rem; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
  background: var(--ok); color: var(--primary-ink); font-weight: 600;
  padding: 0.6rem 1rem; border-radius: 10px; box-shadow: var(--shadow); z-index: 60;
}

@media (max-width: 520px) {
  .row { flex-direction: column; align-items: stretch; }
  .row-actions { justify-content: flex-end; }
  .user-email { display: none; }
  .upsell { flex-direction: column; align-items: stretch; }
}
