:root {
  --bg: #f6efe6;
  --surface: #fbf6ef;
  --card: #fffdf9;
  --ink: #2a241c;
  --muted: #6e6458;
  --line: #e4d8c8;
  --primary: #3f6b4f;
  --primary-hover: #355c44;
  --secondary: #c45c3e;
  --stamp: #d9ece0;
  --stamp-border: #8fb89a;
  --danger: #b42318;
  --ok: #2f6b4f;
  --shadow: 0 10px 30px rgba(42, 36, 28, 0.08);
  --radius: 20px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 236, 224, 0.55), transparent 40%),
    var(--bg);
}

h1,
h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.stamp {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--stamp);
  border: 2px dashed var(--stamp-border);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  color: var(--primary);
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
}

.studio-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.nav-tab {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.nav-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pitch-table-wrap {
  overflow-x: auto;
}

.locked-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--stamp);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
}

.tagline,
.meta,
.hint,
.empty {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.user-chip {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn.primary {
  background: var(--primary);
  color: #f7faf7;
}

.btn.primary:hover {
  background: var(--primary-hover);
}

.btn.ghost {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}

.btn.ghost:hover {
  border-color: var(--stamp-border);
}

.btn.google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.btn.danger {
  background: transparent;
  border-color: rgba(180, 35, 24, 0.25);
  color: var(--danger);
}

.signin-card {
  max-width: 28rem;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.signin-card h2 {
  margin-top: 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.meta-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.locale-filter select {
  min-width: 9.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.view-toggle {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.view-btn {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
}

.view-btn.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(42, 36, 28, 0.08);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.items-list {
  display: block;
}

.items-list-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.items-table th,
.items-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.items-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface);
}

.items-table tbody tr:last-child td {
  border-bottom: none;
}

.items-table tbody tr:hover {
  background: rgba(217, 236, 224, 0.2);
}

.col-id {
  white-space: nowrap;
}

.col-transcript {
  max-width: 22rem;
  color: var(--muted);
}

.muted-cell {
  color: var(--muted);
}

.col-actions .card-actions {
  margin-top: 0;
  min-width: 16rem;
}

.status {
  margin: 0;
  font-size: 0.9rem;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: var(--ok);
}

.item-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}

.item-id {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  margin: 0;
}

.locale-pill {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--stamp);
  color: var(--primary);
}

.asset-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.ok {
  border-color: rgba(63, 107, 79, 0.35);
  color: var(--primary);
  background: rgba(217, 236, 224, 0.5);
}

.badge.missing {
  border-color: rgba(180, 35, 24, 0.25);
  color: var(--danger);
}

.transcript {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.card-actions .btn {
  font-size: 0.85rem;
  padding: 0.45rem 0.8rem;
}

.download-menu {
  position: relative;
  display: inline-flex;
}

.download-menu .download-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.download-menu .chevron {
  font-size: 0.7rem;
  opacity: 0.7;
}

.download-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 20;
  min-width: 9.5rem;
  padding: 0.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.download-option {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
}

.download-option:hover:not(:disabled) {
  background: rgba(217, 236, 224, 0.55);
}

.download-option:disabled {
  color: var(--muted);
  opacity: 0.55;
  cursor: not-allowed;
}

.download-menu.open .download-toggle-btn {
  border-color: var(--stamp-border);
  background: rgba(217, 236, 224, 0.35);
}

.dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: min(560px, calc(100vw - 2rem));
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(33, 29, 24, 0.45);
}

.dialog-body {
  padding: 1.25rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.field-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.field-grid .span-2 {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  font: inherit;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.optional,
.required {
  font-weight: 400;
  color: var(--muted);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.preview-dialog audio {
  width: 100%;
}

.srt-dialog {
  width: min(720px, calc(100vw - 2rem));
}

.srt-editor-label {
  display: block;
}

.srt-editor {
  width: 100%;
  min-height: 18rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  tab-size: 2;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  background: var(--surface);
  color: var(--ink);
}

.srt-editor:disabled {
  opacity: 0.6;
}

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