:root {
  --bg-0: #0b0e16;
  --bg-1: #12192a;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --text: #f4f6fb;
  --muted: rgba(244, 246, 251, 0.72);
  --accent: #e2323b;
  --line: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 500px at 10% 0%, #1b2237 0%, var(--bg-0) 55%, #07090f 100%);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.brand-text p {
  margin: 2px 0 0;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.left-column {
  display: grid;
  gap: 16px;
}

.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 14px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.btn-primary {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 14px;
  cursor: pointer;
}

.btn-secondary {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.url-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 14px;
  margin-top: 8px;
}

.save-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.row.single {
  grid-template-columns: 1fr;
  align-items: center;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 8px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.path {
  font-size: 14px;
  word-break: break-all;
}

.queue {
  min-height: 360px;
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-strong);
}

.queue-list {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: 10px;
  padding: 10px;
  min-width: 0;
  overflow: hidden;
}

.item-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.item-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.progress {
  height: 6px;
  margin: 8px 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.progress > div {
  height: 100%;
  background: #5aa8ff;
}

.detail {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
}

.item-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.footer {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.transcript-page {
  max-width: 900px;
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#transcriptText {
  width: 100%;
  min-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 10px;
  font-family: Menlo, Monaco, monospace;
  font-size: 13px;
}

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

/* Header actions */
.header-actions { display: flex; gap: 8px; margin-left: auto; }
.btn-sm { font-size: 13px; padding: 6px 12px; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-box {
  background: #1a2035; border: 1px solid var(--line);
  border-radius: 16px; padding: 20px;
  width: min(560px, 92vw); max-height: 80vh;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-body { overflow-y: auto; flex: 1; }
.btn-icon {
  background: transparent; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
}
.btn-icon:hover { color: var(--text); }

/* History list */
.history-item {
  border-bottom: 1px solid var(--line); padding: 10px 0;
}
.history-item:last-child { border-bottom: none; }
.history-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 2px; }
.history-url { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.state-ok { color: #4ade80; }
.state-fail { color: #f87171; }

/* Settings form */
.settings-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.settings-row label { color: var(--muted); font-size: 13px; }
.notification-row { display: flex; align-items: center; justify-content: space-between; }

/* Remove/cancel button on queue item */
.item-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.item-title { font-weight: 700; margin-bottom: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-remove { background: transparent; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 11px; padding: 2px 6px; cursor: pointer; }
.btn-remove:hover { color: var(--text); }
