:root {
  --bg: #f4f6f2;
  --ink: #111816;
  --muted: #68736d;
  --line: #dbe4dc;
  --green: #2f765f;
  --soft: #edf7f1;
  --side: #111619;
  --warn: #a85813;
  --shadow: 0 16px 40px rgba(21, 34, 28, 0.08);
  font-family:
    Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1280px;
  background: var(--bg);
  color: var(--ink);
}

aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 18px;
  background: var(--side);
  color: #fff;
}

.brand {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 16px;
}

.brand b {
  font-size: 19px;
}

.brand span,
aside p {
  color: #aeb9b3;
  font-size: 13px;
  line-height: 1.65;
}

aside a,
aside button,
.upload,
#exportBtn {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  margin-bottom: 10px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.ai-box {
  display: grid;
  gap: 9px;
  margin: 14px 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px;
}

.ai-box b {
  font-size: 15px;
}

.ai-box label,
.ai-box span {
  display: grid;
  gap: 5px;
  color: #aeb9b3;
  font-size: 12px;
  font-weight: 800;
}

.ai-box input,
.ai-box textarea,
.ai-box select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 9px 10px;
  background: #0c1113;
  color: #fff;
  outline: 0;
  font: inherit;
}

.ai-box input,
.ai-box select {
  min-height: 36px;
}

.ai-box textarea {
  resize: vertical;
  line-height: 1.45;
}

.ai-box button {
  margin-bottom: 0;
}

aside button + button {
  background: #1f2a2d;
}

aside a {
  background: #f2f5f0;
  color: #111816;
}

main {
  margin-left: 250px;
  padding: 22px;
}

header,
.panel,
.metrics > div,
.drop {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px;
  margin-bottom: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

header p,
.head p,
.drop span,
td small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.upload {
  width: auto;
  margin: 0;
  padding: 0 20px;
}

.upload input {
  display: none;
}

.drop {
  display: grid;
  gap: 8px;
  padding: 24px;
  margin-bottom: 14px;
  border-style: dashed;
  text-align: center;
}

.drop.dragging {
  border-color: var(--green);
  background: var(--soft);
}

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

.metrics > div {
  padding: 18px;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metrics b {
  display: block;
  margin-top: 5px;
  font-size: 30px;
}

.panel {
  margin-bottom: 14px;
  padding: 18px;
}

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

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

.actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.actions button:last-child {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

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

.sheet-item {
  display: flex;
  gap: 10px;
  min-height: 70px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfdfb;
  cursor: pointer;
}

.sheet-item.active {
  border-color: var(--green);
  background: var(--soft);
}

.sheet-item input {
  margin-top: 4px;
  accent-color: var(--green);
}

.sheet-item span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sheet-item b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-item small,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  display: block;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
}

.search {
  width: 360px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 700;
  outline: 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  max-height: 620px;
}

.summary-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  margin-bottom: 10px;
}

.summary-tabs button {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.summary-tabs button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.classified-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.summary-chip,
.summary-muted {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #fbfdfb;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.summary-chip b {
  color: #174a3a;
}

.sheet-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fbfdfb;
}

.sheet-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.sheet-summary h3 {
  margin: 0;
  font-size: 19px;
}

.copy-btn {
  min-height: 36px;
  border: 1px solid var(--green);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

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

.summary-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.summary-block.wide {
  grid-column: 1 / -1;
}

.summary-block b {
  display: block;
  margin-bottom: 8px;
  color: #174a3a;
}

.summary-block ul {
  margin: 0;
  padding-left: 18px;
}

.summary-block li {
  margin: 0 0 7px;
  color: #24322d;
  line-height: 1.55;
}

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

.segment-card {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  background: #fbfdfb;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.segment-card:hover {
  border-color: var(--green);
  background: var(--soft);
}

.segment-card span,
.segment-card em,
.segment-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.segment-card strong {
  display: block;
  margin: 5px 0;
  font-size: 15px;
}

.table-wrap.small {
  max-height: 430px;
}

.table-wrap.mid {
  max-height: 360px;
}

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

.small table {
  min-width: 720px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--soft);
  color: #174a3a;
  font-weight: 900;
}

tbody tr:hover {
  background: #fbfdfb;
}

.tagline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.tag.warn {
  background: #fff2e6;
  color: var(--warn);
}

.score {
  display: inline-flex;
  min-width: 48px;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--soft);
  color: var(--green);
  font-weight: 900;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.empty {
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.hidden {
  display: none;
}

.ai-output {
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fbfdfb;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.24);
}

.drawer.hidden {
  display: none;
}

.drawer-panel {
  width: min(1180px, calc(100vw - 280px));
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #fff;
  padding: 20px;
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.14);
}

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

.drawer-head button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.drawer-summary {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  margin-bottom: 12px;
}

.drawer-summary > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfdfb;
}

.drawer-summary b,
.drawer-summary span {
  display: block;
  line-height: 1.6;
}

.drawer-summary b {
  color: #174a3a;
}

.drawer-actions {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.drawer-table {
  max-height: calc(100vh - 250px);
}
