:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --card: #ffffff;
  --fg: #1b1a17;
  --muted: #6d6a62;
  --faint: #97938a;
  --accent: #0c6b57;
  --accent-ink: #ffffff;
  --accent-soft: rgba(12, 107, 87, .10);
  --line: #e6e3db;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 19, 15, .04), 0 6px 20px rgba(20, 19, 15, .05);
  --mark: rgba(12, 107, 87, .20);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130e;
    --panel: #1b1a13;
    --card: #1e1c15;
    --fg: #ece9e1;
    --muted: #a29e93;
    --faint: #757166;
    --accent: #57d6b4;
    --accent-ink: #06231c;
    --accent-soft: rgba(87, 214, 180, .12);
    --line: #2c2a22;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
    --mark: rgba(87, 214, 180, .26);
  }
}

* { box-sizing: border-box; }
/* the `hidden` attribute must always win over component display rules
   (e.g. .progress/.player-card set display, which would otherwise show them) */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 820px; margin: 0 auto; padding: 1.5rem 1.1rem 4rem; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; letter-spacing: -0.01em; margin: .2rem 0 1rem; }
h2 { margin-top: 2rem; font-size: 1.15rem; letter-spacing: -0.01em; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1.25rem; background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 700; letter-spacing: -0.02em; color: var(--fg); text-decoration: none; font-size: 1.02rem;
}
.brand::before {
  content: ""; width: .85rem; height: .85rem; border-radius: 999px; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.topbar nav { display: flex; gap: .1rem; flex-wrap: wrap; }
.topbar nav a {
  color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 500;
  padding: .4rem .7rem; border-radius: 8px; transition: color .12s, background .12s;
}
.topbar nav a:hover { color: var(--fg); background: var(--accent-soft); }
@media (max-width: 560px) {
  .topbar { padding: .5rem .85rem; gap: .5rem; }
  .brand { font-size: .9rem; white-space: nowrap; }
  .brand::before { width: .7rem; height: .7rem; box-shadow: 0 0 0 2px var(--accent-soft); }
  .topbar nav { gap: 0; }
  .topbar nav a { font-size: .8rem; padding: .3rem .45rem; }
}

/* --- landing hero -------------------------------------------------------- */
.hero {
  text-align: center; padding: 2.6rem 0 2.2rem; margin: 0 0 1rem;
}
.hero .eyebrow {
  color: var(--accent); font-size: .8rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; margin: 0 0 1rem;
}
.hero-title {
  font-size: clamp(1.9rem, 6vw, 2.9rem); line-height: 1.1; letter-spacing: -0.03em;
  margin: 0 0 .9rem; font-weight: 750;
}
.hero-sub {
  max-width: 34rem; margin: 0 auto 1.6rem; color: var(--muted); font-size: 1.02rem; line-height: 1.6;
}
.hero-sub em { font-style: normal; color: var(--fg); font-weight: 600; }
.hero-search { max-width: 40rem; margin: 0 auto 1.1rem; }
.hero-search input[type=search] { padding: .95rem 1.15rem; font-size: 1.05rem; }
.topic-row { display: flex; align-items: center; justify-content: center; gap: .45rem; flex-wrap: wrap; margin: 0 0 1.6rem; }
.tr-lbl { color: var(--faint); font-size: .85rem; }
.topic {
  text-decoration: none; color: var(--fg); background: var(--card); border: 1px solid var(--line);
  padding: .3rem .7rem; border-radius: 999px; font-size: .88rem; transition: all .12s;
}
.topic:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.hero-stats { display: flex; align-items: center; justify-content: center; gap: .55rem; color: var(--muted); font-size: .9rem; flex-wrap: wrap; }
.hero-stats strong { color: var(--fg); font-weight: 700; }
.hero-stats .dot { color: var(--faint); }

/* --- landing sections ---------------------------------------------------- */
.land-sec { margin: 2.2rem 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0 0 .9rem; }
.sec-head h2 { margin: 0; font-size: 1.1rem; }
.see-all { text-decoration: none; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.card-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.vcard { margin: 0; }
.vcard-link {
  display: flex; flex-direction: column; gap: .35rem; height: 100%;
  padding: .9rem 1rem; text-decoration: none; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s, transform .1s;
}
.vcard-link:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-1px); }
.vcard-title { color: var(--fg); font-weight: 650; letter-spacing: -0.01em; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vcard-meta { color: var(--muted); font-size: .82rem; }

/* search box */
.search { display: flex; gap: .55rem; margin: 1.25rem 0 1rem; }
.search input[type=search] {
  flex: 1; padding: .8rem 1rem; font-size: 1.02rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg);
  box-shadow: var(--shadow);
}
.search input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.search button {
  padding: .8rem 1.25rem; font-size: 1rem; font-weight: 600; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.search button:hover { filter: brightness(1.05); }
.filter {
  width: 100%; padding: .65rem .85rem; margin: 1rem 0; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg);
}

