:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #202a2b;
  background: #fff;
  font-size: 17px;
  line-height: 1.5;
  font-synthesis: none;
  letter-spacing: 0;
  --teal: #176c89;
  --coral: #c83950;
  --line: #e2e7eb;
  --muted: #5e6875;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
.auth-return {
  max-width: 480px;
  margin: 80px auto;
  padding: 24px;
}
.auth-return a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-weight: 600;
}
button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: white;
  color: inherit;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}
button:hover {
  border-color: var(--teal);
  background: #f0f8f5;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #f49c5a;
  outline-offset: 3px;
}
.lucide {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}
a {
  color: var(--teal);
}
.header {
  height: 78px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 30px;
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #202a2b;
  font-size: 27px;
}
.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}
.header-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
}
.header-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}
.workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  max-width: 1600px;
  margin: auto;
}
.sidebar {
  padding: 26px 18px;
  border-right: 1px solid var(--line);
  min-height: calc(100dvh - 78px);
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.sidebar nav {
  display: grid;
  gap: 9px;
}
.sidebar nav button,
.sidebar nav a {
  border: 0;
  justify-content: flex-start;
  background: none;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--muted);
}
.sidebar [aria-current="page"] {
  background: #dcf1ea !important;
  color: #075b55 !important;
  font-weight: 650;
}
.allowance {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  gap: 4px;
}
.allowance > span,
.muted,
small {
  color: var(--muted);
  font-size: 0.88rem;
}
.allowance strong {
  font-size: 1.1rem;
}
.support {
  margin-top: auto;
  font-size: 0.85rem;
  padding: 12px 16px;
}
main {
  min-width: 0;
  padding: 30px 36px 60px;
}
.section-heading,
.brief-heading,
.dialog-head {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.section-heading {
  margin-bottom: 24px;
}
h1 {
  font-size: 29px;
  line-height: 1.2;
  margin: 0;
  font-weight: 650;
}
h2 {
  font-size: 21px;
  line-height: 1.25;
  margin: 0;
}
h3 {
  font-size: 19px;
  margin: 0;
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--coral);
  margin: 0 0 10px;
}
.status {
  font-size: 13px;
  color: var(--muted);
  border-left: 3px solid #e89850;
  padding-left: 10px;
  max-width: 220px;
}
.creator-grid {
  display: block;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.conversation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 620px;
  padding: 24px 0;
}
#messages {
  flex: 1;
  max-height: 600px;
  overflow: auto;
  overflow-wrap: anywhere;
}
.agent-message,
.user-message {
  margin: 0 0 24px;
  padding: 0 0 0 15px;
  border-left: 3px solid var(--teal);
}
.user-message {
  border-left-color: var(--coral);
}
.speaker {
  font-size: 13px;
  color: var(--muted);
  font-weight: 650;
}
.agent-message p,
.user-message p {
  margin: 6px 0;
  white-space: pre-wrap;
}
.composer {
  margin-top: 24px;
}
.composer > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.composer > div > span {
  font-size: 13px;
  color: var(--muted);
}
.brief-section {
  padding: 24px 0;
}
.brief-heading {
  margin-bottom: 20px;
}
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}
input:not([type="checkbox"]),
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid #c7d7d1;
  border-radius: 5px;
  background: white;
  color: inherit;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 16px;
}
textarea {
  resize: vertical;
  line-height: 1.65;
}
input[type="checkbox"] {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  accent-color: var(--teal);
  margin: 2px 0;
}
.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 12px;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
}
.primary {
  background: var(--coral);
  color: white;
  border-color: var(--coral);
  font-weight: 600;
}
.primary:hover {
  background: #a82a40;
  color: white;
}


