/* ============================================================
   TechKriti Web Platform — app styles
   Design system: warm editorial, paper-and-ink.
   Built to feel like a real product, not a template.
   ============================================================ */

:root {
  /* Plyr theme customization */
  --plyr-color-main: #C2410C;
  --plyr-video-control-color: #FAF6EE;
  --plyr-video-control-color-hover: #FFFFFF;

  /* Surfaces */
  --paper:      #F5F1E8;   /* app background — warm ivory */
  --surface:    #FFFFFF;   /* card surface */
  --surface-2:  #FAF6EE;   /* secondary surface */
  --surface-3:  #F0EBDE;   /* tertiary surface / hover */
  --ink-panel:  #1C1917;   /* sidebar — warm near-black */
  --ink-panel-2:#292524;   /* sidebar hover */

  /* Text */
  --ink:        #1C1917;   /* primary */
  --ink-2:      #57534E;   /* muted */
  --ink-3:      #A8A29E;   /* subtle */
  --ink-inv:    #F5F1E8;   /* text on dark panel */
  --ink-inv-2:  #D6CFC1;   /* muted text on dark panel */

  /* Lines */
  --line:       #E7E1D5;   /* card border */
  --line-soft:  #F0EBDE;   /* subtle divider */
  --line-dark:  #3F3A33;   /* border on dark panel */

  /* Brand */
  --saffron:    #C2410C;   /* primary accent */
  --saffron-dk: #9A3412;   /* hover */
  --saffron-bg: #FEF3EC;   /* saffron tint */
  --emerald:    #166534;   /* success / free */
  --emerald-bg: #ECFDF5;
  --gold:       #92400E;   /* premium / paid */
  --gold-bg:    #FEF9E7;
  --rust:       #9F1239;   /* danger */
  --rust-bg:    #FFF1F2;

  /* Typography */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadows — warm, soft, layered */
  --sh-1: 0 1px 2px rgba(28, 25, 23, 0.04), 0 1px 1px rgba(28, 25, 23, 0.03);
  --sh-2: 0 2px 4px rgba(28, 25, 23, 0.05), 0 4px 8px rgba(28, 25, 23, 0.04);
  --sh-3: 0 4px 8px rgba(28, 25, 23, 0.06), 0 12px 24px rgba(28, 25, 23, 0.06);
  --sh-pop: 0 8px 16px rgba(28, 25, 23, 0.08), 0 24px 48px rgba(28, 25, 23, 0.12);

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h: 72px;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.14s;
  --t: 0.22s;
  --t-slow: 0.4s;
}

/* ============================================================
   RESET
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--saffron); color: #fff; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5 { font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
em { font-style: italic; }
code, pre { font-family: var(--font-mono); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ============================================================
   ROUTE PROGRESS BAR
   ============================================================ */
.route-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; background: var(--saffron);
  transform: scaleX(0); transform-origin: 0 50%;
  z-index: 9999; opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}
.route-progress.active { opacity: 1; transform: scaleX(1); transition: transform 0.6s var(--ease); }

/* ============================================================
   TYPOGRAPHY UTILITIES
   ============================================================ */
.serif { font-family: var(--font-display); font-weight: 500; }
.mono  { font-family: var(--font-mono); }
.muted { color: var(--ink-2); }
.subtle{ color: var(--ink-3); }
.tiny  { font-size: 0.78rem; letter-spacing: 0.02em; }
.eyebrow {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--saffron);
}

/* ============================================================
   AUTH VIEW
   ============================================================ */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5); position: relative; overflow: hidden;
}
.auth-wrap::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 18% 20%, rgba(194, 65, 12, 0.06), transparent 40%),
    radial-gradient(circle at 82% 75%, rgba(146, 64, 14, 0.05), transparent 45%);
  pointer-events: none;
}
.auth-side {
  position: absolute; left: 0; top: 0; bottom: 0; width: 44%;
  background: var(--ink-panel); color: var(--ink-inv);
  padding: var(--sp-8); display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
.auth-side::after {
  content: ""; position: absolute; right: -1px; top: 20%; bottom: 20%; width: 1px;
  background: linear-gradient(180deg, transparent, var(--line-dark), transparent);
}
.auth-side .brand { display: flex; align-items: center; gap: var(--sp-3); }
.auth-side .brand .mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--saffron); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
}
.auth-side .brand .word { font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; }
.auth-side .word em { color: var(--saffron); font-style: italic; }
.auth-side .pitch { max-width: 420px; }
.auth-side .pitch h2 { font-family: var(--font-display); font-size: 2.2rem; line-height: 1.15; font-weight: 500; }
.auth-side .pitch p { color: var(--ink-inv-2); margin-top: var(--sp-4); font-size: 0.95rem; }
.auth-side .pitch .feat { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-6); }
.auth-side .pitch .feat div { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: 0.9rem; color: var(--ink-inv-2); }
.auth-side .pitch .feat .ic {
  width: 22px; height: 22px; border-radius: 6px; background: rgba(194, 65, 12, 0.15); color: var(--saffron);
  display: grid; place-items: center; flex-shrink: 0; font-size: 0.7rem;
}
.auth-side .foot { font-size: 0.78rem; color: var(--ink-inv-2); opacity: 0.6; }

