/* ── LeLibrary Account pages: landing design language + sidebar ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #09090b;
  --bg-raised: #111114;
  --bg-card: #161619;
  --border: #222228;
  --amber: #f59e0b;
  --amber-dim: #b45309;
  --amber-glow: rgba(245, 158, 11, 0.15);
  --white: #fafafa;
  --muted: #71717a;
  --text: #d4d4d8;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --font: 'Space Grotesk', -apple-system, sans-serif;
  --mono: 'DM Mono', 'Menlo', monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Film grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ── TOP NAV (matches landing) ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 0px) clamp(20px, 4vw, 48px) 0;
  min-height: 64px;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--white); }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; }
.brand-name { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; }
.topbar-links { display: flex; align-items: center; gap: 32px; }
.topbar-links a { color: var(--muted); text-decoration: none; font-size: 0.82rem; font-weight: 500; letter-spacing: 0.02em; transition: color 0.2s; }
.topbar-links a:hover { color: var(--white); }
.topbar-links a.active { color: var(--white); }

/* Reshaped status pill: consistent across top nav + mobile menu */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  background: var(--bg-card);
  transition: all 0.2s;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.status-pill:hover { border-color: var(--muted); color: var(--white); transform: translateY(-1px); }
.status-pill-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(113, 113, 122, 0.4);
}
.status-pill-count { font-weight: 600; color: var(--text); }
.status-pill-label { color: var(--muted); }
.status-pill.op { color: var(--green); border-color: rgba(34, 197, 94, 0.35); }
.status-pill.op .status-pill-dot { background: var(--green); animation: pulse 2s ease-in-out infinite; }
.status-pill.op .status-pill-count { color: var(--green); }
.status-pill.deg { color: var(--amber); border-color: rgba(245, 158, 11, 0.35); }
.status-pill.deg .status-pill-dot { background: var(--amber); animation: pulse 2s ease-in-out infinite; }
.status-pill.deg .status-pill-count { color: var(--amber); }
.status-pill.down { color: var(--red); border-color: rgba(239, 68, 68, 0.35); }
.status-pill.down .status-pill-dot { background: var(--red); }
.status-pill.down .status-pill-count { color: var(--red); }
.status-pill.unknown { color: var(--muted); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── MOBILE MENU (matches landing) ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.3s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu {
  display: none;
  position: fixed;
  top: calc(64px + env(safe-area-inset-top, 0px));
  left: 0; right: 0;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  padding: 16px 24px 24px;
  z-index: 99;
  animation: fadeSlideDown 0.25s ease forwards;
}
@keyframes fadeSlideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.mobile-menu.open { display: flex; }
.mobile-menu a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; padding: 12px 0; border-bottom: 1px solid var(--border); }
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { color: var(--white); }
.mobile-menu a.active { color: var(--white); }
.mobile-menu .mob-cta { background: var(--amber); color: var(--bg) !important; text-align: center; border-radius: 8px; margin-top: 8px; border: none; font-weight: 700; }
.mobile-menu a.status-pill { padding: 8px 16px !important; border-bottom: none !important; margin-top: 8px; border-radius: 999px; background: var(--bg-card); border: 1px solid var(--border); }

/* ── LAYOUT: sidebar + main ── */
.account-layout {
  display: flex;
  min-height: 100vh;
  padding-top: calc(64px + env(safe-area-inset-top, 0px));
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  position: sticky;
  top: calc(64px + env(safe-area-inset-top, 0px));
  height: calc(100vh - 64px);
}
.account-layout.auth-signed-out .sidebar { display: none; }
.account-layout.auth-signed-out .account-main { width: 100%; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 8px;
  color: var(--muted); text-decoration: none;
  font-size: 0.88rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.01em;
}
.sidebar-nav a:hover { background: var(--bg-card); color: var(--text); }
.sidebar-nav a.active { background: var(--amber-glow); color: var(--amber); font-weight: 600; }

.nav-ico { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }

