:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #1e2528;
  --muted: #687076;
  --line: #d9d3c8;
  --accent: #b5212d;
  --accent-dark: #821923;
  --teal: #176b6b;
  --gold: #a96d19;
  --soft-red: #fff2f3;
  --soft-teal: #edf8f7;
  --shadow: 0 14px 40px rgba(32, 30, 25, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(440px, 100%);
}

.login-panel {
  padding: 24px;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

input[type="password"] {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 3;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

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

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

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
}

.nav-link.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  gap: 18px;
  padding: 22px clamp(20px, 4vw, 56px) 48px;
}

.upload-layout {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
}

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

.search-panel {
  grid-row: span 3;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
  margin: 16px 0;
}

input[type="search"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

input[type="search"] {
  height: 42px;
  padding: 0 13px;
}

textarea {
  resize: vertical;
  min-height: 180px;
  padding: 12px;
  line-height: 1.55;
}

input[type="search"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 107, 107, 0.12);
}

button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button.secondary {
  background: #fff;
  color: var(--accent);
}

.result-area {
  min-height: 120px;
}

.notice {
  padding: 16px;
  border-radius: 8px;
  background: var(--soft-red);
  color: var(--accent-dark);
  border: 1px solid #f0c8ca;
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdfa;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.metric strong {
  display: block;
  font-size: 20px;
  line-height: 1.2;
}

.rating-buy-now {
  color: #c00000;
}

.rating-buy {
  color: var(--ink);
}

.status-pill,
.status-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.status-tag {
  margin-left: 8px;
  vertical-align: middle;
}

.section-block {
  margin-top: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.data-table th {
  background: var(--soft-teal);
  color: #123d3d;
  font-size: 13px;
}

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

.text-stack {
  display: grid;
  gap: 10px;
}

.text-item {
  border-left: 4px solid var(--gold);
  padding: 10px 12px;
  background: #fff9ed;
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.text-item b {
  display: block;
  margin-bottom: 4px;
}

.recent-positive {
  background: #fff68c;
  border-color: #e5c900;
  color: #3b3400;
}

.recent-negative {
  background: #e5e5e5;
  border-color: #8a8f94;
  color: #2e3338;
}

.recent-neutral {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.text-item.recent-positive {
  border-left-color: #d8b100;
}

.text-item.recent-negative {
  border-left-color: #747a80;
}

.text-item.recent-neutral {
  border-left-color: var(--line);
}

.change-list {
  display: grid;
  gap: 10px;
  padding-top: 14px;
}

.change-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  line-height: 1.55;
  background: #fff;
}

.opinion-text {
  padding-top: 14px;
  white-space: pre-wrap;
  line-height: 1.65;
}

.legend-list {
  display: grid;
  gap: 10px;
  padding-top: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.legend-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 24px;
  font-weight: 900;
}

.legend-swatch {
  display: inline-block;
  width: 58px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  flex: 0 0 auto;
}

details {
  margin-top: 16px;
}

summary {
  cursor: pointer;
  color: var(--teal);
  font-weight: 800;
}

.upload-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.file-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed var(--teal);
  border-radius: 8px;
  background: var(--soft-teal);
  color: #123d3d;
  font-weight: 800;
}

.file-box input {
  font: inherit;
}

.textarea-label {
  font-weight: 800;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.status-line {
  min-height: 24px;
  margin-top: 12px;
  font-weight: 800;
}

.status-line.ok {
  color: var(--teal);
}

.status-line.error {
  color: var(--accent);
}

@media (max-width: 900px) {
  .topbar,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  nav {
    width: 100%;
    justify-content: flex-start;
  }

  .layout,
  .upload-layout {
    grid-template-columns: 1fr;
  }

  .search-panel {
    grid-row: auto;
  }

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

@media (max-width: 520px) {
  h1 {
    font-size: 24px;
  }

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

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

  .panel {
    padding: 14px;
  }
}