.auth-card {
  position: relative; z-index: 2;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: var(--sp-7);
  width: 100%; max-width: 440px; box-shadow: var(--sh-3);
}
.auth-card .brand-mobile { display: none; }
.auth-card h1 {
  font-family: var(--font-display); font-size: 1.85rem; font-weight: 500;
  letter-spacing: -0.02em; margin-bottom: var(--sp-2);
}
.auth-card .auth-sub { color: var(--ink-2); font-size: 0.95rem; margin-bottom: var(--sp-6); }

.auth-tabs {
  display: flex; background: var(--surface-3); border-radius: var(--r-md);
  padding: 3px; margin-bottom: var(--sp-5); position: relative;
}
.auth-tabs button {
  flex: 1; padding: var(--sp-2) var(--sp-4); font-weight: 500; font-size: 0.88rem;
  color: var(--ink-2); border-radius: 7px; position: relative; z-index: 2;
  transition: color var(--t) var(--ease);
}
.auth-tabs button.active { color: var(--ink); }
.auth-tabs .pill {
  position: absolute; top: 3px; bottom: 3px; left: 3px;
  width: calc(50% - 3px); background: var(--surface);
  border-radius: 7px; box-shadow: var(--sh-1);
  transition: transform var(--t) var(--ease);
}
.auth-tabs.signup .pill { transform: translateX(100%); }

.field { margin-bottom: var(--sp-4); position: relative; }
.field label {
  display: block; font-size: 0.8rem; font-weight: 500;
  color: var(--ink-2); margin-bottom: var(--sp-2);
}
.field input {
  width: 100%; padding: 0.7rem 0.9rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); font-size: 0.92rem;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus {
  outline: 0; border-color: var(--saffron);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.12);
}
.field input.invalid { border-color: var(--rust); }
.field .err {
  display: block; font-size: 0.78rem; color: var(--rust);
  margin-top: var(--sp-2); min-height: 1em;
}
.strength {
  height: 4px; background: var(--surface-3); border-radius: 2px;
  margin-top: var(--sp-2); overflow: hidden;
}
.strength i {
  display: block; height: 100%; width: 0;
  background: var(--rust); border-radius: 2px;
  transition: width var(--t) var(--ease), background var(--t) var(--ease);
}
.strength-label {
  font-size: 0.72rem; color: var(--ink-3);
  margin-top: var(--sp-1); display: block; min-height: 1em;
}

.divider {
  display: flex; align-items: center; gap: var(--sp-3);
  color: var(--ink-3); font-size: 0.78rem; margin: var(--sp-5) 0;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.auth-home {
  display: inline-block; margin-top: var(--sp-5);
  font-size: 0.82rem; color: var(--ink-2);
  transition: color var(--t-fast) var(--ease);
}
.auth-home:hover { color: var(--saffron); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 0.6rem 1rem; font-weight: 500; font-size: 0.9rem;
  border-radius: var(--r-md); border: 1px solid transparent;
  transition: all var(--t) var(--ease); white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 1.4rem; font-size: 0.95rem; }

.btn-primary {
  background: var(--saffron); color: #fff;
  box-shadow: 0 1px 2px rgba(194, 65, 12, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-primary:hover { background: var(--saffron-dk); box-shadow: 0 2px 6px rgba(194, 65, 12, 0.35); }

.btn-secondary {
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--ink-3); background: var(--surface-2); }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }

.btn-danger { background: var(--rust); color: #fff; }
.btn-danger:hover { background: #881337; }

.btn-emerald { background: var(--emerald); color: #fff; }
.btn-emerald:hover { background: #124c28; }

.btn-google {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
}
.btn-google:hover { border-color: var(--ink-3); background: var(--surface-2); }

/* ============================================================
   APP SHELL — sidebar + main + bottomnav
   ============================================================ */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  grid-column: 1;
  grid-row: 1;
  background: var(--ink-panel); color: var(--ink-inv);
  padding: var(--sp-5) 0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line-dark);
  /* Ensure sidebar never overlaps main on desktop */
  z-index: 10;
}
.sidebar .brand {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5) var(--sp-5);
}
.sidebar .brand .mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--saffron); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
}
.sidebar .brand .word {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 500;
}
.sidebar .brand .word em { color: var(--saffron); font-style: italic; }

