/* ============ Design tokens & reset ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f9fc;
  --card: #ffffff;
  --border: #e5e9f0;
  --border-strong: #dbe1ea;
  --navy: #0f172a;
  --text: #172033;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #f97316;
  --radius: 16px;
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* ============ Administration ============ */
.admin-dash {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(160deg, #f4f6fb 0%, #eef1f9 100%);
  color: var(--text);
}
.admin-side {
  position: sticky; top: 0; height: 100vh; width: 248px; flex-shrink: 0; z-index: 20;
  display: flex; flex-direction: column;
  padding: 22px 14px 18px;
  background:
    radial-gradient(600px 340px at 20% -10%, rgba(96, 112, 255, 0.28), transparent 60%),
    radial-gradient(560px 380px at 110% 115%, rgba(139, 92, 246, 0.26), transparent 60%),
    linear-gradient(180deg, #0b1026 0%, #0e1233 55%, #0a0e22 100%);
  border-right: 1px solid rgba(190, 205, 255, 0.1);
  box-shadow: 8px 0 40px rgba(10, 14, 34, 0.18);
}
.adm-logo { display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px; }
.adm-logo-mark {
  width: 40px; height: 40px; display: grid; place-items: center; font-size: 21px; border-radius: 13px;
  background: linear-gradient(135deg, #4f6bff, #8b5cf6 60%, #22d3ee);
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.adm-logo-text { color: #fff; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.adm-logo-text span { background: linear-gradient(90deg, #62e6df, #8b7bff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.adm-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.adm-nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 13px; border: 0; border-radius: 13px;
  background: transparent; color: #9fb0d6; font: inherit; font-size: 14px; font-weight: 600;
  text-align: left; cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.adm-nav-item svg { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.85; }
.adm-nav-item:hover { background: rgba(120, 138, 255, 0.12); color: #fff; transform: translateX(3px); }
.adm-nav-item.active {
  background: linear-gradient(100deg, rgba(79, 107, 255, 0.28), rgba(139, 92, 246, 0.18));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 255, 0.28), 0 8px 24px rgba(79, 107, 255, 0.22);
}
.adm-nav-item.active svg { opacity: 1; color: #9ec5ff; }
.adm-side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(190, 205, 255, 0.1); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top {
  position: sticky; top: 0; z-index: 15;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  padding: 18px 28px;
}
.admin-top-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.admin-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); }
.admin-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.admin-top-actions { display: flex; align-items: center; gap: 16px; }
.adm-status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: #eefbf3; color: #12883c; border: 1px solid #c9efd8;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.adm-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }
.adm-status-pill.warn { background: #fff1f2; color: #dc2626; border-color: #fecaca; }
.adm-status-pill.warn .adm-status-dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18); }
.adm-account { display: flex; align-items: center; gap: 10px; }
.adm-avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #4f6bff, #8b5cf6); color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}
.adm-account-info { display: flex; flex-direction: column; line-height: 1.2; }
.adm-account-info strong { font-size: 13.5px; color: var(--navy); }
.adm-account-info span { font-size: 12px; color: var(--muted); }
.admin-signout {
  border: 1px solid #fecaca; background: #fff; color: #ef4444;
  padding: 9px 16px; border-radius: 11px; font-weight: 700; font-size: 13px;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.admin-signout:hover { background: #fef2f2; box-shadow: 0 6px 18px rgba(239, 68, 68, 0.18); transform: translateY(-1px); }
.admin-content { padding: 26px 28px 48px; animation: admin-fade 0.35s ease both; }
@keyframes admin-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.admin-loading { min-height: 220px; display: grid; place-items: center; color: var(--muted); }

/* Dashboard cards */
.adm-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.adm-stat-card {
  display: flex; align-items: center; gap: 14px; padding: 20px;
  background: #fff; border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 20px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05);
  animation: admin-card-in 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.1) both;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.adm-stat-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1); border-color: rgba(99, 102, 241, 0.25); }
@keyframes admin-card-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.adm-stat-icon {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 23px; flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.tint-blue .adm-stat-icon { background: #e3e9ff; }
.tint-green .adm-stat-icon { background: #e2f7ea; }
.tint-violet .adm-stat-icon { background: #ede9fe; }
.tint-cyan .adm-stat-icon { background: #d9f4fb; }
.tint-amber .adm-stat-icon { background: #fdf0d5; }
.tint-purple .adm-stat-icon { background: #f1e5ff; }
.adm-stat-body { display: flex; flex-direction: column; }
.adm-stat-value { font-size: 25px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.adm-stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.adm-card {
  background: #fff; border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 20px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05); padding: 22px;
}
.adm-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background:
    radial-gradient(560px 200px at 100% 0%, rgba(99, 102, 241, 0.12), transparent 60%),
    linear-gradient(120deg, #fff, #f8f8ff);
  border: 1px solid rgba(99, 102, 241, 0.14);
}
.adm-hero-text h2 { font-size: 18px; font-weight: 800; color: var(--navy); margin: 8px 0 6px; }
.adm-hero-text p { color: var(--muted); font-size: 14px; max-width: 640px; }
.adm-hero-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  background: #eefbf3; color: #12883c; font-size: 12px; font-weight: 700; border: 1px solid #c9efd8;
}

/* Users */
.admin-search { max-width: 520px; margin-bottom: 18px; }
.admin-search-box {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: #fff; border: 1px solid rgba(15, 23, 42, 0.1); border-radius: 14px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-search-box:focus-within { border-color: #6d7dff; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 8px 24px rgba(99, 102, 241, 0.12); }
.admin-search-box svg { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }
.admin-search-box input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; color: var(--navy); margin: 0; }
.admin-list-head { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 4px 2px 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.admin-user-card {
  display: flex; flex-direction: column; gap: 14px; padding: 18px;
  background: #fff; border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 20px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05);
  animation: admin-card-in 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.05) both;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.admin-user-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1); border-color: rgba(99, 102, 241, 0.3); }
.auc-head { display: flex; align-items: center; gap: 12px; }
.auc-avatar {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #4f6bff, #8b5cf6 60%, #22d3ee);
  color: #fff; font-weight: 800; font-size: 18px;
  background-size: cover; background-position: center;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.3);
}
.auc-id { display: flex; flex-direction: column; min-width: 0; }
.auc-id strong { font-size: 15px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auc-id span { font-size: 12.5px; color: var(--muted); }
.auc-badge {
  margin-left: auto; padding: 4px 10px; border-radius: 999px;
  background: linear-gradient(100deg, #4f6bff, #8b5cf6); color: #fff;
  font-size: 11px; font-weight: 700;
}
.auc-meta { display: flex; flex-direction: column; gap: 7px; }
.auc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.auc-row span { color: var(--muted); }
.auc-row b { color: var(--navy); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auc-stats { display: flex; gap: 8px; margin-top: 2px; }
.auc-stats span { font-size: 11.5px; font-weight: 700; color: #6d7dff; background: #eef0ff; padding: 4px 10px; border-radius: 999px; }
.auc-actions { border-top: 1px solid rgba(15, 23, 42, 0.06); padding-top: 12px; }
.btn-sm { padding: 9px 14px; font-size: 13px; border-radius: 11px; }
.back-btn { margin-bottom: 18px; }

/* User detail */
.admin-detail { max-width: 760px; }
.ad-profile-card {
  display: flex; align-items: center; gap: 18px; padding: 22px; margin-bottom: 16px;
  background: #fff; border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 20px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05);
}
.ad-avatar { width: 62px; height: 62px; font-size: 24px; border-radius: 18px; }
.ad-profile-info h2 { font-size: 20px; color: var(--navy); }
.ad-profile-info p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.ad-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ad-chip { font-size: 11.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: #eef0ff; color: #5b6bdc; }
.ad-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ad-stat { background: #fff; border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 16px; padding: 16px; text-align: center; box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04); }
.ad-stat strong { display: block; font-size: 22px; font-weight: 800; color: var(--navy); }
.ad-stat span { font-size: 12px; color: var(--muted); }
.ad-panel { background: #fff; border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 20px; padding: 22px; box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05); }
.ad-panel h3 { font-size: 16px; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.ad-panel form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.ad-panel input { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; font: inherit; font-size: 14px; outline: none; }
.ad-panel input:focus { border-color: #6d7dff; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
.ad-panel .btn-primary { align-self: flex-start; }

/* System controls */
.admin-page-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.adm-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.adm-card-icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0;
  background: linear-gradient(135deg, #eef0ff, #f5e9ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.adm-card-head h2 { font-size: 17px; font-weight: 800; color: var(--navy); }
.adm-card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.adm-settings-list { display: flex; flex-direction: column; }
.adm-setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 2px; border-bottom: 1px solid rgba(15, 23, 42, 0.06); font-size: 13.5px;
}
.adm-setting-row:last-child { border-bottom: 0; }
.adm-setting-row span { color: var(--muted); }
.adm-setting-row b { color: var(--navy); font-weight: 700; text-align: right; word-break: break-all; }
.adm-maint-status {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px;
  background: #f7f9fc; border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 16px;
}
.adm-maint-status strong { display: block; color: var(--navy); font-size: 15px; }
.adm-maint-status p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.maint-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; background: #16a34a; box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18); flex-shrink: 0; }
.maint-dot.on { background: #dc2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18); }
.maint-btn { width: 100%; margin-top: 16px; padding: 13px; border-radius: 14px; font-size: 14px; }

/* System resources monitoring */
.rs-full { margin-bottom: 18px; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.rs-card {
  display: flex; flex-direction: column; gap: 12px; padding: 18px;
  background: linear-gradient(150deg, #ffffff, #f7f8ff);
  border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 18px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  animation: admin-card-in 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.05) both;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.rs-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1); border-color: rgba(99, 102, 241, 0.28); }
.rs-head { display: flex; align-items: center; gap: 11px; }
.rs-icon {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0;
  background: linear-gradient(135deg, #eef0ff, #f5e9ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.rs-head-t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rs-head-t b { font-size: 14px; color: var(--navy); line-height: 1.2; }
.rs-badge {
  align-self: flex-start; font-size: 10.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  background: #eef0ff; color: #5b6bdc;
}
.rs-badge-live { background: #eefbf3; color: #12883c; }
.rs-badge-db { background: #e3e9ff; color: #4257d9; }
.rs-badge-off { background: #e9eef5; color: #64748b; }
.rs-badge-need { background: #fdf0d5; color: #a16207; }
.rs-badge-warn { background: #fff1f2; color: #dc2626; }
.rs-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rs-meta span { font-size: 12px; color: var(--muted); font-weight: 600; }
.rs-meta b { font-size: 15px; color: var(--navy); font-weight: 800; white-space: nowrap; }
.rs-bar { height: 9px; border-radius: 999px; background: rgba(15, 23, 42, 0.07); overflow: hidden; }
.rs-fill { height: 100%; border-radius: 999px; transition: width 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.1); }
.rs-fill-blue { background: linear-gradient(90deg, #4f6bff, #22d3ee); box-shadow: 0 0 12px rgba(79, 107, 255, 0.5); }
.rs-fill-green { background: linear-gradient(90deg, #16a34a, #4ade80); box-shadow: 0 0 12px rgba(22, 163, 74, 0.4); }
.rs-fill-cyan { background: linear-gradient(90deg, #0891b2, #22d3ee); box-shadow: 0 0 12px rgba(8, 145, 178, 0.4); }
.rs-fill-violet { background: linear-gradient(90deg, #8b5cf6, #c084fc); box-shadow: 0 0 12px rgba(139, 92, 246, 0.45); }
.rs-fill.warn, .rs-fill.rs-warn { background: linear-gradient(90deg, #f59e0b, #ef4444); box-shadow: 0 0 12px rgba(239, 68, 68, 0.45); }
.rs-sub { font-size: 11.5px; color: var(--faint); line-height: 1.4; }
.rs-cats { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.rs-cat { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; background: #fff; border: 1px solid rgba(15, 23, 42, 0.05); border-radius: 11px; }
.rs-cat span { font-size: 12.5px; color: var(--muted); }
.rs-cat b { font-size: 13px; color: var(--navy); font-weight: 800; }
.rs-mb { margin-bottom: 4px; }

/* Resource status levels */
.rs-lvl-warning { border-color: rgba(245, 158, 11, 0.45); background: linear-gradient(150deg, #fffdf5, #f7f8ff); }
.rs-lvl-critical { border-color: rgba(249, 115, 22, 0.55); background: linear-gradient(150deg, #fff7f0, #f7f8ff); }
.rs-lvl-full { border-color: rgba(220, 38, 38, 0.55); background: linear-gradient(150deg, #fff5f5, #f7f8ff); }
.rs-badge.rs-lvl-warning { background: #fef3c7; color: #b45309; }
.rs-badge.rs-lvl-critical { background: #ffedd5; color: #c2410c; }
.rs-badge.rs-lvl-full { background: #fee2e2; color: #b91c1c; }
.rs-fill-warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); box-shadow: 0 0 12px rgba(245, 158, 11, 0.5); }
.rs-fill-critical { background: linear-gradient(90deg, #f97316, #fb923c); box-shadow: 0 0 12px rgba(249, 115, 22, 0.5); }
.rs-fill-full { background: linear-gradient(90deg, #dc2626, #ef4444); box-shadow: 0 0 12px rgba(220, 38, 38, 0.5); }

/* Overall status banner */
.rs-banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 14px;
  background: #f0fdf4; border: 1px solid rgba(22, 163, 74, 0.25); border-radius: 14px;
}
.rs-banner b { font-size: 14px; color: #15803d; }
.rs-banner p { font-size: 12.5px; color: #4b5563; margin-top: 2px; }
.rs-banner.rs-banner-warning { background: #fffbeb; border-color: rgba(245, 158, 11, 0.35); }
.rs-banner.rs-banner-warning b { color: #b45309; }
.rs-banner.rs-banner-critical { background: #fff7ed; border-color: rgba(249, 115, 22, 0.4); }
.rs-banner.rs-banner-critical b { color: #c2410c; }
.rs-banner.rs-banner-full { background: #fef2f2; border-color: rgba(220, 38, 38, 0.4); }
.rs-banner.rs-banner-full b { color: #b91c1c; }

/* Automatic maintenance protection panel */
.ap-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 14px; }
.ap-row {
  display: flex; flex-direction: column; gap: 5px; padding: 10px 12px;
  background: #fff; border: 1px solid rgba(15, 23, 42, 0.07); border-radius: 12px;
}
.ap-row span { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.ap-row input {
  width: 100%; padding: 8px 10px; border: 1px solid rgba(15, 23, 42, 0.14); border-radius: 10px;
  font-size: 14px; font-weight: 700; color: var(--navy); background: #fbfcfe;
}
.ap-row input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
.ap-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.ap-history { margin-top: 14px; padding-top: 12px; border-top: 1px dashed rgba(15, 23, 42, 0.1); }
.ap-event { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 12px; }
.ap-event .muted { color: var(--faint); }
.maint-reason { margin-top: 6px; padding: 8px 10px; background: #fef2f2; border: 1px solid rgba(220, 38, 38, 0.2); border-radius: 10px; font-size: 12.5px; color: #b91c1c; font-weight: 600; }


.support-layout { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.7fr); height: min(720px, calc(100dvh - 220px)); min-height: 480px; overflow: hidden; background: #fff; border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 20px; box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05); }
.support-list { display: flex; min-height: 0; flex-direction: column; border-right: 1px solid rgba(15, 23, 42, 0.08); overflow-y: auto; background: #fbfcfe; }
.support-list-head { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.support-list-head h2 { margin: 0; font-size: 17px; color: var(--navy); }
.sup-count { margin-left: auto; font-size: 12px; font-weight: 800; color: #6d7dff; background: #eef0ff; padding: 4px 10px; border-radius: 999px; }
.support-list-body { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 12px; }
.support-thread {
  position: relative; display: flex; width: 100%; flex-direction: column; gap: 4px; padding: 13px; border: 0; border-radius: 14px;
  background: transparent; color: inherit; text-align: left; cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
.support-thread:hover { background: #f0f3ff; transform: translateX(2px); }
.support-thread.selected { background: linear-gradient(100deg, #eef1ff, #f6f0ff); box-shadow: inset 3px 0 0 #6d7dff; }
.support-thread.important { box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.55); }
.support-thread.important.selected { box-shadow: inset 3px 0 0 #6d7dff, inset 0 0 0 1px rgba(245, 158, 11, 0.55); }
.support-thread.flash { animation: support-thread-flash 1.6s ease; }
@keyframes support-thread-flash {
  0% { background: #e3ecff; box-shadow: 0 0 0 3px rgba(109, 125, 255, 0.45); }
  100% { background: transparent; box-shadow: none; }
}
.support-thread-top { display: flex; align-items: center; gap: 9px; min-width: 0; padding-right: 26px; }
.support-thread-avatar { position: relative; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; font-size: 14px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4f6bff, #8b5cf6); }
.support-thread.important .support-thread-avatar { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.support-thread-title { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 14px; font-weight: 700; color: var(--navy); }
.support-thread-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.support-thread-title time { margin-left: auto; flex-shrink: 0; color: var(--faint); font-size: 11px; font-weight: 600; }
.support-unread { width: 8px; height: 8px; border-radius: 50%; background: #6d7dff; box-shadow: 0 0 0 3px rgba(109, 125, 255, 0.18); flex-shrink: 0; }
.support-imp-pin { margin-right: 4px; font-size: 12px; }
.support-thread-subject { color: var(--navy); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.support-thread-preview { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.support-thread-dots {
  position: absolute; top: 8px; right: 8px;
  display: grid; place-items: center;
  width: 26px; height: 24px; padding: 0;
  border: 0; border-radius: 8px;
  background: transparent; color: #94a3b8;
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.support-thread-dots:hover { background: rgba(15, 23, 42, 0.08); color: var(--navy); }
.support-thread.selected .support-thread-dots:hover { background: rgba(109, 125, 255, 0.14); }
.support-conv-menu {
  position: fixed; z-index: 960;
  min-width: 200px; padding: 6px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 10px 34px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
  opacity: 0; transform: scale(0.92) translateY(-4px);
  transform-origin: top left; pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.support-conv-menu.open { opacity: 1; transform: scale(1) translateY(0); pointer-events: auto; }
.support-menu-sep { height: 1px; background: rgba(15, 23, 42, 0.08); margin: 6px 4px; }
.support-menu-ic { width: 20px; flex-shrink: 0; text-align: center; }
.support-conversation { position: relative; display: flex; min-width: 0; min-height: 0; flex-direction: column; background: #fff; }
.sup-conv-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid rgba(15, 23, 42, 0.08); }
.sup-status-badge { padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #fdf0d5; color: #a16207; }
.sup-status-badge.open { background: #eefbf3; color: #12883c; }
.support-back { display: none; }
.support-messages { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 14px; overflow-y: auto; padding: 22px 20px; background: linear-gradient(180deg, #f7f9fd, #f2f5fb); }
.support-message { align-self: flex-start; max-width: min(78%, 540px); animation: admin-card-in 0.3s ease both; }
.support-message.own { align-self: flex-end; }

/* Sender name sits ABOVE the bubble, never inside it. */
.support-bubble-label { display: block; margin: 0 4px 4px; font-size: 10.5px; font-weight: 800; color: #6d7dff; text-transform: uppercase; letter-spacing: 0.04em; }
.support-message.own .support-bubble-label { color: #8b5cf6; text-align: right; }

/* Row holding the action button + bubble; the button side depends on the message owner. */
.support-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.support-message.own .support-row { justify-content: flex-end; }

/* The bubble: ONLY the text, hugging its content. */
.support-bubble {
  width: fit-content; max-width: 100%;
  padding: 8px 14px;
  border-radius: 16px 16px 16px 4px;
  background: #fff; color: var(--navy);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06), inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}
.support-message.own .support-bubble {
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(135deg, #4f6bff, #6d5ce8); color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.3);
}
.support-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; line-height: 1.45; min-width: 0; }
.support-message.own .support-text { color: #fff; }
.support-dots {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 20px; height: 20px; padding: 0; margin: 0;
  border: 0; border-radius: 8px;
  background: transparent; color: #94a3b8;
  font-size: 16px; line-height: 1; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.support-dots:hover { background: rgba(15, 23, 42, 0.08); color: var(--navy); }
.support-message.own .support-dots { color: #cdd6ff; }
.support-message.own .support-dots:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }

/* Timestamp BELOW the bubble, small + muted. */
.support-msg-meta { display: flex; align-items: center; gap: 8px; margin: 3px 4px 0; }
.support-msg-meta time { display: block; margin: 0; color: var(--faint); font-size: 10.5px; }
.support-message.own .support-msg-meta { justify-content: flex-end; }
.support-status { flex-shrink: 0; color: var(--faint); font-size: 10.5px; font-weight: 700; }
.support-message.own .support-status { color: #9ec5ff; }
.sup-presence { font-size: 11px; font-weight: 800; color: var(--faint); }
.sup-presence.on { color: #16a34a; }
.support-online-dot { position: absolute; bottom: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.support-new-pill {
  position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); z-index: 30;
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border: 0; border-radius: 999px; background: #6d7dff; color: #fff;
  font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 20px rgba(109, 125, 255, 0.4); white-space: nowrap;
}
.support-new-pill:hover { background: #5a6bff; }
.support-edited { font-style: italic; opacity: 0.85; }
.support-msg-menu {
  position: fixed; z-index: 950;
  min-width: 158px; padding: 6px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 10px 34px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
  opacity: 0; transform: scale(0.92) translateY(-4px);
  transform-origin: top left; pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.support-msg-menu.open { opacity: 1; transform: scale(1) translateY(0); pointer-events: auto; }
.support-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  border: 0; background: transparent; border-radius: 9px;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--navy);
  text-align: left; cursor: pointer; white-space: nowrap;
  transition: background 0.14s ease;
}
.support-menu-item:hover { background: #f1f4fb; }
.support-menu-item.support-menu-danger { color: #ef4444; }
.support-menu-item.support-menu-danger:hover { background: #fef2f2; }
.support-message.support-deleted .support-bubble { background: #eef1f6; color: #94a3b8; box-shadow: none; opacity: 0.55; }
.support-deleted .support-unsent { font-style: italic; font-size: 13px; }
.support-unsent { font-size: 13px; }
.support-edit-form { display: flex; flex-direction: column; gap: 8px; }
.support-edit-input { min-height: 64px; width: 100%; padding: 9px 11px; border: 1px solid #6d7dff; border-radius: 10px; font: inherit; font-size: 13.5px; background: #fff; color: var(--navy); resize: vertical; outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14); }
.support-message.own .support-edit-input { background: #fff; color: var(--navy); }
.support-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }
.sup-head-actions { display: flex; align-items: center; gap: 10px; }
.sup-del { flex-shrink: 0; }
.support-conversation > header { flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid rgba(15, 23, 42, 0.08); }
.support-composer { flex-shrink: 0; display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid rgba(15, 23, 42, 0.08); background: #fff; }
.support-composer textarea { min-height: 46px; margin: 0; resize: vertical; flex: 1; }
.support-composer textarea:focus { border-color: #6d7dff; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); outline: 0; }
.support-empty { display: grid; place-items: center; padding: 40px; color: var(--muted); text-align: center; }
.support-empty-icon { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; font-size: 34px; background: linear-gradient(135deg, #eef0ff, #f5e9ff); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.support-menu-badge { display: inline-grid; min-width: 16px; height: 16px; place-items: center; margin-left: 4px; border-radius: 999px; background: #2563eb; color: #fff; font-size: 10px; }
.support-chat { position: relative; display: flex; width: min(680px, 100%); max-height: min(760px, calc(100vh - 32px)); flex-direction: column; overflow: hidden; }
.support-chat .modal-head { flex-shrink: 0; }
.support-chat .modal-head h2 { margin: 0; }
.support-chat-messages { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 14px; overflow-y: auto; padding: 20px; background: #f8fafc; }
.support-chat .support-composer { flex-shrink: 0; }
.support-chat-empty, .support-chat-loading { display: grid; flex: 1; place-items: center; padding: 30px; color: #64748b; text-align: center; }

/* Maintenance screen */
.maint-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.maint-card {
  width: min(480px, 100%); text-align: center; position: relative; z-index: 2;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px; padding: 44px 34px;
  box-shadow: 0 30px 80px rgba(30, 41, 88, 0.28);
  animation: admin-card-in 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.1) both;
}
.maint-icon {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 24px; display: grid; place-items: center; font-size: 36px;
  background: linear-gradient(135deg, #4f6bff, #8b5cf6 60%, #22d3ee);
  box-shadow: 0 14px 40px rgba(99, 102, 241, 0.45);
}
.maint-card h1 { font-size: 26px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.maint-card p { color: var(--muted); font-size: 14.5px; margin: 12px auto 0; max-width: 340px; }
.maint-badge { display: inline-flex; align-items: center; gap: 7px; margin-top: 18px; padding: 7px 14px; border-radius: 999px; background: #fff1f2; color: #dc2626; border: 1px solid #fecaca; font-size: 12.5px; font-weight: 700; }
.maint-badge .maint-dot { width: 8px; height: 8px; margin: 0; }

@media (max-width: 640px) {
  .admin-dash { flex-direction: column; }
  .admin-side { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; }
  .adm-logo { padding: 0; }
  .adm-logo-mark { width: 34px; height: 34px; font-size: 17px; border-radius: 11px; }
  .adm-logo-text { font-size: 17px; }
  .adm-nav { flex-direction: row; margin: 0 auto; gap: 4px; overflow-x: auto; }
  .adm-nav-item { padding: 9px 11px; font-size: 0; gap: 0; border-radius: 11px; }
  .adm-nav-item svg { width: 20px; height: 20px; }
  .adm-nav-item.active { font-size: 0; }
  .adm-side-foot { display: none; }
  .admin-top { padding: 14px 16px; }
  .admin-title { font-size: 20px; }
  .admin-content { padding: 18px 16px 40px; }
  .admin-top-actions { gap: 10px; }
  .adm-account-info { display: none; }
  .adm-status-pill { padding: 6px 11px; font-size: 11.5px; }
  .admin-search, .support-composer { align-items: stretch; flex-direction: column; }
  .support-layout { display: block; min-height: 0; height: auto; }
  .support-layout.has-conv .support-list { display: none; }
  .support-layout:not(.has-conv) .support-conversation { display: none; }
  .support-list { max-height: calc(100dvh - 210px); border-right: 0; border-bottom: 1px solid rgba(15, 23, 42, 0.08); }
  .support-conversation { min-height: calc(100dvh - 210px); }
  .support-message { max-width: 88%; }
  .support-back { display: inline-flex; }
  .support-chat { width: 100%; max-height: calc(100dvh - 16px); }
  .support-chat-messages { min-height: 0; }
  .ad-profile-card { flex-direction: column; text-align: center; }
  .adm-avatar { display: none; }
  .maint-card { padding: 34px 22px; }
}

html, body { height: 100%; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }

.muted { color: var(--muted); font-size: 13px; }
.faint { color: var(--faint); }

/* ============ App shell layout ============ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page-row {
  flex: 1;
  display: flex;
  gap: 56px;
  justify-content: center;
  padding: 28px 40px 60px;
  align-items: flex-start;
}

.page-content { min-width: 0; }
.page-content.wide { width: 820px; }
.page-content.medium { width: 700px; }
.page-content.narrow { width: 600px; }
.verify-banner { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 40px 0; padding: 10px 14px; border: 1px solid #fcd34d; border-radius: 12px; background: #fffbeb; color: #92400e; font-size: 13px; }

.rewards-panel {
  width: 290px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 96px;
}

/* ============ Sidebar ============ */
.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy);
  padding: 4px 10px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo .logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f97316, #f59e0b);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  color: #3a4356;
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
  transition: background 0.12s;
}
.side-nav a:hover { background: #f1f4f9; }
.side-nav a.active { background: #eef2f7; color: var(--navy); font-weight: 600; }
.side-nav .nav-icon { width: 22px; text-align: center; font-size: 17px; }

.side-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.btn-study {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.12s;
}
.btn-study:hover { background: #1e293b; }
.btn-add {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 11px 0;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
  transition: background 0.12s;
}
.btn-add:hover { background: #f1f4f9; }

.side-decks { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-decks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px 8px;
  font-size: 13px;
  font-weight: 700;
  color: #3a4356;
}
.side-decks-head button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
}
.side-decks-head button:hover { background: #eef2f7; }
.side-decks-list { overflow-y: auto; flex: 1; min-height: 0; }
.side-deck-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: #3a4356;
  transition: background 0.12s;
  max-width: 100%;
}
.side-deck-row:hover { background: #f1f4f9; }
.side-deck-row .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.side-deck-row .sname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-deck-row .chev { margin-left: auto; color: var(--faint); font-size: 11px; flex-shrink: 0; }
.side-deck-row.active { background: #eef2f7; }
.side-deck-row.sub { padding-left: 26px; }
.side-chev { width: 14px; flex-shrink: 0; font-size: 10px; color: var(--faint); text-align: center; cursor: pointer; }
.side-chev-empty { cursor: default; }

/* ============ Top controls ============ */
.top-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 40px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--bg) 75%, transparent);
}
.top-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  width: 230px;
  color: var(--faint);
  font-size: 14px;
}
.top-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  width: 100%;
  color: var(--text);
}
.top-pill {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
}
.top-pill .live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.top-icon-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.top-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ec4899);
  color: #fff;
  font-size: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: var(--shadow);
}
.top-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.top-avatar .avatar-letter { font-weight: 700; font-size: 16px; }
.top-avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
}
.top-avatar-btn:hover { background: #f8fafc; }
.top-caret { font-size: 10px; color: var(--muted); }
.gsearch-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  width: 230px;
}
.gsearch-ic { color: var(--faint); font-size: 14px; }
.gsearch-box input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  width: 100%;
  color: var(--text);
}
.gsearch-input { border: none; outline: none; background: transparent; font-size: 14px; flex: 1; color: var(--text); }
.gsearch-x {
  border: none;
  background: none;
  color: var(--faint);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gsearch-x:hover { background: #f1f4f9; color: var(--navy); }
.notif-btn { position: relative; }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}
.notif-panel {
  position: fixed;
  z-index: 980;
  width: 340px;
  max-width: 92vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}
.np-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--navy);
}
.np-loading { padding: 24px; text-align: center; color: var(--muted); }
.np-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }
.np-list { overflow: auto; }
.np-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font: inherit;
}
.np-item:hover { background: #f8fafc; }
.np-item.unread { background: #fffbeb; }
.np-item.unread::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #f97316; position: absolute; right: 12px; margin-top: 4px; }
.np-item { position: relative; }
.np-text { font-size: 13.5px; color: var(--navy); }
.np-time { font-size: 11.5px; color: var(--muted); }
.np-readall {
  border: none;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 11px;
  cursor: pointer;
}
.np-readall:hover { background: #f1f4f9; }
.acct-menu {
  position: fixed;
  z-index: 980;
  min-width: 230px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  padding: 6px;
  overflow: hidden;
}
.acct-menu .acct-head { padding: 8px 12px 10px; font-size: 14px; color: var(--navy); border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.acct-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  color: #1e293b;
  border-radius: 9px;
  cursor: pointer;
}
.acct-menu button:hover { background: #f1f4f9; }
.lr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  background: #fff;
}
.lr-code-big {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 10px;
  color: var(--navy);
  margin: 10px 0 14px;
}
.set-sec { font-size: 14px; font-weight: 800; color: var(--navy); margin: 18px 0 10px; }
.set-sec:first-child { margin-top: 4px; }
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--navy);
  border-bottom: 1px solid var(--border);
}
.help-item { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: #fff; overflow: hidden; }
.help-item summary { padding: 11px 14px; cursor: pointer; font-weight: 600; color: var(--navy); font-size: 14px; list-style: none; }
.help-item summary::before { content: "▸ "; color: var(--accent); }
.help-item[open] summary::before { content: "▾ "; }
.help-desc { padding: 0 14px 12px; font-size: 13.5px; color: var(--muted); }

@media (max-width: 980px) {
  .gsearch-box { width: 130px; }
  .top-controls { padding: 14px 18px 0; gap: 8px; }
}
@media (max-width: 720px) {
  .gsearch-box { width: 42px; padding: 8px; }
  .gsearch-box input { display: none; }
  .top-pill { padding: 8px 12px; }
  .top-pill { font-size: 0; gap: 0; }
  .top-pill .live-dot { margin: 0; }
}
@media (max-width: 900px) {
  .page-row { gap: 24px; padding: 24px 20px 48px; }
  .rewards-panel { display: none; }
  .page-content.wide, .page-content.medium, .page-content.narrow { width: min(100%, 760px); }
}
@media (max-width: 640px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; height: auto; min-height: 0; position: static; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .logo, .side-actions, .side-decks { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; margin: 0; gap: 4px; }
  .side-nav a { flex: 0 0 auto; padding: 8px 10px; font-size: 13px; }
  .page-row { padding: 18px 14px 36px; }
  .top-controls { padding: 10px 14px 0; }
  .deck-grid, .subdeck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deck-page-head { flex-wrap: wrap; }
  .deck-page-head h1 { flex-basis: 100%; }
  .lr-code-big { font-size: 28px; letter-spacing: 6px; }
  .verify-banner { margin: 10px 14px 0; align-items: flex-start; flex-direction: column; }
}

/* ============ Shared components ============ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 30px 0 12px;
}
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head .view-all {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.section-head .view-all:hover { color: var(--navy); }

.btn { border: none; border-radius: 999px; font-weight: 600; font-size: 14px; padding: 11px 22px; transition: filter 0.12s, background 0.12s; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #1e293b; }
.btn-secondary { background: #fff; border: 1px solid var(--border-strong); color: var(--navy); }
.btn-secondary:hover { background: #f1f4f9; }

input[type="text"], input[type="password"], textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.12s;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* circular progress */
.circ-wrap { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.circ-wrap svg { transform: rotate(-90deg); }
.circ-bg { stroke: #eef2f7; }
.circ-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.4s; }
.circ-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
}

/* ============ Home ============ */
.home-hero { display: flex; align-items: center; gap: 22px; margin: 26px 0 20px; }
.home-mascot {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7, #ffedd5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
}
.home-hero-title { font-size: 30px; font-weight: 800; line-height: 1.12; color: var(--navy); }
.home-hero-title .big { font-size: 46px; font-weight: 800; display: block; }

.composer {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px 20px;
  position: relative;
}
.composer textarea {
  border: none;
  resize: none;
  min-height: 90px;
  font-size: 16px;
  padding: 6px 0;
}
.composer .plus-ic {
  position: absolute;
  bottom: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  font-size: 18px;
  font-weight: 600;
}
.composer .plus-ic:hover { background: #f1f4f9; }

.home-actions { display: flex; gap: 10px; margin: 14px 0 6px; }
.home-action {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.home-action:hover { background: #f1f4f9; }
.home-action.more { flex: 0 0 96px; }

.hscroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.recent-card {
  flex: 0 0 210px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: box-shadow 0.12s, border-color 0.12s;
}
.recent-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.recent-card .rc-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.recent-card .rc-type { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ============ Progress ============ */
.level-card { padding: 20px; }
.level-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.level-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ec4899);
  color: #fff;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.level-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.level-badge {
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}
.level-xp { margin-left: auto; text-align: right; font-size: 13px; font-weight: 600; color: var(--navy); }
.level-xp .sub { color: var(--muted); font-weight: 500; font-size: 12px; }
.xp-bar { height: 12px; background: #eef2f7; border-radius: 999px; overflow: visible; position: relative; margin-top: 4px; }
.xp-bar .fill { height: 100%; background: #22c55e; border-radius: 999px; position: relative; }
.xp-tag {
  position: absolute;
  top: -16px;
  right: 0;
  background: #22c55e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.streak-card { padding: 20px; }
.streak-inner { display: flex; gap: 26px; align-items: center; margin: 14px 0 16px; }
.week-strip { flex: 1; }
.week-days { display: flex; gap: 4px; margin-top: 8px; }
.week-day { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.week-day .dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  margin: 0 auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: #eef2f7;
  color: var(--faint);
}
.week-day.done .dot { background: #dbeafe; color: #2563eb; }
.week-day.today .dot { background: var(--navy); color: #fff; box-shadow: 0 0 0 3px #eef2f7; }
.streak-flame {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 10px solid #fee2c2;
  background: #fff7ed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.streak-flame .n { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1; }
.streak-flame .lbl { font-size: 11px; color: var(--muted); margin-top: 3px; text-align: center; }
.streak-flame .ic { font-size: 20px; margin-top: 2px; }

.progress-deck { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.progress-deck + .progress-deck { border-top: 1px solid var(--border); }
.progress-deck .pd-info { flex: 1; min-width: 0; }
.progress-deck .pd-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-deck .pd-meta { font-size: 12.5px; color: var(--muted); }

.lb-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.lb-tab {
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.lb-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.lb-rank { width: 26px; font-size: 15px; font-weight: 700; color: var(--faint); }
.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #fff;
  flex-shrink: 0;
}
.lb-name { font-weight: 600; font-size: 14px; flex: 1; }
.lb-xp {
  background: #ecfdf5;
  color: #059669;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}

/* ============ My decks ============ */
.deck-page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.deck-page-head h1 { flex: 1; margin: 0; }
.deck-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.deck-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.12s, transform 0.12s;
  position: relative;
}
.deck-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.deck-card .strip { height: 46px; }
.deck-card .dc-body { padding: 12px 14px 14px; }
.deck-card .dc-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.25;
  min-height: 34px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.deck-card .dc-count { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.deck-card .dc-pct {
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  background: #fff7ed;
  padding: 2px 8px;
  border-radius: 999px;
}
.deck-card .dc-menu-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #334155;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.deck-card .dc-menu-btn:hover { background: #fff; color: var(--navy); }
.subdeck-section { margin-bottom: 4px; }
.subdeck-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.subdeck-card-wrap { position: relative; }
.subdeck-card {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 15px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  transition: box-shadow 0.12s, transform 0.12s;
}
.subdeck-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.subdeck-menu-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #334155;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.subdeck-menu-btn:hover { background: #fff; color: var(--navy); }
.study-chat-page { display:flex; flex-direction:column; gap:16px; min-height:620px; }
.study-chat-hero { display:flex; align-items:center; gap:12px; padding:16px 18px; border:1px solid #dbeafe; border-radius:18px; background:linear-gradient(120deg,#eff6ff,#f5f3ff); color:var(--navy); }
.study-chat-hero > span { display:grid; width:38px; height:38px; place-items:center; border-radius:13px; background:var(--accent); color:#fff; font-size:19px; }
.study-chat-hero div { display:flex; flex-direction:column; gap:2px; }.study-chat-hero small { color:var(--muted); }
.study-chat-skeleton { min-height:430px; border-radius:18px; background:linear-gradient(90deg,#f1f5f9 25%,#f8fafc 40%,#f1f5f9 55%); background-size:300% 100%; animation:study-shimmer 1.2s infinite; }
@keyframes study-shimmer { to { background-position:-300% 0; } }
.study-chat-page .deck-page-head h1 { margin:0; }
.study-chat-messages { display:flex; flex:1; min-height:420px; flex-direction:column; gap:12px; padding:20px; border:1px solid #e2e8f0; border-radius:20px; background:linear-gradient(180deg,#f8fafc,#fff); overflow:auto; }
.study-chat-messages .msg { max-width:min(78%, 680px); padding:12px 15px; border-radius:16px; white-space:pre-wrap; }
.study-chat-messages .msg.user { align-self:flex-end; background:var(--accent); color:#fff; border-bottom-right-radius:4px; }
.study-chat-messages .msg.ai { align-self:flex-start; background:#fff; color:var(--navy); border:1px solid var(--border); border-bottom-left-radius:4px; }
.study-chat-messages .msg.streaming { display:flex; align-items:center; justify-content:center; gap:10px; }
.study-waiting { color:var(--muted); font-size:13px; white-space:nowrap; }
.study-spinner { width:18px; height:18px; border:2px solid rgba(2,6,23,0.14); border-top-color:var(--accent); border-radius:50%; animation:study-spin 0.8s linear infinite; flex-shrink:0; }
@keyframes study-spin { to { transform:rotate(360deg); } }
.study-chat-messages .msg.error { border-color:#fecaca; background:#fef2f2; color:#b91c1c; }
.study-chat-composer { display:flex; gap:10px; align-items:flex-end; }
.study-chat-composer textarea { flex:1; min-height:48px; max-height:140px; resize:vertical; }
.study-suggestions { display:flex; flex-wrap:wrap; gap:8px; }
.study-overview { display:flex; flex-direction:column; gap:16px; }
.study-overview > p { margin:0; font-size:16px; line-height:1.55; }
.study-key-points { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.study-key-points h3,.study-key-points p { margin:0 0 6px; }
.study-methods { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.study-method { text-align:left; display:flex; flex-direction:column; gap:5px; padding:18px; border:1px solid var(--border); border-radius:16px; background:#fff; color:var(--navy); cursor:pointer; transition:.16s ease; }
.study-method:hover { transform:translateY(-2px); box-shadow:var(--shadow); }
.study-method.selected { border-color:var(--accent); box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent); }
.study-method span { color:var(--muted); font-size:13px; }
.study-card-preview { display:grid; gap:12px; margin-top:14px; }
.study-card-preview input:not([type=checkbox]),.study-card-preview textarea { display:block; width:100%; box-sizing:border-box; margin:8px 0; }
@media (max-width:700px) { .study-key-points,.study-methods { grid-template-columns:1fr; } .study-chat-messages .msg { max-width:92%; } .study-chat-composer { align-items:stretch; flex-direction:column; } }
.subdeck-swatch { width: 34px; height: 7px; border-radius: 999px; flex-shrink: 0; }
.subdeck-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.subdeck-count { font-size: 12.5px; color: var(--muted); }
.dc-menu {
  position: fixed;
  z-index: 950;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  padding: 6px;
}
.dc-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  color: #1e293b;
  border-radius: 9px;
  cursor: pointer;
}
.dc-menu button:hover { background: #f1f4f9; }
.dc-menu .dm-icon { font-size: 15px; opacity: 0.75; }

/* create-deck inline form */
.deck-create { padding: 16px 18px; margin-bottom: 18px; }

/* ============ Public decks ============ */
.public-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 18px;
  color: var(--faint);
  margin: 14px 0 12px;
}
.public-search input { border: none; outline: none; background: transparent; font-size: 15px; color: var(--text); }
.filter-row { display: flex; gap: 10px; margin-bottom: 8px; }
.filter-pill {
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-pill .chev { color: var(--faint); font-size: 11px; }

.subject-group { margin: 34px 0 10px; }
.subject-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2f7;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
}
.subject-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.subject-btn {
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px 26px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}
.subject-btn:hover { background: #f1f4f9; border-color: var(--border); }

/* ============ Profile ============ */
.profile-row { display: flex; align-items: center; gap: 16px; margin: 20px 0 18px; }
.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ec4899);
  color: #fff;
  font-size: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}
.profile-meta .p-name { font-size: 20px; font-weight: 800; color: var(--navy); }
.profile-meta .p-sub { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.profile-meta .p-bio { font-size: 13.5px; color: var(--text); margin-top: 8px; line-height: 1.5; }
.profile-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.profile-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.profile-stat { text-align: center; padding: 12px 4px; background: #f8fafc; border-radius: 12px; }
.profile-stat b { display: block; font-size: 17px; color: var(--navy); }
.profile-stat span { font-size: 11px; color: var(--muted); }
.profile-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-counts { display: flex; gap: 16px; margin-top: 10px; }
.p-count { background: none; border: none; padding: 0; font-size: 13px; color: var(--muted); cursor: pointer; }
.p-count b { color: var(--navy); margin-right: 3px; }
.btn-follow { min-width: 96px; justify-content: center; }

.feed-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.feed-item + .feed-item { border-top: 1px solid var(--border); }
.feed-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-soft, #eef2f7);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feed-avatar img { width: 100%; height: 100%; object-fit: cover; }
.feed-avatar .avatar-letter { font-weight: 700; font-size: 15px; color: var(--navy); }
.feed-body { flex: 1; min-width: 0; }
.feed-text { font-size: 13.5px; line-height: 1.45; }

.conn-wrap h1 { margin-bottom: 16px; }
.conn-wrap .round-back { margin-bottom: 10px; }
.conn-info { flex: 1; min-width: 0; }
.conn-name { font-size: 14px; font-weight: 600; }

.lb-me { background: #dbeafe; color: var(--navy); font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 6px; }
.school-head { font-size: 14px; }
.circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border-strong);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
}
.circle-btn:hover { background: #f1f4f9; }

.profile-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.profile-tab {
  background: none;
  border: none;
  padding: 10px 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.profile-tab.active { color: var(--navy); border-bottom-color: var(--navy); }

.clickable-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; }
.clickable-card:hover { box-shadow: var(--shadow-lg); }
.lead-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fce7f3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.lead-text { flex: 1; }
.lead-text .t { font-weight: 700; font-size: 14.5px; }
.lead-text .s { font-size: 12.5px; color: var(--muted); }
.lead-chev { color: var(--faint); font-size: 16px; }

.group-card { padding: 22px; text-align: center; }
.group-mascots { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.group-mascot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: #eef2f7;
}
.group-title { font-weight: 700; font-size: 16px; }
.group-sub { font-size: 13px; color: var(--muted); margin: 3px 0 16px; }

.streak-slots { display: flex; gap: 14px; justify-content: space-between; padding: 18px; }
.streak-slot {
  flex: 1;
  aspect-ratio: 1;
  max-width: 64px;
  border-radius: 50%;
  background: #eef2f7;
  color: var(--faint);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px dashed var(--border-strong);
}

.activity-card { display: flex; gap: 12px; padding: 16px 18px; }
.activity-card + .activity-card { border-top: 1px solid var(--border); }
.act-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #8b5cf6);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.act-body { flex: 1; min-width: 0; }
.act-user { font-weight: 700; font-size: 14px; }
.act-text { font-size: 13.5px; color: var(--text); }
.act-deck {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.act-deck:hover { background: #fafbfc; }
.act-actions { display: flex; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 14px; }
.act-actions span { cursor: pointer; }

/* ============ Rewards panel ============ */
.super-hearts {
  border-radius: var(--radius);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}
.super-hearts .hearts-bg {
  position: absolute;
  top: -12px;
  right: -8px;
  font-size: 88px;
  opacity: 0.25;
  transform: rotate(-14deg);
  pointer-events: none;
}
.super-hearts .sh-free { font-size: 26px; font-weight: 800; line-height: 1.05; }
.super-hearts .sh-title { font-size: 15px; font-weight: 700; margin-top: 2px; }
.super-hearts .sh-sub { font-size: 12.5px; opacity: 0.85; margin-top: 6px; }
.super-hearts .sh-btn {
  margin-top: 14px;
  background: #fff;
  color: #2563eb;
  border: none;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 700;
  width: 100%;
}
.super-hearts .sh-btn:hover { background: #eff6ff; }

.inventory { padding: 18px; }
.inv-top { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.inv-gem { font-size: 18px; }
.inv-count { font-size: 17px; font-weight: 800; color: var(--navy); }
.inv-items { display: flex; justify-content: space-between; }
.inv-item { position: relative; font-size: 24px; }
.inv-badge {
  position: absolute;
  bottom: -2px;
  right: -6px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--navy);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-shadow: var(--shadow);
}

/* ============ Auth ============ */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.auth-card { width: 400px; max-width: 100%; padding: 34px 30px; text-align: center; }
.auth-logo { font-size: 44px; line-height: 1; margin-bottom: 6px; }
.auth-brand { font-size: 28px; font-weight: 800; color: var(--navy); letter-spacing: -0.5px; }
.auth-sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.auth-seg {
  display: flex;
  background: #f1f3f6;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.auth-seg button.active { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.auth-f-title { text-align: left; font-size: 13px; font-weight: 600; color: var(--navy); margin: 2px 2px 10px; }
.auth-card input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  text-align: left;
  outline: none;
  background: #fff;
  color: var(--navy);
}
.auth-card input:focus { border-color: var(--accent, #f97316); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15); }
.auth-submit { width: 100%; padding: 13px; margin-top: 2px; }
.auth-submit:disabled { opacity: 0.7; cursor: default; }
.auth-forgot { margin-top: 12px; background: none; border: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.auth-forgot:hover { color: var(--navy); }
.auth-terms { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin: 20px 0 14px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-other { display: flex; flex-direction: column; gap: 10px; }
.auth-other-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.auth-other-btn:hover { background: #f7f8fa; }

.auth-pw { position: relative; margin-bottom: 12px; }
.auth-pw input { margin-bottom: 0; padding-right: 44px; }
.pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 8px; cursor: pointer;
  color: var(--muted); transition: color 0.15s, background 0.15s;
}
.pw-toggle:hover { color: var(--navy); background: rgba(15, 23, 42, 0.06); }
.pw-toggle svg { width: 19px; height: 19px; }
.pw-toggle .pw-eye-off { display: none; }
.pw-toggle.on .pw-eye-on { display: none; }
.pw-toggle.on .pw-eye-off { display: block; }

.page-loading { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 14px; }
.page-spinner { width: 28px; height: 28px; border: 3px solid #e8edf3; border-top-color: var(--accent, #f97316); border-radius: 50%; animation: page-spin .75s linear infinite; }
@keyframes page-spin { to { transform: rotate(360deg); } }

/* Password recovery deliberately uses a focused, separate auth surface. */
.password-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; box-sizing: border-box; overflow: hidden; position: relative; background: radial-gradient(circle at 20% 20%, #123d55 0, #081521 38%, #0c0b21 100%); color: #f7f9ff; }
.password-orb { position: absolute; width: 48vw; height: 48vw; border-radius: 50%; filter: blur(80px); opacity: .32; pointer-events: none; }
.password-orb-left { background: #00a6a6; left: -26vw; top: -10vw; }
.password-orb-right { background: #7047c9; right: -28vw; bottom: -25vw; }
.password-card { position: relative; z-index: 1; width: min(460px, 100%); box-sizing: border-box; padding: 42px; border: 1px solid rgba(180, 207, 255, .19); border-radius: 24px; background: rgba(12, 25, 45, .9); box-shadow: 0 30px 80px rgba(0, 0, 0, .38); }
.password-brand { color: #62e6df; font-size: 12px; font-weight: 800; letter-spacing: .18em; margin-bottom: 28px; }
.password-card h1 { margin: 0 0 12px; color: #fff; font-size: 32px; line-height: 1.12; letter-spacing: -.04em; }
.password-card p { color: #aebbd0; line-height: 1.6; margin: 0 0 28px; font-size: 14px; }
.password-card label { display: block; margin: 18px 0 8px; color: #bac7dc; font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.password-card input { display: block; box-sizing: border-box; width: 100%; padding: 15px 16px; border: 1px solid #31415c; border-radius: 12px; background: #101f35; color: #fff; font: inherit; outline: none; }
.password-card input:focus { border-color: #4ee4d6; box-shadow: 0 0 0 3px rgba(78, 228, 214, .14); }
.password-primary, .password-secondary { width: 100%; box-sizing: border-box; border-radius: 12px; padding: 15px; margin-top: 20px; border: 0; font: inherit; font-weight: 800; cursor: pointer; }
.password-primary { color: #041922; background: linear-gradient(100deg, #53e4db, #7b72ed); }
.password-secondary { color: #d9e5f5; background: transparent; border: 1px solid #3b4c68; }
.password-back { display: block; margin: 22px auto 0; padding: 0; border: 0; background: transparent; color: #9eb1cc; font: inherit; cursor: pointer; }
.password-note { margin-top: 10px; color: #8494ad; font-size: 12px; line-height: 1.5; }
.password-error { margin: 0 0 16px; padding: 12px; border: 1px solid rgba(255, 115, 115, .4); border-radius: 10px; color: #ffc0c0; background: rgba(117, 30, 40, .25); font-size: 13px; }
.reset-account { margin: 0 0 22px; padding: 13px 14px; border-radius: 12px; background: #101f35; }
.reset-account span { display: block; color: #8798b2; font-size: 11px; font-weight: 800; letter-spacing: .1em; margin-bottom: 5px; }
.reset-account strong { color: #fff; font-size: 14px; overflow-wrap: anywhere; }
.password-card footer { margin-top: 36px; color: #d1dded; font-size: 12px; line-height: 1.55; }
.password-card footer span { color: #7d8ea8; }
@media (max-width: 520px) { .password-page { padding: 16px; align-items: flex-start; } .password-card { margin-top: 20px; padding: 30px 22px; border-radius: 20px; } .password-card h1 { font-size: 28px; } }

/* ============ Onboarding: welcome popup + profile setup ============ */
.onboard-overlay {
  position: fixed; inset: 0; z-index: 300; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(1100px 620px at 50% -12%, #16214a 0%, transparent 55%),
    radial-gradient(900px 520px at 88% 112%, #3b0f5e 0%, transparent 55%),
    linear-gradient(160deg, #0a0e1f 0%, #0d1230 45%, #0a0e1f 100%);
}
.onboard-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; pointer-events: none; animation: orb-float 7s ease-in-out infinite; }
.orb-a { width: 46vmax; height: 46vmax; left: -14vmax; top: -12vmax; background: radial-gradient(circle, rgba(79, 107, 255, 0.55), transparent 60%); }
.orb-b { width: 42vmax; height: 42vmax; right: -14vmax; bottom: -16vmax; background: radial-gradient(circle, rgba(139, 92, 246, 0.5), transparent 60%); animation-delay: -3.5s; }
@keyframes orb-float { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-22px) scale(1.06); } }

.welcome-pop {
  position: relative; z-index: 1; text-align: center;
  padding: 54px 58px; border-radius: 28px; max-width: 470px; width: 100%;
  background: rgba(20, 27, 56, 0.72);
  border: 1px solid rgba(190, 205, 255, 0.14);
  box-shadow: 0 40px 120px rgba(2, 6, 23, 0.6), 0 0 80px rgba(91, 110, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  animation: welcome-in 0.7s cubic-bezier(0.2, 0.9, 0.25, 1.2) both;
  transition: opacity 0.3s, transform 0.3s;
}
.welcome-pop.leaving { opacity: 0; transform: scale(0.94); }
@keyframes welcome-in {
  from { opacity: 0; transform: translateY(26px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.welcome-rings { position: relative; width: 92px; height: 92px; margin: 0 auto 24px; }
.welcome-rings::before, .welcome-rings::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(125, 150, 255, 0.35); animation: ring-pulse 2.4s ease-out infinite; }
.welcome-rings::after { animation-delay: 1.2s; }
@keyframes ring-pulse { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.welcome-badge {
  position: absolute; inset: 12px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 34px; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, #4f6bff, #8b5cf6 55%, #22d3ee);
  box-shadow: 0 0 34px rgba(99, 102, 241, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  animation: badge-pop 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.4) 0.1s both;
}
@keyframes badge-pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
.welcome-pop h2 { color: #fff; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.welcome-pop p { color: #9fb0d6; font-size: 14px; line-height: 1.6; margin: 0; }

.profile-modal {
  position: relative; z-index: 1; width: min(440px, 100%);
  padding: 40px 38px 36px; border-radius: 26px; text-align: center;
  background: linear-gradient(180deg, rgba(24, 32, 66, 0.88), rgba(13, 18, 42, 0.92));
  border: 1px solid rgba(190, 205, 255, 0.15);
  box-shadow: 0 40px 120px rgba(2, 6, 23, 0.62), 0 0 90px rgba(91, 110, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  animation: profile-in 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}
@keyframes profile-in { from { opacity: 0; transform: translateY(22px) scale(0.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
.pm-badge {
  width: 66px; height: 66px; margin: 0 auto 18px; display: flex; align-items: center; justify-content: center;
  font-size: 30px; border-radius: 20px;
  background: linear-gradient(135deg, #4f6bff, #8b5cf6 60%, #22d3ee);
  box-shadow: 0 14px 40px rgba(99, 102, 241, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.profile-modal h2 { color: #fff; font-size: 23px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.pm-sub { color: #9fb0d6; font-size: 14px; line-height: 1.6; margin: 0 0 26px; }
.profile-modal label { display: block; text-align: left; color: #bac7e3; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 9px; }
.profile-modal input {
  width: 100%; box-sizing: border-box; padding: 15px 16px; border-radius: 14px;
  border: 1px solid #33417a; background: rgba(10, 15, 36, 0.7); color: #fff;
  font: inherit; font-size: 15px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.profile-modal input::placeholder { color: #5c6b96; }
.profile-modal input:focus { border-color: #6d7dff; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22), 0 0 24px rgba(99, 102, 241, 0.25); }
.pm-continue {
  width: 100%; margin-top: 18px; padding: 15px; border: 0; border-radius: 14px; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(100deg, #4f6bff, #7c5cf0 55%, #22b8e0);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.pm-continue:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(99, 102, 241, 0.55); filter: brightness(1.06); }
.pm-continue:active:not(:disabled) { transform: translateY(0); }
.pm-continue:disabled { opacity: 0.75; cursor: default; }
.pm-error { min-height: 18px; margin-top: 10px; color: #ff9aa0; font-size: 13px; text-align: left; }
@media (max-width: 480px) {
  .welcome-pop { padding: 44px 26px; }
  .profile-modal { padding: 32px 24px 28px; }
}
.ao-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(from -45deg, #ea4335 0 90deg, #fbbc05 90deg 180deg, #34a853 180deg 270deg, #4285f4 270deg 360deg);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.ao-apple {
  display: inline-block;
  width: 16px;
  height: 18px;
  background: #000;
  -webkit-mask: radial-gradient(circle at 50% 0, transparent 30%, #000 31%);
  mask: radial-gradient(circle at 50% 0, transparent 30%, #000 31%);
  border-radius: 9px 9px 5px 5px;
}
.acct-signout { color: #dc2626 !important; }

/* ============ Deck detail / study options ============ */
.deck-detail-head { text-align: center; padding: 26px 0 6px; }
.deck-detail-head .dd-badge {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
}
.deck-detail-head h1 { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.deck-detail-head .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }

.tabs { display: flex; gap: 6px; margin: 18px 0 16px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tabs button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active { color: var(--navy); border-bottom-color: var(--navy); }

.study-modes { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.study-mode {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.study-mode:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.study-mode.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15); }
.study-mode .sm-icon { font-size: 24px; width: 40px; height: 40px; border-radius: 12px; background: #fff7ed; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.study-mode .sm-name { font-size: 15px; font-weight: 700; }
.study-mode .sm-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.study-mode .sm-check { margin-left: auto; color: #e5e9f0; font-size: 16px; }
.study-mode.selected .sm-check { color: var(--accent); }

.deck-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow 0.12s, border-color 0.12s;
}
.deck-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.deck-row .name { font-size: 15px; font-weight: 600; }
.deck-row .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.deck-row .badge {
  background: #eef2f7;
  color: #3a4356;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 6px;
  font-weight: 600;
}
.deck-row .badge.due { background: #fff7ed; color: var(--accent); }

.card-preview { padding: 13px 4px; border-bottom: 1px solid var(--border); }
.card-preview .cp-front { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.card-preview .cp-back { font-size: 14px; color: var(--muted); }
.card-preview .cp-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.icon-btn {
  background: #f1f4f9;
  border: none;
  color: #3a4356;
  cursor: pointer;
  font-size: 14px;
  padding: 6px 9px;
  border-radius: 8px;
}
.icon-btn:hover { background: #e5e9f0; }
.icon-btn.delete:hover { background: #fef2f2; color: #dc2626; }

.empty { color: var(--muted); text-align: center; padding: 40px; font-size: 14.5px; }

/* chat */
.chat-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  height: 420px;
  overflow-y: auto;
  padding: 16px;
  margin-bottom: 12px;
}
.msg { margin-bottom: 12px; max-width: 80%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.msg.user { background: var(--navy); color: #fff; margin-left: auto; }
.msg.assistant { background: #f1f4f9; color: var(--text); }
.chat-input { display: flex; gap: 8px; }
.chat-input input { margin-bottom: 0; flex: 1; }
.chat-input .btn { margin: 0; }

/* ============ Flashcard / learn ============ */
.flashcard-wrap { position: relative; }
.flashcard {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  cursor: pointer;
  user-select: none;
  text-align: center;
  font-size: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.flashcard .back { color: #059669; }
.hint-txt { text-align: center; color: var(--muted); font-size: 12.5px; }

/* ============ Quiz (gizmo style, light) ============ */
.gq-screen {
  background: #eef1f5;
  color: #1f2937;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 40px;
}
.gq-header { display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid #e5e7eb; padding: 12px 18px; }
.gq-close { background: #f3f4f6; border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 14px; color: #6b7280; cursor: pointer; }
.gq-close:hover { background: #e5e7eb; }
.gq-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: #1f2937; cursor: pointer; }
.gq-deck-badge { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; font-size: 14px; }
.gq-deck-name { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gq-caret { color: #9ca3af; font-size: 12px; }
.gq-actions { display: flex; gap: 8px; }
.gq-icon { background: #f3f4f6; border: none; color: #4b5563; font-size: 13px; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.gq-icon:hover { background: #e5e7eb; }
.gq-icon-btn { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.gq-icon-btn svg { display: block; }

/* gold progress bar with circular indicator */
.gq-progress { height: 5px; background: #e5e7eb; position: relative; }
.gq-progress-fill { height: 100%; background: #fbbf24; transition: width 0.3s; }
.gq-progress-dot {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid #fbbf24;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
}

.gq-navrow { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 8px; gap: 12px; }
.gq-nav-round {
  width: 44px; height: 44px; border-radius: 50%; background: #fff;
  border: 1px solid var(--border-strong); color: var(--navy);
  font-size: 15px; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.gq-nav-round:hover:not(:disabled) { border-color: #fbbf24; color: #b45309; box-shadow: var(--shadow); }
.gq-nav-round:disabled { opacity: 0.4; cursor: default; }
.gq-resources { display: flex; gap: 10px; }
.gq-res {
  background: #fff; border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 9px 16px; font-size: 14px; font-weight: 700; color: var(--navy);
}
.gq-xp-pill {
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 999px;
  padding: 9px 16px; font-size: 14px; font-weight: 800; color: #b45309; white-space: nowrap;
}

/* gold question card */
.gq-card {
  background: #fff; border: 2px solid #fbbf24; border-radius: 24px;
  margin: 10px 22px 18px; padding: 20px 24px 28px; position: relative; text-align: center;
}
.gq-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.gq-new {
  display: inline-block; background: #d1fae5; color: #059669;
  font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 999px;
}
.gq-more {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: #fff; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer;
}
.gq-more:hover { border-color: var(--navy); color: var(--navy); }
.gq-question { font-size: 22px; font-weight: 700; color: #1f2937; line-height: 1.4; }

/* vertical answers */
.gq-answers { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0 22px; }
@media (min-width: 1100px) {
  .gq-answers { grid-template-columns: 1fr 1fr; }
}
.gq-show-options { margin: 0 22px; }
.gq-show-options .btn { width: 100%; padding: 18px; font-size: 16px; border-radius: 20px; }
.gq-answer {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 2px solid #e5e7eb; border-radius: 20px; min-height: 68px;
  padding: 14px 18px; font-size: 15px; color: #1f2937; cursor: pointer;
  text-align: left; transition: border-color 0.15s, box-shadow 0.15s;
}
.gq-answer:hover:not(:disabled) { border-color: #fbbf24; box-shadow: 0 2px 10px rgba(251, 191, 36, 0.18); }
.gq-answer .gq-letter {
  width: 30px; height: 30px; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; border-radius: 50%; background: #f3f4f6;
  font-weight: 700; font-size: 14px; color: #4b5563;
}
.gq-answer.correct { border-color: #16a34a; background: #f0fdf4; }
.gq-answer.correct .gq-letter { background: #16a34a; color: #fff; }
.gq-answer.wrong { border-color: #dc2626; background: #fef2f2; opacity: 0.7; }
.gq-answer.wrong .gq-letter { background: #dc2626; color: #fff; }
.gq-answer:disabled { cursor: default; }
.gq-answer.eliminated { background: #f3f4f6; border-color: #e5e7eb; color: #9ca3af; opacity: 0.55; text-decoration: line-through; }

/* typing */
.gq-typing { margin: 0 22px; }
.gq-typing { display: flex; gap: 10px; }
.gq-typing input {
  flex: 1; border: 2px solid #e5e7eb; border-radius: 16px; padding: 14px 16px;
  font-size: 15px; outline: none; background: #fff;
}
.gq-typing input:focus { border-color: #fbbf24; }
.gq-typing input.good { border-color: #16a34a; background: #f0fdf4; }
.gq-typing input.bad { border-color: #dc2626; background: #fef2f2; }
.gq-typing-fb { margin-top: 12px; font-size: 14px; color: #059669; background: #f0fdf4; border: 1px solid #bbf7d0; padding: 10px 14px; border-radius: 12px; }
.gq-typing-fb.try-again { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.gq-typing.answered input { border-color: #e5e7eb; }

/* flashcard */
.gq-flashcard { margin: 0 22px; text-align: center; }
.gq-reveal-btn {
  background: #fff; border: 2px solid #fbbf24; color: #b45309;
  padding: 16px 28px; border-radius: 999px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.gq-reveal-btn:hover { background: #fffbeb; }
.gq-fc-back {
  background: #fffbeb; border: 2px solid #fde68a; border-radius: 20px;
  padding: 26px 20px; font-size: 20px; font-weight: 600; color: #92400e; line-height: 1.5;
}
.gq-revealed-answer {
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 16px;
  padding: 16px 18px; font-size: 16px; color: #065f46; text-align: center;
}

/* 3-column assistance toolbar */
.gq-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 22px 0; }
.gq-tool {
  background: #fff; border: 1px solid #e5e7eb; color: #374151;
  padding: 13px 10px; border-radius: 18px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.gq-tool:hover:not(:disabled) { border-color: #fbbf24; color: #b45309; }
.gq-tool:disabled { opacity: 0.4; cursor: default; }
.gq-tools.answered { grid-template-columns: repeat(2, 1fr); }
.gq-continue { background: var(--navy); color: #fff; border-color: var(--navy); }
.gq-continue:hover:not(:disabled) { background: #1e293b; color: #fff; border-color: var(--navy); }

.gq-explain-card { margin: 14px 22px 0; background: #fff; border: 1px solid #e5e7eb; color: #374151; padding: 14px 18px; border-radius: 12px; font-size: 14px; line-height: 1.5; }

.gq-qmenu { position: fixed; z-index: 210; min-width: 170px; }

.quiz-result { text-align: center; padding: 60px 20px; }
.result-num { font-size: 64px; font-weight: 800; color: #b45309; margin-bottom: 6px; }

/* ============ misc ============ */
#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--navy);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast .toast-action {
  background: #fbbf24;
  color: var(--navy);
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 14px;
  margin-left: 14px;
  cursor: pointer;
}
#toast .toast-action:hover { background: #fcd34d; }

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5dbe5; border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ Deck detail ============ */
.deck-top { display: flex; align-items: center; gap: 12px; margin: 10px 0 6px; flex-wrap: wrap; }
.round-back {
  width: 38px; height: 38px; border-radius: 50%; background: #fff;
  border: 1px solid var(--border); font-size: 20px; line-height: 1; color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.round-back:hover { background: #f1f4f9; }
.deck-color-sq { width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; }
.deck-head-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.deck-parent-link {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deck-parent-link:hover { color: var(--accent); }
.deck-title {
  font-size: 22px; font-weight: 800; color: var(--navy);
  flex: 1; min-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deck-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.deck-icon-btn {
  width: 42px; height: 42px; border-radius: 50%; background: #fff;
  border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--navy); flex-shrink: 0;
}
.deck-icon-btn:hover { background: #f1f4f9; }
.deck-icon-btn svg { display: block; }
.deck-add {
  height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 14px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.deck-study {
  height: 42px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  box-sizing: border-box;
}
.deck-study:disabled { background: #cbd5e1; cursor: not-allowed; }
.deck-search { margin: 6px 0 2px; }
.deck-top-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.deck-head-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.deck-search-row { display: flex; align-items: center; }
.deck-search-box {
  display: flex; align-items: center; gap: 8px; flex: 1;
  border: 2px solid var(--border-strong); border-radius: 14px;
  padding: 9px 14px; background: #fff;
}
.deck-search-box input { flex: 1; border: none; outline: none; font-size: 14px; background: transparent; color: var(--text); }
.deck-search-x { border: none; background: none; color: var(--faint); font-size: 14px; cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.deck-search-x:hover { background: #f1f4f9; color: var(--navy); }
.deck-actions.searching .deck-icon-btn { display: none; }
mark { background: #fde68a; color: #78350f; border-radius: 3px; padding: 0 1px; }
.add-content-card { width: 440px; max-width: 94vw; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.ac-list { padding: 6px 10px 10px; }
.ac-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 13px 12px; border: none; background: none; border-bottom: 1px solid var(--border);
  cursor: pointer; font: inherit;
}
.ac-row:last-child { border-bottom: none; }
.ac-row:hover { background: #fbfbfd; }
.ac-icon { width: 42px; height: 42px; border-radius: 12px; background: #f1f4f9; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.ac-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ac-title { font-weight: 700; font-size: 14.5px; color: var(--navy); }
.ac-sub { font-size: 12.5px; }
.ac-chev { color: var(--faint); font-size: 20px; flex-shrink: 0; }
.note-ta { width: 100%; border: 2px solid var(--border-strong); border-radius: 16px; padding: 14px 16px; font-size: 15px; outline: none; resize: vertical; background: #fff; font-family: inherit; color: var(--text); }
.note-ta:focus { border-color: #fbbf24; }
.import-ta { min-height: 220px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 13px; color: var(--navy); margin-bottom: 6px; }
.imp-err { color: #dc2626; font-size: 13px; margin-top: 6px; }
.import-url { width: 100%; border: 2px solid var(--border-strong); border-radius: 14px; padding: 12px 14px; font-size: 15px; outline: none; background: #fff; color: var(--text); }
.import-url:focus { border-color: #fbbf24; }
.home-more-menu {
  position: fixed; z-index: 900; min-width: 230px;
  background: #fff; border: 1px solid var(--border); border-radius: 0 0 14px 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18); padding: 6px; overflow: hidden;
}
.home-more-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 12px; border: none; background: none; font: inherit; font-size: 14px;
  color: #1e293b; border-radius: 9px; cursor: pointer;
}
.home-more-menu button:hover { background: #f1f4f9; }
.home-more-menu .hm-icon { font-size: 16px; }
.deck-select-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 10px; border: 1px solid var(--border); border-radius: 12px;
  background: #fff; cursor: pointer; font: inherit; margin-bottom: 8px;
}
.deck-select-row:hover { border-color: #fbbf24; }
.deck-select-row.selected { border-color: #fbbf24; background: #fffbeb; }
.deck-picker-body { max-height: 56vh; overflow: auto; }
.quizlet-preview { max-height: 68vh; overflow: auto; }
.quizlet-card-list { display: grid; gap: 10px; margin: 14px 0; }
.quizlet-card { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; }
.quizlet-card input, .quizlet-card textarea, .quizlet-preview select, .field select { width: 100%; border: 1px solid var(--border-strong); border-radius: 9px; padding: 9px 10px; background: #fff; color: var(--text); font: inherit; }
.quizlet-card textarea { min-height: 64px; resize: vertical; }
.quizlet-card input:focus, .quizlet-card textarea:focus, .field select:focus { border-color: #2563eb; box-shadow: 0 0 0 3px #dbeafe; outline: 0; }
.rec-timer { font-size: 30px; font-weight: 800; color: var(--navy); text-align: center; margin: 10px 0; font-variant-numeric: tabular-nums; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; margin-right: 6px; animation: recblink 1s infinite; }
@keyframes recblink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.lecture-modal { width: min(720px, 100%); }
.lecture-recording { text-align: center; }
.lecture-controls { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.lecture-stop { border: 1px solid #fecaca; background: #fff; color: #dc2626; }
.lecture-text { min-height: 320px; }
.lecture-preview { max-height: 70vh; overflow: auto; }

.cards-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 12px; }
.cards-head h2 { font-size: 16px; font-weight: 700; }
.sort-btn {
  width: 36px; height: 36px; border-radius: 50%; background: #fff;
  border: 1px solid var(--border); font-size: 15px; color: var(--navy);
}
.sort-btn:hover { background: #f1f4f9; }

.flashcard-list-card {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 15px 18px; margin-bottom: 10px; box-shadow: var(--shadow); position: relative;
}
.flashcard-list-card:hover { box-shadow: var(--shadow-lg); }
.fc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.fc-q { font-size: 15px; font-weight: 700; color: var(--navy); line-height: 1.4; }
.fc-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.card-type-badge {
  font-size: 11px; font-weight: 700; color: #7c3aed; background: #f5f3ff;
  padding: 3px 10px; border-radius: 999px;
}
.fc-menu-btn { background: none; border: none; color: var(--faint); font-size: 18px; padding: 2px 8px; border-radius: 8px; cursor: pointer; }
.fc-menu-btn:hover { background: #f1f4f9; color: var(--navy); }
.fc-divider { border-top: 1px dashed #dbe1ea; margin: 12px 0; }
.fc-a { font-size: 14.5px; color: var(--text); line-height: 1.45; }

/* card context menu */
.card-menu {
  position: fixed; background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 300; min-width: 172px;
}
.card-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none;
  padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--text); text-align: left;
}
.card-menu button:hover { background: #f1f4f9; }
.card-menu button.danger:hover { background: #fef2f2; color: #dc2626; }
.card-menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* notes tab */
.note-block { padding: 12px 0; border-bottom: 1px solid var(--border); }
.note-block:last-child { border-bottom: none; }
.note-head { margin-bottom: 6px; font-size: 14px; }
.note-content {
  font-size: 13.5px; color: var(--muted); line-height: 1.6;
  white-space: pre-wrap; max-height: 220px; overflow-y: auto;
}

/* ============ Overlay + editor ============ */
.sg-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.20); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.editor-modal {
  width: 580px; max-width: 94vw; max-height: 92vh; border-radius: 24px;
  display: flex; flex-direction: column; overflow: hidden;
}
.editor-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.editor-title { font-size: 16px; font-weight: 700; }
.editor-save {
  width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff;
  border: none; font-size: 17px; display: inline-flex; align-items: center; justify-content: center;
}
.editor-save:hover:not(:disabled) { background: #1e293b; }
.editor-save:disabled { opacity: 0.6; cursor: wait; }
.editor-body { padding: 20px; overflow-y: auto; }

.type-switch { display: flex; background: #f1f4f9; border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.type-switch button {
  flex: 1; border: none; background: transparent; padding: 9px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.type-switch button.active { background: #fff; color: var(--navy); box-shadow: var(--shadow); }

.field label {
  font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.03em; display: block; margin-bottom: 6px;
}
.field textarea { margin-bottom: 0; }
.field { margin-bottom: 16px; }

.fmt-bar { display: flex; gap: 6px; justify-content: flex-end; margin: 8px 0 2px; }
.fmt-bar button {
  width: 32px; height: 32px; border-radius: 50%; background: #f1f4f9;
  border: 1px solid var(--border); color: var(--navy); font-size: 13px; font-weight: 700;
}
.fmt-bar button:hover { background: #e5e9f0; }

.mc-editor { margin-top: 8px; }
.scope-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.scope-chips button {
  background: #fff; border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.scope-chips button.active { background: #dcfce7; border-color: #86efac; color: #15803d; }
.opt-count {
  text-align: center; font-size: 14px; font-weight: 700; color: var(--navy);
  background: #f1f4f9; border-radius: 999px; padding: 7px 18px;
  width: fit-content; margin: 0 auto 14px;
}
.opt-group { border-radius: 16px; overflow: hidden; margin-bottom: 12px; }
.opt-row { display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; border-bottom: 1px solid var(--border); background: #fff; }
.opt-row:last-child { border-bottom: none; }
.opt-row.correct { background: #dcfce7; }
.opt-row.correct .opt-input { background: transparent; }
.opt-input { flex: 1; border: none; outline: none; background: transparent; font-size: 14.5px; color: var(--text); }
.opt-mark {
  width: 26px; height: 26px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
}
.opt-row.correct .opt-mark { background: #22c55e; color: #fff; }
.opt-row:not(.correct) .opt-mark { background: #eef2f7; color: var(--muted); }
.opt-row:not(.correct) .opt-mark:hover { background: #fee2e2; color: #dc2626; }
.add-opt {
  width: 100%; background: #fff; border: 1px dashed var(--border-strong); border-radius: 14px;
  padding: 12px; font-size: 14px; font-weight: 600; color: var(--navy);
}
.add-opt:hover:not(:disabled) { background: #f1f4f9; }
.add-opt:disabled { opacity: 0.5; cursor: not-allowed; }

/* move modal */
.move-modal { width: 420px; max-width: 92vw; max-height: 70vh; overflow-y: auto; padding: 0; }
.mm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff;
}
.mm-head h2 { font-size: 16px; }
.mm-list { padding: 8px; }
.mm-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.mm-row:hover { background: #f1f4f9; }
.mm-name { flex: 1; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ Quiz settings + Share modals ============ */
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.modal-head h2 { font-size: 16px; font-weight: 700; }
.round-close {
  width: 32px; height: 32px; border-radius: 50%; background: #f3f4f6;
  border: none; font-size: 13px; color: #6b7280; cursor: pointer;
}
.round-close:hover { background: #e5e7eb; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body h3 {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.03em; margin: 18px 0 10px;
}
.modal-body h3:first-child { margin-top: 0; }

.settings-modal { width: 480px; max-width: 94vw; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.style-group { border-radius: 16px; overflow: hidden; }
.style-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  cursor: pointer; border-bottom: 1px solid var(--border); background: #fff;
  width: 100%; text-align: left; font: inherit; color: inherit; border-left: none; border-right: none; border-top: none;
}
.style-row:last-child { border-bottom: none; }
.style-row:hover { background: #fbfbfd; }
.style-row:focus-visible { outline: 2px solid #fbbf24; outline-offset: -2px; }
.style-row.selected { background: #fffbeb; }
.style-radio { font-size: 17px; color: var(--muted); line-height: 1.3; flex-shrink: 0; }
.style-row.selected .style-radio { color: #b45309; }
.style-text { display: flex; flex-direction: column; gap: 2px; }
.style-name { font-weight: 600; font-size: 14.5px; color: var(--navy); }
.style-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.settings-group { border-radius: 16px; overflow: hidden; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px;
  width: 100%; text-align: left; font: inherit; color: inherit;
  cursor: pointer; background: #fff; border: none; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row:hover { background: #fbfbfd; }
.setting-row:focus-visible { outline: 2px solid #fbbf24; outline-offset: -2px; }
.setting-text { display: flex; flex-direction: column; gap: 2px; }
.setting-name { font-weight: 600; font-size: 14.5px; color: var(--navy); }
.setting-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.toggle {
  width: 44px; height: 26px; border-radius: 999px; border: none; background: #e2e8f0;
  position: relative; cursor: pointer; flex-shrink: 0; transition: background 0.15s;
}
.toggle span {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: left 0.15s;
}
.toggle.on { background: #22c55e; }
.toggle.on span { left: 21px; }
.share-from-settings { width: 100%; margin-top: 18px; }

.share-modal { width: 460px; max-width: 94vw; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.share-deck-name { font-size: 17px; font-weight: 800; color: var(--navy); margin-bottom: 14px; }
.access-row {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--border-strong); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px;
  font-size: 14px; color: var(--muted); cursor: pointer;
}
.access-row b { color: var(--navy); }
.chev { font-size: 11px; color: var(--muted); }
.shared-preview {
  display: flex; align-items: center; gap: 12px; border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 14px;
}
.sp-strip { width: 8px; align-self: stretch; border-radius: 999px; flex-shrink: 0; }
.sp-name { font-weight: 700; font-size: 14.5px; color: var(--navy); }
.share-actions { display: flex; align-items: center; gap: 10px; }
.share-copy { flex: 1; }
.circle-btn {
  width: 40px; height: 40px; border-radius: 50%; background: #f1f4f9;
  border: 1px solid var(--border-strong); color: var(--navy); font-size: 17px; cursor: pointer; flex-shrink: 0;
}
.circle-btn:hover { background: #e5e9f0; }

.conn-area { margin-top: 20px; }
.conn-search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-strong); border-radius: 14px; padding: 11px 14px; background: #fff;
}
.conn-search input { flex: 1; border: none; outline: none; font-size: 14px; background: transparent; }
.conn-area h3 { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 18px 0 8px; }
.conn-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.conn-row + .conn-row { border-top: 1px solid var(--border); }
.conn-name { flex: 1; font-weight: 600; font-size: 14.5px; color: var(--navy); }
.conn-share { padding: 8px 16px; font-size: 13.5px; }
.conn-share:disabled { background: #dcfce7; border-color: #86efac; color: #15803d; }

/* ============ Add deck modal ============ */
.ad-overlay .add-deck-modal { transform: translateX(4vw); }
.add-deck-modal {
  width: 720px; max-width: 94vw; min-height: 560px; max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28); border: 1px solid var(--border);
}
.ad-head {
  display: flex; align-items: center; justify-content: center; position: relative;
  padding: 18px 16px 12px;
}
.ad-head h2 { font-size: 17px; font-weight: 800; color: var(--navy); }
.ad-head .round-close { position: absolute; right: 16px; top: 14px; }
.ad-body { padding: 4px 26px 22px; overflow-y: auto; flex: 1; }

.ad-dest { display: flex; justify-content: center; margin: 4px 0 22px; position: relative; }
.ad-pill {
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 8px 18px;
  background: #fff; font-size: 13.5px; font-weight: 600; color: var(--navy); cursor: pointer;
}
.ad-pill:hover { border-color: var(--navy); }
.ad-menu {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15); min-width: 230px; padding: 6px;
  z-index: 8; display: none;
}
.ad-menu.open { display: block; }
.ad-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: none; border-radius: 10px;
  font-size: 13.5px; color: var(--navy); cursor: pointer;
}
.ad-menu button:hover { background: #f1f4f9; }

.ad-field label {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 7px;
}
.ad-name-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.ad-field { flex: 1; }
.ad-name-input {
  width: 100%; border: 2px solid var(--border-strong); border-radius: 16px;
  padding: 14px 16px; font-size: 15px; outline: none; background: #fff; color: var(--navy);
}
.ad-name-input:focus { border-color: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18); }
.ad-remove {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; color: var(--muted); font-size: 14px; cursor: pointer; flex-shrink: 0;
}
.ad-remove:hover { color: #dc2626; border-color: #fca5a5; background: #fef2f2; }
.ad-add-another {
  display: block; margin: 0 0 24px auto; border: none; background: none;
  color: var(--navy); font-weight: 700; font-size: 13.5px; cursor: pointer; padding: 4px 2px;
}
.ad-add-another:hover { color: #b45309; }

.ad-colour label {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 12px;
}
.ad-palette { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.ad-color {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; position: relative; padding: 0;
}
.ad-color.selected { border: 3px solid #fff; box-shadow: 0 0 0 2px var(--navy); }
.ad-color.ad-custom {
  border: 2px dashed var(--border-strong); background: #fff; color: var(--navy);
  font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.ad-color.ad-custom:hover { border-color: var(--navy); }
.ad-color-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.ad-foot { padding: 14px 26px 22px; border-top: 1px solid var(--border); background: #fff; }
.add-deck-submit {
  width: 100%; padding: 15px; font-size: 15.5px; font-weight: 700; border-radius: 16px;
}
.add-deck-submit:disabled { background: #94a3b8; opacity: 1; cursor: not-allowed; }

/* ============ Empty deck state ============ */
.empty-deck {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 46px 20px 60px;
}
.empty-deck-illustration {
  width: 88px; height: 88px; border-radius: 50%; background: #eff6ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; margin-bottom: 20px; color: #3b82f6;
}
.empty-deck h3 { font-size: 21px; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.empty-deck .sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.empty-deck-actions { display: flex; flex-direction: column; gap: 12px; width: min(430px, 100%); }
.empty-deck-actions .btn { padding: 14px; font-size: 15px; border-radius: 999px; }

/* Keep study controls usable on narrow screens without changing desktop density. */
@media (max-width: 640px) {
  h1 { font-size: clamp(22px, 7vw, 26px); }
  .card-pad { padding: 16px; }
  .flashcard { min-height: min(52vh, 360px); padding: 22px 18px; font-size: clamp(17px, 5vw, 20px); }
  .chat-box { height: min(52vh, 420px); padding: 12px; }
  .msg { max-width: 90%; }

  .gq-screen { padding-bottom: 24px; }
  .gq-header { padding: 10px 12px; }
  .gq-title { font-size: 14px; min-width: 0; }
  .gq-deck-name { max-width: 34vw; }
  .gq-actions { gap: 4px; }
  .gq-icon { padding: 7px 10px; }
  .gq-navrow { padding: 12px 14px 6px; }
  .gq-resources { gap: 6px; }
  .gq-res, .gq-xp-pill { padding: 8px 10px; font-size: 12px; }
  .gq-card { margin: 8px 14px 14px; padding: 16px 16px 22px; border-radius: 18px; }
  .gq-question { font-size: clamp(18px, 5.5vw, 22px); }
  .gq-answers, .gq-show-options, .gq-typing, .gq-flashcard { margin-left: 14px; margin-right: 14px; }
  .gq-answer { min-height: 58px; padding: 12px 14px; font-size: 14px; border-radius: 16px; }
  .gq-fc-back { padding: 20px 16px; font-size: clamp(17px, 5vw, 20px); }
  .gq-tools, .gq-tools.answered { grid-template-columns: 1fr; gap: 8px; margin: 14px 14px 0; }
  .gq-tool { padding: 12px; border-radius: 14px; }
  .gq-explain-card { margin: 12px 14px 0; padding: 12px 14px; }
  .quiz-result { padding: 40px 16px; }

  .add-deck-modal { max-width: 100vw; max-height: 100dvh; min-height: 100dvh; border-radius: 0; }
  .ad-overlay .add-deck-modal { transform: none; }
  .ad-body { padding: 4px 18px 18px; }
  .ad-foot { padding: 12px 18px 18px; }
  .ad-name-row { align-items: flex-end; }
}
