:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-2: #f0eee7;
  --ink: #25231f;
  --muted: #6b6760;
  --line: #ded9cf;
  --accent: #245d63;
  --accent-strong: #1b474c;
  --accent-soft: #dcebed;
  --warm: #b65f2a;
  --danger: #a33a3a;
  --shadow: 0 18px 50px rgba(37, 35, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 36px;
  align-items: stretch;
}

.auth-copy {
  min-height: 580px;
  padding: 52px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
  background:
    linear-gradient(rgba(20, 33, 36, 0.12), rgba(12, 28, 31, 0.72)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1400&q=80") center/cover;
  border-radius: 6px;
  overflow: hidden;
}

.auth-copy h1 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.auth-copy p:not(.eyebrow) {
  max-width: 520px;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.05rem;
  line-height: 1.6;
}

.auth-form,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-form {
  padding: 34px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-self: center;
}

.auth-form h2 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary-btn,
.ghost-btn,
.icon-text-btn,
.icon-btn,
.record-btn,
.nav-item,
.tab-btn {
  border: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  font-weight: 800;
}

.primary-btn:hover,
.record-btn:hover {
  background: var(--accent-strong);
}

.ghost-btn {
  background: var(--surface-2);
  color: var(--ink);
  padding: 11px 14px;
  font-weight: 750;
}

.form-error {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  background: #fbfaf6;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: var(--muted);
  padding: 11px 12px;
  font-weight: 780;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.sidebar-footer {
  margin-top: auto;
}

.icon-text-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 11px 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 780;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 245, 239, 0.9);
  backdrop-filter: blur(16px);
}