.sidebar .nav-section { padding: 0 var(--sp-3); margin-top: var(--sp-2); }
.sidebar .nav-label {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-inv-2);
  padding: var(--sp-4) var(--sp-3) var(--sp-2); opacity: 0.6;
}
.side-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.55rem var(--sp-3); border-radius: var(--r-md);
  color: var(--ink-inv-2); font-size: 0.9rem; font-weight: 500;
  margin-bottom: 2px; transition: all var(--t-fast) var(--ease);
  position: relative;
}
.side-link .ic {
  width: 18px; height: 18px; display: grid; place-items: center;
  font-size: 0.85rem; opacity: 0.85;
}
.side-link:hover { background: var(--ink-panel-2); color: var(--ink-inv); }
.side-link.active {
  background: rgba(194, 65, 12, 0.14); color: #fff;
}
.side-link.active::before {
  content: ""; position: absolute; left: -var(--sp-3); top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px; background: var(--saffron); border-radius: 0 2px 2px 0;
}
.side-link.active .ic { opacity: 1; color: var(--saffron); }

.sidebar .side-foot { margin-top: auto; padding: var(--sp-3); }
.side-user {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r-md);
  cursor: pointer; transition: background var(--t-fast) var(--ease);
}
.side-user:hover { background: var(--ink-panel-2); }
.side-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--saffron), var(--gold));
  color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 0.85rem; flex-shrink: 0;
}
.side-user .nm { font-size: 0.86rem; font-weight: 500; color: var(--ink-inv); }
.side-user .em { font-size: 0.74rem; color: var(--ink-inv-2); opacity: 0.7;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }

.sidebar .side-cta {
  margin: var(--sp-3); padding: var(--sp-4);
  background: linear-gradient(135deg, rgba(194, 65, 12, 0.15), rgba(146, 64, 14, 0.1));
  border: 1px solid rgba(194, 65, 12, 0.25);
  border-radius: var(--r-md);
}
.sidebar .side-cta .t { font-size: 0.85rem; font-weight: 600; color: var(--ink-inv); margin-bottom: var(--sp-1); }
.sidebar .side-cta .d { font-size: 0.76rem; color: var(--ink-inv-2); opacity: 0.8; margin-bottom: var(--sp-3); }
.sidebar .side-cta .btn { width: 100%; }

/* ---------- Main ---------- */
.main {
  grid-column: 2;
  grid-row: 1;
  padding: 0; min-width: 0; display: flex; flex-direction: column;
}
.main-inner {
  padding: var(--sp-6) var(--sp-7); max-width: 1280px; width: 100%;
  margin: 0 auto; flex: 1;
}

/* Demo-mode banner (shown when Firebase isn't configured) */
.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
  background: var(--gold-bg); border: 1px solid rgba(146, 64, 14, 0.25);
  border-radius: var(--r-md); font-size: 0.84rem; color: var(--ink-2);
  border-left: 3px solid var(--gold);
}
.demo-banner strong { color: var(--gold); font-weight: 600; }
.demo-banner code {
  background: var(--surface); padding: 0.1rem 0.35rem;
  border-radius: 4px; font-size: 0.78rem;
}
.demo-banner-error {
  background: var(--rust-bg); border-color: rgba(159, 18, 57, 0.25);
  border-left-color: var(--rust);
}
.demo-banner-error strong { color: var(--rust); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-5); margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-5); border-bottom: 1px solid var(--line);
}
.topbar h1 {
  font-family: var(--font-display); font-size: 2rem; font-weight: 500;
  letter-spacing: -0.02em;
}
.topbar h1 em { font-style: italic; color: var(--saffron); }
.topbar .sub { color: var(--ink-2); margin-top: var(--sp-2); font-size: 0.92rem; }
.topbar .top-actions { display: flex; gap: var(--sp-2); align-items: center; }

.back-link {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  color: var(--ink-2); font-size: 0.85rem; margin-bottom: var(--sp-4);
  transition: color var(--t-fast) var(--ease);
}
.back-link:hover { color: var(--saffron); }

/* View transition */
.view-enter { animation: viewIn 0.4s var(--ease-soft); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-5);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.card-pad-lg { padding: var(--sp-6); }
.card-pad-sm { padding: var(--sp-4); }

