/* Plan Konten — gaya UI mengikuti konten/konten.css */

/* ===== BRAND MARK — pakai logo WebP, hapus background kuning ===== */
body.planmusic-app.suaraku-app .brand-mark {
  width: 56px !important;
  height: 56px !important;
  background: transparent !important;
  box-shadow: 0 0 0 1px rgba(250,204,21,0.2) !important;
  border-radius: 14px !important;
  overflow: hidden;
  padding: 0;
}

body.planmusic-app.suaraku-app .brand-mark img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
  border-radius: 14px;
}

/* ===== FULL HEIGHT LAYOUT ===== */
body.planmusic-app.suaraku-app {
  overflow: hidden;
  height: 100dvh;
}

body.planmusic-app.suaraku-app .app-shell {
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
}

body.planmusic-app.suaraku-app .workspace {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ===== BRIEF CARD ===== */
/* Kolom kiri mengisi penuh tinggi workspace */
.col-left {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.card-brief.card-studio {
  flex: 1;
  min-height: 0;
}

.card-brief .card-studio-scroll {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  padding-bottom: 1.25rem;
}

.card-brief .studio-notice,
.card-brief .credits-banner {
  max-height: 5.75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  word-break: break-word;
}

.card-brief .card-studio-footer {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  padding-top: 0.65rem;
}

.card-brief .card-studio-footer .actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
}

.card-brief .card-studio-footer .actions #btnGenerate {
  display: flex;
  width: min(100%, 22rem);
  min-height: 3rem;
  padding: 0.72rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #0a0a0a;
  background: linear-gradient(120deg, var(--yellow), var(--yellow2));
  border: none;
  box-shadow: 0 2px 0 rgba(0,0,0,0.38), 0 8px 32px rgba(250,204,21,0.38);
}

.card-brief .card-head--brief {
  align-items: center;
  gap: 0.5rem;
}

.card-brief .card-head--brief h2 { margin: 0; }

.card-brief .card-head--brief #btnResetBrief {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-color: rgba(250,204,21,0.42);
}

body.planmusic-app.suaraku-app input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

body.planmusic-app.suaraku-app input[type="number"]:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(250,204,21,0.18), 0 0 16px rgba(250,204,21,0.1);
}

select optgroup { font-weight: 800; color: var(--yellow2); background: #0c0c0c; }
select option   { font-weight: 500; color: var(--text); background: #0a0a0a; }

.field-tipe-konten label { display: flex; align-items: center; gap: 0.35rem; }

.tipe-konten-mark {
  display: inline-block;
  width: 14px; height: 10px;
  background: linear-gradient(
    var(--yellow2) 0, var(--yellow2) 2px,
    transparent 2px, transparent 4px,
    var(--yellow2) 4px, var(--yellow2) 6px,
    transparent 6px, transparent 8px,
    var(--yellow2) 8px, var(--yellow2) 10px
  );
  border-radius: 1px;
  flex-shrink: 0;
  opacity: 0.95;
}

.theme-input-auto {
  resize: none;
  overflow-y: auto;
  min-height: 5rem;
  max-height: 10rem;
  line-height: 1.6;
}

/* ===== PLAN RESULT CARD ===== */
/* Kolom kanan harus mengisi penuh tinggi workspace */

/* Counter ide — warna kuning seperti Plan Konten */
.card-head-plan-meta .char-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--yellow2);
  letter-spacing: 0.02em;
}
.col-right {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.card-plan {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-head--plan {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.6rem 0.85rem 0.5rem;
}

.card-head-plan-meta {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.card-head-plan-meta h2 {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.plan-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Dua tombol ikon kecil (copy & delete) */
.card-head--plan .plan-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.card-head--plan .plan-icon-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #e0e0e0;
  border-color: rgba(255,255,255,0.18);
}

.card-head--plan .plan-icon-btn.copied {
  background: rgba(74,222,128,0.1);
  color: #4ade80;
  border-color: rgba(74,222,128,0.3);
}

/* Export buttons — mengisi sisa ruang */
.plan-export-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  height: 30px;
  padding: 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 8px;
  white-space: nowrap;
}

.plan-result {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem 0 0.75rem;
  scrollbar-gutter: stable;
  /* Pastikan mengisi sisa tinggi card */
  height: 0;
}

.plan-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
  min-height: 220px;
}

.plan-empty svg { opacity: 0.3; }

.plan-empty p {
  font-size: 0.82rem;
  line-height: 1.6;
  max-width: 28rem;
  margin: 0;
}

/* ===== PLAN GRID ===== */
.plan-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.plan-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(250,204,21,0.15);
  border-radius: 12px;
  background: rgba(0,0,0,0.35);
  transition: background 0.15s, border-color 0.15s;
  animation: planItemIn 0.3s ease both;
}

