/* Nahdoh AI. Arah dari DESIGN.md: hitam kehijauan, aksen hijau, tema terang putih kehijauan.
   Plus Jakarta Sans untuk teks; LPMQ Isep Misbah (Kemenag) untuk Arab, Noto Naskh Arabic cadangan. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url(plus-jakarta-sans-latin-ext.woff2?v=1) format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url(plus-jakarta-sans-latin.woff2?v=1) format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "LPMQ Isep Misbah";
  src: url(lpmq-isep-misbah.woff2?v=1) format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --bg: #030805;
  --surface: #0c1510;
  --surface-2: #13201a;
  --text: #eaf3ec;
  --muted: #9db1a3;
  --line: #1d2e24;
  --line-strong: #5f8270;
  --leaf: #3bd46e;
  --leaf-text: #3bd46e;
  --leaf-tint: #10261a;
  --lime: #c8f25a;
  --cta-from: #3bd46e;
  --cta-to: #c8f25a;
  --cta-text: #04140a;
  --amber-text: #f2b84b;
  --amber-tint: #2a2210;
  --rose-text: #ff7a7a;
  --rose-tint: #2c1414;
  --bubble-user: #173323;
  --nav-glass: rgba(18, 28, 22, 0.62);
  --nav-rim: rgba(255, 255, 255, 0.12);
  --glass-shine: rgba(255, 255, 255, 0.10);
  --glass-blur: blur(24px) saturate(1.6);
  --nav-idle: #9db1a3;
  --nav-active: #ffffff;
  --nav-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
  --logo: #eaf3ec;
  --chase: #d9ff7a;
  --chase-anim: nw-chase;

  /* Gerak gaya iOS: kurva pelan di akhir, cepat di awal. Dipakai laci, pesan baru, pil, toast, dan perpindahan halaman. */
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --dur: .38s;

  --r-panel: 18px;
  --r-control: 10px;
  --r-chip: 6px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --arabic: "LPMQ Isep Misbah", "Noto Naskh Arabic", "Amiri", serif;
  color-scheme: dark;
}

/* Tema gelap adalah bawaan; terang hanya bila dipilih lewat saklar. */
:root[data-theme="light"] {
  --bg: #f3f6f3; --surface: #ffffff; --surface-2: #e9efea; --text: #101a13; --muted: #4f6155;
  --line: #dbe4dd; --line-strong: #7c9484; --leaf: #23b45a; --leaf-text: #146f38; --leaf-tint: #e4f3e8;
  --cta-from: #23b45a; --cta-to: #a6d92e; --amber-text: #7a4f00; --amber-tint: #fbf1dc;
  --rose-text: #b3261e; --rose-tint: #fbe9e7; --bubble-user: #dff0e4; --nav-glass: rgba(255, 255, 255, 0.58);
  --nav-rim: rgba(255, 255, 255, 0.9); --glass-shine: rgba(255, 255, 255, 0.9); --nav-idle: #5d6d62; --nav-active: #0b0b0b;
  --nav-shadow: 0 18px 40px -20px rgba(20, 60, 35, 0.3); --logo: #146f38; --chase: transparent; --chase-anim: none;
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
/* Halaman terkunci kiri-kanan: tidak bisa digeser menyamping. clip (bukan hidden) agar position: sticky tetap jalan. */
html, body { overflow-x: clip; overscroll-behavior-x: none; }
/* HP: hanya gulir atas-bawah; cubit dan ketuk dua kali tidak memperbesar. Pilih dan salin teks tetap bisa.
   Tabel dan menu admin yang memang lebar tetap bisa digulir menyamping di dalam wadahnya. */
@media (pointer: coarse) {
  html { touch-action: pan-y; }
  .table-wrap, .rail-nav { touch-action: pan-x pan-y; }
}
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:not([class]) { color: var(--leaf-text); text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
.arabic, [dir="rtl"] { font-family: var(--arabic); line-height: 2.1; }
h1, h2, h3 { letter-spacing: -0.015em; line-height: 1.25; }
/* Fokus keyboard memakai bayangan, bukan outline. */
html { -webkit-tap-highlight-color: transparent; }
/* Hover dan tekan hanya untuk mouse (@media hover): di HP, jari yang menggulir melewati tombol tidak membuatnya tampak terpilih. */
/* Tanpa batang gulir abu/putih di tepi kiri (riwayat) dan kanan (halaman); gulir tetap jalan. */
html, .drawer, .drawer-list, .feat-tentang { scrollbar-width: none; }
.drawer, .drawer-list { overscroll-behavior: contain; }
html::-webkit-scrollbar, .drawer::-webkit-scrollbar, .drawer-list::-webkit-scrollbar, .feat-tentang::-webkit-scrollbar { display: none; }
button, [role="tab"], .feat-item, .drawer-list a, .toc a, .pill, .suggest button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--leaf-text), 0 8px 20px -6px var(--leaf); }
a, button, summary, select, label[for], input[type="checkbox"], input[type="radio"], input[type="file"] { cursor: pointer; }
button[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kerangka dashboard: rel navigasi di kiri, isi di kanan. */
.shell { display: grid; grid-template-columns: 104px minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 20px 8px; gap: 6px; border-right: 1px solid var(--line); }
.rail-logo { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 14px; border-radius: 50%; }
.rail-nav, .rail-foot { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.rail-nav { flex: 1; overflow-y: auto; scrollbar-width: none; }
.rail-btn {
  position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 60px; padding: 8px 4px; border-radius: var(--r-control); border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 12px; text-decoration: none; text-align: center;
}
.rail-btn .ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; transition: background .15s, box-shadow .15s, color .15s; }
.rail-btn .i-fill { display: none; }
@media (hover: hover) { .rail-btn:hover { color: var(--text); } }
@media (hover: hover) { .rail-btn:hover .ic { background: var(--surface-2); } }
@media (hover: hover) { .rail-btn:active .ic { transform: scale(.96); } }
/* Motif lingkaran: halaman aktif ditandai cincin, gema dari bola Nahdoh */
.rail-btn[aria-current="page"] { color: var(--leaf-text); font-weight: 600; }
.rail-btn[aria-current="page"] .ic { background: var(--leaf-tint); box-shadow: 0 8px 18px -8px var(--leaf); }
.count { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--rose-tint); color: var(--rose-text); font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 1px solid var(--rose-text); }
form.inline { display: inline; margin: 0; }

.main { min-width: 0; padding: 22px clamp(16px, 3vw, 40px) 40px; display: flex; flex-direction: column; min-height: 100dvh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.topbar h1 { margin: 0; font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; }
.topbar .lede { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.tools { display: flex; align-items: center; gap: 10px; }
/* Saklar tema dashboard: satu tombol, ikon menunjukkan tema tujuan. */
.theme-btn { border: 1px solid var(--line-strong); background: var(--surface); }
.theme-btn .i-sun, .theme-btn .i-moon { display: none; }
.theme-btn[data-current="dark"] .i-sun, .theme-btn[data-current="light"] .i-moon { display: block; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--muted); flex: none; }
.avatar.lg { width: 80px; height: 80px; font-size: 28px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-link { text-decoration: none; border-radius: 50%; }
.more-btn, .more-sheet { display: none; }
.site-foot { margin-top: auto; padding-top: 32px; color: var(--muted); font-size: 13px; }

/* Panel: permukaan padat tanpa bayangan; hierarki dari ukuran, posisi, dan jarak */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 22px; min-width: 0; }
.panel.focus { border-color: var(--line-strong); padding: 26px; }
.panel.flat { background: transparent; border-style: dashed; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.layout { display: grid; gap: 20px; }
.layout.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.layout.split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.layout.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack.tight { gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
p { margin: 0 0 12px; }

/* Daftar tindakan: fokus halaman Ringkasan */
.todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.todo a { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; min-height: 64px; border-radius: var(--r-control); background: var(--surface-2); text-decoration: none; border: 1px solid transparent; }
@media (hover: hover) { .todo a:hover { border-color: var(--line-strong); } }
.todo .num { font-size: 26px; font-weight: 700; min-width: 2ch; text-align: right; }
.todo .warn .num { color: var(--amber-text); }
.todo .bad .num { color: var(--rose-text); }
.todo b { display: block; font-weight: 600; }
.todo span { color: var(--muted); font-size: 13px; }

/* Angka nyata dengan keterangan */
.figure { display: flex; flex-direction: column; gap: 4px; }
.figure strong { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.figure span { color: var(--muted); font-size: 14px; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; }
.meter { height: 10px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line-strong); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--leaf); }
.meter.warn i { background: var(--amber-text); }

/* Grafik batang */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 6px; height: 170px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar i { width: 100%; max-width: 26px; border-radius: 4px 4px 2px 2px; background: var(--leaf); min-height: 2px; }
.bar b { font-size: 11px; font-weight: 600; color: var(--muted); }
.bar small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.bar:nth-child(odd) small { visibility: hidden; }

/* Tombol: pil hanya untuk aksi utama */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-control);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
@media (hover: hover) { .btn:hover { background: var(--surface-2); } }
@media (hover: hover) { .btn:active { transform: translateY(1px); } }
.btn-primary { border: 0; border-radius: 999px; padding: 0 22px; color: var(--cta-text); background: linear-gradient(100deg, var(--cta-from), var(--cta-to)); }
@media (hover: hover) { .btn-primary:hover { background: linear-gradient(100deg, var(--cta-from), var(--cta-from)); } }
.btn-danger { color: var(--rose-text); border-color: var(--rose-text); }
@media (hover: hover) { .btn-danger:hover { background: var(--rose-tint); } }
.btn-quiet { border-color: transparent; background: transparent; }
@media (hover: hover) { .btn-quiet:hover { background: var(--surface-2); } }
.btn-icon { width: 44px; padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; transform: none; }
.btn.full { width: 100%; }

/* Label status: hanya untuk keadaan nyata */
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--r-chip); font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.good { background: var(--leaf-tint); color: var(--leaf-text); }
.tag.warn { background: var(--amber-tint); color: var(--amber-text); }
.tag.bad { background: var(--rose-tint); color: var(--rose-text); }

