/* ===== Design tokens =====
   Palette: Ink navy base, warm amber "highlighter" accent, chalk white, muted slate for secondary text.
   Type: "Fraunces"-esque serif for display (fallback Georgia), Inter for UI/body, JetBrains Mono for codes/data.
   Signature: index-card stacked resource tiles with a torn top-corner fold + a left "spine" rule on panels.
*/
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #14213d;
  --ink-2: #1e2f52;
  --paper: #faf8f3;
  --paper-dim: #f0ede4;
  --amber: #e8a33d;
  --amber-dark: #c9822a;
  --slate: #5b6472;
  --slate-light: #8a92a0;
  --line: #dcd6c8;
  --danger: #c0392b;
  --success: #2f7a4f;
  --card-shadow: 0 1px 2px rgba(20,33,61,0.06), 0 8px 24px rgba(20,33,61,0.06);
  --radius: 10px;
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
button { font-family: var(--font-body); cursor: pointer; }
input, select, textarea { font-family: var(--font-body); }

::selection { background: var(--amber); color: var(--ink); }

/* ===== Layout shells ===== */
.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.center-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 15% 20%, rgba(232,163,61,0.07), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(20,33,61,0.05), transparent 45%),
    var(--paper);
}

/* ===== Auth card (spine-ruled panel signature) ===== */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 40px 36px;
  position: relative;
  border-left: 4px solid var(--ink);
}
.auth-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.auth-brand .mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  background: var(--ink);
  color: var(--paper);
  width: 26px; height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
}
.auth-brand .word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
}
.auth-card h1 {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 6px;
  margin-top: 18px;
}
.auth-sub {
  color: var(--slate);
  font-size: 14px;
  margin-bottom: 26px;
  line-height: 1.5;
}
.step-track {
  display: flex;
  gap: 5px;
  margin-bottom: 24px;
}
.step-track .dot {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--line);
}
.step-track .dot.done { background: var(--amber); }
.step-track .dot.active { background: var(--ink); }

/* ===== Form elements ===== */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
  margin-bottom: 7px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14.5px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: #fff;
}
.field .hint {
  font-size: 12.5px;
  color: var(--slate-light);
  margin-top: 6px;
  line-height: 1.5;
}
.field .hint a { color: var(--amber-dark); font-weight: 600; text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border: none;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--ink-2); }
.btn:active { transform: scale(0.99); }
.btn.amber { background: var(--amber); color: var(--ink); }
.btn.amber:hover { background: var(--amber-dark); color: #fff; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn.ghost:hover { border-color: var(--ink); background: var(--paper-dim); }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a5311f; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.link-row {
  text-align: center;
  margin-top: 20px;
  font-size: 13.5px;
  color: var(--slate);
}
.link-row a { color: var(--ink); font-weight: 600; border-bottom: 1.5px solid var(--amber); }

.auth-legal-strip {
  text-align: center;
  padding: 18px 16px 28px;
  font-size: 12.5px;
  color: var(--slate-light);
}
.auth-legal-strip a { color: var(--slate); }
.auth-legal-strip a:hover { color: var(--ink); }