.count { color: var(--muted); margin: .25rem 0 1rem; font-size: .95rem; }
.hint { color: var(--muted); }

/* buttons */
.btn, .act {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  padding: .5rem .85rem; font-size: .9rem; font-weight: 600; line-height: 1;
  border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); white-space: nowrap;
}
.btn:hover, .act:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.act.ghost, .act.expand { background: transparent; color: var(--accent); border-color: var(--line); }
.act.ghost:hover { background: var(--accent-soft); filter: none; }
.act.play.on { box-shadow: 0 0 0 3px var(--accent-soft); }
.act .ico { font-size: .82em; }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: .25rem .4rem; border-radius: 8px;
}
.icon-btn:hover { color: var(--fg); background: var(--accent-soft); }

/* result cards */
.hits, .vlist { list-style: none; padding: 0; margin: 0; }
.hit {
  margin-bottom: .7rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s;
}
.hit:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.hit-row { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; padding: 1rem 1.1rem; }
.hit-body { min-width: 0; flex: 1; }
.hit-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .35rem; }
.vtitle { color: var(--fg); font-weight: 650; letter-spacing: -0.01em; }
.ts-badge {
  margin-left: auto; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums;
  background: var(--accent-soft); padding: .1rem .45rem; border-radius: 999px; white-space: nowrap;
}
.roman { margin: .25rem 0 .2rem; }
.urdu { margin: .15rem 0 0; color: var(--muted); font-size: 1.08rem; line-height: 1.9; }
.hit-actions { display: flex; flex-direction: column; gap: .4rem; flex-shrink: 0; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .12em; font-weight: 600; }

@media (max-width: 560px) {
  .hit-row { flex-direction: column; gap: .7rem; }
  .hit-actions { flex-direction: row; }
  .act { flex: 1; }
}