/* Tab segmen */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-control); background: var(--surface-2); flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500; }
@media (hover: hover) { .tab:hover { color: var(--text); } }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line-strong); }

/* Tabel */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 8px 10px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list td a { text-decoration: none; }
@media (hover: hover) { table.list td a:hover b { text-decoration: underline; } }
.person { display: flex; align-items: center; gap: 12px; min-width: 210px; min-height: 44px; }
.person b { display: block; font-weight: 600; }
.person span { color: var(--muted); font-size: 13px; }

/* Peringkat & kata kunci */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.rank .track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.rank .track i { display: block; height: 100%; background: var(--leaf); }
.words { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.words li { padding: 6px 10px; border-radius: var(--r-chip); background: var(--surface-2); font-size: 14px; }
.words em { font-style: normal; color: var(--muted); margin-left: 6px; font-size: 13px; }

/* Formulir */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-size: 14px; font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; }
input[type="text"], input[type="email"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-control); padding: 10px 12px;
}
input[disabled] { background: var(--surface-2); color: var(--muted); }
textarea { min-height: 110px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, input:focus, select:focus, textarea:focus { border-color: var(--leaf-text); box-shadow: 0 0 0 3px var(--leaf-tint), 0 8px 20px -10px var(--leaf); }
input[type="file"] { font: inherit; color: var(--muted); max-width: 100%; min-height: 44px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; min-height: 40px; padding: 0 14px; border-radius: var(--r-control); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); cursor: pointer; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; min-height: 44px; padding-top: 10px; }
.check input { margin-top: 3px; accent-color: var(--leaf); width: 18px; height: 18px; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 8px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-control); background: var(--surface-2); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg span { display: flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 8px; font-size: 14px; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg input:focus-visible + span { box-shadow: 0 0 0 2px var(--leaf-text), 0 6px 16px -6px var(--leaf); }
.searchbar { display: flex; gap: 8px; align-items: flex-end; }
.searchbar .field { flex: 1; min-width: 0; }

/* Pesan sistem */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-control); margin-bottom: 20px; background: var(--leaf-tint); color: var(--leaf-text); font-size: 14px; font-weight: 500; }
.flash.warn { background: var(--amber-tint); color: var(--amber-text); }
.flash.warn a { color: inherit; font-weight: 700; }
.flash > span { flex: 1; }
[data-demo-note="hidden"] .demo-note { display: none; }
.flash-close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -11px -10px -11px 0; border: 0; border-radius: var(--r-control); background: none; color: inherit; }
@media (hover: hover) { .flash-close:hover { background: rgba(127, 127, 127, 0.15); } }
.composer textarea[disabled] { cursor: not-allowed; }
.flash.error { background: var(--rose-tint); color: var(--rose-text); }
.flash svg { flex: none; margin-top: 2px; }
.empty { padding: 26px 4px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }

/* Bola Nahdoh: identitas AI. Diam saat menunggu input; berputar hanya saat sedang mencari jawaban. */
.orb { --size: 88px; display: inline-block; position: relative; width: var(--size); height: var(--size); border-radius: 50%; flex: none; }
.orb::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 20deg, transparent 0 8%, var(--leaf) 22%, transparent 34%, var(--lime) 52%, transparent 64%, var(--leaf) 80%, transparent 92%);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 56%, #000 70%, transparent 72%);
          mask: radial-gradient(circle, transparent 54%, #000 56%, #000 70%, transparent 72%);
  filter: drop-shadow(0 0 8px var(--leaf));
}
.orb { display: inline-grid; place-items: center; }
.orb .nw { position: relative; z-index: 1; width: 54%; height: 54%; overflow: visible; }
.orb .nw .base { fill: var(--logo); }
/* Lampu berjalan di bulan bintang (hanya tema gelap). Tiga putaran saat halaman dibuka, terus berjalan selama AI mencari jawaban. */
.orb .nw .chase path { fill: none; stroke: var(--chase); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 9 91; stroke-dashoffset: 100; filter: drop-shadow(0 0 5px var(--chase));
  animation: var(--chase-anim) 4.8s linear infinite; }
.orb .nw .chase path:nth-child(2) { animation-delay: -2.4s; }
/* Tombol pensil "Percakapan baru" di kanan atas, seperti aplikasi chat pada umumnya */
.tool-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-control); color: var(--text); text-decoration: none; }
@media (hover: hover) { .tool-btn:hover { background: var(--surface-2); } }
@keyframes nw-chase { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
.orb.sm { --size: 40px; }
.orb.xs { --size: 30px; }
.orb.thinking::before { animation: orb-spin 1.4s linear infinite; }
@keyframes orb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orb.thinking::before, .orb .nw .chase path { animation: none !important; stroke-dasharray: none; opacity: .35; } * { transition: none !important; } }

/* Uji Chat */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; height: calc(100dvh - 150px); min-height: 520px; }
.chat-panel { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-panel .panel-head { padding: 16px 20px 0; margin-bottom: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 18px; }
.chat-hello { margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; max-width: 520px; }
.chat-hello h2 { margin: 0; font-size: clamp(20px, 2.6vw, 26px); font-weight: 700; }
.chat-hello p { margin: 0; color: var(--muted); }
.msg { display: flex; gap: 12px; align-items: flex-start; max-width: 780px; }
.msg.user { align-self: flex-end; }
.bubble { padding: 12px 16px; border-radius: 14px; background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--bubble-user); border-top-right-radius: 4px; }
.msg.ai .bubble { border-top-left-radius: 4px; }
.msg.refusal .bubble { background: var(--amber-tint); }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sources a, .sources span { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 10px; border-radius: var(--r-chip); font-size: 13px; text-decoration: none; background: var(--surface-2); color: var(--muted); }
@media (hover: hover) { .sources a:hover { color: var(--text); text-decoration: underline; } }
.thumbs { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.thumbs a { display: block; width: 128px; text-decoration: none; }
.thumbs img { width: 128px; height: 96px; object-fit: cover; border-radius: var(--r-control); }
.thumbs small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.composer { margin: 0 14px 14px; padding: 10px 12px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-strong); }
.composer label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 2px 4px 2px; }
.composer textarea { border: 0; background: transparent; min-height: 48px; max-height: 200px; padding: 4px; resize: none; }
.composer textarea:focus-visible, .composer textarea:focus { outline: none; box-shadow: none; }
.composer:focus-within { border-color: var(--leaf-text); box-shadow: 0 10px 28px -12px var(--leaf); }
/* Tombol kirim: lingkaran warna teks, pudar bila kolom kosong. */
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; color: var(--bg); background: var(--text); transition: opacity .15s, transform .1s; }
@media (hover: hover) { .send:hover { opacity: .85; } }
@media (hover: hover) { .send:active { transform: scale(.94); } }
.send[disabled] { opacity: .3; transform: none; }
.history { display: flex; flex-direction: column; overflow: hidden; }
.history-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.history-list a { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 8px 10px; border-radius: var(--r-control); text-decoration: none; font-size: 14px; color: var(--muted); }
@media (hover: hover) { .history-list a:hover { background: var(--surface-2); color: var(--text); } }
.history-list a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-list a[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 600; }

