:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #61706b;
  --line: #dde6e2;
  --accent: #16725f;
  --accent-strong: #0f5b4b;
  --accent-soft: #e5f3ef;
  --accent-tint: #f2faf7;
  --warning: #9a6500;
  --shadow: 0 6px 18px rgba(20, 45, 38, 0.055);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef6f3 0, var(--bg) 210px),
    var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.workspace {
  max-width: 1360px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(10, 56, 48, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #0f4d43, #17322e);
  padding: 12px 14px;
  box-shadow: 0 10px 26px rgba(15, 77, 67, 0.18);
  backdrop-filter: blur(8px);
}

.eyebrow {
  margin: 0 0 4px;
  color: #bde8dd;
  font-size: 12px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar h1 {
  color: #ffffff;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
}

h3 {
  margin-bottom: 0;
  font-size: 14px;
}

.actions,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions button {
  min-width: 96px;
}

.topbar .ghost {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.topbar .ghost:hover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.topbar .primary {
  border-color: #dff7ef;
  background: #f7fffc;
  color: #0f4d43;
}

.topbar .primary:hover {
  background: #e5f3ef;
  color: #0f4d43;
}

.primary,
.ghost,
.wide-button,
.file-upload {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.ghost,
.wide-button,
.file-upload {
  background: #fff;
  color: var(--ink);
}

.ghost:hover,
.wide-button:hover,
.file-upload:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 12px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.form-panel,
.competitors-panel,
.results-panel {
  padding: 13px;
}

.form-panel,
.competitors-panel {
  height: 100%;
}

.form-panel {
  display: flex;
  flex-direction: column;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 11px;
  border-bottom: 1px solid #eef3f1;
  padding-bottom: 9px;
}

.section-title span,
.hint,
#fileName {
  color: var(--muted);
  font-size: 12px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: #2e403b;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
  font-size: 13px;
  line-height: 1.45;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

textarea {
  resize: vertical;
  min-height: 58px;
}

.compact-textarea {
  min-height: 54px;
}

.source-textarea {
  min-height: 145px;
}

.source-field {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 180px;
}

.source-field textarea {
  flex: 1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.file-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  border: 1px dashed #cbdcd6;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 14px;
}

.file-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  margin: 0;
  background: #ffffff;
}

.file-upload input {
  display: none;
}

.overview {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #f7fbfa, #ffffff);
  padding: 12px;
}

.overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.overview-head h3 {
  color: #193c35;
}

.overview-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.score-pill {
  display: inline-flex;
  min-width: 52px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #0f4d43;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.overview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.overview-item {
  border: 1px solid #e2ebe7;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.overview-item strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: #21342f;
  font-size: 13px;
}

.status-pill {
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-done {
  background: #e2f5ef;
  color: #0f5b4b;
}

.status-partial {
  background: #fff4da;
  color: #8a5a00;
}

.status-empty {
  background: #eef2f1;
  color: #61706b;
}

.overview-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.competitor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff, #fbfdfc);
}

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

.card-head h3 {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 8px;
  background: #17322e;
  color: #ffffff;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.wide-button {
  width: 100%;
  margin-top: 12px;
}

.results-panel {
  margin-top: 14px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.5;
}

th {
  background: var(--accent-tint);
  color: #21342f;
  white-space: nowrap;
  font-weight: 800;
}

th:first-child,
td:first-child {
  width: 128px;
  background: #e8f4f0;
  color: #17322e;
  font-weight: 800;
  white-space: nowrap;
}

tbody tr:nth-child(even) td:first-child,
tbody tr:hover td:first-child {
  background: #dceee8;
  color: #17322e;
}

tbody tr:nth-child(even) {
  background: #fbfdfc;
}

tbody tr:hover {
  background: #f4faf7;
}

tr:last-child td {
  border-bottom: 0;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.result-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
  border-left: 3px solid rgba(22, 114, 95, 0.45);
}

.result-box h3 {
  margin-bottom: 8px;
  color: #1b3e36;
}

.result-box ul {
  margin: 0;
  padding-left: 18px;
}

.result-box li {
  margin: 6px 0;
  line-height: 1.5;
  font-size: 13px;
}

.result-box li::marker {
  color: var(--accent);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.warning {
  color: var(--warning);
}

@media (max-width: 1100px) {
  .app-shell {
    padding: 14px;
  }

  .grid,
  .result-grid,
  .overview-list,
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1;
  }
}