/* ============================================================
   BADGES & CHIPS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 0.25rem 0.6rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.badge-free { background: var(--emerald-bg); color: var(--emerald); border-color: rgba(22, 101, 52, 0.18); }
.badge-paid { background: var(--gold-bg); color: var(--gold); border-color: rgba(146, 64, 14, 0.18); }
.badge-unlocked { background: var(--emerald-bg); color: var(--emerald); border-color: rgba(22, 101, 52, 0.18); }
.badge-tag {
  background: var(--surface-3); color: var(--ink-2);
  border-color: var(--line); font-family: var(--font-mono);
  letter-spacing: 0.05em; text-transform: uppercase;
}

.chip {
  display: inline-flex; align-items: center;
  padding: 0.18rem 0.55rem; border-radius: 4px;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--surface-3); color: var(--ink-2);
  border-left: 3px solid var(--c, var(--saffron));
}

/* ============================================================
   GRID: BATCH CARDS
   ============================================================ */
.grid-batches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-5);
}
.batch-card {
  display: flex; flex-direction: column; cursor: pointer;
  position: relative; overflow: hidden;
}
.batch-thumb {
  width: calc(100% + var(--sp-5) * 2);
  margin: calc(-1 * var(--sp-5)) calc(-1 * var(--sp-5)) var(--sp-4);
  height: 160px;
  overflow: hidden;
  position: relative;
  background: var(--surface-3);
}
.batch-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t) var(--ease);
}
.batch-card:hover .batch-thumb img {
  transform: scale(1.05);
}
.batch-card::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--c, var(--saffron)); opacity: 0; transition: opacity var(--t) var(--ease);
}
.batch-card:hover {
  border-color: var(--ink-3); box-shadow: var(--sh-2);
  transform: translateY(-2px);
}
.batch-card:hover::after { opacity: 1; }

.batch-card .row-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.batch-card h3 {
  font-family: var(--font-display); font-size: 1.2rem; font-weight: 500;
  letter-spacing: -0.01em; margin-bottom: var(--sp-2); line-height: 1.3;
}
.batch-card .desc {
  color: var(--ink-2); font-size: 0.88rem; line-height: 1.55;
  margin-bottom: var(--sp-4); display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.batch-card .meta {
  display: flex; gap: var(--sp-4); flex-wrap: wrap;
  font-size: 0.8rem; color: var(--ink-2);
  padding: var(--sp-3) 0; border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft); margin-bottom: var(--sp-4);
}
.batch-card .meta span { display: flex; align-items: center; gap: var(--sp-1); }
.batch-card .row-bot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto;
}
.batch-card .enrolled { font-size: 0.8rem; color: var(--ink-3); }
.batch-card .rating { color: var(--gold); }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  height: 6px; background: var(--surface-3); border-radius: 3px;
  overflow: hidden; margin: var(--sp-3) 0;
}
.progress i {
  display: block; height: 100%; background: var(--saffron);
  border-radius: 3px; transition: width 0.5s var(--ease);
}
.progress-thin { height: 4px; }
.progress-label {
  font-size: 0.78rem; color: var(--ink-3); font-weight: 500;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-8) var(--sp-6); text-align: center;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg);
}
.empty .icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--surface-3); display: grid; place-items: center;
  font-size: 1.6rem; color: var(--ink-3); margin-bottom: var(--sp-4);
}
.empty h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; margin-bottom: var(--sp-2); }
.empty p { color: var(--ink-2); max-width: 380px; margin-bottom: var(--sp-5); }

/* ============================================================
   BATCH DETAIL
   ============================================================ */
.detail-head {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-6);
  margin-bottom: var(--sp-5); position: relative; overflow: hidden;
}
.detail-head::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--c, var(--saffron));
}
.detail-head .row-top {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.detail-head h2 {
  font-family: var(--font-display); font-size: 1.85rem; font-weight: 500;
  letter-spacing: -0.02em; line-height: 1.2; margin-bottom: var(--sp-3);
}
.detail-head .desc { color: var(--ink-2); font-size: 0.95rem; max-width: 720px; margin-bottom: var(--sp-5); }
.detail-stats {
  display: flex; flex-wrap: wrap; gap: var(--sp-5);
  padding-top: var(--sp-4); border-top: 1px solid var(--line-soft);
  font-size: 0.85rem; color: var(--ink-2);
}
.detail-stats span b { color: var(--ink); font-weight: 600; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-5); overflow-x: auto;
}
.tab {
  padding: var(--sp-3) var(--sp-5); font-size: 0.9rem; font-weight: 500;
  color: var(--ink-2); border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--saffron); border-bottom-color: var(--saffron); }