/* Halaman tunggal (masuk, publik) */
.single { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 18px; gap: 18px; }
.single main { width: min(440px, 100%); }
.single.wide main { width: min(720px, 100%); }
.hero { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.hero h1 { margin: 0; font-size: clamp(26px, 5vw, 34px); font-weight: 700; }
.hero p { margin: 0; color: var(--muted); }
/* Halaman masuk: isi ditambat ke atas agar tidak melompat saat tinggi layar berubah. */
.single.login-page { justify-content: flex-start; padding-top: clamp(40px, 12dvh, 110px); }
.single.login-page footer { margin-top: auto; padding-top: 24px; }
.hero.login { align-items: center; text-align: center; gap: 10px; }
.hero.login .orb { --size: 96px; margin-bottom: 14px; }
.hero.login h1 { font-size: 30px; }
.hero.login .lede { max-width: 34ch; font-size: 15px; margin-bottom: 18px; }
.hero.login .flash { width: 100%; margin: 0 0 8px; text-align: left; }
.profile-page { width: min(420px, 100%); }
.profile-form { display: flex; flex-direction: column; gap: 16px; width: 100%; margin-top: 8px; text-align: left; }
.avatar-pick { position: relative; align-self: center; display: block; border-radius: 50%; cursor: pointer; }
.avatar-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.avatar-pick:focus-within { box-shadow: 0 0 0 3px var(--leaf-text); }
.avatar-pick .avatar, .avatar-pick img { width: 96px; height: 96px; font-size: 34px; object-fit: cover; }
.avatar-cam { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 34px; height: 34px; border: 3px solid var(--bg); border-radius: 50%; background: var(--leaf-text); color: var(--bg); }
.avatar-hint { margin: -6px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.avatar-reset { align-self: center; }
.profile-static { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-control); color: var(--muted); }
.btn-save { min-height: 48px; border: 0; border-radius: 999px; background: var(--leaf-text); color: var(--bg); font-weight: 700; }
.hero.login .actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.hero.login .actions form { margin: 0; }
.hero.login .or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.hero.login .or::before, .hero.login .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hero.login .hint { margin-top: 6px; font-size: 13px; max-width: 36ch; }
.google-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; gap: 12px; min-height: 48px; padding: 0 18px; border: 1px solid #8e918f; border-radius: 999px; background: #131314; color: #e3e3e3; font-size: 15px; font-weight: 600; text-decoration: none; transition: background .2s; }
/* Warna netral dari pedoman tombol Google: gelap #131314 bergaris #8E918F, terang putih bergaris #747775. */
html[data-theme="light"] .google-btn { border-color: #747775; background: #fff; color: #1f1f1f; }
.google-btn svg { flex: none; }
@media (hover: hover) { .google-btn:hover { background: #202124; } html[data-theme="light"] .google-btn:hover { background: #f4f6fb; } }
.drawer-foot .google-btn { margin-top: 4px; }
.single footer { color: var(--muted); font-size: 13px; }
.prose { white-space: pre-wrap; max-width: 68ch; }

/* Potongan teks & galeri */
.chunk { border-top: 1px solid var(--line); padding: 16px 0; }
.chunk:first-of-type { border-top: 0; padding-top: 0; }
.chunk textarea { min-height: 150px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; border-radius: var(--r-control); overflow: hidden; background: var(--surface-2); }
.gallery img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { padding: 10px 12px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.pager span.info { color: var(--muted); font-size: 13px; }
blockquote.quote { margin: 12px 0 8px; padding: 12px 16px; border-radius: var(--r-control); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Layar laptop yang pendek: rapatkan rel supaya semua menu terlihat tanpa digulir */
@media (min-width: 761px) and (max-height: 860px) {
  .rail { padding: 12px 8px; gap: 2px; }
  .rail-logo { width: 44px; height: 44px; margin-bottom: 6px; }
  .rail-btn { min-height: 0; padding: 3px; gap: 1px; font-size: 11.5px; line-height: 1.2; }
  .rail-btn .ic { width: 32px; height: 32px; }
}
/* Lebar menengah (tablet, laptop kecil): rel tetap, kolom samping turun ke bawah */
@media (max-width: 1100px) {
  .layout.side, .layout.split { grid-template-columns: minmax(0, 1fr); }
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: auto; }
  .chat-panel { height: calc(100dvh - 150px); min-height: 480px; }
  .history { max-height: 280px; }
}

/* HP: rel menjadi navigasi bawah berlabel (satu-satunya elemen kaca) */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  /* Navigasi bawah mengikuti referensi pemilik: bilah membulat melayang, menu aktif dengan ikon terisi. */
  .rail {
    position: fixed; z-index: 30; left: 10px; right: 10px; top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); height: auto;
    flex-direction: row; padding: 6px 4px; border: 1px solid var(--nav-rim); border-radius: 26px;
    background: var(--nav-glass); box-shadow: var(--nav-shadow);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  }
  .rail-logo, .rail-foot { display: none; }
  .rail-nav { flex-direction: row; overflow-x: auto; gap: 0; }
  .rail-btn { min-width: 0; min-height: 60px; padding: 6px 2px 4px; gap: 3px; font-size: 12px; font-weight: 500; color: var(--nav-idle); border-radius: 18px; }
  .rail-btn .ic { width: 28px; height: 28px; border-radius: 0; background: none !important; box-shadow: none !important; }
  .rail-btn .ic svg { width: 26px; height: 26px; }
  @media (hover: hover) { .rail-btn:hover { color: var(--nav-active); } }
  @media (hover: hover) { .rail-btn:active { transform: scale(.94); } }
  .rail-btn[aria-current="page"], .more-btn[data-active], .more-btn[aria-expanded="true"] { color: var(--nav-active); font-weight: 700; }
  .rail-btn[aria-current="page"] .i-out, .more-btn[data-active] .i-out, .more-btn[aria-expanded="true"] .i-out { display: none; }
  .rail-btn[aria-current="page"] .i-fill, .more-btn[data-active] .i-fill, .more-btn[aria-expanded="true"] .i-fill { display: block; }
  .count { left: calc(50% + 6px); top: 2px; }
  .rail-nav { overflow: visible; justify-content: space-around; }
  .rail-btn { flex: 1; min-width: 0; }
  .rail-btn.secondary { display: none; }
  .more-btn { display: flex; }

  .more-sheet:not([hidden]) {
    display: flex; flex-direction: column; position: absolute; right: 8px; bottom: calc(100% + 8px); width: min(260px, calc(100vw - 16px));
    padding: 6px; border-radius: 22px; background: var(--surface); border: 1px solid var(--nav-rim); box-shadow: var(--nav-shadow);
  }
  .more-sheet a, .more-sheet button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: var(--r-control); border: 0; background: none; color: var(--text); font: inherit; font-size: 15px; text-decoration: none; width: 100%; text-align: left; }
  @media (hover: hover) { .more-sheet a:hover, .more-sheet button:hover { background: var(--surface-2); } }
  .more-sheet a { color: var(--nav-idle); }
  .more-sheet a[aria-current="page"] { color: var(--nav-active); font-weight: 700; }
  @media (hover: hover) { .more-sheet a:hover, .more-sheet button:hover { color: var(--nav-active); font-weight: 700; } }
  .more-sheet form { margin: 0; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
  .main { padding: 16px 14px calc(104px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 18px; }
  .topbar .lede { display: none; }
  .layout.halves, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 16px; }
  .panel.focus { padding: 18px; }
  .chat-panel { height: calc(100dvh - 196px); min-height: 420px; }
  .composer { margin: 0 8px 8px; }
  .composer .hint { display: none; }
  .composer .spread { justify-content: flex-end; }
  .chat-hello { gap: 12px; }
  .chat-hello .orb { --size: 56px; }
  .chat-hello p { display: none; }
  .figure strong { font-size: 24px; }
  .searchbar { flex-wrap: wrap; }
  .trio { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .tools .avatar-link { display: none; }
  .tools { gap: 6px; }
  .topbar { flex-wrap: wrap; }
}

/* Gerak gaya iOS untuk kesinambungan ruang: laci, pesan baru, pil, perpindahan halaman. Berhenti di "kurangi gerak". */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; animation-timing-function: var(--ease-ios); }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes drop-in { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.msg.enter { animation: rise-in var(--dur) var(--ease-ios) both; }
.toast { animation: drop-in var(--dur) var(--ease-ios) both; }
.to-bottom:not([hidden]) { animation: pop-in .25s var(--ease-ios) both; }
.round-btn, .send, .pill, .suggest button, .drawer-link, .drawer-new, .drawer-list a, .msg-action, .to-bottom { transition: transform .18s var(--ease-ios), background .18s, opacity .18s, border-color .18s; }
@media (hover: hover) { .round-btn:active, .pill:active, .suggest button:active, .drawer-link:active, .drawer-new:active, .drawer-list a:active { transform: scale(.97); } }
@media (prefers-reduced-motion: reduce) {
  .msg.enter, .toast, .to-bottom:not([hidden]), .pill, .drawer:not([hidden]), .drawer-backdrop:not([hidden]), .hist-menu, .hist.enter { animation: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Chat penuh layar. Satu markup: laci di HP, sidebar tetap di desktop (>= 960px); --side menggeser header dan composer. */
body.chat-app { --side: 0px; background: var(--bg); }
body.chat-app.drawer-open { overflow: hidden; }
.chat-top {
  position: fixed; z-index: 20; top: 0; left: var(--side); right: 0; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px; pointer-events: none;
  background: linear-gradient(var(--bg) 55%, transparent);
}
.chat-top > * { pointer-events: auto; }
.round-btn {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--nav-rim);
  background: var(--nav-glass); color: var(--text); text-decoration: none; box-shadow: var(--nav-shadow), inset 0 1px 0 var(--glass-shine);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.round-btn.small { width: 44px; height: 44px; box-shadow: none; }
@media (hover: hover) { .round-btn:hover { background: var(--surface-2); } }
@media (hover: hover) { .round-btn:active { transform: scale(.95); } }
.chat-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; text-decoration: none; color: var(--text); }
.chat-main { min-height: 100dvh; margin-left: var(--side); }
.chat-thread { width: min(760px, 100%); margin: 0 auto; padding: calc(84px + env(safe-area-inset-top)) 18px calc(130px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 28px; min-height: 100dvh; }

/* Layar kosong: satu titik fokus (bola), sapaan, tiga saran. */
.chat-empty { margin: auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding-bottom: 8px; }
.chat-empty .orb { --size: 88px; margin-bottom: 10px; }
.chat-empty h1 { margin: 0; max-width: 18ch; font-size: clamp(24px, 5.5vw, 32px); font-weight: 700; }
.chat-empty p { margin: 0; max-width: 44ch; color: var(--muted); font-size: 15.5px; }
.suggest { list-style: none; margin: 22px 0 0; padding: 0; width: min(520px, 100%); display: flex; flex-direction: column; gap: 8px; }
.suggest button {
  display: block; width: 100%; min-height: 52px; padding: 13px 18px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; text-align: left; transition: border-color .15s, background .15s;
}
@media (hover: hover) { .suggest button:hover { border-color: var(--line-strong); background: var(--surface-2); } }
@media (hover: hover) { .suggest button:active { transform: translateY(1px); } }

/* Pesan: pengguna di gelembung kanan; AI tanpa gelembung, ditandai bola kecil di kiri (siapa yang bicara). */
.chat-app .msg { display: flex; gap: 14px; align-items: flex-start; max-width: 100%; }
.chat-app .msg.user { align-self: flex-end; max-width: 85%; }
.chat-app .msg.user .bubble { border-radius: 22px; border-bottom-right-radius: 6px; padding: 12px 18px; font-size: 16.5px; background: var(--bubble-user); }
.chat-app .msg.ai .msg-body { width: 100%; }
.chat-app .thinking-row > .orb { --size: 30px; }
/* Header layar sapaan: logo dan tombol percakapan baru disembunyikan, tempatnya tetap agar tata letak tidak bergeser. */
.chat-top .is-hidden { visibility: hidden; }
.orb-flight { position: fixed; z-index: 60; margin: 0; transform-origin: top left; transition: transform .5s var(--ease-ios); pointer-events: none; }
.chat-app .msg.ai .answer { font-size: 17px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body { min-width: 0; flex: 1; }
.msg-actions { display: flex; gap: 4px; margin-top: 6px; margin-left: -10px; }
.msg-actions.mine { justify-content: flex-end; margin-left: 0; margin-right: -10px; }
.msg-action { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
@media (hover: hover) { .msg-action:hover { color: var(--text); background: var(--surface-2); } }
.msg-tail.pending { visibility: hidden; }
/* Teks jawaban: tiap kata memudar dari buram ke tajam, kurva iOS. Tanpa gerakan, jadi tetap untuk "kurangi gerak". */
.chat-app .msg.ai .answer strong { font-weight: 700; }
.answer .w { animation: word-in .5s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes word-in { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: blur(0); } }
/* Pil saran lanjutan, hanya di bawah jawaban terakhir. */
.followups { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 14.5px; line-height: 1.3; text-align: left; }
.followups.pop .pill { animation: rise-in var(--dur) var(--ease-ios) both; }
@media (hover: hover) { .pill:hover { background: var(--surface-2); border-color: var(--leaf-text); } }
.thinking-row { align-items: center; }
.thinking-row .hint { margin: 0; }

/* Rujukan: garis hijau di kiri adalah satu-satunya aksen hijau di jawaban. */
.refs { margin-top: 16px; padding: 2px 0 2px 14px; border-left: 2px solid var(--leaf); }
.refs-label { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--leaf-text); }
.refs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.refs li > * { display: flex; align-items: flex-start; gap: 10px; min-height: 32px; padding: 4px 0; color: var(--text); text-decoration: none; font-size: 14.5px; line-height: 1.45; }
.refs li svg { flex: none; margin-top: 2px; color: var(--muted); }
.refs li b { font-weight: 600; }
.refs li small { display: block; font-size: 13px; color: var(--muted); }
@media (hover: hover) { .refs li a:hover b { text-decoration: underline; text-underline-offset: 3px; } }

/* Penolakan: kartu lembut, kuning hanya di ikon. */
.refusal-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--amber-tint); white-space: normal !important; }
.refusal-card svg { flex: none; margin-top: 3px; color: var(--amber-text); }
.refusal-card p { margin: 0; font-size: 16px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Composer: pil kaca, pilihan pemilik. */
.chat-composer {
  position: fixed; z-index: 20; left: var(--side); right: 0; margin: 0 auto; bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(760px, calc(100% - var(--side) - 24px)); display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 20px;
  border-radius: 30px; border: 1px solid var(--nav-rim); background: var(--nav-glass);
  box-shadow: var(--nav-shadow), inset 0 1px 0 var(--glass-shine);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.chat-composer:focus-within { border-color: var(--leaf-text); }
.chat-composer textarea { flex: 1; min-height: 44px; max-height: 180px; padding: 11px 0; border: 0; background: transparent; resize: none; font-size: 17px; line-height: 1.4; box-shadow: none !important; }
.chat-composer .send { flex: none; }
.to-bottom {
  position: fixed; z-index: 19; left: var(--side); right: 0; margin: 0 auto; bottom: calc(92px + env(safe-area-inset-bottom));
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--nav-rim);
  background: var(--nav-glass); color: var(--text); box-shadow: var(--nav-shadow), inset 0 1px 0 var(--glass-shine);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
@media (hover: hover) { .to-bottom:hover { background: var(--surface-2); } }
.to-bottom svg { transition: transform var(--dur) var(--ease-ios); }
.to-bottom.is-up svg { transform: rotate(180deg); }

/* Laci (HP) / sidebar (desktop) */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.45); }
.drawer {
  position: fixed; z-index: 41; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); display: none; flex-direction: column; gap: 6px;
  padding: calc(14px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom));
  /* Kaca tipis: cukup pekat agar teks halaman di belakang tidak terbaca menembus menu; garis kanan memantulkan cahaya. */
  background: color-mix(in srgb, var(--surface) 96%, transparent); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--nav-rim); box-shadow: 20px 0 50px -20px rgba(0, 0, 0, 0.5), inset -1px 0 0 var(--glass-shine);
}
.drawer:not([hidden]) { display: flex; transition: transform var(--dur) var(--ease-ios); }
@starting-style { .drawer:not([hidden]) { transform: translateX(-100%); } }
.drawer.closing { transform: translateX(-100%); }
.drawer-backdrop:not([hidden]) { transition: opacity var(--dur) var(--ease-ios); }
@starting-style { .drawer-backdrop:not([hidden]) { opacity: 0; } }
.drawer-backdrop.closing { opacity: 0; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; }
.drawer-new, .drawer-link { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 10px; border: 0; border-radius: var(--r-control); background: none; color: var(--text); font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; width: 100%; text-align: left; }
@media (hover: hover) { .drawer-new:hover, .drawer-link:hover { background: var(--surface-2); } }
.drawer-label { margin: 12px 10px 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
/* APK offline (salinan bacaan): akun dan kuota butuh internet, jadi disembunyikan. */
html[data-offline] .drawer-foot, html[data-offline] #feat-tab-kuota, html[data-offline] #feat-kuota { display: none !important; }
/* Motif logo madrasah NWDI di belakang riwayat: garis samar via mask, warnanya ikut tema; tetap di tempat saat riwayat digulir. */
.drawer-hist { position: relative; isolation: isolate; flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; transition: opacity .3s; }
/* Tab Tentang berteks panjang: kartu naik menutupi riwayat, isinya digulir di dalam kartu. */
.drawer.about-open .drawer-hist { flex-grow: 0; opacity: 0; pointer-events: none; }
.drawer.about-open .feat { flex-grow: 1; }
.drawer-hist::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 52%; width: min(240px, 90%); aspect-ratio: 1; transform: translate(-50%, -50%); background: var(--leaf-text); opacity: .08; -webkit-mask: var(--motif) center / contain no-repeat; mask: var(--motif) center / contain no-repeat; pointer-events: none; }
html[data-theme="light"] .drawer-hist::before { opacity: .1; }
.drawer-list { flex: 1; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.hist { position: relative; display: flex; align-items: center; border-radius: var(--r-control); }
.hist > a { flex: 1; min-width: 0; display: block; min-height: 44px; padding: 11px 44px 11px 10px; border-radius: var(--r-control); color: var(--text); text-decoration: none; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist > a { transition: background .2s, box-shadow .2s; }
/* Riwayat terpilih: kaca tembus pandang (bukan blok solid) agar motif logo NWDI di belakangnya tetap terlihat. */
.hist:focus-within > a, .hist > a[aria-current="page"] { background: color-mix(in srgb, var(--surface-2) 45%, transparent); box-shadow: inset 0 0 0 1px var(--nav-rim), inset 0 1px 0 var(--glass-shine), 0 6px 18px -12px rgba(0, 0, 0, .6); }
@media (hover: hover) { .hist:hover > a { background: color-mix(in srgb, var(--surface-2) 45%, transparent); box-shadow: inset 0 0 0 1px var(--nav-rim); } }
.hist > a[aria-current="page"] { font-weight: 600; }
.hist-more { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: grid; place-items: center; opacity: 0; transition: opacity .15s, background .15s; }
.hist:focus-within .hist-more, .hist > a[aria-current="page"] ~ .hist-more, .hist-more[aria-expanded="true"] { opacity: 1; }
@media (hover: hover) { .hist:hover .hist-more { opacity: 1; } }
@media (hover: none) { .hist-more { opacity: 1; } }
.hist-more[aria-expanded="true"] { background: var(--surface); color: var(--text); }
@media (hover: hover) { .hist-more:hover { background: var(--surface); color: var(--text); } }
.hist-edit { flex: 1; min-width: 0; min-height: 44px; padding: 10px; border: 1px solid var(--leaf-text); border-radius: var(--r-control); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; }
.hist.enter { animation: rise-in var(--dur) var(--ease-ios) both; }
/* Menu titik tiga: popover kecil. */
.hist-menu { position: fixed; z-index: 70; min-width: 200px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .55); transform-origin: top right; animation: pop-in .2s var(--ease-ios) both; }
.hist-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; font-size: 14.5px; text-align: left; }
.hist-menu button:focus-visible { background: var(--surface-2); box-shadow: none; }
@media (hover: hover) { .hist-menu button:hover { background: var(--surface-2); box-shadow: none; } }
.hist-menu button svg { color: var(--muted); }
.hist-menu button.danger, .hist-menu button.danger svg { color: var(--rose-text); }
@media (hover: hover) { .hist-menu button.danger:hover { background: var(--rose-tint); } }
.drawer-list .hint { padding: 0 10px; }
.drawer-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.drawer-foot form { margin: 0; }
.drawer-me { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 2px 10px 6px; }
.drawer-user { display: flex; flex-direction: column; min-width: 0; }
.drawer-user b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-user span { color: var(--muted); font-size: 13px; }
/* Fitur di laci: kartu bertab gaya map; sudut cekung (radial-gradient) menimpa ujung garis sisi tab agar melengkung ke kartu.
   Permukaan solid, bukan kaca: kaca sudah dipakai laci. */
.feat { --feat-bg: var(--surface-2); --feat-r: 18px; display: flex; flex: 0 1 auto; flex-direction: column; min-height: 0; margin: 12px 0 6px; }
.feat-tabs { display: flex; flex: none; align-items: flex-end; padding-right: calc(var(--feat-r) + 6px); } /* ruang sudut cekung tab terakhir */
.feat-tab { position: relative; display: inline-flex; flex: 0 0 auto; min-width: 0; align-items: center; gap: 0; min-height: 46px; padding: 0 11px 4px; border: 1px solid transparent; border-bottom: 0; border-radius: var(--feat-r) var(--feat-r) 0 0; background: none; color: var(--muted); font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: color .2s; }
@media (hover: hover) { .feat-tab:hover { color: var(--text); } }
.feat-tab svg, .feat-item svg { flex: none; }
/* Tiga tab tidak muat berlabel di sidebar 255px: tab tak aktif hanya ikon, tab aktif melebar menampilkan labelnya. */
.feat-label { position: relative; display: block; max-width: 0; margin-left: 0; padding-bottom: 9px; margin-bottom: -9px; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: max-width var(--dur) var(--ease-ios), margin var(--dur) var(--ease-ios), opacity .2s; }
.feat-tab[aria-selected="true"] .feat-label { max-width: 8.2em; margin-left: 8px; opacity: 1; }
.feat-tab[aria-selected="true"] { flex-shrink: 1; z-index: 1; margin-bottom: -1px; border-color: var(--line); background: var(--feat-bg); color: var(--text); }
.feat-tab[aria-selected="true"] .feat-label::after { content: ""; position: absolute; left: 0; right: 0; bottom: 1px; height: 3px; border-radius: 2px; background: currentColor; }
.feat-tab[aria-selected="true"]::before, .feat-tab[aria-selected="true"]::after { content: ""; position: absolute; bottom: 0; width: var(--feat-r); height: var(--feat-r); pointer-events: none; }
.feat-tab[aria-selected="true"]::after { left: 100%; background: radial-gradient(circle at 100% 0, transparent calc(var(--feat-r) - 1px), var(--line) calc(var(--feat-r) - .5px), var(--line) var(--feat-r), var(--feat-bg) calc(var(--feat-r) + .5px)); }
.feat-tab[aria-selected="true"]::before { right: 100%; background: radial-gradient(circle at 0 0, transparent calc(var(--feat-r) - 1px), var(--line) calc(var(--feat-r) - .5px), var(--line) var(--feat-r), var(--feat-bg) calc(var(--feat-r) + .5px)); }
.feat-tab:first-child[aria-selected="true"]::before { content: none; }
.feat-panel { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; border: 1px solid var(--line); border-radius: var(--feat-r); background: var(--feat-bg); padding: 10px 6px; }
.feat:has(.feat-tab:first-child[aria-selected="true"]) .feat-panel { border-top-left-radius: 0; }
.feat-items { display: flex; gap: 4px; }
.feat-items[hidden] { display: none; }
.feat-item { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; border: 0; border-radius: 12px; background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; transition: color .2s, background .2s; }
.feat-item { position: relative; }
/* Penanda fitur yang belum tersedia, menempel di pojok ikon. */
.soon-tag { position: absolute; top: -5px; right: 2px; padding: 1px 6px; border-radius: 999px; background: var(--amber-tint); color: var(--amber-text); font-size: 10px; font-style: normal; font-weight: 700; line-height: 1.5; }
.feat-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .feat-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); } }
/* Seperti tab di dalam kartu: yang aktif terang, sisanya redup. Tanpa yang aktif, semua tampil biasa. */
.feat-items:has([aria-current="page"], [aria-pressed="true"]) .feat-item:not([aria-current="page"]):not([aria-pressed="true"]) { color: var(--muted); font-weight: 500; }
/* Tentang: logo kotak, judul, teks panjang yang digulir di dalam kartu, lalu kontak. */
.feat-tentang { flex: 1 1 auto; flex-direction: column; gap: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 10px 6px; font-size: 14px; line-height: 1.6; color: var(--muted); }
/* Paragraf Tentang rata kiri-kanan; hyphens mencegah celah lebar antarkata di kolom sempit. */
.feat-tentang > p { margin: 0 0 10px; text-align: justify; -webkit-hyphens: auto; hyphens: auto; }
.feat-tentang .about-head p { text-align: left; }
/* Tentang: ketuk tab sekali lagi untuk meringkas (tinggal logo dan nama), ketuk lagi untuk membuka penuh.
   Membuka: logo "pop" memantul, judul dan paragraf naik bergantian. Meringkas: paragraf turun memudar. */