.alert {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 18px;
  line-height: 1.5;
}
.alert.error { background: #fbeceb; color: var(--danger); border: 1px solid #f3cec9; }
.alert.success { background: #eaf5ef; color: var(--success); border: 1px solid #c9e6d5; }
.alert.info { background: #eef1fa; color: var(--ink); border: 1px solid #dbe1f2; }

.warning-box {
  background: #fdf2e0; border: 1px solid #f3d9a8; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 20px;
}
.warning-box h4 { font-size: 13.5px; margin-bottom: 10px; color: var(--ink); }
.warning-box ul { margin: 0; padding-left: 18px; }
.warning-box li { font-size: 13px; color: var(--slate); line-height: 1.6; margin-bottom: 8px; }
.warning-box li:last-child { margin-bottom: 0; }
.warning-box li strong { color: var(--ink); }

/* ===== OTP inputs ===== */
.otp-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.otp-row input {
  text-align: center;
  font-size: 20px;
  font-family: var(--font-mono);
  padding: 12px 0;
  width: 100%;
}
.resend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--slate);
  margin-bottom: 18px;
}
.resend-row button {
  background: none; border: none; color: var(--amber-dark); font-weight: 600; font-size: 13px; padding: 0;
}
.resend-row button:disabled { color: var(--slate-light); cursor: not-allowed; }

/* ===== Top navigation ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .brand { display: flex; align-items: center; gap: 9px; }
.topbar .brand .mark {
  font-family: var(--font-display); font-weight: 700; font-style: italic;
  background: var(--ink); color: var(--paper); width: 30px; height: 30px;
  border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}
.topbar .brand .word { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.topbar-nav { display: flex; align-items: center; gap: 22px; }
.topbar-nav a { font-size: 13.5px; font-weight: 600; color: var(--slate); }
.topbar-nav a:hover { color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.balance-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--paper-dim); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 20px; font-size: 13.5px; font-weight: 600;
}
.balance-chip .amt { font-family: var(--font-mono); color: var(--success); }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--slate);
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--amber); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.icon-btn {
  background: none; border: 1.5px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; color: var(--ink); font-weight: 600;
}
.icon-btn:hover { border-color: var(--ink); }
.hamburger-btn { display: none; font-size: 17px; padding: 6px 10px; }

.mobile-menu {
  display: none; flex-direction: column; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 61px; z-index: 39;
}
.mobile-menu.open { display: flex; }
.mobile-menu a, .mobile-menu button {
  padding: 13px 20px; font-size: 14px; font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--paper-dim); background: none; border-left: none; border-right: none; border-top: none;
  text-align: left; width: 100%;
}

@media (max-width: 760px) {
  .topbar-nav { display: none; }
  .hamburger-btn { display: inline-flex; }
  .hide-mobile { display: none; }
  .topbar { padding: 12px 16px; }
}

/* ===== Dashboard shell ===== */
.dash-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 60px;
  width: 100%;
}
.dash-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 14px;
}
.dash-head .eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--amber-dark); font-weight: 700; margin-bottom: 6px;
}
.dash-head h1 { font-size: 28px; }
.dash-head .meta { color: var(--slate); font-size: 13.5px; margin-top: 5px; }

.activation-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius); padding: 20px 26px; margin-bottom: 28px;
  gap: 18px; flex-wrap: wrap;
}
.activation-banner .text h3 { font-size: 17px; margin-bottom: 4px; color: #fff; }
.activation-banner .text p { font-size: 13.5px; color: #c7cde0; margin: 0; }

/* ===== Resource grid: index-card signature ===== */
.section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--slate); font-weight: 700; margin: 30px 0 14px;
}
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.res-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
}
.res-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow);
}
.res-card .thumb {
  height: 110px;
  background: var(--paper-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid var(--line);
}
.res-card .thumb::before {
  /* torn corner fold - signature detail */
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 22px 22px 0;
  border-color: transparent var(--paper) transparent transparent;
  filter: drop-shadow(-1px 1px 1px rgba(0,0,0,0.08));
}
.res-card .thumb img { width: 42px; height: 42px; opacity: 0.85; }
.res-card .body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.res-card .body h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.res-card .body .type-tag {
  font-size: 11px; color: var(--slate-light); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 10px; font-weight: 600;
}
.res-card .body .go {
  margin-top: auto; font-size: 13px; font-weight: 700; color: var(--amber-dark);
  display: flex; align-items: center; gap: 4px;
}
.res-card.premium { border-color: var(--amber); }
.res-card .price-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 9px; border-radius: 20px; font-family: var(--font-mono);
}
.premium-section-note {
  font-size: 13px; color: var(--slate); margin: -8px 0 16px; line-height: 1.5;
}
.uploader-cta-strip {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--paper-dim); border: 1px dashed var(--line); border-radius: 10px;
  padding: 14px 18px; margin: 4px 0 30px; font-size: 13.5px; color: var(--slate);
}
.uploader-cta-strip a { color: var(--amber-dark); font-weight: 700; text-decoration: underline; }
.res-card.locked { cursor: pointer; }
.res-card.locked .body, .res-card.locked .thumb { filter: grayscale(0.5) opacity(0.55); }
.res-card.locked .lock-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(250,248,243,0.35);
}
.res-card.locked .lock-overlay .lock-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.bookmark-form { position: absolute; top: 8px; right: 8px; z-index: 2; margin: 0; }
.bookmark-star {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.85); color: var(--slate-light);
  font-size: 15px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15); transition: color .15s ease, transform .1s ease;
}
.bookmark-star:hover { transform: scale(1.1); color: var(--amber-dark); }
.bookmark-star.active { color: var(--amber); }

