:root {
  --brand: #24735f;
  --brand-2: #3f8f75;
  --ink: #17252f;
  --muted: #687984;
  --line: #dce6e2;
  --page: #eef4f2;
  --panel: #ffffff;
  --warn: #b7791f;
  --danger: #bf3b35;
  --blue: #246f9d;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }

.app-shell {
  width: min(100vw, 440px);
  min-height: 100vh;
  margin: 0 auto;
  background: #f7faf9;
  position: relative;
  padding-bottom: 74px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(247, 250, 249, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px 8px;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800;
}
.brand h1 { margin: 0; font-size: 17px; line-height: 1.2; }
.brand p { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.api-chip {
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
}

.content { padding: 10px 10px 14px; }
.compact-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.metric {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}
.metric strong { display: block; font-size: 18px; color: var(--brand); }
.metric span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }

.toolbar {
  display: grid;
  grid-template-columns: 1fr 116px;
  gap: 8px;
  margin-bottom: 10px;
}
.toolbar.full { grid-template-columns: 1fr; }
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.input, .select, .textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}
.textarea { min-height: 76px; resize: vertical; }

.btn {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 11px;
  background: #e8f3ef;
  color: var(--brand);
  font-weight: 700;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.warn { background: #fff4df; color: var(--warn); }
.btn.danger { background: #ffede9; color: var(--danger); }
.btn.plain { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn.small { min-height: 30px; padding: 0 8px; font-size: 12px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  margin-bottom: 9px;
}
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-title { margin: 0; font-size: 15px; line-height: 1.35; }
.sub { color: var(--muted); font-size: 12px; line-height: 1.5; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 9px 0; }
.info-grid div { background: #f6f8f8; border-radius: 8px; padding: 7px; min-width: 0; }
.info-grid span { display: block; color: var(--muted); font-size: 11px; }
.info-grid strong { display: block; margin-top: 2px; font-size: 13px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  background: #edf6f2;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.pill.warn { background: #fff3dc; color: var(--warn); }
.pill.blue { background: #e8f2fb; color: var(--blue); }
.pill.gray { background: #edf1f1; color: var(--muted); }

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
}
th, td {
  padding: 9px 8px;
  text-align: left;
  border-bottom: 1px solid #edf2f0;
  white-space: nowrap;
}
th {
  background: #f4f8f7;
  color: #42525b;
  position: sticky;
  top: 0;
}
td.wrap { white-space: normal; min-width: 180px; line-height: 1.45; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, 440px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.97);
  border-top: 1px solid var(--line);
  z-index: 8;
}
.nav-btn {
  min-height: 46px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  display: grid;
  place-items: center;
  gap: 2px;
}
.nav-btn strong { font-size: 16px; line-height: 1; }
.nav-btn.active { background: #e8f3ef; color: var(--brand); font-weight: 800; }

.float-chat {
  position: fixed;
  right: calc((100vw - min(100vw, 440px)) / 2 + 14px);
  bottom: 86px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 12px 28px rgba(36, 115, 95, 0.24);
  font-weight: 800;
  z-index: 9;
}
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(12, 25, 31, 0.38);
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 14px;
}
.modal {
  width: min(100%, 420px);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px 12px 8px 8px;
  padding: 14px;
}
.modal h2 { margin: 0 0 12px; font-size: 17px; }
.form-grid { display: grid; gap: 8px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-actions { display: flex; gap: 8px; margin-top: 12px; }
.form-actions .btn { flex: 1; }

.chat-window {
  position: fixed;
  right: calc((100vw - min(100vw, 440px)) / 2 + 10px);
  bottom: 146px;
  width: min(330px, calc(100vw - 20px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(23, 37, 47, 0.18);
  z-index: 18;
  overflow: hidden;
}
.chat-head { padding: 10px; background: #eff7f4; display: flex; justify-content: space-between; gap: 8px; }
.chat-list { max-height: 210px; overflow: auto; padding: 10px; display: grid; gap: 7px; }
.bubble { padding: 8px 9px; border-radius: 8px; background: #f2f5f4; font-size: 13px; line-height: 1.45; }
.bubble.me { background: #e3f2eb; justify-self: end; }
.chat-send { display: grid; grid-template-columns: 1fr 62px; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.empty { padding: 22px 10px; color: var(--muted); text-align: center; }

@media (max-width: 360px) {
  .toolbar, .filters { grid-template-columns: 1fr; }
  .compact-band { grid-template-columns: 1fr 1fr; }
}