.feat.about-compact .feat-tentang { overflow: hidden; max-height: 84px; }
.feat-tentang.about-play > * { animation: about-in .5s var(--ease-ios) both; }
.feat-tentang.about-play > :nth-child(2) { animation-delay: .08s; }
.feat-tentang.about-play > :nth-child(3) { animation-delay: .14s; }
.feat-tentang.about-play > :nth-child(4) { animation-delay: .2s; }
.feat-tentang.about-play > :nth-child(5) { animation-delay: .26s; }
.feat-tentang.about-play .about-logo { animation: logo-pop .7s cubic-bezier(.34, 1.56, .64, 1) .05s both; }
.feat-tentang.about-leave > :not(.about-head) { animation: about-out .32s var(--ease-ios) both; }
@keyframes about-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes about-out { to { opacity: 0; transform: translateY(16px); } }
@keyframes logo-pop { 0% { opacity: 0; transform: scale(.4) rotate(-14deg); } 60% { opacity: 1; transform: scale(1.08) rotate(4deg); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .feat-tentang.about-play > *, .feat-tentang.about-play .about-logo, .feat-tentang.about-leave > * { animation: none; } }
.about-head { display: flex; align-items: center; gap: 12px; margin: 2px 0 12px; }
.about-logo { flex: none; width: 64px; height: 64px; border-radius: 12px; }
.about-head h2 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.about-head p { margin: 2px 0 0; font-size: 13px; }
.about-contact { margin: 4px 0 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.about-contact dt { font-size: 12px; font-weight: 600; text-transform: none; color: var(--muted); }
.about-contact dd { margin: 0 0 8px; color: var(--text); }
.about-contact a { color: var(--leaf-text); }
/* Akun di dasar laci: nama/email, menu titik tiga (Edit profil, Keluar) yang membuka ke atas; Kebijakan Privasi teks kecil di kiri bawah. */
.drawer-acct { position: relative; display: flex; align-items: center; gap: 4px; }
.drawer-acct .drawer-me { flex: 1; min-width: 0; }
.acct-more { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; color: var(--muted); }
.acct-more[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
@media (hover: hover) { .acct-more:hover { background: var(--surface-2); color: var(--text); } }
.acct-menu { position: absolute; z-index: 5; right: 0; bottom: calc(100% + 6px); min-width: 210px; padding: 6px; border: 1px solid var(--nav-rim); border-radius: 16px; background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: var(--nav-shadow), inset 0 1px 0 var(--glass-shine); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); transform-origin: bottom right; }
.acct-menu:not([hidden]) { display: flex; flex-direction: column; animation: pop-in .22s var(--ease-ios) both; }
.acct-menu form { margin: 0; }
.acct-menu a, .acct-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: 15px; font-weight: 600; text-align: left; text-decoration: none; }
.acct-menu .danger { color: var(--rose-text); }
.acct-menu .menu-gap { flex: none; width: 18px; } /* Kebijakan Privasi tanpa ikon, teks tetap sejajar */
@media (hover: hover) { .acct-menu a:hover, .acct-menu button:hover { background: var(--surface-2); } }
.acct-menu a:focus-visible, .acct-menu button:focus-visible { outline: 2px solid var(--leaf-text); outline-offset: -2px; }
.foot-privacy { align-self: flex-start; margin: 6px 10px 0; font-size: 13px; color: var(--muted); text-decoration: none; }
@media (hover: hover) { .foot-privacy:hover { color: var(--text); text-decoration: underline; } }
.drawer-link svg { flex: none; }
/* Kuota pengunjung: angka besar, batang sisa, lalu catatan. */
.feat-kuota { flex-direction: column; gap: 8px; padding: 4px 10px 6px; }
.kuota-num { margin: 0; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kuota-num b { font-size: 28px; font-weight: 700; color: var(--text); }
.kuota-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.kuota-bar i { display: block; height: 100%; border-radius: inherit; background: var(--leaf); transition: width var(--dur) var(--ease-ios); }
.kuota-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.feat-item:focus-visible, .feat-tab:focus-visible { outline: 2px solid var(--leaf-text); outline-offset: -2px; }
.soon { font-style: normal; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-chip); background: var(--amber-tint); color: var(--amber-text); white-space: nowrap; }
.switch { position: relative; flex: none; width: 40px; height: 24px; border-radius: 12px; background: var(--line-strong); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }

@media (min-width: 960px) {
  body.chat-app { --side: 300px; }
  html[data-side="hidden"] body.chat-app { --side: 0px; }
  .drawer { view-transition-name: sidebar; }
  .chat-composer { view-transition-name: composer; }
  .drawer, .drawer[hidden] { display: flex !important; width: 300px; box-shadow: none; padding-top: 14px; padding-bottom: 14px; transform: none; transition: transform var(--dur) var(--ease-ios); }
  html[data-side="hidden"] .drawer { transform: translateX(-100%); visibility: hidden; transition: transform var(--dur) var(--ease-ios), visibility 0s var(--dur); }
  .chat-main { transition: margin-left var(--dur) var(--ease-ios); }
  .chat-top, .chat-composer, .to-bottom { transition: left var(--dur) var(--ease-ios), width var(--dur) var(--ease-ios); }
  .drawer-backdrop, .chat-top .chat-brand { display: none; }
  /* Hamburger hanya tampil saat sidebar tersembunyi; tombol X di sidebar yang menyembunyikannya. */
  html:not([data-side="hidden"]) .chat-top [data-drawer-open] { display: none; }
  .chat-top { padding-top: 14px; }
  .chat-top > :last-child { margin-left: auto; }
  .chat-thread { padding-top: 72px; }
  .chat-empty { margin-top: auto; margin-bottom: auto; }
}
.toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); top: calc(16px + env(safe-area-inset-top)); padding: 12px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 15px; font-weight: 600; box-shadow: var(--nav-shadow); white-space: nowrap; }
.consent-text { max-height: 55dvh; overflow-y: auto; }