.plan-item:hover {
  background: rgba(250,204,21,0.03);
  border-color: rgba(250,204,21,0.28);
}

@keyframes planItemIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.plan-item-day {
  flex-shrink: 0;
  height: 28px;
  padding: 0 0.6rem;
  border-radius: 8px;
  background: rgba(250,204,21,0.1);
  border: 1px solid rgba(250,204,21,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.plan-item-day-label {
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.plan-item-day-num {
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--yellow2);
  line-height: 1;
}

.plan-item-body {
  flex: 1;
  min-width: 0;
}

.plan-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #e4e4e7;
  line-height: 1.4;
  margin: 0 0 0.2rem;
}

.plan-item-desc {
  font-size: 0.74rem;
  color: #a1a1aa;
  line-height: 1.5;
  margin: 0;
}

.plan-item-actions {
  flex-shrink: 0;
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.plan-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.plan-icon-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #e0e0e0;
}

.plan-icon-btn.copied {
  background: rgba(74,222,128,0.1);
  color: #4ade80;
}

/* Tombol Buat Skrip — menonjol kuning */
.plan-btn-skrip {
  width: auto;
  padding: 0 0.55rem;
  height: 26px;
  border-radius: 7px;
  background: rgba(250,204,21,0.1);
  border: 1px solid rgba(250,204,21,0.3);
  color: var(--yellow2);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  gap: 0.3rem;
  white-space: nowrap;
}

.plan-btn-skrip:hover {
  background: rgba(250,204,21,0.2);
  border-color: rgba(250,204,21,0.6);
  color: var(--yellow2);
}

/* ===== STREAMING INDICATOR ===== */
.plan-streaming-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border: 1px dashed rgba(250,204,21,0.2);
  border-radius: 12px;
  background: rgba(250,204,21,0.02);
  font-size: 0.75rem;
  color: var(--muted);
}

.plan-streaming-dots {
  display: inline-flex;
  gap: 3px;
}

.plan-streaming-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(250,204,21,0.7);
  animation: planDotWalk 1.2s ease-in-out infinite;
}

.plan-streaming-dot:nth-child(2) { animation-delay: 0.2s; }
.plan-streaming-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes planDotWalk {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.7); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* ===== LOADING OVERLAY ===== */
.plan-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(3,3,3,0.96);
  z-index: 10;
  border-radius: inherit;
  overflow: hidden;
  padding: 1.5rem 1rem 2.5rem;
  gap: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.plan-loading.visible { opacity: 1; pointer-events: auto; }

.kl-glow {
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: rgba(250,204,21,0.12);
  filter: blur(60px);
  animation: klGlowPulse 3.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes klGlowPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.92); }
  50%       { opacity: 1;   transform: scale(1.08); }
}

.kl-rings { position: relative; width: 160px; height: 160px; flex-shrink: 0; }

.kl-ring-outer {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(250,204,21,0.22);
  animation: klRotateCW 22s linear infinite;
}

.kl-dots { position: absolute; inset: 0; }

.kl-dot {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  top: 50%; left: 50%;
  background: rgba(250,204,21,0.12);
  transition: background 0.3s, box-shadow 0.3s;
}

.kl-dot.lit {
  background: rgba(250,204,21,0.85);
  box-shadow: 0 0 8px rgba(250,204,21,0.55);
}

.kl-ring-mid {
  position: absolute; inset: 18px;
  border-radius: 50%;
  border: 1px solid rgba(250,204,21,0.15);
  border-top-color: rgba(250,204,21,0.7);
  animation: klRotateCCW 9s linear infinite;
}

