﻿:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --panel: #ffffff;
  --ink: #1f2926;
  --muted: #66736e;
  --line: #dfe5df;
  --accent: #16715f;
  --accent-strong: #0f5b4d;
  --gold: #b07d2b;
  --rose: #b94f5e;
  --soft: #eef4ef;
  --shadow: 0 18px 45px rgba(31, 41, 38, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: #182522;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e6be65;
  color: #182522;
  font-weight: 800;
  font-size: 22px;
}

.brand h1,
.brand p,
.page-head h2,
.page-head p,
.panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
  line-height: 1.2;
}

.brand p {
  color: #a8b8b2;
  margin-top: 5px;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #d9e4df;
  padding: 12px 14px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #263734;
  border-color: #40534e;
  color: white;
}

.storage-card {
  margin-top: auto;
  border: 1px solid #40534e;
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
  background: #20312e;
}

.storage-card span {
  color: #b8c7c2;
}

.storage-card strong {
  font-size: 36px;
}

#currentUser {
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
}

main {
  padding: 34px;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.page-head h2 {
  font-size: 28px;
  line-height: 1.25;
}

.page-head p {
  color: var(--muted);
  margin-top: 8px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.quick-questions button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 16px;
  white-space: nowrap;
}

.primary-btn {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 22px rgba(22, 113, 95, 0.2);
}

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

.secondary-btn {
  background: #eaf1ed;
  color: var(--accent-strong);
}

.danger-btn {
  background: #fff0f1;
  color: #9e3142;
}

.hidden {
  display: none !important;
}

.drop-zone {
  min-height: 230px;
  border: 2px dashed #aec2b7;
  border-radius: 8px;
  background: #fbfdfb;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 34px;
  gap: 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone.dragging {
  background: #edf8f4;
  border-color: var(--accent);
}

.drop-zone input {
  display: none;
}

.upload-icon {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--accent);
  font-size: 34px;
  font-weight: 300;
}

.drop-zone small {
  color: var(--muted);
}

.panel,
.answer-box,
.ask-box,
.detail-panel {
  margin-top: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.upload-log {
  display: grid;
  gap: 10px;
}

.log-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
}

.log-item strong {
  display: block;
  margin-bottom: 6px;
}

.warning {
  margin: 7px 0 10px;
  color: #9a5b13;
  line-height: 1.45;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  border-radius: 999px;
  background: #edf4f1;
  color: #315d53;
  padding: 5px 9px;
  font-size: 12px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 220px;
  gap: 12px;
  margin-bottom: 16px;
}

.filters input,
.filters select,
.ask-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

.filters input:focus,
.filters select:focus,
.ask-box textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 113, 95, 0.12);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1900px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  white-space: pre-line;
  line-height: 1.45;
}
/* ---- wider columns ---- */
th:nth-child(2),
td:nth-child(2) {
  min-width: 100px;
}

th:nth-child(3),
td:nth-child(3) {
  min-width: 180px;
}

th:nth-child(6),
td:nth-child(6) {
  min-width: 90px;
  padding-left: 20px;
  padding-right: 20px;
}

th:nth-child(7),
td:nth-child(7),
th:nth-child(8),
td:nth-child(8),
th:nth-child(9),
td:nth-child(9),
th:nth-child(10),
td:nth-child(10),
th:nth-child(11),
td:nth-child(11),
th:nth-child(12),
td:nth-child(12),
th:nth-child(13),
td:nth-child(13) {
  min-width: 130px;
}

th:nth-child(14),
td:nth-child(14) {
  min-width: 260px;
  max-width: 360px;
}


th {
  color: #51625d;
  font-weight: 700;
  background: #f1f5f1;
  font-size: 13px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #eef7f3;
}

.empty {
  color: var(--muted);
}

.detail-panel,
.answer-box {
  padding: 18px;
}

.detail-delete-btn {
  margin-top: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

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

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

.field strong {
  display: block;
  white-space: pre-line;
  line-height: 1.45;
}

.order-image {
  max-width: 200px;
  max-height: 150px;
  display: block;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f6f4;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.order-image:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.field .order-image {
  max-width: 100%;
  max-height: 360px;
}

.order-image.broken {
  opacity: 0.4;
  cursor: default;
}

.order-image.broken:hover {
  transform: none;
  box-shadow: none;
}

/* ---- image lightbox ---- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}


.ask-box {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(320px, 1fr);
  gap: 18px;
}

.account-card,
.login-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.account-card h3,
.login-card h2,
.login-card p {
  margin-top: 0;
}

.account-card label,
.login-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
}

.account-card input,
.login-card input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
}

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

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.account-row span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.form-message {
  min-height: 20px;
  color: #9a5b13;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 37, 34, 0.72);
}

.login-card {
  width: min(420px, 100%);
}

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

.quick-questions button {
  background: #f0f4f2;
  color: #305e54;
}

.answer-title {
  font-weight: 800;
  margin-bottom: 10px;
}

.source {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.source-title {
  color: var(--accent-strong);
  font-weight: 700;
}

blockquote {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-left: 4px solid var(--gold);
  background: #fffaf0;
  color: #514332;
  border-radius: 0 8px 8px 0;
  white-space: pre-line;
  line-height: 1.5;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .filters,
  .detail-grid,
  .account-layout {
    grid-template-columns: 1fr;
  }

  main {
    padding: 22px;
  }

  .page-head {
    flex-direction: column;
  }
}



/* ---- AI answer ---- */
.ai-answer {
  line-height: 1.75;
}

.ai-answer p {
  margin: 0 0 10px;
}

.ai-answer strong {
  color: var(--accent-strong);
}

.ai-meta {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

/* ---- pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
  padding: 12px 0;
}

.pagination span {
  font-size: 14px;
  color: var(--muted);
  min-width: 120px;
  text-align: center;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.answer-line {
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.answer-line:hover {
  background: #eef7f3;
  color: var(--accent-strong);
}