.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-bottom a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 8px;
  color: var(--muted); text-decoration: none;
  font-size: 0.84rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.sidebar-bottom a:hover { background: var(--bg-card); color: var(--text); }
.sidebar-bottom a.sponsor { color: var(--amber); }
.sidebar-bottom a.sponsor:hover { background: var(--amber-glow); }
.sidebar-bottom .sidebar-user { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.sidebar-bottom .sidebar-user .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-card); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; border: 1px solid var(--border); font-weight: 700; font-size: 0.8rem; color: var(--amber); }
.sidebar-bottom .sidebar-user .avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-bottom .sidebar-user .su-name { flex: 1; min-width: 0; font-size: 0.78rem; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account-main { flex: 1; min-width: 0; }

/* ── HERO (signed-out) ── */
.hero {
  min-height: calc(100vh - 64px - env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px clamp(24px, 5vw, 80px) 60px;
  text-align: center;
  position: relative;
}
.grid-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.4;
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 560px; width: 100%; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 20px;
}
.hero-title {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 18px;
}
.hero-title em { font-style: normal; color: var(--amber); }
.hero-desc {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto 36px;
}
.auth-btns { display: flex; flex-direction: column; gap: 12px; align-items: stretch; max-width: 360px; margin: 0 auto; }
.cookie-summary { color: var(--muted); font-size: 0.72rem; line-height: 1.5; margin: 2px 0 0; }
.cookie-settings-link { border: 0; padding: 0; background: none; color: var(--amber); font: inherit; font-weight: 600; cursor: pointer; }
.cookie-settings-link:hover { text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  color: var(--bg);
}
.btn svg, .btn img { width: 18px; height: 18px; flex-shrink: 0; }
.btn-amber { background: var(--amber); color: var(--bg); }
.btn-amber:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(245, 158, 11, 0.25); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--muted); background: rgba(255,255,255,0.03); transform: translateY(-2px); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-2px); box-shadow: 0 8px 32px rgba(239, 68, 68, 0.25); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── PAGE BODY (signed-in / settings) ── */
.page { padding: 48px clamp(24px, 4vw, 48px) 60px; max-width: 900px; }
.page-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 12px;
}
.page-title {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 10px;
}
.page-title em { font-style: normal; color: var(--amber); }
.page-desc { color: var(--muted); font-size: 0.92rem; line-height: 1.65; max-width: 640px; margin-bottom: 36px; }
.member-since { color: var(--muted); font-family: var(--mono); font-size: 0.72rem; margin: -24px 0 36px; }

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 24px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--white); letter-spacing: -0.01em; }
.card-title .beta { font-family: var(--mono); font-size: 0.62rem; color: var(--amber); background: var(--amber-glow); padding: 3px 8px; border-radius: 4px; vertical-align: middle; letter-spacing: 0.05em; }
.card-desc { color: var(--muted); font-size: 0.84rem; line-height: 1.55; margin-bottom: 20px; }