.tab .count {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3);
  margin-left: var(--sp-2); padding: 0.1rem 0.4rem; background: var(--surface-3);
  border-radius: 4px;
}
.tab.active .count { color: var(--saffron); background: var(--saffron-bg); }

/* ---------- Detail grid: player + sidebar ---------- */
.detail-grid {
  display: grid; grid-template-columns: 1fr 360px; gap: var(--sp-5);
  align-items: start;
}

/* ---------- Player ---------- */
.player-frame {
  position: relative; aspect-ratio: 16 / 9; background: #000;
  overflow: hidden;
}
.player-frame iframe, .player-frame .plyr {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0;
}
/* Mask overlay: prevents clicking on YouTube title bar or logo links */
.player-frame::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 56px;
  z-index: 10; pointer-events: auto; background: transparent;
}
.player-info {
  padding: var(--sp-5); display: flex; align-items: flex-start;
  justify-content: space-between; gap: var(--sp-4);
}
.player-info h3 {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 500;
  letter-spacing: -0.01em; margin-bottom: var(--sp-2);
}
.player-info .who { font-size: 0.82rem; color: var(--ink-2); }

.secure-note {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface-2); border-top: 1px solid var(--line-soft);
  font-size: 0.78rem; color: var(--ink-3);
}
.secure-note .ic {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--emerald-bg); color: var(--emerald);
  display: grid; place-items: center; font-size: 0.7rem; flex-shrink: 0;
}

/* ---------- Free batch player placeholder (no embed) ---------- */
.player-free {
  padding: var(--sp-7); text-align: center;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--r-lg);
}
.player-free .icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--saffron-bg); color: var(--saffron);
  display: grid; place-items: center; margin: 0 auto var(--sp-4);
  font-size: 1.8rem;
}
.player-free h3 {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 500;
  margin-bottom: var(--sp-2);
}
.player-free p { color: var(--ink-2); max-width: 380px; margin: 0 auto var(--sp-5); font-size: 0.92rem; }

/* ---------- Locked overlay ---------- */
.locked-wrap { position: relative; }
.locked-blur { filter: blur(8px) saturate(0.7); pointer-events: none; user-select: none; opacity: 0.85; }
.locked-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: var(--sp-6); background: rgba(245, 241, 232, 0.7);
  backdrop-filter: blur(2px); border-radius: var(--r-lg);
}
.locked-overlay .lock-ic {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--saffron); color: #fff;
  display: grid; place-items: center; font-size: 1.4rem;
  margin-bottom: var(--sp-4); box-shadow: 0 8px 16px rgba(194, 65, 12, 0.3);
}
.locked-overlay h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; margin-bottom: var(--sp-2); }
.locked-overlay p { color: var(--ink-2); max-width: 360px; margin-bottom: var(--sp-4); font-size: 0.9rem; }

/* ---------- Lecture list ---------- */
.list-card { padding: 0; overflow: hidden; }
.list-card .list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-soft);
}
.list-card .list-head h3 {
  font-family: var(--font-display); font-size: 1rem; font-weight: 500;
}