.kl-ring-inner {
  position: absolute; inset: 44px;
  border-radius: 50%;
  border: 2px solid rgba(250,204,21,0.12);
  border-bottom-color: var(--yellow);
  animation: klRotateCW 3.5s linear infinite;
}

.kl-center {
  position: absolute; inset: 0; margin: auto;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(253,224,71,0.2), rgba(250,204,21,0.08));
  border: 1.5px solid rgba(250,204,21,0.45);
  box-shadow: 0 0 22px rgba(250,204,21,0.28), inset 0 0 14px rgba(250,204,21,0.1);
  display: flex; align-items: center; justify-content: center;
  animation: klCenterPulse 2.2s ease-in-out infinite;
}

.kl-center-icon {
  font-size: 1.6rem; line-height: 1;
  filter: drop-shadow(0 0 10px rgba(250,204,21,0.7));
  transition: opacity 0.3s, transform 0.3s;
}

@keyframes klCenterPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes klRotateCW  { to { transform: rotate(360deg); } }
@keyframes klRotateCCW { to { transform: rotate(-360deg); } }

.kl-text { text-align: center; z-index: 1; width: 100%; max-width: 280px; }

.kl-phase-text {
  font-family: var(--font-display, "Bebas Neue", sans-serif);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  letter-spacing: 0.08em; line-height: 1;
  background: linear-gradient(135deg, #fde047 0%, #facc15 50%, #ca8a04 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(250,204,21,0.4));
  transition: opacity 0.35s, transform 0.35s, filter 0.35s;
  margin: 0 0 0.4rem;
}

.kl-phase-text.fade-out {
  opacity: 0; transform: translateY(-6px);
  filter: blur(4px) drop-shadow(0 0 0 transparent);
}

.kl-phase-sub {
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: #4b5563; margin: 0; transition: opacity 0.3s;
}

.kl-phase-sub.fade-out { opacity: 0; }

.kl-footer {
  position: absolute; bottom: 0.75rem; left: 1rem; right: 1rem;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.55rem; font-weight: 900;
  letter-spacing: 0.18em; text-transform: uppercase; color: #374151;
}

.kl-footer-left { display: inline-flex; align-items: center; gap: 0.4rem; }

.kl-footer-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--yellow); display: inline-block; margin-right: 0.4rem;
  animation: klDotBlink 0.7s ease-in-out infinite;
}

@keyframes klDotBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.28; } }

.kl-footer-brand { font-size: 0.55rem; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(250,204,21,0.7); }

.kl-thinking-dots { display: inline-flex; align-items: center; gap: 3px; }

.kl-td {
  display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(250,204,21,0.85);
  animation: klDotWalk 1.2s ease-in-out infinite;
}

.kl-td:nth-child(1) { animation-delay: 0s; }
.kl-td:nth-child(2) { animation-delay: 0.2s; }
.kl-td:nth-child(3) { animation-delay: 0.4s; }

@keyframes klDotWalk {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.7); }
  40% { opacity: 1; transform: scale(1.2); box-shadow: 0 0 6px rgba(250,204,21,0.7); }
}

/* ===== MODAL API KEY ===== */
.plan-modal-keys {
  width: min(540px, 100%);
  max-height: 90dvh;
  padding: 0;
  display: flex; flex-direction: column;
  overflow: hidden; border-radius: 20px;
}

.km-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(250,204,21,0.12);
  background: rgba(0,0,0,0.3); flex-shrink: 0;
}

.km-header-left { display: flex; align-items: center; gap: 0.75rem; }

.km-header-icon {
  width: 34px; height: 34px;
  background: rgba(250,204,21,0.08);
  border: 1px solid rgba(250,204,21,0.2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--yellow2); flex-shrink: 0;
}

.km-title {
  font-size: 0.82rem; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--yellow2); margin: 0; line-height: 1.2;
}

.km-subtitle {
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 0.15rem 0 0;
}

.km-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s; flex-shrink: 0;
}