/* ── KEY ROWS ── */
#debridKeyRows, #posterKeyRows { display: grid; grid-template-columns: 1fr; row-gap: 10px; }
@media (min-width: 861px) {
  #debridKeyRows, #posterKeyRows { grid-template-columns: 1fr 1fr; column-gap: 12px; }
}
.key-row {
  display: flex; align-items: center; gap: 16px;
  padding: 18px; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 10px;
}
.key-logo {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px; background: var(--bg-raised);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 1px solid var(--border);
}
.key-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.key-logo.emoji { font-size: 1.2rem; }
.key-info { flex: 1; min-width: 0; }
.key-name { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.key-info strong { font-size: 0.92rem; font-weight: 600; color: var(--white); }
.key-sub { color: var(--muted); font-size: 0.78rem; margin-top: 3px; }
.getkey-link { color: var(--amber); font-size: 0.76rem; text-decoration: none; white-space: nowrap; font-weight: 600; font-family: var(--mono); }
.getkey-link:hover { text-decoration: underline; }

/* Saved-state pill (sits next to the service name) */
.saved-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--green);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Input + eye + verify cluster */
.key-controls { display: flex; flex-direction: column; align-items: stretch; gap: 6px; flex: 1; min-width: 0; }
.key-input-wrap { display: flex; gap: 8px; align-items: center; width: 100%; }
.key-input-field { position: relative; flex: 1; min-width: 0; }
.key-input-wrap input, .key-input-field input {
  flex: 1; min-width: 0;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 14px; color: var(--text);
  font-size: 0.88rem; font-family: var(--font);
  transition: border-color 0.15s;
}
.key-input-field input { width: 100%; padding-right: 40px; }
.key-input-wrap input:focus, .key-input-field input:focus { outline: none; border-color: var(--amber); }
.btn-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none;
  border-radius: 6px; color: var(--muted); font-size: 0.88rem;
  cursor: pointer; transition: all 0.15s;
}
.btn-eye:hover { color: var(--white); background: rgba(255,255,255,0.06); }
.btn-eye.active { color: var(--amber); }
.btn-verify {
  height: 42px; padding: 0 16px; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
  white-space: nowrap;
}
.btn-verify:hover { border-color: var(--amber); color: var(--amber); }
.btn-edit {
  height: 42px; padding: 0 16px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-raised); border: 1px solid var(--border2);
  border-radius: 8px; color: var(--amber); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
  white-space: nowrap; line-height: 1;
}
.btn-edit:hover { border-color: var(--amber); color: var(--amber); background: rgba(245, 158, 11, 0.08); }
.btn-edit.cancel {
  background: var(--bg-raised); border-color: var(--border2); color: var(--muted);
}
.btn-edit.cancel:hover { border-color: var(--muted); color: var(--text); background: rgba(255,255,255,0.03); }
.key-input-wrap input[readonly], .key-input-field input[readonly] { color: var(--muted); font-family: var(--mono); letter-spacing: 0.15em; }
.verify-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.7rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; font-family: var(--mono); }
.verify-badge.ok { background: rgba(34, 197, 94, 0.12); color: var(--green); }
.verify-badge.bad { background: rgba(239, 68, 68, 0.12); color: var(--red); }
.verify-badge.pending { background: rgba(59, 130, 246, 0.12); color: var(--blue); }