.lec-list { display: flex; flex-direction: column; }
.lec {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5); width: 100%; text-align: left;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--t-fast) var(--ease);
  position: relative;
}
.lec:last-child { border-bottom: 0; }
.lec:hover:not(:disabled) { background: var(--surface-2); }
.lec:disabled { opacity: 0.5; cursor: not-allowed; }
.lec.playing { background: var(--saffron-bg); }
.lec.playing::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--saffron);
}
.lec .num {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3);
  width: 28px; flex-shrink: 0; font-weight: 500;
}
.lec.playing .num { color: var(--saffron); }
.lec .t { flex: 1; min-width: 0; }
.lec .ttl {
  font-size: 0.88rem; font-weight: 500; color: var(--ink);
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lec.is-done .ttl { color: var(--ink-2); }
.lec .dur { font-size: 0.74rem; color: var(--ink-3); margin-top: 2px; display: block; }
.lec .ic-right {
  width: 24px; height: 24px; flex-shrink: 0; display: grid; place-items: center;
  color: var(--ink-3); font-size: 0.9rem;
}
.lec.is-done .ic-right { color: var(--emerald); }
.lec.playing .ic-right { color: var(--saffron); }
.lec .external-ic {
  font-size: 0.7rem; opacity: 0; transition: opacity var(--t-fast) var(--ease);
}
.lec:hover .external-ic { opacity: 0.6; }

/* ---------- Note rows ---------- */
.note-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5); width: 100%;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--t-fast) var(--ease);
}
.note-row:last-child { border-bottom: 0; }
.note-row:hover { background: var(--surface-2); }
.note-row .pdf {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: var(--rust-bg); color: var(--rust);
  display: grid; place-items: center; flex-shrink: 0; font-size: 0.85rem; font-weight: 600;
  font-family: var(--font-mono);
}
.note-row .t { flex: 1; min-width: 0; }
.note-row .ttl {
  font-size: 0.88rem; font-weight: 500; color: var(--ink);
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-row .mt { font-size: 0.74rem; color: var(--ink-3); margin-top: 2px; display: block; }
.note-row .dl-btn {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 0.35rem 0.7rem; font-size: 0.78rem; font-weight: 500;
  background: var(--surface-3); color: var(--ink); border-radius: var(--r-sm);
  transition: all var(--t-fast) var(--ease);
}
.note-row .dl-btn:hover { background: var(--saffron); color: #fff; }

/* ============================================================
   NOTES GRID
   ============================================================ */
.notes-filter {
  display: flex; gap: var(--sp-2); margin-bottom: var(--sp-5); flex-wrap: wrap;
}
.notes-filter button {
  padding: 0.4rem 0.9rem; font-size: 0.82rem; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); border-radius: 999px;
  transition: all var(--t-fast) var(--ease);
}
.notes-filter button:hover { border-color: var(--ink-3); color: var(--ink); }
.notes-filter button.active {
  background: var(--ink); color: var(--surface); border-color: var(--ink);
}

.grid-notes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}
.note-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--sp-4);
  display: flex; flex-direction: column;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.note-card:hover { border-color: var(--ink-3); box-shadow: var(--sh-2); transform: translateY(-1px); }
.note-card .top { display: flex; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.note-card .pdf-ic {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  background: var(--rust-bg); color: var(--rust);
  display: grid; place-items: center; flex-shrink: 0; font-weight: 600;
  font-family: var(--font-mono); font-size: 0.85rem;
}
.note-card h4 {
  font-family: var(--font-display); font-size: 1rem; font-weight: 500;
  letter-spacing: -0.01em; margin-bottom: var(--sp-2); line-height: 1.3;
}
.note-card .foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--line-soft);
}
.note-card .sz { font-size: 0.76rem; color: var(--ink-3); }
.note-card .dl-btn {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 0.35rem 0.7rem; font-size: 0.78rem; font-weight: 500;
  background: var(--saffron); color: #fff; border-radius: var(--r-sm);
  transition: background var(--t-fast) var(--ease);
}
.note-card .dl-btn:hover { background: var(--saffron-dk); }

/* ============================================================
   DOUBT CHAT
   ============================================================ */
.chat-card {
  padding: 0; overflow: hidden; display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h) - var(--sp-6) - 100px); min-height: 480px;
}
.chat-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-soft); background: var(--surface-2);
}
.chat-head .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--saffron), var(--gold));
  color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 0.9rem;
}
.chat-head .nm { font-weight: 600; font-size: 0.95rem; }
.chat-head .st {
  font-size: 0.76rem; color: var(--emerald);
  display: flex; align-items: center; gap: var(--sp-1);
}
.chat-head .st::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--emerald); box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.18);
}
.chat-body {
  flex: 1; overflow-y: auto; padding: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-3);
  background:
    radial-gradient(circle at 30% 20%, rgba(194, 65, 12, 0.025), transparent 50%),
    var(--surface-2);
}
.msg {
  max-width: 78%; padding: 0.75rem 1rem; border-radius: var(--r-md);
  font-size: 0.9rem; line-height: 1.5; word-wrap: break-word;
  animation: msgIn 0.3s var(--ease-soft);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.me {
  background: var(--saffron); color: #fff;
  align-self: flex-end; border-bottom-right-radius: 3px;
}
.msg.bot {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line);
  align-self: flex-start; border-bottom-left-radius: 3px;
}
.msg.bot .who {
  display: block; font-size: 0.72rem; font-weight: 600;
  color: var(--saffron); margin-bottom: var(--sp-1); letter-spacing: 0.02em;
}
.msg.bot.typing {
  display: flex; gap: 4px; align-items: center; padding: 0.9rem 1rem;
}
.msg.bot.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3); animation: blink 1.4s infinite both;
}
.msg.bot.typing i:nth-child(2) { animation-delay: 0.2s; }
.msg.bot.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.chat-input {
  display: flex; gap: var(--sp-2); padding: var(--sp-3);
  border-top: 1px solid var(--line-soft); background: var(--surface);
}
.chat-input input {
  flex: 1; padding: 0.7rem 1rem; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface-2);
  font-size: 0.9rem; transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.chat-input input:focus {
  outline: 0; border-color: var(--saffron);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.12);
}
.chat-input .send-btn {
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: var(--saffron); color: #fff; display: grid; place-items: center;
  font-size: 1rem; transition: background var(--t-fast) var(--ease);
}
.chat-input .send-btn:hover { background: var(--saffron-dk); }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-grid {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-5);
  align-items: start;
}
.profile-card .profile-top {
  display: flex; gap: var(--sp-4); align-items: center;
  padding-bottom: var(--sp-5); margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line-soft);
}
.profile-card .avatar-lg {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--saffron), var(--gold));
  color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 1.3rem; flex-shrink: 0;
}
.profile-card .nm { font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; }
.profile-card .sid { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-3); margin-top: 2px; }
.verified-badge {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: var(--sp-2); padding: 0.2rem 0.6rem;
  background: var(--emerald-bg); color: var(--emerald);
  border: 1px solid rgba(22, 101, 52, 0.18); border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
}
.profile-card h3 {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 500;
  margin-bottom: var(--sp-4);
}

