:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --page: #f4f7fb;
  --accent: #2f6fef;
  --accent-dark: #1f56c8;
  --ok: #16794c;
  --warn: #9a5b00;
  --danger: #a83a3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  font-size: 17px;
  line-height: 1.4;
}

#healthText {
  margin-top: 8px;
  color: var(--muted);
}

.actions,
.searchbar,
.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

button,
.button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

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

#scanBtn,
#searchBtn,
#syncBtn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#syncBtn {
  background: var(--ok);
  border-color: var(--ok);
}

.sync-status {
  margin: -6px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  margin-bottom: 16px;
}

.searchbar input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

.searchbar button {
  width: 72px;
}

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

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

.panel-title {
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title span {
  color: var(--muted);
}

.case-list,
.file-list,
.log-list {
  max-height: 62vh;
  overflow: auto;
}

.case-item,
.file-item,
.log-item {
  display: grid;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid #edf1f6;
}

.case-item {
  cursor: pointer;
}

.case-item:hover,
.case-item.active {
  background: #eef5ff;
}

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

.name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef2f7;
  color: #42526b;
  font-size: 12px;
}

.badge.deleted {
  background: #fdecec;
  color: var(--danger);
}

.badge.manual {
  background: #e8f6ef;
  color: var(--ok);
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.file-actions a {
  color: var(--accent-dark);
  text-decoration: none;
}

.send-btn {
  min-height: 28px;
  border-color: var(--accent);
  background: #eef5ff;
  color: var(--accent-dark);
  padding: 0 10px;
  font-size: 12px;
}

.send-btn:disabled {
  cursor: default;
  opacity: 0.72;
}

.empty {
  padding: 18px 16px;
  color: var(--muted);
}

.logs-panel {
  margin-top: 16px;
}

.log-item {
  grid-template-columns: 150px 80px minmax(0, 1fr);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .topbar,
  .layout {
    display: block;
  }

  .actions {
    margin-top: 14px;
  }

  .detail-panel {
    margin-top: 16px;
  }
}