.search-wrap {
  width: min(620px, 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
}

.search-wrap input {
  border: 0;
  box-shadow: none;
  padding-left: 0;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn {
  width: 42px;
  height: 42px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.record-btn {
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: 850;
}

.content-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
}

.notes-pane {
  min-height: 0;
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr;
}

.pane-header {
  padding: 24px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--warm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 900;
}

.pane-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.count-pill {
  min-width: 34px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 900;
}

.notes-list {
  overflow: auto;
  padding: 0 14px 22px;
}

.note-card {
  width: 100%;
  margin-bottom: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.note-card:hover,
.note-card.active {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(36, 93, 99, 0.12);
}

.note-card-top {
  display: flex;
  align-items: start;
  gap: 12px;
  justify-content: space-between;
}

.note-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.star-mini {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
}

.star-mini.active {
  color: var(--warm);
}

.note-preview {
  min-height: 42px;
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.note-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-pane {
  min-width: 0;
  overflow: auto;
  padding: 28px;
}

.detail-pane.empty {
  display: grid;
  place-items: center;
}

.empty-state {
  max-width: 360px;
  text-align: center;
  color: var(--muted);
}

.empty-state svg {
  width: 58px;
  height: 58px;
  color: var(--accent);
}

.empty-state h2 {
  margin: 16px 0 8px;
  color: var(--ink);
}

.detail-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.title-input {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.15;
}

.title-input:focus {
  box-shadow: none;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.tab-btn {
  padding: 10px 13px;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 830;
}

.tab-btn.active {
  color: #fff;
  background: var(--ink);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.summary-box,
.transcript-editor,
.chat-box,
.mind-map {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.summary-text {
  white-space: pre-wrap;
  line-height: 1.7;
  margin: 0;
}

.action-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.action-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--ink);
}

.action-item input {
  width: 18px;
  margin-top: 3px;
}

.transcript-editor {
  min-height: 360px;
}

.mind-map {
  min-height: 360px;
  display: grid;
  place-items: center;
  overflow: auto;
}

.map-node {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(37, 35, 31, 0.08);
}

.map-center {
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.map-layout {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.map-branches {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.map-branch {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.map-child {
  color: var(--muted);
  background: var(--surface-2);
}

.chat-messages {
  min-height: 280px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.chat-message {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-message.user {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
}

.chat-message.bot {
  background: var(--surface-2);
}

.chat-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.chat-form input {
  flex: 1;
}

.audio-player {
  width: 100%;
  margin: 10px 0 18px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 18, 0.54);
}

.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  overflow: auto;
  padding: 24px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.modal-header h2 {
  margin: 0;
}

.recorder-card {
  display: grid;
  gap: 18px;
}

.recorder-main {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 8px 0;
}

.mic-toggle {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 18px 34px rgba(36, 93, 99, 0.28);
}

.mic-toggle.recording {
  background: var(--danger);
  animation: pulse 1.4s infinite;
}

.mic-toggle svg {
  width: 38px;
  height: 38px;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  font-weight: 950;
}

.support-text {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  text-align: center;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(163, 58, 58, 0.42);
  }
  70% {
    box-shadow: 0 0 0 22px rgba(163, 58, 58, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(163, 58, 58, 0);
  }
}

@media (max-width: 980px) {
  .auth-panel,
  .app-shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: 380px;
    padding: 32px;
  }

  .sidebar {
    min-height: unset;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item,
  .icon-text-btn {
    width: auto;
    white-space: nowrap;
  }

  .sidebar-footer {
    display: none;
  }

  .notes-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 430px;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .record-btn {
    flex: 1;
  }

  .detail-pane {
    padding: 20px 14px;
  }

  .detail-header {
    flex-direction: column;
  }

  .detail-actions {
    justify-content: flex-start;
  }

  .title-input {
    font-size: 1.55rem;
  }

  .chat-form {
    flex-direction: column;
  }
}

/* Penunjuk level mikrofon — supaya rekaman hening ketahuan saat itu juga,
   bukan setelah disimpan. */
.nav-group {
  margin: 18px 0 4px;
  padding-left: 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tts-panel {
  padding: 22px 26px 26px;
  overflow-y: auto;
}

.tts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

@media (max-width: 980px) {
  .tts-grid { grid-template-columns: 1fr; }
}

.tts-kiri {
  display: grid;
  gap: 14px;
}

.tts-kontrol {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}

@media (max-width: 560px) {
  .tts-kontrol { grid-template-columns: 1fr; }
}

.tts-kontrol select,
.tts-kontrol input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  padding: 10px 11px;
  outline: none;
}

.tts-kontrol select:focus,
.tts-kontrol input:focus {
  border-color: var(--accent);
}

.tts-centang {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.tts-centang input {
  width: auto;
  margin-top: 2px;
}

.tts-aksi {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.transkrip-atas {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.salin-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Umpan balik sesudah tersalin: warnanya berubah sebentar supaya jelas
   bahwa tekanan jempolnya benar-benar mendarat. */
.salin-btn.berhasil {
  border-color: #22c55e;
  color: #15803d;
}

.tr-progres {
  margin-bottom: 12px;
}

.live-saklar {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  width: min(340px, 100%);
  text-align: left;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
}

.live-saklar input {
  width: auto;
  margin-top: 3px;
  flex: 0 0 auto;
}

.live-saklar small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.45;
}

.tts-progres {
  display: grid;
  gap: 7px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tts-progres-baris {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 700;
}

.tts-progres-baris.kecil {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

#tts-persen {
  font-variant-numeric: tabular-nums;
}

.tts-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--border, rgba(127, 127, 127, 0.22));
  overflow: hidden;
}

.tts-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent, #245d63);
  /* Transisi selembut polling: bar bergerak mulus, bukan melompat tiap 1,3 detik. */
  transition: width 240ms linear, background-color 200ms linear;
}

/* Garis berjalan hanya saat benar-benar sedang mengerjakan - supaya animasinya
   menandakan kerja nyata, bukan hiasan yang berputar terus. */
.tts-progres[data-keadaan="jalan"] .tts-bar span {
  background-image: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 20%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 80%
  );
  background-size: 220% 100%;
  animation: tts-geser 1.15s linear infinite;
}

.tts-progres[data-keadaan="antre"] .tts-bar span {
  background-color: #f59e0b;
}

.tts-progres[data-keadaan="selesai"] .tts-bar span {
  background-color: #22c55e;
}

.tts-progres[data-keadaan="gagal"] .tts-bar span {
  background-color: #ef4444;
}

@keyframes tts-geser {
  from { background-position: 140% 0; }
  to { background-position: -40% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tts-progres[data-keadaan="jalan"] .tts-bar span { animation: none; }
  .tts-bar span { transition: none; }
}

.tts-daftar {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.tts-kartu {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.tts-kartu h4 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

.tts-kartu audio {
  width: 100%;
}

.tts-kartu-bawah {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tts-kartu[data-status="gagal"] {
  border-color: #ef4444;
}

.tts-lencana {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.mic-picker {
  width: min(320px, 100%);
  display: grid;
  gap: 6px;
  text-align: left;
}

.mic-picker label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.mic-picker select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  padding: 9px 11px;
  outline: none;
}

.mic-picker select:focus {
  border-color: var(--accent);
}

.mic-warning {
  margin: 0;
  color: #b91c1c;
  font-size: 0.84rem;
  line-height: 1.45;
}

.level-meter {
  width: min(280px, 100%);
  display: grid;
  gap: 6px;
}

.level-track {
  height: 8px;
  border-radius: 999px;
  background: var(--border, rgba(127, 127, 127, 0.25));
  overflow: hidden;
}

.level-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #22c55e;
  transition: width 90ms linear, background-color 200ms linear;
}

.level-meter[data-keadaan="sepi"] .level-fill {
  background: #ef4444;
}

.level-meter[data-keadaan="pelan"] .level-fill {
  background: #f59e0b;
}


/* ==========================================================================
   HP — dirapikan 13 Sep 2026

   Aturannya satu: halaman boleh panjang ke bawah, tapi TIDAK BOLEH bisa
   digeser ke samping. Semua yang lebih lebar dari layar harus mengalah.
   ========================================================================== */

@media (max-width: 820px) {
  /* Sebab utama layar bisa digeser ke samping: item grid dan flex TIDAK mau
     menyusut di bawah lebar isinya kecuali diberi min-width 0. Deretan menu
     yang nowrap memaksa kolomnya jadi 684px di layar 390px. */
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .workspace,
  .nav-list,
  .content-grid,
  .notes-pane,
  .detail-pane,
  .topbar,
  .search-wrap {
    min-width: 0;
  }

  /* Jaring pengaman: apa pun yang meleset tetap tidak bikin halaman melebar. */
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* iOS memotong bagian bawah layar dengan bar Safari. 100dvh ikut menyusut
     waktu bar itu muncul; 100vh tidak, dan bikin isi terpotong. */
  .app-shell,
  .sidebar {
    min-height: auto;
  }

  .app-shell {
    min-height: 100dvh;
  }

  /* Sidebar jadi kepala halaman yang ringkas, bukan kolom. */
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 12px;
    padding: 10px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: #fbfaf6;
  }

  .brand span {
    display: none;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  /* Menunya dibuat membungkus ke baris kedua, bukan digeser: semua pilihan
     kelihatan sekaligus dan tidak ada yang perlu digeser sama sekali. */
  .nav-list {
    gap: 6px;
    margin: 0;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .nav-item {
    flex: 1 1 auto;
    justify-content: center;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-group {
    display: none;
  }

  .nav-item {
    padding: 9px 12px;
    font-size: 0.88rem;
  }

  /* Daftar catatan tidak lagi dikurung tinggi tetap: biar mengalir ke bawah. */
  .notes-pane {
    max-height: none;
  }

  .content-grid {
    min-height: 0;
  }

  .detail-pane,
  .notes-pane {
    overflow: visible;
  }

  /* Semua yang gampang meluber dikunci selebar layar. */
  .tts-panel,
  .tts-grid,
  .tts-kiri,
  .tts-kanan,
  .tts-kontrol,
  .mic-picker,
  .level-meter,
  .tts-progres,
  .detail-pane,
  .notes-pane,
  .workspace,
  .topbar {
    max-width: 100%;
    min-width: 0;
  }

  .mic-picker,
  .level-meter {
    width: 100%;
  }

  .tts-panel {
    padding: 16px 12px 24px;
  }

  .tts-kontrol {
    grid-template-columns: 1fr;
  }

  /* Deretan tombol di kepala catatan: melipat ke bawah, bukan melebar. */
  .detail-actions,
  .topbar-actions,
  .tts-aksi,
  .modal-actions {
    flex-wrap: wrap;
  }

  .audio-player,
  .tts-kartu audio {
    width: 100%;
  }

  /* Kotak dialog rekam ikut lebar layar, dengan jarak aman dari tepi. */
  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: 88dvh;
    overflow-y: auto;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .mic-toggle {
    width: 92px;
    height: 92px;
  }

  /* Kata panjang tanpa spasi (URL, nama berkas) bisa melebarkan halaman. */
  .note-card,
  .note-preview,
  .summary-text,
  .chat-message,
  .tts-kartu h4,
  .mind-map {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Sasaran sentuh yang nyaman jempol. */
  .icon-btn,
  .star-mini,
  .nav-item,
  .primary-btn,
  .ghost-btn {
    min-height: 40px;
  }

  /* iOS memperbesar halaman sendiri kalau font kolom isian di bawah 16px,
     dan sesudah diperbesar halaman jadi bisa digeser ke samping. Inilah
     sebab utama layar terasa berantakan, bukan lebar elemennya. */
  input,
  textarea,
  select,
  .title-input,
  .transcript-editor {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 10px 12px;
    gap: 8px;
  }

  .record-btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  .pane-header,
  .notes-list {
    padding-left: 12px;
    padding-right: 12px;
  }

  .detail-pane {
    padding: 16px 12px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .title-input {
    font-size: 1.3rem;
  }

  .tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }
}

/* ==========================================================================
   Ubah suara (Seed-VC) — 15 Sep 2026
   Memakai kerangka panel suara (.tts-panel, .tts-grid, .tts-progres, .tts-kartu);
   yang di sini cuma bagian khususnya. Ditaruh paling bawah supaya menang
   atas aturan HP .tts-kontrol yang sengaja tidak berlaku untuk baris pilih suara.
   ========================================================================== */

/* Atribut hidden kalah oleh display: grid milik kelas di bawah, jadi kotak
   perekam dan kotak pilihan tetap tampil walau disembunyikan. Dikunci di sini. */
#vc-panel [hidden] {
  display: none !important;
}

.vc-langkah {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.vc-langkah h3 {
  margin: 0;
  font-size: 0.98rem;
}

.vc-langkah h3 small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.vc-langkah .note-meta {
  margin: 0;
}

.vc-tombol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vc-pilihan {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface-2);
}

.vc-pilihan-atas {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.vc-pilihan-atas strong {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

/* Tanpa display: block, pemutar yang langsung jadi anak grid menyusut ke
   lebar bawaannya di HP dan tulisan waktunya terpotong. */
.vc-langkah > audio,
.vc-pilihan audio {
  display: block;
  width: 100%;
}

.vc-kontrol-suara {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

/* Teks bacaan: huruf besar dan longgar, karena dibaca sambil merekam. */
.vc-naskah {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf6;
}

.vc-naskah summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.vc-naskah-teks {
  margin: 12px 0 10px;
  color: var(--ink);
  font-size: 1.14rem;
  line-height: 1.75;
}

.vc-naskah-bawah {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.vc-kontrol {
  grid-template-columns: minmax(0, 240px);
}

.vc-perekam {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  background: #fff5f5;
}

.vc-perekam-atas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.vc-perekam .level-meter {
  width: 100%;
}

.vc-titik {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: vc-kedip 1s ease-in-out infinite;
}

.vc-waktu {
  margin-right: auto;
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@keyframes vc-kedip {
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .vc-titik { animation: none; }
}

#vc-kabar[data-keadaan="mati"] {
  background: #fee2e2;
  color: #991b1b;
}

/* Tombol kartu hasil tetap sebaris; yang mengalah tulisan lencananya. */
.vc-kartu-aksi {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

#vc-daftar .tts-lencana {
  min-width: 0;
}

@media (max-width: 820px) {
  .vc-kontrol {
    grid-template-columns: minmax(0, 1fr);
  }
}