/* Spinner (inline, e.g. "Verifying…" on the save button) */
.spin {
  width: 14px; height: 14px; flex-shrink: 0;
  display: inline-block;
  border: 2px solid rgba(9, 9, 11, 0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: rot 0.7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ── CONNECT ROWS ── */
.connect-row { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.connect-row:last-child { border-bottom: none; }
.connect-logo {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 10px; background: var(--bg-raised);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 1px solid var(--border);
}
.connect-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.connect-logo.emoji { font-size: 1.25rem; }
.connect-info { flex: 1; min-width: 0; }
.connect-info strong { font-size: 0.92rem; color: var(--white); }
.connect-sub { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.connect-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; font-family: var(--mono); }
.badge.ok { background: rgba(34, 197, 94, 0.12); color: var(--green); }
.badge.off { background: rgba(113, 113, 122, 0.12); color: var(--muted); }
.btn-sm { padding: 8px 14px; font-size: 0.78rem; border-radius: 7px; }
.btn-sm.danger { color: var(--red); border-color: rgba(239, 68, 68, 0.3); }
.btn-sm.danger:hover { border-color: var(--red); background: rgba(239, 68, 68, 0.08); }

/* ── TABLES ── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 0.68rem; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  font-family: var(--mono);
}
.tbl td { padding: 11px 10px; font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.tbl td code { background: var(--bg-raised); padding: 2px 8px; border-radius: 5px; font-size: 0.76rem; font-family: var(--mono); }
.empty { color: var(--muted); font-size: 0.85rem; padding: 16px 10px; }
a.inline { color: var(--amber); text-decoration: none; font-size: 0.82rem; font-weight: 600; }
a.inline:hover { text-decoration: underline; }
.danger { color: var(--red); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px; width: 100%; max-width: 420px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}
.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.modal-head h3 { font-size: 1.05rem; color: var(--white); flex: 1; }
.modal-x {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.modal-x:hover { color: var(--white); border-color: var(--amber); background: var(--bg-card); }
.modal-x:active { transform: scale(0.94); }
.modal-sub { color: var(--muted); font-size: 0.76rem; margin-top: 2px; }
.modal-body p { color: var(--muted); font-size: 0.84rem; line-height: 1.55; margin-bottom: 16px; }
.modal-label {
  display: block; font-size: 0.7rem; color: var(--muted);
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.modal input {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 12px; color: var(--text);
  font-size: 0.88rem; font-family: var(--font); margin-bottom: 10px;
}
.modal input:focus { outline: none; border-color: var(--amber); }
.modal select {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 12px; color: var(--text);
  font-size: 0.88rem; font-family: var(--font); margin-bottom: 4px;
}
.modal select:focus { outline: none; border-color: var(--amber); }
.modal-note { font-size: 0.74rem; color: var(--muted); line-height: 1.5; margin: 2px 0 0; }
.modal .modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .modal-actions .btn { flex: 1; }
.oauth-modal .modal-body { text-align: center; padding: 6px 0 2px; }
.cookie-consent-banner {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 1500;
  width: min(880px, calc(100% - 32px)); transform: translateX(-50%);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px;
  background: rgba(17,17,20,.97); box-shadow: 0 18px 60px rgba(0,0,0,.55); backdrop-filter: blur(14px);
}
.cookie-consent-copy { min-width: 0; }
.cookie-consent-copy strong { display: block; color: var(--white); font-size: .88rem; margin-bottom: 4px; }
.cookie-consent-copy p { color: var(--muted); font-size: .74rem; line-height: 1.5; margin: 0; }
.cookie-consent-copy a { color: var(--amber); font-weight: 600; }
.cookie-consent-actions { display: flex; gap: 9px; flex-shrink: 0; }
.cookie-consent-actions .btn { min-width: 88px; padding: 10px 18px; font-size: .78rem; }
@media (max-width: 620px) {
  .cookie-consent-banner { align-items: stretch; flex-direction: column; gap: 12px; padding: 15px; }
  .cookie-consent-actions { width: 100%; }
  .cookie-consent-actions .btn { flex: 1; }
}
.oauth-spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(245,158,11,.18); border-top-color: var(--amber);
  animation: oauth-spin .8s linear infinite; margin: 0 auto 18px;
}
.oauth-spinner.done {
  border-color: rgba(52,211,153,.25); border-top-color: #34d399;
}
@keyframes oauth-spin { to { transform: rotate(360deg); } }

/* ── TOAST (matches /configure) ── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(34, 197, 94, 0.5);
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--green);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
  pointer-events: none;
  z-index: 2000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  font-family: var(--font);
  max-width: min(90vw, 440px);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(239, 68, 68, 0.5); color: var(--red); }
.toast.info { border-color: rgba(59, 130, 246, 0.5); color: var(--blue); }
.toast-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: inherit;
  background: rgba(34, 197, 94, 0.15);
}
.toast.error .toast-ico { background: rgba(239, 68, 68, 0.15); }
.toast.info .toast-ico { background: rgba(59, 130, 246, 0.15); }
@media (max-width: 700px) {
  .toast { bottom: 16px; right: 16px; left: 16px; max-width: none; justify-content: center; }
}

/* ── STATS ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: rgba(245, 158, 11, 0.3); transform: translateY(-2px); }
.stat-label { font-family: var(--mono); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 1.9rem; font-weight: 700; color: var(--white); }
.stat-value span { color: var(--amber); }
.stat-sub { color: var(--muted); font-size: 0.76rem; margin-top: 6px; }
.stat-sub a { color: var(--amber); text-decoration: none; }
.stat-sub a:hover { text-decoration: underline; }

/* ── SETUP PROMPT ── */
.setup-prompt {
  background: var(--amber-glow);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.setup-prompt h3 { color: var(--white); font-size: 1.05rem; margin-bottom: 4px; }
.setup-prompt p { color: var(--muted); font-size: 0.84rem; line-height: 1.5; max-width: 520px; }

/* ── ACCOUNT CONTROL CENTRE ── */
.dashboard-welcome { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:28px; }
.dashboard-welcome .page-title { margin-bottom:6px; }
.dashboard-actions { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.dashboard-spotlight { display:flex; align-items:center; gap:18px; min-height:142px; padding:24px 26px; margin-bottom:18px; border:1px solid rgba(245,158,11,.34); border-radius:12px; background:linear-gradient(100deg,rgba(245,158,11,.14),rgba(245,158,11,.035) 48%,rgba(22,22,25,.78)); }
.spotlight-icon { display:grid; place-items:center; width:54px; height:54px; flex:0 0 54px; color:var(--amber); background:rgba(245,158,11,.11); border:1px solid rgba(245,158,11,.28); border-radius:12px; }
.spotlight-mark { display:block; color:var(--amber); font-size:30px; font-weight:400; line-height:1; }
.spotlight-copy { min-width:0; }
.spotlight-copy .eyebrow { margin-bottom:5px; color:var(--amber); }
.spotlight-copy h2,.panel-heading h2 { color:var(--white); font-size:1.16rem; letter-spacing:-.025em; }
.spotlight-copy p { margin-top:5px; color:var(--muted); font-size:.84rem; line-height:1.5; max-width:620px; }
.spotlight-action { margin-left:auto; white-space:nowrap; }
.dashboard-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(310px,.75fr); gap:18px; margin-bottom:18px; }
.dashboard-panel { min-width:0; background:var(--bg-card); border:1px solid var(--border); border-radius:12px; padding:22px; }
.panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:18px; }
.panel-heading .eyebrow { margin-bottom:5px; }
.panel-link { color:var(--amber); font-size:.8rem; font-weight:600; text-decoration:none; padding-top:4px; }
.panel-link:hover { color:#fbbf24; }
.setup-list { display:grid; gap:10px; }
.dashboard-loading { color:var(--muted); font-size:.84rem; padding:18px 0; }
.dashboard-setup { display:flex; align-items:center; gap:12px; padding:13px; color:var(--text); text-decoration:none; border:1px solid var(--border); border-radius:9px; background:rgba(9,9,11,.36); transition:border-color .2s, background .2s, transform .2s; }
.dashboard-setup:hover { border-color:rgba(245,158,11,.35); background:rgba(245,158,11,.055); transform:translateY(-1px); }
.dashboard-setup-brand { width:34px; height:34px; padding:7px; object-fit:contain; flex:0 0 34px; border:1px solid var(--border); border-radius:8px; background:#111116; }
.dashboard-setup-copy { min-width:0; flex:1; }
.dashboard-setup-copy strong { display:block; overflow:hidden; color:var(--white); font-size:.9rem; text-overflow:ellipsis; white-space:nowrap; }
.dashboard-setup-copy small { display:block; margin-top:2px; color:var(--muted); font-size:.72rem; }
.dashboard-setup-count { color:var(--amber); font:500 .68rem var(--mono); white-space:nowrap; }
.dashboard-empty { padding:18px; border:1px dashed #303037; border-radius:9px; color:var(--muted); font-size:.84rem; line-height:1.55; }
.dashboard-empty a { color:var(--amber); text-decoration:none; font-weight:600; }
.health-list { display:grid; }
.health-row { display:flex; align-items:center; gap:12px; padding:13px 0; color:var(--text); text-decoration:none; border-top:1px solid var(--border); }
.health-row:first-child { border-top:0; padding-top:1px; }
.health-row:last-child { padding-bottom:0; }
.health-row:hover strong { color:var(--amber); }
.health-icon { display:grid; place-items:center; width:28px; height:28px; flex:0 0 28px; border:1px solid var(--border); border-radius:50%; color:var(--muted); font:500 .68rem var(--mono); }
.health-row.is-ready .health-icon { color:var(--green); border-color:rgba(34,197,94,.35); background:rgba(34,197,94,.09); }
.health-row.is-needed .health-icon { color:var(--amber); border-color:rgba(245,158,11,.35); background:rgba(245,158,11,.08); }
.health-row span:nth-child(2) { min-width:0; flex:1; }
.health-row strong { display:block; color:var(--white); font-size:.82rem; transition:color .2s; }
.health-row small { display:block; margin-top:2px; color:var(--muted); font-size:.71rem; }
.health-row b { color:var(--muted); font-size:1.25rem; font-weight:400; }
.dashboard-stats { display:grid; grid-template-columns:repeat(4,1fr); margin-bottom:24px; overflow:hidden; border:1px solid var(--border); border-radius:11px; background:var(--bg-card); }
.dashboard-stat { display:flex; align-items:baseline; justify-content:space-between; gap:10px; min-height:70px; padding:18px 20px; color:var(--text); text-decoration:none; border-left:1px solid var(--border); transition:background .2s; }
.dashboard-stat:first-child { border-left:0; }
.dashboard-stat:hover { background:rgba(245,158,11,.06); }
.dashboard-stat span { color:var(--muted); font-size:.76rem; }
.dashboard-stat strong { color:var(--white); font-size:1.35rem; }
.dashboard-stat:hover strong { color:var(--amber); }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .hamburger { display: flex; }
  .topbar-links { display: none; }
  .sidebar { display: none; }
  .account-layout { padding-top: calc(64px + env(safe-area-inset-top, 0px)); }
  .page { padding: 36px 20px 60px; }
  .dashboard-welcome { align-items:flex-start; flex-direction:column; }
  .dashboard-actions { width:100%; }
  .dashboard-actions .btn { flex:1; text-align:center; }
  .dashboard-spotlight { align-items:flex-start; flex-wrap:wrap; padding:20px; }
  .spotlight-action { width:100%; margin-left:0; text-align:center; }
  .dashboard-grid { grid-template-columns:1fr; }
  .dashboard-stats { grid-template-columns:repeat(2,1fr); }
  .dashboard-stat:nth-child(3) { border-left:0; border-top:1px solid var(--border); }
  .dashboard-stat:nth-child(4) { border-top:1px solid var(--border); }
  .hero { padding-top: calc(64px + env(safe-area-inset-top, 0px)); }
  /* Stack key rows vertically on mobile */
  .key-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 18px;
  }
  .key-controls {
    align-items: stretch;
    width: 100%;
  }
  .key-input-wrap {
    max-width: 100%;
    width: 100%;
  }
  .key-input-field input {
    flex: 1;
    min-width: 0;
  }
  .connect-row { flex-wrap: wrap; gap: 12px; }

  /* Stack account tables into cards on small screens so the action
     links (URL · lock · revoke · delete) no longer run off the page */
  #tokens table.tbl thead,
  #sessionsCard table.tbl thead { display: none; }
  #tokens table.tbl, #sessionsCard table.tbl,
  #tokens table.tbl tbody, #sessionsCard table.tbl tbody,
  #tokens table.tbl tr, #sessionsCard table.tbl tr,
  #tokens table.tbl td, #sessionsCard table.tbl td { display: block; width: 100%; }
  #tokens table.tbl tr, #sessionsCard table.tbl tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 4px 2px;
  }
  #tokens table.tbl td, #sessionsCard table.tbl td {
    border-bottom: none;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: right;
  }
  #tokens table.tbl td:first-child, #sessionsCard table.tbl td:first-child {
    text-align: left;
    justify-content: flex-start;
    gap: 10px;
  }
  #tokens table.tbl td::before, #sessionsCard table.tbl td::before {
    content: attr(data-label);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-family: var(--mono);
    text-align: left;
    flex: none;
  }
  #tokens table.tbl td.token-actions, #sessionsCard table.tbl td.token-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 12px;
  }
  #tokens table.tbl td.token-actions::before, #sessionsCard table.tbl td.token-actions::before { content: none; }
}