/* Pembaca Al-Barzanji dan Hizib: Arab besar rata kanan bernomor, terjemahan di bawahnya, memakai kerangka chat. */
:root { --ar-size: 28px; }
.reader-inner { width: min(760px, 100%); margin: 0 auto; padding: calc(84px + env(safe-area-inset-top)) 18px calc(60px + env(safe-area-inset-bottom)); }
.reader-head { text-align: center; padding: 10px 0 18px; }
.reader-title-ar { margin: 0; font-family: var(--arabic); font-size: 40px; line-height: 1.9; color: var(--leaf-text); }
.reader-head h1 { margin: 4px 0 8px; font-size: 24px; font-weight: 700; }
.reader-status { margin: 0 auto; max-width: 48ch; font-size: 13px; color: var(--muted); }
/* Alat baca: satu bilah membulat; di desktop melayang (sticky) di atas kolom baca. */
.reader-tools { display: flex; align-items: center; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.tools-sep { flex: none; width: 1px; height: 24px; background: var(--line); }
.tool-switch { display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 0 10px 0 14px; border: 0; border-radius: 11px; background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left; white-space: nowrap; }
@media (hover: hover) { .tool-switch:hover { background: var(--surface-2); } }
.tool-switch[aria-checked="true"] .switch { background: var(--leaf); }
.tool-switch[aria-checked="true"] .switch::after { transform: translateX(16px); }
.toc { margin: 22px 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.toc a { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 12px; border-radius: 12px; color: var(--text); text-decoration: none; }
@media (hover: hover) { .toc a:hover { background: var(--surface-2); } }
.toc .n { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--leaf-tint); color: var(--leaf-text); font-size: 13px; font-weight: 700; }
.toc .t { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.toc .t b { font-weight: 600; font-size: 15px; }
.toc .t span { font-family: var(--arabic); font-size: 20px; line-height: 1.8; color: var(--muted); text-align: right; }
.part { padding-top: 24px; scroll-margin-top: calc(80px + env(safe-area-inset-top)); }
.part-head { text-align: center; padding: 18px 12px; margin-bottom: 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.part-ar { margin: 0; font-family: var(--arabic); font-size: 30px; line-height: 1.9; color: var(--leaf-text); }
.part-head h2 { margin: 2px 0 0; font-size: 16px; font-weight: 600; color: var(--muted); }
.ayat { list-style: none; margin: 0; padding: 0; }
.ayah { padding: 18px 2px 16px; border-bottom: 1px solid var(--line); }
.ayah:last-child { border-bottom: 0; }
.ayah .ar { font-family: var(--arabic); font-size: var(--ar-size); line-height: 2.2; text-align: right; overflow-wrap: anywhere; }
/* اللهم tanpa glyph gabungan font LPMQ (harakat mim-nya menabrak kata berikutnya). */
.lafz { font-feature-settings: "liga" 0; }
/* Nomor ayat/bait: lencana bintang delapan (rub el hizb) berukuran tetap, jadi selalu simetris berapa pun digitnya. */
.ayah .num { position: relative; isolation: isolate; display: inline-grid; place-items: center; width: 2.6em; height: 2.6em; margin-inline-start: .3em; color: var(--leaf-text); font-family: var(--font); font-size: .38em; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; vertical-align: middle; }
.ayah .num.n3 { width: 3.55em; height: 3.55em; font-size: .28em; letter-spacing: -.04em; }
.ayah .num::before, .ayah .num::after { content: ""; position: absolute; inset: 0; z-index: -1; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ayah .num::before { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 1.4L25.45 6.85H33.15V14.55L38.6 20L33.15 25.45V33.15H25.45L20 38.6L14.55 33.15H6.85V25.45L1.4 20L6.85 14.55V6.85H14.55Z'/%3E%3C/svg%3E"); opacity: .13; }
.ayah .num::after { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' fill='none' stroke='%23000'%3E%3Cpath stroke-width='1.8' stroke-linejoin='round' d='M20 1.4L25.45 6.85H33.15V14.55L38.6 20L33.15 25.45V33.15H25.45L20 38.6L14.55 33.15H6.85V25.45L1.4 20L6.85 14.55V6.85H14.55Z'/%3E%3Ccircle cx='20' cy='20' r='11.2' stroke-width='1.1'/%3E%3C/svg%3E"); }
.ayah .bait { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: .6em; }
.ayah .bait .half { flex: 1 1 42%; text-align: center; }
.ayah .bait .sep { flex: none; color: var(--leaf); font-size: .8em; }
.ayah.pembuka .ar { text-align: center; color: var(--leaf-text); }
.ayah.reff { background: var(--leaf-tint); margin: 6px -10px; padding: 16px 12px 14px; border-radius: 14px; border-bottom: 0; }
.ayah.reff .ar { color: var(--leaf-text); }
.ayah .tag { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: var(--r-chip); background: var(--surface); color: var(--leaf-text); font-size: 12px; font-weight: 700; }
.ayah .tr { margin: 10px 0 0; font-size: 15.5px; line-height: 1.6; color: var(--muted); }
body.no-tr .ayah .tr { display: none; }
/* Mode baca (mushaf): teks Arab satu halaman buku mengalir bersambung, nomor di sela kalimat; terjemahan dan label disembunyikan. */
body.mushaf .ayat { direction: rtl; text-align: justify; text-align-last: right; font-family: var(--arabic); font-size: var(--ar-size); line-height: 2.3; padding: 8px 0 4px; }
body.mushaf .ayah { display: inline; margin: 0; padding: 0; border: 0; background: none; }
body.mushaf .ayah .ar, body.mushaf .ayah .bait, body.mushaf .ayah .bait .half, body.mushaf .ayah .bait .sep { display: inline; font-size: inherit; line-height: inherit; text-align: inherit; }
body.mushaf .ayah .bait .sep { margin: 0 .2em; }
body.mushaf .ayah .tr, body.mushaf .ayah .tags { display: none; }
body.mushaf .ayah.basmalah, body.mushaf .ayah.pembuka { display: block; margin: 2px 0 6px; text-align: center; }
.mushaf-btn { color: var(--muted); }
.mushaf-btn[aria-pressed="true"] { color: var(--leaf-text); }
.reader-foot { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.6; }
/* Daftar isi: halaman berakhir tak lama setelah catatan kaki. */
.reader-inner:has(> .reader-foot) { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.reader-foot p { margin: 0 0 6px; }
.to-top { position: fixed; z-index: 19; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom)); /* di atas bilah bawah */ width: 46px; height: 46px; }
.to-top:not([hidden]) { animation: pop-in .25s var(--ease-ios) both; }
@media (max-width: 600px) {
  /* HP: dua paruh bait bertumpuk; nomor menempel di akhir paruh kedua. */
  .ayah .bait { display: block; }
  .ayah .bait .half { display: block; text-align: right; }
  .ayah .bait .sep + .half { display: inline; }
  .ayah .bait .sep { display: none; }
  .reader-tools { flex-wrap: wrap; }
}
@media (min-width: 960px) {
  .reader-inner { padding-top: 96px; }
  .to-top { right: 24px; }
}

/* Cara baca: Gulir (semua halaman berurutan) atau Geser (satu halaman buku, dibolak-balik kiri-kanan). */
.mode-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.mode-switch button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; transition: background .2s, color .2s; }
@media (hover: hover) { .mode-switch button:hover { color: var(--text); } }
.mode-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25), 0 0 0 1px var(--line); }
.mode-switch button svg { color: inherit; }
.jump { display: block; flex: 1; min-width: 0; }
.jump select { width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.toc .t small { font-size: 13px; color: var(--muted); white-space: nowrap; }
.pages { margin-top: 10px; }
.page { position: relative; margin: 0 0 10px; scroll-margin-top: 84px; } /* scroll-margin: tidak tertutup header */
.text-page { padding-top: 4px; }
/* Geser: judul tetap di alur halaman (tidak menimpa teks). Setelah halaman berganti ia dilipat seketika;
   baru terbuka dengan animasi saat pembaca menggulir sampai paling atas. */
body.mode-page:not(.head-shown) .part-head { max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; border-width: 0; opacity: 0; overflow: hidden; visibility: hidden; }
body.mode-page.head-shown .part-head { max-height: 420px; overflow: hidden; transition: max-height .5s var(--ease-ios), padding .5s var(--ease-ios), margin .5s var(--ease-ios), opacity .4s ease .08s; }
@media (prefers-reduced-motion: reduce) { body.mode-page.head-shown .part-head { transition: none; } }
/* Geser: hanya halaman aktif yang tampil; halaman mengikuti jari lalu berganti, atau lewat .page-nav dan panah keyboard. */
body.mode-page .page:not(.is-current) { display: none; }
/* Halaman pendek tidak menyisakan ruang kosong: cukup ruang untuk pil pindah halaman di bawah. */
body.mode-page .pages { padding-bottom: 0; }
/* Ruang untuk bilah bawah (alat + halaman) di kedua cara baca. */
body[data-section] .reader-inner { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
body.mode-page .next-nav { display: none; }
body.mode-page .page { will-change: transform; }
.page.enter-next { animation: page-next var(--dur) var(--ease-ios) both; }
.page.enter-prev { animation: page-prev var(--dur) var(--ease-ios) both; }
@keyframes page-next { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes page-prev { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page.enter-next, .page.enter-prev { animation: none; } }
/* Bilah bawah: alat baca dan nomor halaman sebaris, di tengah area baca. */
.reader-dock { position: fixed; z-index: 19; left: calc(var(--side) + (100vw - var(--side)) / 2); transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; }
.page-nav { flex: none; transition: background .3s, box-shadow .3s; display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--nav-rim); border-radius: 999px; background: var(--nav-glass); box-shadow: var(--nav-shadow), inset 0 1px 0 var(--glass-shine), inset 0 -1px 0 rgba(0, 0, 0, .12); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.page-step { display: grid; place-items: center; width: 40px; height: 44px; padding: 0; border: 0; border-radius: 999px; background: none; color: var(--text); transition: background .2s, transform .2s var(--ease-ios); }
@media (hover: hover) { .page-step:hover { background: var(--glass-shine); } }
@media (hover: hover) { .page-step:active { transform: scale(.92); } }
.page-step[disabled] { color: var(--muted); opacity: .4; background: none; }
.page-pick { position: relative; display: grid; place-items: center; height: 44px; padding: 0 10px; border-radius: 999px; cursor: pointer; }
@media (hover: hover) { .page-pick:hover { background: var(--surface-2); } }
.page-pick select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.page-pick:focus-within { box-shadow: 0 0 0 2px var(--leaf-text); }
.page-nav-label { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* HP sempit: cukup "hlm. X", urutan halaman disembunyikan agar bilah muat sebaris. */
@media (max-width: 399px) { .pn-count { display: none; } }
.page-nav-label::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 3px 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
/* Alat baca di bilah bawah: satu pil kaca berisi tombol-tombol ikon. */
.font-float { flex: none; display: flex; padding: 4px; border: 1px solid var(--nav-rim); border-radius: 999px; background: var(--nav-glass); box-shadow: var(--nav-shadow), inset 0 1px 0 var(--glass-shine); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); transition: opacity .25s; }
.font-float button { display: grid; place-items: center; width: 38px; height: 44px; padding: 0; border: 0; border-radius: 999px; background: none; color: var(--text); font: inherit; font-weight: 700; line-height: 1; }
@media (hover: hover) { .font-float button:hover { background: var(--glass-shine); } }
.font-float button[disabled] { color: var(--muted); opacity: .45; }
.font-float .lbl { display: inline-flex; align-items: baseline; gap: 1px; line-height: 1; }
.font-float .a-big { font-size: 18px; }
.font-float .a-small { font-size: 13px; }
.font-float small { font-size: 11px; font-weight: 600; color: var(--muted); }
.font-float .tr-icon { color: var(--muted); }
.font-float .tr-icon[aria-checked="true"] { color: var(--leaf-text); }
/* Saat teks dipilih untuk disalin, alat cepat menyingkir agar tidak menghalangi menu salin. */
body.is-selecting .font-float { opacity: 0; pointer-events: none; }
/* HP: terjemahan pindah ke kolom ikon kiri, bilah alat tinggal Gulir/Geser. */
@media (max-width: 959px) {
  .reader-tools .tools-sep, .reader-tools .tool-switch { display: none; }
}
@media (min-width: 960px) {
  .font-float .tr-icon { display: none; }
}
@media (max-width: 600px) {
  .reader-tools { flex-wrap: wrap; }
  .reader-tools .tool-back { padding: 0 8px 0 6px; }
  .mode-switch { flex: 1; }
  .mode-switch button { flex: 1; justify-content: center; }
  .tools-sep { display: none; }
  .tool-switch { width: 100%; }
}
@media (min-width: 960px) {
  /* Alat baca: tiga pil kaca terpisah bertumpuk di kiri atas area baca (kanan sidebar). Kolom baca
     bergeser ke kanan bila celah kiri tidak cukup, jadi teks tidak pernah tertutup. */
  body.reader-page { --tools-w: 176px; --rail: calc(16px + var(--tools-w) + 12px); --reader-w: calc(100vw - var(--side)); --col-ml: max(calc(var(--rail) - 18px), calc((var(--reader-w) - 760px) / 2)); --col-w: min(760px, calc(var(--reader-w) - var(--rail) - 16px)); }
  html[data-side="hidden"] body.reader-page { --rail: calc(80px + var(--tools-w) + 12px); }
  .reader .reader-inner { width: var(--col-w); margin-left: var(--col-ml); margin-right: 0; }
  .reader .reader-tools { position: fixed; top: 14px; left: calc(var(--side) + 16px); z-index: 21; flex-direction: column; align-items: stretch; gap: 8px; width: var(--tools-w); margin: 0; padding: 0; border: 0; border-radius: 0; background: none; transition: left var(--dur) var(--ease-ios); }
  html[data-side="hidden"] .reader .reader-tools { left: 80px; }
  .reader .reader-tools .mode-switch { display: flex; flex-direction: column; gap: 8px; padding: 0; border-radius: 0; background: none; }
  .reader .reader-tools .tools-sep { display: none; }
  .reader .reader-tools .tool-back, .reader .reader-tools .mode-switch button, .reader .reader-tools .tool-switch { min-height: 44px; padding: 0 12px 0 16px; border: 1px solid var(--nav-rim); border-radius: 999px; background: var(--nav-glass); color: var(--muted); box-shadow: var(--nav-shadow), inset 0 1px 0 var(--glass-shine); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
  @media (hover: hover) { .reader .reader-tools .tool-back:hover, .reader .reader-tools .mode-switch button:hover, .reader .reader-tools .tool-switch:hover { color: var(--text); } }
  .reader .reader-tools .mode-switch button[aria-pressed="true"] { border-color: transparent; background: var(--leaf-tint); color: var(--leaf-text); box-shadow: var(--nav-shadow), inset 0 0 0 1px color-mix(in srgb, var(--leaf-text) 35%, transparent); }
  .reader .reader-tools .tool-switch { color: var(--text); }
}

/* Pembaca per bagian: daftar isi di halaman sendiri, satu bagian dimuat per halaman. */
.round-spacer { width: 52px; height: 52px; flex: none; }
.reader-by { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.resume { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; padding: 14px 16px; border-radius: 14px; background: var(--leaf-tint); color: var(--text); text-decoration: none; font-size: 15px; }
.resume svg { color: var(--leaf-text); flex: none; }
.resume b { font-weight: 600; }
.tool-back { display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px 0 10px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
@media (hover: hover) { .tool-back:hover { color: var(--text); background: var(--surface-2); } }
.reader .part-head h1 { margin: 2px 0 0; font-size: 18px; font-weight: 700; }
.part-src { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
@media (max-width: 959px) { .reader .reader-tools { margin: 0 0 12px; } }
.ayah .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.ayah .tags .tag { margin: 0; }
.ayah .tag.qs { background: var(--leaf-tint); color: var(--leaf-text); font-weight: 600; }
.next-nav { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 32px 0 8px; padding-top: 24px; border-top: 1px solid var(--line); }
/* Bagian berikutnya: kartu kalem (bukan gradasi CTA), judul tebal, panah di kiri dalam lingkaran hijau lembut. */
.next-btn { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 520px; min-height: 60px; padding: 8px 18px 8px 8px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); font-size: 16px; font-weight: 700; line-height: 1.35; text-decoration: none; transition: border-color .2s, background .2s; }
.next-btn span { flex: 1; min-width: 0; }
.next-ic { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--leaf-tint); color: var(--leaf-text); transition: transform .25s var(--ease-ios); }
@media (hover: hover) { .next-btn:hover { border-color: color-mix(in srgb, var(--leaf-text) 45%, var(--line)); } .next-btn:hover .next-ic { transform: translateX(-3px); } }
.visitor-note { margin: 18px 0 0; font-size: 13px; color: var(--muted); max-width: 44ch; }
.login-cta { margin-top: 12px; }
@media (min-width: 960px) {
  .reader-page .chat-top .round-spacer { display: none; }
}

/* Tulisan bersambung: tombol Lanjutkan di bawah bagian yang belum tamat. */
.continue-btn { margin-top: 14px; border-radius: 999px; padding: 10px 22px; font-weight: 600; background: var(--leaf-tint); color: var(--leaf-text); border: 1px solid transparent; }
@media (hover: hover) { .continue-btn:hover { border-color: var(--leaf); } }

/* Kutipan tokoh (nasihat, wasiat, motivasi): blok tersendiri dengan atribusi. */
.answer blockquote.quote { margin: 16px 0; padding: 16px 20px 16px 22px; border-left: 3px solid var(--leaf); border-radius: 4px 14px 14px 4px; background: var(--leaf-tint); white-space: normal; }
.answer blockquote.quote .q-line { display: block; font-style: italic; font-size: 1.04em; line-height: 1.6; white-space: pre-wrap; }
.answer blockquote.quote cite { display: block; margin-top: 10px; font-style: normal; font-size: .86em; font-weight: 600; color: var(--leaf-text); }
.answer blockquote.quote .q-ar { font-family: var(--arabic); font-style: normal; font-size: 1.32em; line-height: 2.1; text-align: right; margin: 4px 0 6px; color: var(--leaf-text); }

/* Admin: Tambah sumber di paling atas; detail opsional dilipat di bawah. */
.add-source .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.add-source .add-details > summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); list-style: none; }
.add-source .add-details > summary::-webkit-details-marker { display: none; }
.add-source .add-details > summary::before { content: "+ "; }
.add-source .add-details[open] > summary::before { content: "− "; }

/* Saran pertanyaan: label kategori kecil di atas pertanyaan. */
.suggest button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.suggest .sg-k { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--leaf-text); }

/* Cincin pemakaian kuota (tab Kuota dan tombol kirim). Warna per tingkat sisa kuota, didefinisikan dalam OKLCH
   lewat properti terdaftar agar perpindahan warnanya diinterpolasi di OKLCH: tetap cerah, tidak lewat abu-abu. */
@property --ur-l { syntax: '<number>'; inherits: true; initial-value: 0.70; }
@property --ur-c { syntax: '<number>'; inherits: true; initial-value: 0.17; }
@property --ur-h { syntax: '<number>'; inherits: true; initial-value: 150; }
[data-usage-ring], .kuota-bar i[data-level] {
  --ur-l: 0.70; --ur-c: 0.17; --ur-h: 150;
  --ur: oklch(var(--ur-l) var(--ur-c) var(--ur-h));
  transition: --ur-l .8s var(--ease-ios), --ur-c .8s var(--ease-ios), --ur-h .8s var(--ease-ios);
}
[data-usage-ring][data-level="blue"], .kuota-bar i[data-level="blue"] { --ur-l: 0.64; --ur-c: 0.19; --ur-h: 260; }
[data-usage-ring][data-level="orange"], .kuota-bar i[data-level="orange"] { --ur-l: 0.78; --ur-c: 0.17; --ur-h: 70; }
[data-usage-ring][data-level="red"], .kuota-bar i[data-level="red"] { --ur-l: 0.65; --ur-c: 0.22; --ur-h: 25; }
.usage-ring { flex: none; }
[data-usage-ring] .ur-track { stroke: var(--line-strong); opacity: .5; }
[data-usage-ring] .ur-fill { stroke: #22b45a; stroke: var(--ur); transition: stroke-dasharray .9s var(--ease-ios), stroke-opacity .4s; }
.kuota-bar i[data-level] { background: var(--ur); transition: width var(--dur) var(--ease-ios), --ur-l .8s var(--ease-ios), --ur-c .8s var(--ease-ios), --ur-h .8s var(--ease-ios); }
.send-wrap { position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; }
.send-ring { position: absolute; inset: -6px; width: 56px; height: 56px; pointer-events: none; }
.send-ring .ur-track { opacity: .35; }

/* Admin Sumber: hapus per baris dan hapus terpilih. */
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
@media (hover: hover) { .icon-btn.danger:hover { color: var(--rose-text); border-color: var(--rose-text); background: var(--rose-tint); } }
.list .col-check { width: 36px; }
.list .col-check input { width: 18px; height: 18px; }
#s-results[aria-busy="true"] { opacity: .6; transition: opacity .15s; }

/* Rujukan: paling banyak 4 tampil, sisanya digulir di dalam kotak tanpa garis scrollbar. */
.refs ul.refs-scroll { max-height: 192px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent); }
.refs ul.refs-scroll::-webkit-scrollbar { display: none; }
.refs ul.refs-scroll.at-end { -webkit-mask-image: none; mask-image: none; }

/* Admin Sumber: hanya isi daftar yang digulir (halaman tidak memanjang); kepala tabel menempel; tanpa scrollbar. */
.sources-scroll { max-height: min(560px, 62vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sources-scroll::-webkit-scrollbar { display: none; }
.sources-scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