/* ===== Notice modal ===== */
.notice-overlay {
  position: fixed; inset: 0; background: rgba(20,33,61,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.notice-modal {
  background: #fff; border-radius: 12px; max-width: 440px; width: 100%;
  padding: 28px 26px; border-top: 5px solid var(--amber);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.notice-modal h3 { font-size: 19px; margin-bottom: 10px; }
.notice-modal .msg { font-size: 14px; color: var(--slate); line-height: 1.6; margin-bottom: 20px; }
.notice-modal .msg em, .notice-modal .msg strong { color: var(--ink); }

/* ===== Info/help modal ===== */
.help-overlay {
  position: fixed; inset: 0; background: rgba(20,33,61,0.55);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.help-overlay.open { display: flex; }
.help-modal {
  background: #fff; border-radius: 12px; max-width: 460px; width: 100%;
  padding: 28px 26px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.help-modal h3 { font-size: 18px; margin-bottom: 12px; }
.help-modal ol { padding-left: 18px; color: var(--slate); font-size: 13.5px; line-height: 1.8; }
.help-modal .close-help { margin-top: 18px; }

/* ===== Wallet page ===== */
.wallet-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; }
@media (max-width: 860px) { .wallet-grid { grid-template-columns: 1fr; } }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; border-left: 4px solid var(--ink);
}
.panel h3 { font-size: 17px; margin-bottom: 4px; }
.panel .sub { font-size: 13px; color: var(--slate); margin-bottom: 18px; }
.big-balance { font-family: var(--font-mono); font-size: 38px; font-weight: 600; color: var(--success); margin-bottom: 4px; }

.wd-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--paper-dim);
  font-size: 13.5px;
}
.wd-item:last-child { border-bottom: none; }
.status-badge {
  padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
}
.status-badge.pending { background: #fdf2e0; color: var(--amber-dark); }
.status-badge.paid { background: #e7f5ec; color: var(--success); }
.status-badge.rejected { background: #fbeceb; color: var(--danger); }
.status-badge.cancelled { background: var(--paper-dim); color: var(--slate); }

.invite-code-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper-dim); border: 1.5px dashed var(--line);
  padding: 14px 16px; border-radius: 8px; margin-bottom: 16px;
}

.uploader-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.listing-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--paper-dim);
}
.listing-row:last-child { border-bottom: none; }
@media (max-width: 640px) { .uploader-stats-row { grid-template-columns: 1fr 1fr; } }
.invite-code-box .code {
  font-family: var(--font-mono); font-size: 18px; font-weight: 600; letter-spacing: 1px; flex: 1;
}
.copy-btn {
  background: var(--ink); color: #fff; border: none; border-radius: 6px;
  padding: 7px 12px; font-size: 12.5px; font-weight: 600;
}

