:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #f0f4f8;
  --text: #17202a;
  --muted: #667085;
  --line: #d9e0e8;
  --primary: #176b87;
  --primary-strong: #0f4c5c;
  --accent: #c2410c;
  --good: #13795b;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px max(20px, calc((100vw - 1120px) / 2));
  background: #0e2a36;
  color: #ffffff;
}

.app-header h1,
.section-heading h2,
.submit-panel h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: #9ed8d0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.auth-panel {
  width: min(1120px, calc(100vw - 32px));
  margin: 16px auto 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.auth-form input {
  min-width: 160px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.auth-form span {
  color: var(--muted);
}

.submit-panel,
.upload-panel {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 24px;
  align-items: start;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.upload-panel,
.quick-panel {
  margin-top: 16px;
}

.quick-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.quick-panel h2 {
  margin: 0;
}

.quick-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  align-content: center;
  padding: 14px;
  color: #344054;
  background: #f8fafc;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
}

.quick-card.is-over {
  background: #e7f2f5;
  border-color: var(--primary);
}

.quick-card span {
  color: var(--muted);
  font-size: 13px;
}

.quick-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bookmarklet {
  display: inline-flex;
  width: fit-content;
  min-height: 34px;
  align-items: center;
  padding: 7px 10px;
  color: #ffffff;
  background: var(--primary);
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
}

.quick-status {
  min-height: 38px;
  padding: 9px 12px;
  color: #344054;
  background: #f8fafc;
  border: 1px solid #d9e0e8;
  border-radius: 6px;
}

.quick-status.good {
  color: var(--good);
  background: #eaf7f1;
  border-color: #b8e2d0;
}

.quick-status.warn {
  color: var(--warn);
  background: #fff7ed;
  border-color: #fed7aa;
}

.submit-panel p,
.upload-panel p,
.section-heading p,
.empty-state p,
.meta,
.hint {
  color: var(--muted);
}

.dropzone {
  position: relative;
  display: grid;
  min-height: 140px;
  place-items: center;
  padding: 18px;
  text-align: center;
  color: #344054;
  background: #f8fafc;
  border: 2px dashed #adc7d0;
  border-radius: 8px;
}

.dropzone.is-over {
  background: #e7f2f5;
  border-color: var(--primary);
}

.dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone strong,
.dropzone span {
  display: block;
}

.dropzone span {
  margin-top: 6px;
  color: var(--muted);
}

.source-form,
.settings-grid,
.search-form {
  display: grid;
  gap: 14px;
}

.search-form {
  grid-template-columns: 1fr minmax(160px, 220px) auto;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

textarea {
  resize: vertical;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

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

.secondary-button {
  background: #e7f2f5;
  color: var(--primary-strong);
  border-color: #b8d8df;
}

.ghost-button {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.42);
}

.danger-button {
  background: #fff1f0;
  color: var(--danger);
  border-color: #fecdca;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.tab {
  min-height: 44px;
  padding: 10px 8px;
  color: #344054;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 700;
}

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

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric strong {
  display: block;
  margin-bottom: 4px;
  font-size: 28px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-heading {
  margin: 22px 0 14px;
}

.row-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.content-list {
  display: grid;
  gap: 12px;
}

.item-card,
.empty-state,
.settings-grid,
.export-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.item-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.badge-row,
.diagnostic-row,
.actions,
.claim-list,
.todo-list,
.todo-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.diagnostic-row {
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  color: #344054;
  background: var(--surface-muted);
  border: 1px solid #d7dee8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.good {
  color: var(--good);
  background: #eaf7f1;
  border-color: #b8e2d0;
}

.badge.warn {
  color: var(--warn);
  background: #fff7ed;
  border-color: #fed7aa;
}

.badge.danger {
  color: var(--danger);
  background: #fff1f0;
  border-color: #fecdca;
}

.insight-box {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.supplement-box,
.transcript-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
}

.insight-box h4 {
  margin: 0 0 8px;
}

.insight-box ul {
  margin: 0;
  padding-left: 20px;
}

.empty-state {
  padding: 28px 18px;
  text-align: center;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 16px;
}

.setting-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
}

.setting-card span {
  color: var(--muted);
  font-size: 13px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.checkbox-row input {
  width: auto;
}

.compact-control {
  display: grid;
  gap: 4px;
  min-width: 116px;
  font-size: 12px;
  color: var(--muted);
}

.compact-control select,
.compact-control input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.export-box {
  min-height: 160px;
  max-height: 420px;
  margin: 14px 0 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
}

.todo-edit {
  width: min(100%, 520px);
  align-items: stretch;
}

.todo-edit textarea {
  flex: 1 1 260px;
}

@media (max-width: 760px) {
  .app-header,
  .submit-panel,
  .upload-panel,
  .row-heading,
  .item-header {
    display: grid;
  }

  .app-shell {
    width: min(100vw - 20px, 720px);
    margin-top: 12px;
  }

  .submit-panel,
  .metrics-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .tabbar {
    grid-template-columns: repeat(2, 1fr);
  }
}
