/* Voice Studio — website styles.
   Ink on cool paper, peacock teal for actions, marigold reserved for sound (waveforms, progress). */
:root {
  --paper: #F5F6FA;
  --surface: #FFFFFF;
  --ink: #1D2340;
  --ink-2: #4A5072;
  --muted: #7A7F9A;
  --line: #DDE1EC;
  --teal: #0B7A83;
  --teal-deep: #075C63;
  --teal-wash: #E3F2F3;
  --marigold: #E9A23B;
  --marigold-soft: #F6DDB4;
  --danger: #B3363C;
  --danger-wash: #FBEAEA;
  --ok: #2C8A4B;

  --font-head: "Bricolage Grotesque", "Noto Sans Tamil", "Noto Sans Devanagari", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", "Noto Sans Tamil", "Noto Sans Devanagari", system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --shadow: 0 1px 2px rgba(29, 35, 64, .06), 0 6px 24px -12px rgba(29, 35, 64, .18);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.55 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 650; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px; padding: 0 28px; height: 64px;
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; }
.brand-mark { display: block; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: #C9CDE3; text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); font-weight: 500;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.14); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: .9rem; }
.gen-status { display: flex; align-items: center; gap: 8px; color: #C9CDE3; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #8A8FA8; flex: none; }
.dot.on { background: #4CC77A; box-shadow: 0 0 0 3px rgba(76,199,122,.25); }
.meter { display: grid; gap: 4px; min-width: 150px; color: #C9CDE3; }
.meter-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.18); overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--marigold); }
.linkish { background: none; border: 0; color: #C9CDE3; cursor: pointer; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: #fff; }

main { max-width: 1180px; margin: 0 auto; padding: 36px 28px 80px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { color: var(--ink-2); max-width: 60ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 10px; color: var(--ink-2); text-decoration: none; font-size: .95rem; }
.back:hover { color: var(--ink); }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--teal); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--teal-deep); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--ink-2); }
.btn.quiet { background: transparent; color: var(--ink-2); border-color: transparent; padding: 0 10px; }
.btn.quiet:hover { color: var(--ink); background: #ECEEF5; }
.btn.danger { background: transparent; color: var(--danger); border-color: #EBC6C8; }
.btn.danger:hover { background: var(--danger-wash); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: .88rem; }
.btn.big { min-height: 48px; padding: 0 22px; font-size: 1.02rem; }

label.field { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
label.field span.hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  padding: 10px 12px; min-height: 42px;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-wash); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--ink-2); }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--teal); }
input[type=range] { width: 100%; accent-color: var(--teal); }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 3px; gap: 3px; }
.segmented button { border: 0; background: transparent; padding: 7px 14px; border-radius: 4px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.note { padding: 12px 14px; border-radius: var(--r-sm); background: var(--teal-wash); color: var(--teal-deep); font-size: .92rem; }
.note.warn { background: #FFF4E2; color: #7A4B05; }
.error { color: var(--danger); font-size: .92rem; min-height: 1.2em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 24px; }
.panel h2 { margin-bottom: 4px; }
.panel > p.muted { margin-bottom: 16px; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-side {
  background: var(--ink); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-side h1 { font-size: clamp(2.2rem, 4.2vw, 3.6rem); font-weight: 700; max-width: 14ch; }
.auth-side p { color: #C9CDE3; max-width: 44ch; margin-top: 18px; font-size: 1.08rem; }
.auth-wave { width: 100%; height: 140px; display: block; }
.auth-langs { color: #8F95B5; font-size: .95rem; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .segmented { margin-bottom: 24px; }

/* ---------------------------------------------------------------- projects list */
.plist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.prow {
  display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px 150px auto; gap: 16px; align-items: center;
  padding: 16px 20px; border-top: 1px solid var(--line);
}
.prow:first-child { border-top: 0; }
.prow.head { color: var(--muted); font-size: .85rem; padding-top: 12px; padding-bottom: 12px; }
.prow a.pname { font-family: var(--font-head); font-weight: 650; font-size: 1.08rem; color: var(--ink); text-decoration: none; }
.prow a.pname:hover { color: var(--teal); }
.prow .desc { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .num { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.empty { padding: 48px 24px; text-align: center; color: var(--ink-2); }
.empty h2 { margin-bottom: 8px; }
.empty .btn { margin-top: 18px; }
.newproj { display: flex; gap: 10px; margin-bottom: 20px; }
.newproj input { max-width: 420px; }

/* ---------------------------------------------------------------- project page */
.workspace { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 28px; align-items: start; }
.composer { position: sticky; top: 88px; }
.composer textarea { min-height: 200px; }
.counter { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; }
.counter .over { color: var(--danger); font-weight: 600; }
.title-edit { font-family: var(--font-head); font-size: 2rem; font-weight: 650; border: 1px solid transparent; background: transparent;
  padding: 2px 6px; margin-left: -7px; border-radius: var(--r-sm); width: 100%; max-width: 680px; }
.title-edit:hover { border-color: var(--line); }
.title-edit:focus { border-color: var(--teal); background: var(--surface); outline: none; }

.clips { display: grid; gap: 12px; }
.clip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.clip-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clip-meta { margin-top: 6px; color: var(--muted); font-size: .86rem; }
.clip-meta span + span::before { content: ""; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--line); margin: 0 8px 2px; }
.clip-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.clip-foot .spacer { flex: 1; }

.player { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.play {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; flex: none;
  display: grid; place-items: center;
}
.play:hover { background: var(--teal); }
.wave { flex: 1; height: 48px; display: block; cursor: pointer; min-width: 0; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; min-width: 74px; text-align: right; }

.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.status.queued { color: var(--ink-2); }
.status.running { color: #9A6205; }
.status.error, .status.cancelled { color: var(--danger); }
.progress { height: 6px; border-radius: 3px; background: var(--marigold-soft); overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; background: var(--marigold); transition: width .4s ease; }
.progress.indeterminate span { width: 30%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

/* ---------------------------------------------------------------- voices / account / admin */
.two-col { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 28px; align-items: start; }
.vlist { display: grid; gap: 12px; }
.vitem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.vitem audio { width: 100%; margin-top: 10px; height: 36px; }
.vitem details { margin-top: 10px; }
.vitem summary { cursor: pointer; color: var(--ink-2); font-size: .92rem; }
.rec { color: var(--danger); }

table.data { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: .84rem; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data td.num { font-variant-numeric: tabular-nums; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: #EEF0F6; padding: 2px 6px; border-radius: 4px; font-size: .9rem; word-break: break-all; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #ECEEF5; color: var(--ink-2); }
.tag.ok { background: #E3F4E9; color: var(--ok); }
.tag.bad { background: var(--danger-wash); color: var(--danger); }
.admin-grid { display: grid; gap: 28px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r-sm); box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .workspace, .two-col { grid-template-columns: minmax(0, 1fr); }
  .composer { position: static; }
  .prow { grid-template-columns: minmax(0, 1fr) auto; }
  .prow .num, .prow.head .num { display: none; }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { padding: 32px 20px; }
  .auth-side h1 { font-size: 2.1rem; }
  .auth-wave { height: 80px; }
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 16px; gap: 10px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .topbar-right { gap: 12px; }
  .meter { min-width: 110px; }
  main { padding: 24px 16px 64px; }
  h1, .title-edit { font-size: 1.6rem; }
  .newproj { flex-direction: column; }
  table.data { font-size: .86rem; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* project title fills its column; on phones the delete button drops below it */
.page-head .grow { min-width: 0; }
.title-edit { width: 100%; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .page-head { flex-wrap: wrap; }
  .page-head .grow { flex-basis: 100%; }
  .title-edit { font-size: 1.5rem; }
}
@media (min-width: 961px) { .composer { position: sticky; top: 24px; align-self: start; } }
.two-col > *, .workspace > * { min-width: 0; }
label.field input:not([type=checkbox]):not([type=range]), label.field select, label.field textarea { width: 100%; min-width: 0; box-sizing: border-box; }
label.field input[type=file] { max-width: 100%; }

/* ---------- Phase 2.4b: banner, badges, footer, auth tabs, help, admin tabs, policy pages */
.banner { display: flex; align-items: center; gap: 16px; justify-content: center; padding: 10px 20px;
  background: var(--teal-wash); color: var(--teal-deep); font-weight: 500; font-size: .95rem; }
.banner.warn { background: #FFF4E2; color: #7A4B05; }
.banner .linkish { color: inherit; flex: none; }
.badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px;
  background: var(--marigold); color: var(--ink); font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 1px; }
.foot { max-width: 1180px; margin: -40px auto 0; padding: 0 28px 40px; display: flex; gap: 20px; flex-wrap: wrap; font-size: .85rem; }
.foot a, .auth-foot a { color: var(--muted); }
.auth-foot { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 28px; font-size: .82rem; }
.auth-card { max-width: 420px; }
.auth-tabs { display: flex; width: 100%; }
.auth-tabs button { flex: 1; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.tlist { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.tlist > .empty { border: 0; }
.titem { display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.titem:first-child { border-top: 0; }
.titem:hover { background: #FAFBFD; }
.titem .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.titem strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.titem.unread strong { font-weight: 800; }
.titem.unread { box-shadow: inset 3px 0 0 var(--marigold); }

.convo { max-width: 760px; display: flex; flex-direction: column; gap: 16px; }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.msg.from-team { align-self: flex-start; border-color: #BFE0E3; background: var(--teal-wash); }
.msg.from-user { align-self: flex-end; }
.msg-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; margin-bottom: 4px; font-size: .9rem; }
.msg-body, .msgbody { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }

.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 24px; overflow-x: auto; }
.subnav a { padding: 10px 14px; color: var(--ink-2); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--teal); }
.req { display: flex; flex-direction: column; gap: 8px; }
.req p { margin: 0; overflow-wrap: anywhere; }
.msgcopy { white-space: pre-wrap; background: var(--surface); border: 1px solid #BFE0E3; border-radius: var(--r-sm); padding: 12px;
  font-family: var(--font-body); font-size: .9rem; color: var(--ink); margin: 0; }
.clamp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
td.plus { color: var(--ok); }

main.doc { max-width: 760px; }
.doc h1 { font-size: 2.2rem; margin-bottom: 6px; }
.doc h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.doc p, .doc li { line-height: 1.65; max-width: 70ch; }
.doc ul { padding-left: 22px; }

@media (max-width: 760px) {
  .msg { max-width: 100%; }
  .clamp { max-width: 22ch; }
  .banner { justify-content: space-between; }
}