.icon {
  width: 44px;
  flex-shrink: 0;
  padding: 8px;
}
.generation {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.generation .primary {
  width: 100%;
}
.generation p {
  margin: 10px 0 0;
  font-size: 13px;
}
summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 0 12px;
}
details label {
  margin-top: 10px;
}
.jobs-section {
  padding-top: 28px;
}
.job-row {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.job-row > div {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.job-row p {
  font-size: 14px;
  color: var(--muted);
  margin: 3px 0 0;
}
#notice {
  border-left: 4px solid var(--coral);
  background: #fff0ed;
  padding: 12px 16px;
  margin-bottom: 20px;
  overflow-wrap: anywhere;
}
dialog {
  width: min(720px, calc(100% - 30px));
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  color: inherit;
}
dialog::backdrop {
  background: #13272280;
}
.dialog-head {
  margin-bottom: 18px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.plan-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.plan-row small {
  grid-column: 1/-1;
}
.plan-row strong {
  font-size: 20px;
}
.plan-row .price {
  font-weight: 650;
}
.song-row {
  display: flex;
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.song-row > div {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.song-row p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 14px;
}
.song-art {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
}
.song-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}
.song-actions button[aria-pressed="true"] {
  color: var(--coral);
  border-color: #f5aca5;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.detail-head h2 {
  overflow-wrap: anywhere;
}
#song-detail {
  margin-top: 28px;
  border-top: 2px solid var(--teal);
  padding-top: 24px;
}
audio {
  width: 100%;
  margin: 18px 0;
}
.song-lyrics {
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.comment-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.comment-row p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0;
}
.comment-row small {
  display: block;
}
.danger {
  color: #ad3434;
}
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
[hidden] {
  display: none !important;
}
input,
select,
textarea {
  font-weight: 400;
}
.conversation {
  height: max(360px, calc(100dvh - 310px));
  min-height: 360px;
}
.creator-modes { display: flex; gap: 8px; margin-bottom: 16px; }
.creator-modes button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; }
.creator-modes [aria-selected="true"] { border-bottom-color: var(--teal); color: var(--teal); font-weight: 650; }
#create-view { max-width: 960px; margin: 0 auto; }
#draft-title { display: block; margin-bottom: 12px; overflow-wrap: anywhere; }
.generation { max-width: 640px; }
.agent-message p, .user-message p { overflow-wrap: anywhere; }
.chat-tools { flex-shrink: 0; padding: 12px 16px; border-bottom: 1px solid var(--line, #dce2e5); }
.chat-tools[hidden] { display: none; }
.chat-focus { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-focus button { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.chat-focus button[aria-pressed="true"] { background: #ffe9e5; color: #942d28; border-color: #e48078; }
.chat-focus svg { width: 18px; height: 18px; }
.chat-reference { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 12px; margin-top: 12px; }
.chat-reference label { min-width: 0; font-size: 14px; }
.chat-reference select, .chat-reference input { min-width: 0; width: 100%; font-size: 16px; margin-top: 4px; }
#messages {
  min-height: 180px;
  max-height: none;
}
@media (min-width: 1400px) {
  main {
    padding: 36px 48px;
  }
  .conversation {
    padding-right: 0;
  }
  .brief-section {
    padding: 24px 0;
  }
}
@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 175px minmax(0, 1fr);
  }
  main {
    padding: 25px 22px;
  }
  .creator-grid {
    grid-template-columns: 1fr;
  }
  .conversation {
    position: static;
    height: max(600px, calc(100dvh - 310px));
    min-height: 600px;
    padding: 24px 0;
  }
  .brief-section {
    border-left: 0;
  }
  #messages {
    max-height: none;
  }
  .sidebar {
    padding: 20px 8px;
  }
  .section-heading {
    align-items: flex-start;
  }
}
@media (max-width: 600px) {
  .header {
    height: 68px;
    padding: 0 14px;
    gap: 10px;
  }
  .brand {
    font-size: 23px;
  }
  .brand img {
    width: 33px;
    height: 33px;
  }
  .header > span {
    display: none;
  }
  .header-actions {
    gap: 6px;
  }
  .header-actions button {
    padding: 8px 10px;
    font-size: 14px;
  }
  .header-actions .lucide {
    width: 18px;
  }
  .workspace {
    display: block;
  }
  .sidebar {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    gap: 0;
  }
  .sidebar nav {
    display: flex;
    gap: 3px;
    overflow: auto;
  }
  .sidebar nav button,
  .sidebar nav a {
    white-space: nowrap;
    font-size: 14px;
    padding: 8px 11px;
    gap: 7px;
    min-height: 42px;
  }
  .sidebar nav .lucide {
    width: 17px;
  }
  .allowance {
    padding: 12px 3px 0;
    display: block;
  }
  .allowance > span,
  .allowance small,
  .support {
    display: none;
  }
  .allowance strong {
    font-size: 13px;
    color: var(--muted);
  }
  main {
    padding: 24px 16px 50px;
  }
  h1 {
    font-size: 25px;
  }
  .section-heading {
    display: block;
  }
  .status {
    display: block;
    margin-top: 14px;
    max-width: none;
  }
  .brief-section {
    padding: 22px 0;
    background: transparent;
  }
  .conversation {
    padding-top: 20px;
    height: max(620px, calc(100dvh - 220px));
    min-height: 620px;
  }
  .chat-tools { padding: 10px 0; }
  .chat-focus { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chat-focus button { padding: 8px 4px; font-size: 14px; gap: 4px; }
  .form-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  dialog {
    padding: 22px 18px;
  }
  .song-art {
    width: 48px;
    height: 48px;
  }
  .song-row {
    gap: 12px;
  }
}

/* Chat owns the available viewport; only its message history scrolls. */
body[data-view="create"][data-mode="agent"] { height: 100dvh; overflow: hidden; }
body[data-view="create"][data-mode="agent"] .workspace { height: calc(100dvh - 64px); }
.header { height: 64px; padding: 0 22px; }
.brand { font-size: 24px; }
.brand img { width: 36px; height: 36px; }
.header-divider, .header > span, #plans-button span { display: none; }
.sidebar { min-height: 0; background: #f5f9fc; }
.sidebar [aria-current="page"] { background: #e1eff8 !important; color: #215b78 !important; }
body[data-view="create"][data-mode="agent"] main {
  display: flex; flex-direction: column; min-height: 0; padding: 18px 28px 0;
}
body[data-mode="agent"] #create-view {
  flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%; max-width: 900px;
}
body[data-mode="agent"] .section-heading { margin-bottom: 8px; }
body[data-mode="agent"] .section-heading h1 { font-size: 21px; }
body[data-mode="agent"] .status { border: 0; font-size: 12px; }
.creator-modes { margin-bottom: 4px; gap: 16px; }
.creator-modes button { padding: 8px 2px; min-height: 40px; font-size: 14px; }
.creator-modes [aria-selected="true"] { color: var(--coral); border-bottom-color: var(--coral); }
body[data-mode="agent"] .creator-grid { flex: 1; min-height: 0; border: 0; }
body[data-mode="agent"] .conversation { height: 100%; min-height: 0; padding: 0; }
body[data-mode="agent"] #messages { min-height: 80px; padding: 24px 6px 12px; overscroll-behavior: contain; }
.agent-message, .user-message { border: 0; padding: 0; margin: 0 0 26px; font-size: 18px; line-height: 1.75; }
.agent-message { padding-right: 16px; }
.user-message { margin-left: auto; width: fit-content; max-width: 88%; background: #fff0f1; border-radius: 8px; padding: 10px 16px; }
.speaker { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.chat-empty { padding: 44px 0; }
.chat-empty .lucide { width: 34px; height: 34px; color: var(--coral); margin-bottom: 16px; }
.chat-empty h2 { font-size: 27px; font-weight: 600; }
.composer { flex-shrink: 0; margin: 8px 0 12px; padding: 10px 12px; border: 1px solid #d4dee6; border-radius: 8px; background: #f7fafc; box-shadow: 0 3px 14px #20476308; }
.composer:focus-within { border-color: #91b5ce; }
.composer > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.composer textarea { border: 0; background: transparent; margin: 0; padding: 6px 4px; font-size: 18px; line-height: 1.5; min-height: 54px; max-height: 180px; resize: none; }
.composer textarea:focus-visible { outline: none; }
.composer > div { margin-top: 2px; }
.composer #chat-status { margin-right: auto; font-size: 12px; }
#context-button { border: 0; background: transparent; }
#send { border-radius: 50%; width: 42px; min-height: 42px; }
#working { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); padding: 8px 4px; }
.working-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); animation: working-pulse 1.5s ease-in-out infinite; }
@keyframes working-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .working-dot { animation: none; } }
#draft-action { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-top: 1px solid var(--line); }
#chat-draft-title { flex: 1; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
#chat-generate { font-size: 14px; flex-shrink: 0; }
.chat-tools { max-height: 38dvh; overflow: auto; padding: 12px 4px; }
.chat-reference label { margin-bottom: 4px; }
.jobs-section { padding: 0; flex-shrink: 0; max-height: 30dvh; overflow: auto; }
.jobs-section summary { padding: 8px 0 12px; color: var(--muted); }
.jobs-section .section-heading { padding-top: 10px; }
#notice { max-height: 22dvh; overflow: auto; flex-shrink: 0; margin-bottom: 8px; font-size: 14px; }
.auth-return { width: min(480px, 100%); margin: 12dvh auto; padding: 28px; }
.auth-return h1 { margin-top: 20px; }
.auth-return a { justify-content: center; padding: 12px 18px; border-radius: 8px; text-decoration: none; width: 100%; margin-top: 12px; }
.auth-return .primary { color: white; }
.return-secondary { border: 1px solid var(--line); }
.auth-return p { color: var(--muted); }
.auth-return a[aria-disabled="true"] { opacity: .5; pointer-events: none; }
@media (max-width: 600px) {
  .header { height: 60px; padding: 0 14px; }
  body[data-view="create"][data-mode="agent"] .workspace { height: calc(100dvh - 60px); display: flex; flex-direction: column; }
  .sidebar { padding: 4px 8px; flex-shrink: 0; }
  .sidebar nav { gap: 1px; }
  .sidebar nav button, .sidebar nav a { padding: 8px; font-size: 13px; }
  .sidebar nav .lucide { width: 16px; }
  .allowance { display: none; }
  body[data-view="create"][data-mode="agent"] main { flex: 1; padding: 8px 14px 0; }
  body[data-mode="agent"] .section-heading { display: none; }
  .creator-modes { justify-content: space-between; }
  .composer { margin-bottom: max(8px, env(safe-area-inset-bottom)); }
  .composer textarea { font-size: 17px; }
  .chat-empty { padding: 30px 0; }
  .chat-empty h2 { font-size: 24px; }
  #chat-generate { padding: 8px; }
  #draft-action { gap: 8px; }
}
