:root {
  color: #1e2935;
  background: #f5f6f5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f6f5;
}

.site-header {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #e4e8e5;
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 5vw;
}

.brand,
.account-actions {
  align-items: center;
  display: flex;
}

.brand {
  color: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  gap: 0.55rem;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: #356b5c;
  border-radius: 0.45rem;
  color: #fff;
  display: inline-flex;
  font-size: 0.75rem;
  height: 1.7rem;
  justify-content: center;
  width: 1.7rem;
}

.account-actions {
  gap: 0.8rem;
}

.user-name,
.muted,
.webinar-meta,
.upload-preview p,
.empty-state p {
  color: #64717b;
}

.user-name,
.webinar-meta {
  font-size: 0.875rem;
}

.page-content {
  margin: 0 auto;
  max-width: 960px;
  padding: 3.5rem 1.5rem;
}

.login-shell {
  display: grid;
  min-height: calc(100vh - 134px);
  place-items: center;
}

.login-card {
  background: #fff;
  border: 1px solid #e1e6e2;
  border-radius: 0.85rem;
  box-shadow: 0 12px 35px rgb(30 41 53 / 7%);
  max-width: 390px;
  padding: 2rem;
  width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 1.75rem;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.eyebrow {
  color: #356b5c;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stack-form {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.form-field {
  display: grid;
  gap: 0.4rem;
}

label {
  font-size: 0.875rem;
  font-weight: 650;
}

input {
  border: 1px solid #cbd4cf;
  border-radius: 0.45rem;
  font: inherit;
  padding: 0.65rem 0.75rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #356b5c;
  outline: 3px solid rgb(53 107 92 / 16%);
}

.button {
  align-items: center;
  background: #356b5c;
  border: 1px solid #356b5c;
  border-radius: 0.45rem;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  flex: 0 1 auto;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 650;
  justify-content: center;
  justify-self: start;
  line-height: 1.25rem;
  max-width: 100%;
  min-height: 2.5rem;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 0.5625rem 1rem;
  text-align: center;
  text-decoration: none;
  width: fit-content;
}

.button:hover {
  background: #285447;
}

.button-secondary {
  background: #fff;
  border-color: #bdcec4;
  color: #356b5c;
}

.button-secondary:hover {
  background: #eff5f2;
}

.button-small {
  font-size: 0.8125rem;
  min-height: 2.25rem;
  padding: 0.4375rem 0.75rem;
}

.button:focus-visible,
input[type="file"]::file-selector-button:focus-visible {
  outline: 3px solid #356b5c;
  outline-offset: 3px;
}

.stack-form select,
.stack-form input[type="number"],
.stack-form textarea {
  background: #fff;
  border: 1px solid #cbd4cf;
  border-radius: 0.45rem;
  color: inherit;
  font: inherit;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
}

.stack-form select,
.stack-form input[type="number"] {
  font-size: 0.875rem;
  line-height: 1.25rem;
  width: 13.75rem;
}

.stack-form select[name="dataset_id"] {
  width: min(100%, 32rem);
}

.stack-form textarea {
  resize: vertical;
  width: 100%;
}

.stack-form input[type="file"] {
  border: 0;
  border-radius: 0;
  color: #64717b;
  font-size: 0.8125rem;
  padding: 0;
  width: 100%;
}

input[type="file"]::file-selector-button {
  background: #fff;
  border: 1px solid #bdcec4;
  border-radius: 0.45rem;
  color: #356b5c;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  margin-right: 0.75rem;
  min-height: 2.25rem;
  padding: 0.4375rem 0.75rem;
}

input[type="file"]::file-selector-button:hover {
  background: #eff5f2;
}

.button:disabled {
  color: #8c9891;
  cursor: not-allowed;
  opacity: 0.75;
}

.form-error {
  background: #fff0ef;
  border-radius: 0.4rem;
  color: #9c2f28;
  font-size: 0.875rem;
  padding: 0.65rem 0.75rem;
}

.field-error {
  color: #9c2f28;
  font-size: 0.825rem;
}

.dashboard-heading,
.section-heading,
.upload-preview,
.webinar-card {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.dashboard-heading {
  margin-bottom: 1.75rem;
}

.upload-preview {
  background: #f1f6f3;
  border: 1px dashed #9eb8ad;
  border-radius: 0.75rem;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding: 1.5rem;
}

.upload-content {
  flex: 1;
  min-width: 0;
}

.stack-form input, .stack-form select, .stack-form fieldset {
  max-width: 100%;
  min-width: 0;
}

.stack-form { overflow-wrap: anywhere; }

.upload-preview .stack-form {
  gap: 1.25rem;
}

.upload-preview .form-field {
  gap: 0.5rem;
}

.upload-preview fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.upload-preview summary {
  color: #456051;
  cursor: pointer;
  font-size: 0.8125rem;
  width: fit-content;
}

.upload-preview details[open] > :not(summary) {
  margin-top: 0.75rem;
}

.upload-actions {
  align-items: center;
  border-top: 1px solid #dce6df;
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  padding-top: 1.25rem;
}

.upload-actions .muted {
  font-size: 0.8125rem;
}

.upload-preview p,
.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 0;
}

.upload-icon {
  align-items: center;
  background: #dcece4;
  border-radius: 999px;
  color: #356b5c;
  display: flex;
  font-size: 1.35rem;
  height: 2.6rem;
  justify-content: center;
  width: 2.6rem;
}

.section-heading {
  margin-bottom: 0.8rem;
}

.section-heading h2 {
  margin-bottom: 0;
}

.webinar-list {
  display: grid;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.webinar-card,
.empty-state {
  background: #fff;
  border: 1px solid #e1e6e2;
  border-radius: 0.7rem;
  padding: 1rem 1.1rem;
}

.webinar-meta {
  margin-bottom: 0;
}

.status-pill {
  background: #eef4f1;
  border-radius: 999px;
  color: #356b5c;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.55rem;
  white-space: nowrap;
}

.card-actions,
.detail-actions,
.detail-heading,
.status-line {
  align-items: center;
  display: flex;
  gap: 0.65rem;
}

.card-actions,
.detail-actions {
  flex-wrap: wrap;
  max-width: 100%;
  width: fit-content;
}

.card-actions > form,
.detail-actions > form {
  max-width: 100%;
  min-width: 0;
}

.card-link,
.back-link a {
  color: inherit;
  text-decoration-color: #9eb8ad;
  text-underline-offset: 0.2em;
}

.back-link {
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.detail-heading {
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.button-danger {
  background: #fff;
  border-color: #b84c45;
  color: #9c2f28;
}

.button-danger:hover {
  background: #fff0ef;
  border-color: #9c2f28;
}

.status-card,
.result-section {
  background: #fff;
  border: 1px solid #e1e6e2;
  border-radius: 0.7rem;
  padding: 1rem 1.1rem;
}

.status-card {
  margin-bottom: 1rem;
}

.status-line {
  justify-content: space-between;
}

.status-card progress {
  accent-color: #356b5c;
  height: 0.6rem;
  margin-top: 0.75rem;
  width: 100%;
}

.current-stage {
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

.results-stack {
  display: grid;
  gap: 1rem;
}

.chapter-list,
.transcript-list {
  display: grid;
  gap: 0.8rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-list li,
.transcript-list li {
  align-items: flex-start;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: auto 1fr;
}

.transcript-list li:target {
  background: #eff5f2;
  border-radius: 0.45rem;
  outline: 2px solid #9eb8ad;
  padding: 0.45rem;
}

.chapter-list p,
.transcript-list p,
.frame-card p {
  margin-bottom: 0;
}

.timecode {
  color: #356b5c;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  padding-top: 0.15rem;
}

.frame-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.frame-card {
  border: 1px solid #e1e6e2;
  border-radius: 0.55rem;
  overflow: hidden;
  padding: 0.65rem;
}

.frame-image-shell {
  margin: -0.65rem -0.65rem 0.65rem;
  position: relative;
}

.frame-image-shell img {
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: contain;
  width: 100%;
}

.chapter-primary-frame {
  border: 1px solid #e1e6e2;
  border-radius: 0.45rem;
  display: block;
  margin: 0.5rem 0;
  max-height: 260px;
  max-width: 100%;
}

.important-badge {
  background: #fff4cf;
  border-radius: 999px;
  color: #755b00;
  font-size: 0.7rem;
  font-weight: 750;
  padding: 0.25rem 0.45rem;
  position: absolute;
  right: 0.45rem;
  top: 0.45rem;
}

.frame-ocr {
  font-size: 0.8rem;
  margin-top: 0.45rem;
}

@media (max-width: 600px) {
  .site-header,
  .page-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .user-name {
    display: none;
  }

  .upload-preview,
  .webinar-card,
  .detail-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .upload-preview .button { margin-left: 0; }

  .upload-preview { padding: 1.125rem 1rem; }

  .upload-actions { align-items: flex-start; flex-direction: column; }

  .profile-buttons .button { font-size: 0.8125rem; padding-inline: 0.75rem; }
}

.operation-list { display: grid; gap: 1rem; }
.operation { border-top: 1px solid #dce2ec; padding-top: .5rem; }
.source-image { display: block; max-width: 100%; height: auto; margin: 1rem 0; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll table { border-collapse: collapse; }
.table-scroll th, .table-scroll td { padding: .5rem; border: 1px solid #cbd5e1; text-align: left; }
.analysis-report { max-width: 70rem; margin-inline: auto; overflow-wrap: anywhere; }
.report-claim { padding: .5rem 0; border-bottom: 1px solid #e2e8f0; }
[data-preserve-analysis-form] textarea, [data-preserve-analysis-form] select { max-width: 100%; }

.profile-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.profile-buttons[hidden] { display: none; }
.source-modes { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
[data-link-form] input[type="url"] { width: 100%; font-size: .875rem; }
.profile-buttons [aria-pressed="true"] { color: white; background: #356b5c; border-color: #356b5c; }