.km-close:hover { background: rgba(255,255,255,0.06); color: #e0e0e0; }

.km-body {
  flex: 1; overflow-y: auto;
  padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: 1rem;
  scrollbar-gutter: stable;
}

.km-info-banner {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.65rem 0.8rem;
  background: rgba(250,204,21,0.04);
  border: 1px solid rgba(250,204,21,0.14);
  border-radius: 12px;
  font-size: 0.72rem; color: #a3a3a3; line-height: 1.55;
}

.km-info-icon { color: var(--yellow2); flex-shrink: 0; margin-top: 0.1rem; }
.km-info-banner a { color: var(--yellow2); text-decoration: underline; text-underline-offset: 2px; }

.km-keys-list { display: flex; flex-direction: column; gap: 0.45rem; }

.km-empty { text-align: center; padding: 1.5rem 0.5rem; opacity: 0.4; }
.km-empty svg { margin: 0 auto 0.5rem; display: block; color: var(--muted); }
.km-empty p { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0; }

.km-key-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  transition: background 0.15s, border-color 0.15s; position: relative;
}

.km-key-row:hover { background: rgba(255,255,255,0.05); border-color: rgba(250,204,21,0.2); }
.km-key-row--active { border-color: rgba(250,204,21,0.4); background: rgba(250,204,21,0.03); }