/* inline expand panel */
.expand-panel { border-top: 1px solid var(--line); padding: .4rem .9rem .8rem; }
.panel-head {
  /* pinned just BELOW the sticky player (JS-measured --pin-top), so
     Romanize / Export / Download stay reachable while the transcript scrolls */
  position: sticky; top: var(--pin-top, 0px); z-index: 9;
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; flex-wrap: wrap; padding: .5rem .4rem; margin: 0 -.4rem;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.panel-head .pfull { text-decoration: none; white-space: nowrap; }
.panel-status { flex-basis: 100%; font-size: .82rem; line-height: 1.45; }
.panel-tools { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.btn.sm { padding: .32rem .6rem; font-size: .82rem; border-radius: 8px; }
.btn.ghost, .btn.sm.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn.ghost:hover { background: var(--accent-soft); filter: none; }
.btn.done { background: transparent; color: var(--muted); border-color: var(--line); }
.export summary { cursor: pointer; }
a.disabled { pointer-events: none; opacity: .7; }
.panel-transcript { position: relative; max-height: 55vh; overflow-y: auto; margin: .3rem 0 0; }
.panel-transcript .line { padding: .4rem 0; }

/* sticky inline player */
.player-card {
  position: sticky; top: var(--topbar-h, 3.4rem); z-index: 10; margin: 0 0 1.1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.player-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .5rem .4rem .5rem .85rem;
}
.now-playing { font-size: .88rem; font-weight: 600; color: var(--fg); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.player-wrap { position: relative; padding-bottom: 56.25%; height: 0; background: #000; }
.player-wrap #player, .player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* video page "stage" — the player AND its action bar (script filter, Romanize,
   Export/Download) are pinned together as one sticky block, so those controls
   never scroll out of reach while the transcript moves underneath. */
.stage {
  position: sticky; top: var(--topbar-h, 3.3rem); z-index: 10;
  margin: .6rem 0 .4rem; padding-bottom: .55rem;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
/* cap the video height (~40vh) by capping its width at 16:9, leaving the sticky
   header short enough that the transcript below always has room */
.player-frame {
  width: 100%; max-width: calc(40vh * 16 / 9); margin: 0 auto .5rem;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--bg);
}
@media (max-width: 560px) {
  /* phones: keep the pinned video short so the toolbar + transcript fit too */
  .player-frame { max-width: calc(32vh * 16 / 9); }
}

/* video page toolbar */
.vhead { margin-bottom: .5rem; }
.vtools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: .45rem .8rem; cursor: pointer; font: inherit; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.export { position: relative; }
.export > summary { list-style: none; display: inline-flex; }
.export > summary::-webkit-details-marker { display: none; }
.export-menu {
  position: absolute; z-index: 15; margin-top: .4rem; padding: .85rem; min-width: 230px;
  display: flex; flex-direction: column; gap: .6rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.export-menu label { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--muted); }
.export-menu .cbx { color: var(--fg); }
.export-menu select { padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }

/* transcript */
.transcript { list-style: none; padding: 0; margin: 1rem 0; }
.line { display: flex; gap: .85rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.line .text { display: flex; flex-direction: column; }
.ts { color: var(--muted); font-variant-numeric: tabular-nums; text-decoration: none; white-space: nowrap; font-size: .9rem; padding-top: .12rem; }
a.ts.seek { cursor: pointer; }
a.ts.seek:hover { color: var(--accent); text-decoration: underline; }
.transcript.mode-roman .urdu { display: none; }
.transcript.mode-urdu .roman { display: none; }
/* in Roman mode, a line whose Roman isn't ready yet falls back to its Urdu
   (faded) so the transcript is never blank while romanization catches up */
.transcript.mode-roman .roman:empty ~ .urdu { display: block; opacity: .5; }

/* search-context bar on the transcript page */
.matchbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: .9rem 0 .4rem; padding: .5rem .75rem;
  background: var(--accent-soft); border: 1px solid var(--line); border-radius: 12px;
}
.matchbar .back { text-decoration: none; font-size: .9rem; font-weight: 600; }
.matchnav { display: inline-flex; align-items: center; gap: .5rem; }
.matchnav .muted { min-width: 8ch; text-align: center; }

.line.match { border-left: 3px solid var(--accent); padding-left: .6rem; margin-left: -.6rem; }
.line.current {
  background: var(--accent-soft); border-radius: 8px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* play-along sync */
.transcript.seekable .line { cursor: pointer; }
.transcript.seekable .line:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); border-radius: 8px; }
.line.playing {
  background: var(--accent-soft); border-radius: 8px;
  box-shadow: inset 3px 0 0 var(--accent);
}
.line.playing .ts { color: var(--accent); font-weight: 700; }
.follow-chip {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  z-index: 40; box-shadow: var(--shadow);
}

/* progress bar */
.progress { display: flex; align-items: center; gap: .75rem; margin: .6rem 0 1rem; }
.progress .bar { flex: 1; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress .bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

/* notices, misc */
.notice { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; overflow-x: auto; }
.ext { color: var(--accent); }
.vlist li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.vlist a { color: var(--accent); text-decoration: none; }
.cov { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.muted { color: var(--muted); font-size: .9rem; }

/* dashboard */
.sync-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.2rem 1.3rem; margin: 1.4rem 0;
}
.sync-card h2 { margin: 0 0 .3rem; font-size: 1.1rem; }
.sync-card > .muted { margin: 0 0 .9rem; }
.sync-warn {
  background: var(--warn-soft, rgba(183,121,31,.14)); color: #b7791f;
  border: 1px solid color-mix(in srgb, #b7791f 30%, transparent);
  border-radius: 10px; padding: .55rem .75rem; margin: 0 0 .9rem; font-size: .88rem;
}
@media (prefers-color-scheme: dark) { .sync-warn { color: #e0b062; } }
.sync-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.sync-row input {
  flex: 1; min-width: 200px; padding: .7rem .85rem; font-size: 1rem; font: inherit;
  border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--fg);
}
.sync-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.sync-list {
  list-style: none; padding: .7rem .9rem; margin: .9rem 0 0; max-height: 220px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-size: .9rem;
}
.sync-list li { padding: .25rem 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.sync-list li:last-child { border-bottom: 0; }

.bulk { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.stats { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0 1.5rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.1rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); min-width: 140px; box-shadow: var(--shadow); }
.stat .num { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.stat .lbl { color: var(--muted); font-size: .82rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; }
.ell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; border: 1px solid var(--line); }
.badge.done { color: var(--accent); border-color: var(--accent); }
.badge.error { color: #c0392b; border-color: #c0392b; }
.badge.running, .badge.queued { color: var(--muted); }

/* --- sign-in page -------------------------------------------------------- */
.login-body { min-height: 100vh; display: flex; }
.login-shell {
  margin: auto; width: 100%; max-width: 400px; padding: 2rem 1.2rem;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.login-card {
  width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); padding: 2rem 1.7rem 1.9rem;
}
.login-brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 700; letter-spacing: -0.02em; color: var(--fg); font-size: 1rem; margin-bottom: 1.4rem;
}
.brand-dot {
  width: .85rem; height: .85rem; border-radius: 999px; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-title { font-size: 1.6rem; margin: 0 0 .35rem; letter-spacing: -0.02em; }
.login-sub { color: var(--muted); margin: 0 0 1.5rem; font-size: .95rem; line-height: 1.5; }
.login-error {
  background: color-mix(in srgb, #c0392b 12%, transparent); color: #c0392b;
  border: 1px solid color-mix(in srgb, #c0392b 35%, transparent);
  border-radius: 10px; padding: .6rem .8rem; margin: 0 0 1rem; font-size: .9rem;
}
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-field { display: flex; flex-direction: column; gap: .35rem; }
.login-field span { font-size: .85rem; color: var(--muted); font-weight: 500; }
.login-field input {
  padding: .75rem .85rem; font-size: 1rem; font: inherit;
  border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--fg);
}
.login-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.login-submit { width: 100%; justify-content: center; padding: .8rem; font-size: 1rem; margin-top: .3rem; }
.login-foot { color: var(--faint); font-size: .8rem; text-align: center; margin: 0; }

/* forms (feedback / login) */
.fb { display: flex; flex-direction: column; gap: .85rem; max-width: 520px; }
.fb label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--muted); }
.fb select, .fb textarea, .fb input {
  padding: .6rem .75rem; font-size: 1rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--fg); font: inherit;
}
.fb .btn { align-self: flex-start; }

.foot { max-width: 820px; margin: 0 auto; padding: 1.4rem 1.1rem; color: var(--faint); font-size: .85rem; }
.foot p { margin: .6rem 0 0; }
.foot-nav { display: flex; gap: 1.1rem; flex-wrap: wrap; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.foot-nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.foot-nav a:hover { color: var(--accent); }
.nav-out { margin-left: .4rem; opacity: .8; }

/* --- save stars ---------------------------------------------------------- */
.star-btn .star, .hit-save .star { font-size: 1em; }
.star-btn.on, .act.hit-save.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.line { position: relative; }
.line-star {
  border: 0; background: transparent; cursor: pointer; color: var(--faint);
  font-size: 1.05rem; line-height: 1; padding: .1rem .25rem; align-self: flex-start;
  opacity: 0; transition: opacity .12s, color .12s; margin-left: auto;
}
.line:hover .line-star, .line-star.on { opacity: 1; }
.line-star.on { color: var(--accent); }
.line-star:hover { color: var(--accent); }

/* --- library page -------------------------------------------------------- */
.lib-tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin: 0 0 1rem; flex-wrap: wrap; }
.lib-tab {
  padding: .55rem .9rem; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.lib-tab:hover { color: var(--fg); }
.lib-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.lib-tab .pill { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 .45rem; font-size: .78rem; }

.lib-filter { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0 0 1rem; }
.lib-filter input[type=search] {
  flex: 1; min-width: 180px; padding: .55rem .8rem; font-size: .95rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg);
}
.lib-filter .dt { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .85rem; }
.lib-filter input[type=date] { padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); font: inherit; }
.lib-filter button { padding: .5rem 1rem; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; }
.clearf { text-decoration: none; }

.playlists { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: 0 0 1.1rem; }
.pl-lbl { color: var(--muted); font-size: .85rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; text-decoration: none;
  padding: .28rem .6rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); font-size: .85rem;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .c { color: var(--muted); font-size: .78rem; }
.chip.on .c { color: var(--accent-ink); opacity: .8; }
.chip.sm { padding: .18rem .5rem; font-size: .8rem; }

.saves { list-style: none; padding: 0; margin: 0; }
.save {
  display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start;
  padding: .85rem 1rem; margin-bottom: .6rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.save-main { min-width: 0; flex: 1; }
.save-head { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
.stitle { color: var(--fg); font-weight: 650; text-decoration: none; }
.stitle:hover { color: var(--accent); }
.kind-badge { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.save .roman { margin: .35rem 0 .15rem; }
.save .urdu { margin: .1rem 0 0; }
.save-tags { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }
.tag-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: .95em; padding: 0 0 0 .1rem; opacity: .7; }
.tag-x:hover { opacity: 1; }
.add-tag { border: 1px dashed var(--line); background: transparent; color: var(--muted); cursor: pointer;
  border-radius: 999px; padding: .18rem .55rem; font-size: .8rem; }
.add-tag:hover { color: var(--accent); border-color: var(--accent); }
.save-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; flex-shrink: 0; }
.save-meta .when { font-size: .8rem; }

.timeline { list-style: none; padding: 0; margin: 0; }
.tl { display: flex; flex-direction: column; gap: .3rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.tl-line1 { display: flex; align-items: baseline; gap: .55rem; }
.tl-line2 { display: flex; align-items: baseline; gap: .5rem; font-size: .82rem; flex-wrap: wrap; }
.tl-when { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-sep { color: var(--faint); }
.tl-kind {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: .12rem .5rem; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.tl.transcribe .tl-kind { background: rgba(52,152,219,.15); color: #2c7fb8; }
.tl.romanize .tl-kind { background: var(--accent-soft); color: var(--accent); }
.tl.save .tl-kind { background: rgba(230,180,30,.16); color: #b8860b; }
.tl-title { color: var(--fg); text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.tl-title:hover { color: var(--accent); }
.tl-detail { overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) {
  .tl.transcribe .tl-kind { color: #7fc4e8; }
  .tl.save .tl-kind { color: #e0c068; }
}