/* ===== PDF viewer ===== */
.pdf-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: var(--ink); color: #fff; gap: 12px; flex-wrap: wrap;
}
.demo-preview-banner {
  background: var(--amber); color: var(--ink); font-size: 13px; font-weight: 600;
  padding: 9px 20px; text-align: center;
}
.demo-preview-banner a { color: var(--ink); text-decoration: underline; margin-left: 6px; }
.pdf-toolbar .title {
  font-size: 14px; font-weight: 600; font-family: var(--font-display);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw;
}
.pdf-toolbar .controls { display: flex; align-items: center; gap: 8px; }
.pdf-toolbar button {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff;
  border-radius: 6px; padding: 7px 12px; font-size: 14px; min-width: 38px;
}
.pdf-toolbar button:hover { background: rgba(255,255,255,0.2); }
.pdf-toolbar span.page-info { font-size: 13px; font-family: var(--font-mono); display: flex; align-items: center; gap: 5px; }
.pdf-toolbar #page-jump {
  width: 40px; text-align: center; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25);
  color: #fff; border-radius: 5px; padding: 5px 4px; font-family: var(--font-mono); font-size: 13px;
}
.pdf-toolbar .hide-narrow { display: inline-flex; }

.pdf-viewport {
  flex: 1; overflow: auto; background: #4a4f5c; display: flex; justify-content: center;
  align-items: flex-start; padding: 24px 0; position: relative;
}
#pdf-canvas-wrap { position: relative; }
#pdf-canvas-wrap canvas { display: block; box-shadow: 0 4px 24px rgba(0,0,0,0.4); background: #fff; }

/* Selectable text layer overlaid on the canvas, matching pdf.js's standard approach,
   so zoomed-in text stays crisp (vector) instead of relying on the raster canvas. */
.pdf-text-layer {
  position: absolute; top: 0; left: 0; overflow: hidden; opacity: 1;
  line-height: 1; pointer-events: auto;
}
.pdf-text-layer span, .pdf-text-layer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.pdf-text-layer ::selection { background: rgba(232,163,61,0.4); }

.protection-watermark {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-wrap: wrap; align-content: space-around; justify-content: space-around;
  opacity: 0.10; overflow: hidden;
}
.protection-watermark span {
  transform: rotate(-30deg); font-size: 13px; color: #000; white-space: nowrap; font-family: var(--font-mono);
}