.info-rows { display: flex; flex-direction: column; gap: var(--sp-3); }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.88rem; padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--line-soft);
}
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--ink-2); }
.info-row b { font-weight: 600; }

.danger-card { border-color: rgba(159, 18, 57, 0.2); }
.danger-card h3 { color: var(--rust); }
.danger-card p { color: var(--ink-2); font-size: 0.88rem; margin-bottom: var(--sp-4); }

/* ============================================================
   TOAST
   ============================================================ */
#toast-root {
  position: fixed; bottom: var(--sp-6); right: var(--sp-6); z-index: 9000;
  display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none;
}
.toast {
  background: var(--ink-panel); color: var(--ink-inv);
  padding: 0.8rem 1.2rem; border-radius: var(--r-md);
  font-size: 0.88rem; box-shadow: var(--sh-pop);
  display: flex; align-items: center; gap: var(--sp-2);
  animation: toastIn 0.3s var(--ease-soft);
  border-left: 3px solid var(--ink-3);
  max-width: 360px;
}
.toast.success { border-left-color: var(--emerald); }
.toast.error { border-left-color: var(--rust); }
.toast.out { animation: toastOut 0.35s var(--ease) forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

/* ============================================================
   MODAL — Razorpay-style checkout
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(28, 25, 23, 0.55);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: var(--sp-5);
  animation: fadeIn 0.2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); width: 100%; max-width: 460px;
  box-shadow: var(--sh-pop); overflow: hidden;
  animation: modalIn 0.3s var(--ease-soft);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line-soft); background: var(--surface-2);
}
.modal-head .brand {
  display: flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-display); font-weight: 500; font-size: 0.95rem;
}
.modal-head .brand .mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--saffron); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 0.8rem;
}
.modal-head .rzp {
  font-size: 0.7rem; color: var(--ink-3); padding: 0.2rem 0.5rem;
  background: var(--surface-3); border-radius: 4px;
  font-family: var(--font-mono);
}
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-2);
  transition: background var(--t-fast) var(--ease);
}
.modal-close:hover { background: var(--surface-3); color: var(--ink); }

.modal-body { padding: var(--sp-5); }
.pay-summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-4); background: var(--surface-2);
  border-radius: var(--r-md); margin-bottom: var(--sp-5);
}
.pay-summary .t { font-weight: 500; font-size: 0.92rem; }
.pay-summary .a {
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 600;
  color: var(--saffron);
}

.pay-methods { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.pay-method {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.85rem 1rem; border: 1px solid var(--line);
  border-radius: var(--r-md); cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.pay-method:hover { border-color: var(--ink-3); background: var(--surface-2); }
.pay-method.sel { border-color: var(--saffron); background: var(--saffron-bg); }
.pay-method .radio {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); flex-shrink: 0;
  position: relative; transition: border-color var(--t-fast) var(--ease);
}
.pay-method.sel .radio { border-color: var(--saffron); }
.pay-method.sel .radio::after {
  content: ""; position: absolute; inset: 2px;
  border-radius: 50%; background: var(--saffron);
}
.pay-method .lbl { flex: 1; font-size: 0.9rem; font-weight: 500; }
.pay-method .tag {
  font-size: 0.68rem; padding: 0.1rem 0.4rem;
  background: var(--emerald-bg); color: var(--emerald);
  border-radius: 4px; font-weight: 600;
}

.test-mode-note {
  text-align: center; font-size: 0.76rem; color: var(--ink-3);
  margin-top: var(--sp-3); font-family: var(--font-mono);
}

.pay-state {
  text-align: center; padding: var(--sp-6) var(--sp-4);
}
.pay-state .spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--surface-3); border-top-color: var(--saffron);
  margin: 0 auto var(--sp-4); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pay-state p { color: var(--ink-2); }
.pay-state .success-check {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--emerald-bg); color: var(--emerald);
  display: grid; place-items: center; margin: 0 auto var(--sp-4);
  font-size: 2rem; animation: pop 0.4s var(--ease-soft);
}
@keyframes pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.pay-state h3 {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 500;
  margin-bottom: var(--sp-2);
}
.pay-state .txid {
  display: inline-block; margin-top: var(--sp-3);
  padding: 0.3rem 0.7rem; background: var(--surface-2);
  border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--ink-2);
}

/* ============================================================
   BOTTOM NAV (mobile only)
   ============================================================ */
.bottomnav { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet landscape & smaller desktops — compact sidebar */
@media (max-width: 1100px) {
  :root { --sidebar-w: 220px; }
  .main-inner { padding: var(--sp-5); }
  .detail-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* Tablet portrait & mobile — sidebar hidden by default, off-canvas drawer */
@media (max-width: 1024px) {
  .auth-side { display: none; }
  .auth-card .brand-mobile {
    display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5);
  }
  .auth-card .brand-mobile .mark {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--saffron); color: #fff;
    display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 700;
  }
  .auth-card .brand-mobile .word { font-family: var(--font-display); font-size: 1.2rem; font-weight: 500; }
  .auth-card .brand-mobile .word em { color: var(--saffron); font-style: italic; }

  /* Sidebar: slides in from left as off-canvas drawer — no display:none flash */
  .shell { grid-template-columns: 1fr; }
  .main { grid-column: 1; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; max-width: 85vw;
    /* Hidden off-screen by default — CSS transition handles the slide */
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.3s var(--ease), visibility 0s linear 0.3s;
    z-index: 1001;
    /* Must be flex at all times so layout works when opened */
    display: flex;
  }
  .sidebar.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s var(--ease), visibility 0s linear 0s;
    box-shadow: var(--sh-pop);
  }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(28, 25, 23, 0.5);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
  }
  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.3s var(--ease), visibility 0s linear 0s;
  }

  /* Mobile menu button — always visible at top-left on mobile */
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--sp-3);
    position: sticky; top: 0; z-index: 50;
    background: var(--paper);
    padding: var(--sp-2) 0;
    margin-top: calc(-1 * var(--sp-2));
  }
  .mobile-menu-btn {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: var(--r-md);
    background: var(--surface); border: 1px solid var(--line);
    color: var(--ink);
  }

  .main-inner { padding: var(--sp-4) var(--sp-4) 100px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
  .topbar h1 { font-size: 1.5rem; }

  /* Bottom nav — fixed at bottom on mobile */
  .bottomnav {
    display: block;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--surface); border-top: 1px solid var(--line);
    z-index: 100; padding: var(--sp-2);
    box-shadow: 0 -2px 12px rgba(28, 25, 23, 0.06);
  }
  .bottomnav-inner {
    display: flex; justify-content: space-around; align-items: center;
    max-width: 600px; margin: 0 auto;
  }
  .bn-link {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: var(--sp-2) var(--sp-3); font-size: 0.68rem; font-weight: 500;
    color: var(--ink-3); border-radius: var(--r-sm);
    transition: color var(--t-fast) var(--ease);
  }
  .bn-link .ic { font-size: 1.1rem; }
  .bn-link.active { color: var(--saffron); }

  .grid-batches { grid-template-columns: 1fr; }
  .grid-notes { grid-template-columns: 1fr; }
  .chat-card { height: calc(100vh - 200px); min-height: 400px; }
  #toast-root { bottom: 90px; right: var(--sp-4); left: var(--sp-4); }
  .toast { max-width: none; }

  /* detail-head compact */
  .detail-head { padding: var(--sp-4); }
  .detail-head h2 { font-size: 1.5rem; }
  .detail-stats { gap: var(--sp-3); font-size: 0.78rem; }

  /* modal full-width on mobile */
  .modal { max-width: 100%; }
  .modal-head .rzp { display: none; }
}

/* Desktop — hide mobile menu button & topbar */
@media (min-width: 1025px) {
  .mobile-menu-btn { display: none !important; }
  .mobile-topbar { display: none !important; }
}

/* ============================================================
   PRINT (notes / receipts)
   ============================================================ */
@media print {
  .sidebar, .bottomnav, .topbar .top-actions, .back-link { display: none; }
}
