/* ─── Reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: #1a1a1a;
  background: #f4f4f2;
  min-height: 100vh;
  padding: 1.5rem 1rem 3rem;
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.login-card {
  max-width: 400px;
  margin: 4rem auto 0;
}

.app-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

.card {
  background: #fff;
  border: 1px solid #d8d8d4;
  border-radius: 6px;
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
}

/* ─── Login ─────────────────────────────────────────────────────────────────── */
.tool-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  text-align: center;
}

.tool-subtitle {
  display: block;
  font-size: 1rem;
  font-weight: 400;
  color: #555;
}

.login-intro {
  text-align: center;
  color: #555;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* ─── Typography ────────────────────────────────────────────────────────────── */
h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a1a;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
}

.section-title {
  margin-bottom: 0.35rem;
}

.section-note {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 1.25rem;
}

/* ─── Labels & inputs ───────────────────────────────────────────────────────── */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.3rem;
}

.hint-label {
  font-weight: 400;
  color: #777;
  font-size: 0.8rem;
}

.required {
  color: #c0392b;
}

input[type="text"],
input[type="password"],
textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: #1a5cad;
  box-shadow: 0 0 0 3px rgba(26, 92, 173, 0.18);
}

input[type="file"] {
  display: block;
  font-size: 0.9rem;
  color: #333;
  margin-top: 0.1rem;
}

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

.field {
  margin-bottom: 1rem;
}

.field-note {
  font-size: 0.8rem;
  color: #777;
  margin-top: 0.3rem;
}

/* ─── Field grid (header form) ──────────────────────────────────────────────── */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.names-field {
  margin-top: 0.5rem;
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  line-height: 1.4;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #1a5cad;
  color: #fff;
  margin-top: 0.75rem;
}
.btn-primary:hover:not(:disabled) {
  background: #154d96;
}

.btn-secondary {
  background: #e8e8e4;
  color: #1a1a1a;
}
.btn-secondary:hover:not(:disabled) {
  background: #d4d4d0;
}

.btn-ghost {
  background: transparent;
  color: #555;
  border: 1px solid #bbb;
}
.btn-ghost:hover:not(:disabled) {
  background: #f0f0ec;
}

.btn-danger {
  background: #c0392b;
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #a93226;
}

/* Full-width button in login form */
.login-card .btn {
  width: 100%;
  margin-top: 1rem;
}

/* ─── Tabs ──────────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #d0d0cc;
  margin-bottom: 1.25rem;
}

.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 0.5rem 1.1rem;
  font-size: 0.925rem;
  font-family: inherit;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.tab:hover {
  color: #1a1a1a;
}

.tab[aria-selected="true"] {
  color: #1a5cad;
  border-bottom-color: #1a5cad;
}

/* ─── Panel notes ───────────────────────────────────────────────────────────── */
.panel-note {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 1rem;
}

.panel-note code {
  font-size: 0.8rem;
  background: #f0f0ec;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* ─── Cost estimate ─────────────────────────────────────────────────────────── */
.cost-estimate {
  font-size: 0.875rem;
  color: #555;
  min-height: 1.4em;
  margin-top: 0.4rem;
}

/* ─── Progress ──────────────────────────────────────────────────────────────── */
.progress-area {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: #f0f4fb;
  border: 1px solid #c0d0e8;
  border-radius: 4px;
}

.progress-text {
  font-size: 0.9rem;
  color: #1a5cad;
  font-weight: 500;
}

/* Retry/skip buttons inside progress area */
.chunk-retry-notice {
  margin-top: 0.75rem;
}

.chunk-retry-notice p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: #a04000;
}

.chunk-retry-notice .btn-retry,
.chunk-retry-notice .btn-skip {
  font-size: 0.875rem;
  padding: 0.35rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  margin-right: 0.5rem;
  border: 1px solid #bbb;
  background: #fff;
  color: #1a1a1a;
  transition: background 0.12s;
}

.chunk-retry-notice .btn-retry:hover {
  background: #e0e8f8;
}
.chunk-retry-notice .btn-skip:hover {
  background: #f0f0ec;
}

/* ─── Status message ────────────────────────────────────────────────────────── */
.status {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.status--error {
  background: #fdf0ee;
  border: 1px solid #e8b0a8;
  color: #8b1a0e;
}

.status--warn {
  background: #fdf6e8;
  border: 1px solid #e8d08a;
  color: #7a5700;
}

.status--info {
  background: #eaf2fb;
  border: 1px solid #a0c0e0;
  color: #1a5cad;
}

/* ─── Error (login) ─────────────────────────────────────────────────────────── */
.error-msg {
  font-size: 0.875rem;
  color: #c0392b;
  background: #fdf0ee;
  border: 1px solid #e8b0a8;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

/* ─── Help panel ────────────────────────────────────────────────────────────── */
.help-panel {
  background: #f8f8f5;
  border: 1px solid #d8d8d4;
  border-left: 4px solid #1a5cad;
  border-radius: 0 6px 6px 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.help-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a5cad;
  margin-bottom: 0.75rem;
}

.help-steps {
  padding-left: 1.35rem;
  margin-bottom: 1rem;
}

.help-steps li {
  font-size: 0.9rem;
  color: #333;
  margin-bottom: 0.5rem;
}

.help-steps li strong {
  color: #1a1a1a;
}

.help-privacy {
  font-size: 0.8rem;
  color: #555;
  line-height: 1.5;
  border-top: 1px solid #ddd;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

.help-privacy code {
  font-size: 0.75rem;
  background: #e8e8e4;
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

/* ─── Check-these callout ───────────────────────────────────────────────────── */
.check-callout {
  background: #fff8e8;
  border: 1px solid #e8c840;
  border-left: 4px solid #e8a000;
  border-radius: 0 4px 4px 0;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.check-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: #7a5700;
  margin-bottom: 0.35rem;
}

.check-intro {
  font-size: 0.875rem;
  color: #7a5700;
  margin-bottom: 0.6rem;
}

.check-list {
  padding-left: 1.25rem;
}

.check-list li {
  font-size: 0.875rem;
  color: #5c4000;
  margin-bottom: 0.3rem;
}

/* ─── Parse warning ─────────────────────────────────────────────────────────── */
.parse-warning {
  font-size: 0.875rem;
  color: #8b1a0e;
  background: #fdf0ee;
  border: 1px solid #e8b0a8;
  border-radius: 4px;
  padding: 0.65rem 0.9rem;
  margin-bottom: 1rem;
}

/* ─── Raw transcript ────────────────────────────────────────────────────────── */
.transcript-toggle-wrap {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.raw-transcript-panel {
  border: 1px solid #d8d8d4;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  background: #fafaf8;
  margin-bottom: 1.25rem;
}

.raw-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.5rem;
}

.raw-transcript-text {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 28rem;
  overflow-y: auto;
}

/* ─── Download bar ──────────────────────────────────────────────────────────── */
.download-bar {
  border-top: 1px solid #e8e8e4;
  padding-top: 1.25rem;
  margin-top: 1.25rem;
}

.download-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.download-buttons .btn {
  margin-top: 0;
}

/* ─── Clear session ─────────────────────────────────────────────────────────── */
.clear-session-wrap {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e8e8e4;
}

.clear-note {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.4rem;
}

/* ─── Code (inline) ─────────────────────────────────────────────────────────── */
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ─── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  body {
    padding: 1rem 0.5rem 2rem;
  }

  .card {
    padding: 1.25rem 1rem;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: 1;
  }

  .download-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .download-buttons .btn {
    width: 100%;
  }

  .tab {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }
}