.pdf-loading {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: #cfd3de; font-size: 13.5px;
}
.spinner.light { border-color: rgba(255,255,255,0.2); border-top-color: #fff; }

.page-render-spinner {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  display: none; background: rgba(0,0,0,0.55); border-radius: 50%; padding: 14px;
}
.page-render-spinner.active { display: block; }

.pdf-error {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; text-align: center; padding: 30px;
}

.blur-guard {
  position: fixed; inset: 0; background: var(--ink); color: #fff;
  display: none; align-items: center; justify-content: center; z-index: 200; font-size: 15px; text-align: center;
}
.blur-guard.active { display: flex; }

@media (max-width: 640px) {
  .pdf-toolbar { padding: 8px 10px; gap: 6px; }
  .pdf-toolbar .title { max-width: 100%; font-size: 12.5px; }
  .pdf-toolbar .controls { gap: 5px; width: 100%; justify-content: space-between; }
  .pdf-toolbar button { padding: 8px 10px; min-width: 34px; font-size: 15px; }
  .pdf-toolbar .hide-narrow { display: none; }
  .pdf-viewport { padding: 12px 0; }
}



/* ===== Questions interface ===== */
.qbank-wrap { max-width: 760px; margin: 0 auto; padding: 30px 20px 60px; }
.q-card {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--amber);
  border-radius: 10px; padding: 20px 22px; margin-bottom: 16px;
}
.q-card .q-num { font-size: 12px; color: var(--slate-light); font-weight: 700; margin-bottom: 8px; letter-spacing: 0.04em; }
.q-card .q-text { font-size: 15.5px; font-weight: 600; margin-bottom: 12px; line-height: 1.5; }
.q-card .reveal-btn {
  background: none; border: 1.5px solid var(--line); border-radius: 6px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.q-card .ans {
  margin-top: 12px; padding: 12px 14px; background: var(--paper-dim); border-radius: 8px;
  font-size: 14px; color: var(--ink); display: none; line-height: 1.55;
}
.q-card .ans.shown { display: block; }

/* ===== Notices list page ===== */
.notice-list { max-width: 760px; margin: 0 auto; padding: 30px 20px 60px; }
.notice-entry {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 14px; font-size: 14.5px; line-height: 1.6; border-left: 4px solid var(--ink);
}

/* ===== PDF list (folder browsing) ===== */
.pdf-list { max-width: 900px; margin: 0 auto; padding: 30px 20px 60px; }
.pdf-file-row {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 18px; margin-bottom: 10px; font-size: 14.5px; font-weight: 500;
}
.pdf-file-row .fname { display: flex; align-items: center; gap: 12px; }
.pdf-file-row .fname .fi {
  width: 32px; height: 32px; border-radius: 6px; background: #fbeee0; color: var(--amber-dark);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--slate);
}
.empty-state h3 { font-size: 17px; margin-bottom: 6px; color: var(--ink); }
.empty-state.locked-state {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 44px 24px;
}
.empty-state.locked-state p { max-width: 420px; margin: 0 auto 18px; font-size: 14px; line-height: 1.6; }

/* ===== Admin (bare functional) ===== */
.admin-body { font-family: var(--font-body); background: #f4f4f6; color: #222; }
.admin-nav {
  background: #1a1a2e; color: #fff; padding: 12px 20px;
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
}
.admin-nav a { color: #cfd3e0; font-size: 13.5px; padding: 6px 10px; border-radius: 5px; }
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,0.12); color: #fff; }
.admin-nav .brand { font-weight: 700; margin-right: 10px; }
.admin-wrap { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; }
.admin-wrap h1 { font-family: var(--font-body); font-size: 20px; margin-bottom: 16px; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.admin-table th, .admin-table td { padding: 8px 10px; border: 1px solid #ddd; text-align: left; }
.admin-table th { background: #f0f0f3; font-weight: 600; }
@media (max-width: 720px) {
  .admin-table { display: block; overflow-x: auto; white-space: nowrap; }
  .admin-nav { overflow-x: auto; flex-wrap: nowrap; }
  .admin-form { max-width: 100% !important; }
}
.admin-form { background: #fff; padding: 16px; border: 1px solid #ddd; margin-bottom: 20px; max-width: 480px; }
.admin-form label { display: block; font-size: 12.5px; font-weight: 600; margin: 10px 0 4px; }
.admin-form input, .admin-form select, .admin-form textarea { width: 100%; padding: 7px 8px; border: 1px solid #ccc; font-size: 13px; }
.admin-form button { margin-top: 12px; }
.admin-btn { padding: 5px 10px; font-size: 12px; border: 1px solid #ccc; background: #fff; border-radius: 4px; }
.admin-btn.danger { background: #c0392b; color: #fff; border-color: #c0392b; }
.admin-btn.success { background: #2f7a4f; color: #fff; border-color: #2f7a4f; }
.badge-sm { padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-sm.yes { background: #e7f5ec; color: #2f7a4f; }
.badge-sm.no { background: #fbeceb; color: #c0392b; }
.tabs-row { margin-bottom: 16px; }
.stat-cards { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card { background: #fff; border: 1px solid #ddd; padding: 14px 20px; min-width: 140px; }
.stat-card .num { font-size: 24px; font-weight: 700; }
.stat-card .lbl { font-size: 12px; color: #777; }

/* ===== Home / landing page ===== */
.hero-wrap {
  max-width: 1180px; margin: 0 auto; padding: 60px 24px 50px;
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 50px; align-items: center;
}
.hero-copy .eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--amber-dark); font-weight: 700; margin-bottom: 14px; }
.hero-copy h1 { font-size: 44px; line-height: 1.15; margin-bottom: 18px; }
.hero-copy h1 em { font-style: italic; color: var(--amber-dark); }
.hero-sub { font-size: 16px; color: var(--slate); line-height: 1.6; margin-bottom: 26px; max-width: 480px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.hero-actions .btn { width: auto; padding: 13px 26px; }
.hero-price-note { font-size: 13px; color: var(--slate-light); }

.hero-visual { position: relative; height: 320px; }
.stack-card {
  position: absolute; width: 220px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; box-shadow: var(--card-shadow);
}
.stack-card.c1 { top: 10px; left: 10px; transform: rotate(-6deg); z-index: 1; }
.stack-card.c2 { top: 60px; left: 130px; transform: rotate(4deg); z-index: 2; }
.stack-card.c3 { top: 150px; left: 30px; transform: rotate(-2deg); z-index: 3; }
.sc-thumb { height: 60px; border-radius: 8px; background: var(--paper-dim); margin-bottom: 12px; }
.sc-thumb.amber-thumb { background: #fbeee0; }
.sc-line { height: 8px; border-radius: 4px; background: var(--paper-dim); margin-bottom: 8px; }
.sc-line.w70 { width: 70%; }
.sc-line.w60 { width: 60%; }
.sc-line.w50 { width: 50%; }
.sc-line.w40 { width: 40%; background: var(--amber); opacity: 0.5; }

.features-wrap { max-width: 1180px; margin: 30px auto 0; padding: 30px 24px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.feature-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 24px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow); }
.feature-card .fi-icon { font-size: 26px; margin-bottom: 12px; }
.feature-card h3 { font-size: 16.5px; margin-bottom: 8px; }
.feature-card p { font-size: 13.5px; color: var(--slate); line-height: 1.6; margin: 0; }

.how-wrap { max-width: 1180px; margin: 20px auto 0; padding: 30px 24px 50px; }
.steps-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.step-item { position: relative; padding-left: 4px; }
.step-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-display);
  margin-bottom: 12px; font-size: 15px;
}
.step-item h4 { font-size: 15.5px; margin-bottom: 6px; }
.step-item p { font-size: 13.5px; color: var(--slate); line-height: 1.6; margin: 0; }

.cta-band {
  background: var(--ink); color: #fff; text-align: center;
  padding: 56px 24px; margin-top: 10px;
}
.cta-band h2 { font-size: 26px; color: #fff; margin-bottom: 22px; font-weight: 600; }
.cta-band .btn { width: auto; padding: 13px 30px; display: inline-flex; }

@media (max-width: 860px) {
  .hero-wrap { grid-template-columns: 1fr; padding-top: 40px; gap: 40px; }
  .hero-copy h1 { font-size: 32px; }
  .hero-visual { height: 220px; margin: 0 auto; max-width: 320px; width: 100%; }
  .stack-card { width: 180px; }
  .stack-card.c2 { left: 90px; }
}

/* ===== Chat corner ===== */
.chat-shell {
  display: flex; flex: 1; min-height: 0; height: calc(100vh - 61px);
}
.chat-main { display: flex; flex-direction: column; flex: 1; min-width: 0; background: var(--paper); }
.chat-tabs {
  display: flex; align-items: center; gap: 4px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line);
}
.chat-tab {
  background: none; border: none; padding: 9px 16px; font-size: 13.5px; font-weight: 600; color: var(--slate);
  border-radius: 8px; cursor: pointer;
}
.chat-tab.active { background: var(--paper-dim); color: var(--ink); }
.chat-online-toggle {
  margin-left: auto; background: none; border: 1.5px solid var(--line); border-radius: 8px;
  padding: 7px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink); display: none;
}

.chat-loading {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--slate); font-size: 13.5px;
}
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--ink);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chat-error {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--danger); font-size: 14px; padding: 30px;
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px;
}
.chat-msg { max-width: 70%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; }
.chat-msg-name { font-size: 11.5px; font-weight: 700; color: var(--slate); margin-bottom: 3px; margin-left: 2px; }
.chat-msg-course { font-weight: 500; color: var(--slate-light); text-transform: none; }
.chat-msg-bubble {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; border-bottom-left-radius: 4px;
  padding: 10px 14px; font-size: 14px; line-height: 1.5; word-break: break-word;
}
.chat-msg.mine .chat-msg-bubble {
  background: var(--ink); color: #fff; border: none; border-bottom-right-radius: 4px; border-bottom-left-radius: 14px;
}
.chat-msg-time { font-size: 10.5px; color: var(--slate-light); margin-top: 3px; margin-left: 2px; display: flex; align-items: center; gap: 8px; }
.chat-msg.mine .chat-msg-time { text-align: right; margin-right: 2px; justify-content: flex-end; }
.chat-report-btn {
  background: none; border: none; color: var(--slate-light); font-size: 10.5px; text-decoration: underline;
  cursor: pointer; padding: 0;
}
.chat-report-btn:hover { color: var(--danger); }
.chat-report-btn:disabled { text-decoration: none; cursor: default; }

.chat-input-row {
  display: flex; gap: 10px; padding: 14px 20px; background: #fff; border-top: 1px solid var(--line);
}
.chat-input-row input {
  flex: 1; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 20px; font-size: 14px;
}
.chat-input-row input:focus { outline: none; border-color: var(--ink); }
.chat-input-row .btn { border-radius: 20px; }

.chat-online-panel {
  width: 220px; flex-shrink: 0; background: #fff; border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.chat-online-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--slate);
}
.close-online-btn { display: none; background: none; border: none; font-size: 18px; color: var(--slate); }
.chat-online-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.online-item {
  padding: 9px 16px; font-size: 13.5px; color: var(--ink); display: flex; align-items: center; gap: 8px;
}
.online-item::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

@media (max-width: 900px) {
  .chat-online-panel {
    position: fixed; right: 0; top: 61px; bottom: 0; z-index: 50; transform: translateX(100%);
    transition: transform .2s ease; box-shadow: -4px 0 16px rgba(0,0,0,0.1);
  }
  .chat-online-panel.open { transform: translateX(0); }
  .chat-online-toggle { display: inline-flex; }
  .close-online-btn { display: block; }
  .chat-msg { max-width: 85%; }
}


.account-field-row {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--paper-dim); font-size: 14px;
}
.account-field-row:last-child { border-bottom: none; }
.account-field-row span { color: var(--slate); }
.account-field-row strong { color: var(--ink); }

.toggle-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch {
  width: 42px; height: 24px; border-radius: 20px; background: var(--line);
  position: relative; flex-shrink: 0; transition: background .15s ease;
}
.toggle-switch::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s ease; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-row input:checked + .toggle-switch { background: var(--ink); }
.toggle-row input:checked + .toggle-switch::before { transform: translateX(18px); }
.toggle-label { font-size: 14px; font-weight: 600; }


.ticket-thread { display: flex; flex-direction: column; gap: 12px; }
.ticket-msg {
  max-width: 75%; padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.55;
}
.ticket-msg.user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.ticket-msg.admin { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ticket-msg .tm-who { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; margin-bottom: 6px; }
.ticket-msg .tm-text { white-space: pre-wrap; }
.ticket-msg .tm-time { font-size: 11px; opacity: 0.6; margin-top: 8px; }
@media (max-width: 640px) { .ticket-msg { max-width: 90%; } }

/* ===== Site footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  margin-top: auto;
  padding: 26px 24px;
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.footer-brand { display: flex; align-items: center; gap: 8px; }
.footer-brand .mark {
  font-family: var(--font-display); font-weight: 700; font-style: italic;
  background: var(--ink); color: var(--paper); width: 24px; height: 24px;
  border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.footer-brand .word { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { font-size: 13px; color: var(--slate); font-weight: 500; }
.footer-links a:hover { color: var(--ink); }
.footer-copy { font-size: 12.5px; color: var(--slate-light); }
@media (max-width: 720px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ===== Public content pages (policy, contact, pricing) ===== */
.public-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--line);
}
.public-topbar .brand { display: flex; align-items: center; gap: 9px; }
.public-topbar .brand .mark {
  font-family: var(--font-display); font-weight: 700; font-style: italic;
  background: var(--ink); color: var(--paper); width: 30px; height: 30px;
  border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}
.public-topbar .brand .word { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.public-wrap {
  max-width: 780px; margin: 0 auto; padding: 50px 24px 70px; flex: 1;
}
.public-wrap .eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--amber-dark); font-weight: 700; margin-bottom: 10px;
}
.public-wrap h1 { font-size: 32px; margin-bottom: 8px; }
.public-wrap .updated { font-size: 13px; color: var(--slate-light); margin-bottom: 36px; }
.public-wrap h2 { font-size: 19px; margin: 32px 0 12px; font-family: var(--font-body); font-weight: 700; }
.public-wrap p, .public-wrap li { font-size: 14.5px; color: var(--slate); line-height: 1.75; }
.public-wrap ul, .public-wrap ol { padding-left: 20px; margin-bottom: 14px; }
.public-wrap strong { color: var(--ink); }
.public-wrap a.inline-link { color: var(--amber-dark); font-weight: 600; border-bottom: 1.5px solid var(--amber); }

.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 24px 0 10px; }
.contact-card {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ink);
  border-radius: 10px; padding: 18px 20px;
}
.contact-card .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-light); font-weight: 700; margin-bottom: 6px; }
.contact-card .val { font-size: 15px; font-weight: 600; color: var(--ink); }
.contact-card .val a { color: var(--amber-dark); }

.pricing-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 30px 28px; border-left: 4px solid var(--amber); margin: 24px 0;
}
.pricing-card .plan-name { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate); font-weight: 700; margin-bottom: 10px; }
.pricing-card .price { font-family: var(--font-mono); font-size: 40px; font-weight: 600; color: var(--ink); }
.pricing-card .price .currency { font-size: 22px; vertical-align: super; margin-right: 2px; }
.pricing-card .price .period { font-size: 14px; color: var(--slate-light); font-weight: 400; margin-left: 6px; }
.pricing-card ul { list-style: none; padding: 0; margin: 20px 0 0; }
.pricing-card ul li { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.pricing-card ul li::before { content: '✓'; color: var(--success); font-weight: 700; }


.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.small-muted { font-size: 12.5px; color: var(--slate-light); }
@media (max-width: 640px) {
  .dash-wrap { padding: 22px 14px 50px; }
  .auth-card { padding: 30px 22px; }
}

/* ===== Global loading feedback (buttons + page nav) ===== */
.btn.is-loading { opacity: 0.75; cursor: wait; pointer-events: none; }
.btn-spinner {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite; margin-right: 2px; vertical-align: -2px;
}
.btn.ghost .btn-spinner, .admin-btn .btn-spinner { border-color: rgba(20,33,61,0.25); border-top-color: var(--ink); }

#nav-progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--amber); z-index: 9999; opacity: 0;
  transition: width 4s cubic-bezier(0.1,0.8,0.2,1), opacity 0.2s ease;
}
#nav-progress-bar.active { opacity: 1; width: 85%; }

/* ===== Leaderboard ===== */
.leaderboard-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 6px;
  border-bottom: 1px solid var(--paper-dim);
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row.me { background: #fdf6e8; border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.lb-rank {
  width: 28px; height: 28px; border-radius: 50%; background: var(--paper-dim); color: var(--slate);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.lb-rank.top1 { background: #f5c451; color: #5c4500; }
.lb-rank.top2 { background: #d6d9e0; color: #3a3f4a; }
.lb-rank.top3 { background: #e3b088; color: #5c3a1e; }
.lb-name { flex: 1; font-size: 14.5px; font-weight: 600; }
.lb-count { font-size: 13px; color: var(--slate); font-family: var(--font-mono); }