.km-key-num {
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(250,204,21,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 900; color: var(--yellow2); flex-shrink: 0;
}

.km-key-info { flex: 1; min-width: 0; }

.km-key-label {
  font-size: 0.78rem; font-weight: 700; color: #e0e0e0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 0.4rem;
}

.km-key-badge {
  font-size: 0.55rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 0.1rem 0.35rem; border-radius: 4px;
  background: rgba(250,204,21,0.1); color: var(--yellow2); flex-shrink: 0;
}

.km-key-mask {
  font-size: 0.68rem; font-family: ui-monospace, monospace;
  color: var(--muted); margin-top: 0.1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.km-key-credit {
  font-size: 0.7rem; font-weight: 700; font-family: ui-monospace, monospace;
  color: #4ade80; flex-shrink: 0; min-width: 3rem; text-align: right;
}

.km-key-actions { display: flex; align-items: center; gap: 0.2rem; flex-shrink: 0; }

.km-icon-btn {
  width: 28px; height: 28px; border-radius: 7px;
  background: transparent; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background 0.15s, color 0.15s;
}

.km-icon-btn:hover { background: rgba(255,255,255,0.08); color: #e0e0e0; }
.km-icon-btn--copy.copied { background: rgba(74,222,128,0.1); color: #4ade80; }

.km-icon-btn--activate {
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  width: auto; padding: 0 0.5rem; color: var(--yellow-dim);
  border: 1px solid rgba(250,204,21,0.25);
}

.km-icon-btn--activate:hover { background: rgba(250,204,21,0.08); color: var(--yellow2); border-color: rgba(250,204,21,0.5); }
.km-icon-btn--activate.is-active { background: rgba(250,204,21,0.12); color: var(--yellow2); border-color: rgba(250,204,21,0.5); }
.km-icon-btn--del:hover { background: rgba(248,113,113,0.1); color: #f87171; }

.km-section-label {
  font-size: 0.62rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 0.55rem;
}

.km-add-section { padding-top: 0.75rem; border-top: 1px solid rgba(255,255,255,0.05); }

.km-add-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }

.km-select {
  flex: 0 0 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  outline: none;
  transition: border-color 0.2s;
  cursor: pointer;
}

.km-select:focus { border-color: var(--yellow); }

.km-model-section {
  padding: 0.85rem 0 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 0.75rem;
}

.km-model-select { width: 100%; margin-bottom: 0.5rem; cursor: pointer; }

.km-model-hint {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(163, 163, 163, 0.85);
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(163, 163, 163, 0.85);
}

.field-hint a { color: rgba(250, 204, 21, 0.75); text-decoration: underline; }

.km-key-badge--oa {
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.35);
  color: #93c5fd;
}

.km-key-badge--low {
  background: rgba(244, 162, 97, 0.15);
  color: #f4a261;
}

.km-key-row--low { border-color: rgba(244, 162, 97, 0.35); }

.km-input {
  flex: 1; font-family: inherit; font-size: 0.82rem;
  color: var(--text); background: rgba(0,0,0,0.55);
  border: 1px solid var(--stroke); border-radius: 10px;
  padding: 0.5rem 0.65rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%; box-sizing: border-box;
}

.km-input:focus { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(250,204,21,0.15); }

.km-key-input-wrap { position: relative; margin-bottom: 0.5rem; }
.km-key-input { padding-right: 2.5rem; font-family: ui-monospace, monospace; font-size: 0.78rem; }

.km-eye-btn {
  position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  padding: 0.2rem; transition: color 0.15s;
}

.km-eye-btn:hover { color: #e0e0e0; }

.km-add-error { font-size: 0.72rem; color: #f87171; margin: 0 0 0.5rem; display: flex; align-items: center; gap: 0.35rem; }
.km-add-error.hidden { display: none; }

.km-add-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; font-family: inherit; font-size: 0.82rem; font-weight: 700;
  color: #d4d4d8; cursor: pointer; transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.km-add-btn:hover:not(:disabled) { background: rgba(250,204,21,0.08); border-color: rgba(250,204,21,0.3); color: var(--yellow2); }
.km-add-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.km-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(250,204,21,0.1);
  background: rgba(0,0,0,0.2); flex-shrink: 0; gap: 0.5rem;
}

.km-key-count { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* ===== TOAST ===== */
#pmToastContainer {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  pointer-events: none; width: max-content; max-width: min(92vw, 420px);
}

.pm-toast {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 1rem; border-radius: 999px;
  font-family: inherit; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
  pointer-events: auto; white-space: nowrap;
  animation: planToastIn 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.pm-toast.hiding { animation: planToastOut 0.25s ease-in forwards; }

.pm-toast--success { background: rgba(20,20,20,0.92); border: 1px solid rgba(74,222,128,0.45); color: #86efac; }
.pm-toast--error   { background: rgba(20,20,20,0.92); border: 1px solid rgba(248,113,113,0.45); color: #fca5a5; }
.pm-toast--info    { background: rgba(20,20,20,0.92); border: 1px solid rgba(250,204,21,0.4); color: #fde68a; }

.pm-toast-icon {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 0.7rem;
}

.pm-toast--success .pm-toast-icon { background: rgba(74,222,128,0.15); color: #4ade80; }
.pm-toast--error   .pm-toast-icon { background: rgba(248,113,113,0.15); color: #f87171; }
.pm-toast--info    .pm-toast-icon { background: rgba(250,204,21,0.12); color: #facc15; }

@keyframes planToastIn  { from { opacity: 0; transform: translateY(12px) scale(0.92); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes planToastOut { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(8px) scale(0.95); } }

/* ===== NAV COMPACT ===== */
body.planmusic-app.suaraku-app .nav-actions { gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }

.btn-nav-compact, .btn-nav-settings {
  display: inline-flex; align-items: center; gap: 0.35rem;
  white-space: nowrap; flex-shrink: 0;
}

body.planmusic-app.suaraku-app .nav-actions .btn { white-space: nowrap; flex-shrink: 0; }

/* ===== GENERATE BUTTON STATE ===== */
.card-brief .card-studio-footer .actions #btnGenerate {
  font-family: var(--font);
}

.card-brief .card-studio-footer .actions #btnGenerate.btn-generating {
  background: linear-gradient(120deg, #ef4444, #dc2626) !important;
  box-shadow: 0 2px 0 rgba(0,0,0,0.38), 0 8px 32px rgba(239,68,68,0.35) !important;
  color: #fff !important;
  font-family: var(--font) !important;
  font-weight: 800 !important;
  letter-spacing: 0.03em !important;
}

/* ===== BOTTOM NAVBAR ===== */
.pm-bottom-nav { display: none; }

/* ===== BOTTOM NAV BASE STYLES (always defined, shown only on mobile) ===== */
.kbn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.22rem; padding: 0.55rem 0.25rem 0.5rem;
  background: transparent; border: none; cursor: pointer; color: #6b7280;
  text-decoration: none; font-family: inherit; transition: color 0.18s; position: relative;
  -webkit-tap-highlight-color: transparent; min-height: 56px;
}

.kbn-item:active { transform: scale(0.93); }
.kbn-item--active { color: var(--yellow2); }

.kbn-icon { width: 20px; height: 20px; flex-shrink: 0; transition: transform 0.18s; }
.kbn-item--active .kbn-icon { filter: drop-shadow(0 0 6px rgba(250,204,21,0.5)); }

.kbn-label {
  font-size: 0.58rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; line-height: 1;
}

.kbn-generate-btn { display: none; }

.kbn-badge {
  position: absolute; top: 6px; right: calc(50% - 14px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--yellow); color: #000;
  font-size: 0.52rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

.kbn-badge.hidden { display: none; }

.kbn-dot {
  position: absolute; top: 8px; right: calc(50% - 12px);
  width: 7px; height: 7px; border-radius: 50%;
  background: #f87171; border: 1.5px solid #080808;
}

.kbn-dot.hidden { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  body.planmusic-app.suaraku-app .app-title { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
  body.planmusic-app.suaraku-app .byline { font-size: 0.78rem; }
  body.planmusic-app.suaraku-app .nav-actions { gap: 0.3rem; }
  body.planmusic-app.suaraku-app .nav-actions .btn { font-size: 0.72rem; padding: 0.38rem 0.65rem; }
  body.planmusic-app.suaraku-app .nav-actions .credit-pill { font-size: 0.62rem; padding: 0.2rem 0.45rem 0.2rem 0.38rem; }
  .btn-nav-compact .btn-nav-label, .btn-nav-settings .btn-nav-label { display: none; }
  .btn-nav-compact, .btn-nav-settings { padding: 0.38rem 0.55rem; min-width: 36px; justify-content: center; }
}

/* ===== MOBILE (≤ 900px) ===== */
@media (max-width: 900px) {

  /* Layout utama */
  body.planmusic-app.suaraku-app {
    overflow: hidden !important;
    height: 100dvh !important;
    min-height: unset !important;
  }

  body.planmusic-app.suaraku-app .app-shell {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  }

  /* Nav header — compact satu baris */
  body.planmusic-app.suaraku-app .nav {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    margin: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(250,204,21,0.12);
    background: rgba(3,3,3,0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    flex-shrink: 0;
  }

  /* Sembunyikan nav-actions di mobile — pakai bottom nav */
  body.planmusic-app.suaraku-app .nav-actions { display: none !important; }

  /* Brand lebih kecil di mobile */
  body.planmusic-app.suaraku-app .brand { gap: 0.55rem; }
  body.planmusic-app.suaraku-app .brand-mark {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
  }
  body.planmusic-app.suaraku-app .app-title { font-size: 1.25rem; line-height: 1.1; }
  body.planmusic-app.suaraku-app .byline { font-size: 0.65rem; margin: 0; }
  body.planmusic-app.suaraku-app .tag { display: none; }

  /* Workspace — satu kolom, tab switching */
  body.planmusic-app.suaraku-app .workspace {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    gap: 0 !important;
    padding: 0 !important;
  }

  /* Sembunyikan kolom yang tidak aktif */
  body.planmusic-app.suaraku-app .col-left,
  body.planmusic-app.suaraku-app .col-right { display: none; }

  body.planmusic-app.suaraku-app .col-left.kbn-tab-active,
  body.planmusic-app.suaraku-app .col-right.kbn-tab-active {
    display: flex;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  /* Card brief di tab kiri */
  body.planmusic-app.suaraku-app .col-left.kbn-tab-active .card-brief.card-studio {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  /* Scroll area brief */
  .card-brief .card-studio-scroll {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    padding: 0.75rem 0.85rem 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  /* Footer generate di brief */
  .card-brief .card-studio-footer {
    padding: 0.65rem 0.85rem;
    border-top: 1px solid rgba(250,204,21,0.1);
    background: rgba(3,3,3,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  /* Card plan di tab kanan */
  body.planmusic-app.suaraku-app .col-right.kbn-tab-active .card-plan {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  body.planmusic-app.suaraku-app .col-right.kbn-tab-active .plan-result {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100%;
    max-height: none;
    padding: 0.5rem 0.75rem 0.75rem;
    -webkit-overflow-scrolling: touch;
  }

  /* Card head plan di mobile — 2 baris compact */
  .planmusic-app .col-right .card-head--plan {
    padding: 0.5rem 0.75rem 0.45rem;
    gap: 0.3rem;
  }

  /* Bottom navbar */
  .pm-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(6,6,6,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(250,204,21,0.12);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.6);
  }

  .kbn-item--active::before {
    content: '';
    position: absolute;
    top: 0; left: 15%; right: 15%;
    height: 2px;
    border-radius: 0 0 3px 3px;
    background: var(--yellow2);
    box-shadow: 0 0 8px rgba(250,204,21,0.6);
  }

  .kbn-generate-btn::before { display: none; }
}

/* ===== SMALL MOBILE (≤ 640px) ===== */
@media (max-width: 640px) {
  body.planmusic-app.suaraku-app .app-title { font-size: 1.15rem; }

  /* Field spacing lebih rapat */
  .card-brief .card-studio-scroll .field { margin-bottom: 0.65rem; }

  .km-add-row { flex-direction: column; gap: 0.4rem; }
  .km-key-actions { gap: 0.15rem; }
  .km-icon-btn { width: 32px; height: 32px; }
  .km-icon-btn--activate { font-size: 0.55rem; padding: 0 0.4rem; }

  /* Plan item lebih compact */
  .plan-item { padding: 0.55rem 0.7rem; gap: 0.5rem; }
  .plan-item-title { font-size: 0.84rem; }
  .plan-item-desc { font-size: 0.72rem; }
}

/* ===== EXTRA SMALL (≤ 400px) ===== */
@media (max-width: 400px) {
  body.planmusic-app.suaraku-app .app-title { font-size: 1rem; }
  body.planmusic-app.suaraku-app .brand-mark {
    width: 32px !important;
    height: 32px !important;
  }

  .kbn-label { font-size: 0.52rem; }
  .kbn-item { min-height: 52px; padding: 0.45rem 0.2rem 0.4rem; }
}

/* ===== CUSTOM LANGUAGE DROPDOWN (mirip Kampung Lirik) ===== */
.pm-lang-select {
  position: relative;
}

.pm-lang-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0.5rem 0.75rem;
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pm-lang-trigger:hover {
  border-color: rgba(250,204,21,0.4);
}

.pm-lang-trigger[aria-expanded="true"] {
  border-color: rgba(250,204,21,0.6);
  box-shadow: 0 0 0 2px rgba(250,204,21,0.15);
}

.pm-lang-trigger-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.pm-lang-trigger .pm-lang-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-lang-trigger .pm-lang-native {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-lang-trigger svg {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s;
}

.pm-lang-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Popup — di-render via JS ke body dengan position:fixed */
.pm-lang-pop {
  background: rgba(8,8,8,0.98);
  border: 1px solid rgba(250,204,21,0.25);
  border-radius: 14px;
  box-shadow: 0 20px 50px -10px rgba(0,0,0,0.85);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pm-lang-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  color: var(--muted);
  flex-shrink: 0;
}

.pm-lang-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text);
}

.pm-lang-search input::placeholder {
  color: #4b5563;
}

.pm-lang-clear {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-family: inherit;
}

.pm-lang-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  overscroll-behavior: contain;
}

.pm-lang-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  text-align: left;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}

.pm-lang-item:hover {
  background: rgba(255,255,255,0.05);
}

.pm-lang-item.active {
  background: linear-gradient(90deg, rgba(250,204,21,0.15), rgba(202,138,4,0.1));
  color: #fef3c7;
}

.pm-lang-item .pm-lang-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-lang-item .pm-lang-native {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.pm-lang-item.active .pm-lang-native {
  color: rgba(253,224,71,0.7);
}

.pm-lang-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.pm-lang-foot {
  padding: 6px 12px;
  font-size: 0.68rem;
  color: #4b5563;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
