:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #edf7f5;
  --ink: #12201d;
  --muted: #66736f;
  --line: #d9e3df;
  --accent: #0f766e;
  --accent-2: #14532d;
  --warn: #b45309;
  --danger: #b91c1c;
  --shadow: 0 16px 40px rgba(20, 83, 45, 0.08);
}

* {
  box-sizing: border-box;
}

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

body.modal-open {
  overflow: hidden;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: #0b2f2b;
  color: #eefcf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #26a69a;
  font-weight: 900;
  color: white;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span,
.account span {
  color: #b6d8d1;
  font-size: 13px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  color: #d7f4ee;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.account {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.account button,
.ghost,
.primary,
.danger,
.mini,
.chips button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.account button {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.danger {
  border-color: #fecaca;
  background: #fee2e2;
  color: var(--danger);
}

.main {
  min-width: 0;
  padding: 22px;
}

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

.topbar p {
  margin: 0 0 4px;
  color: var(--accent);
  font-weight: 700;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions input {
  width: min(380px, 36vw);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric,
.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0;
  font-size: 26px;
}

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

.panel {
  padding: 16px;
}

.panel-head,
.module-toolbar,
.card-head,
.card-actions,
.dialog-head,
menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head {
  margin-bottom: 12px;
}

.panel h2,
.card h3,
.dialog-card h2 {
  margin: 0;
  letter-spacing: 0;
}

.panel-head span,
.card-head p,
.row p,
.activity p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.list,
.timeline {
  display: grid;
  gap: 10px;
}

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

.activity {
  display: block;
}

.activity span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent-2);
  font-size: 12px;
  white-space: nowrap;
}

.log {
  max-height: 260px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #d1fae5;
  white-space: pre-wrap;
  font-size: 12px;
}

.module-toolbar {
  margin-bottom: 12px;
}

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

.chips button.active {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--accent);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 14px;
}

.card h3 {
  font-size: 17px;
}

.card-body {
  flex: 1;
  color: #33433f;
  line-height: 1.65;
}

.mini {
  display: inline-flex;
  align-items: center;
  border-color: #ccfbf1;
  background: #f0fdfa;
  color: #0f766e;
  font-size: 13px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
}

dialog {
  width: min(760px, calc(100vw - 24px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.24);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 18px;
  background: rgba(6, 24, 20, 0.56);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.modal.hidden {
  display: none;
}

.modal .dialog-card {
  width: min(760px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.24);
}

.error-text {
  min-height: 20px;
  color: var(--danger);
  font-weight: 700;
}

dialog::backdrop {
  background: rgba(6, 24, 20, 0.48);
}

.dialog-card {
  padding: 18px;
}

.form {
  display: grid;
  gap: 14px;
}

.form p {
  margin: 0;
  color: var(--muted);
}

.form label {
  display: grid;
  gap: 6px;
  color: #33433f;
  font-weight: 700;
  font-size: 13px;
}

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

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

.icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

menu {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
}

.mobile-nav {
  display: none;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .cards {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 820px) {
  .shell {
    display: block;
    padding-bottom: 72px;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    display: grid;
    gap: 12px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
  }

  .top-actions input {
    width: 100%;
    grid-column: 1 / -1;
  }

  .metric-grid,
  .split,
  .cards,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .card {
    min-height: 0;
  }

  .module-toolbar {
    display: grid;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    padding: 7px 8px 9px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }

  .mobile-nav button {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
  }

  .mobile-nav button.active {
    background: var(--surface-2);
    color: var(--accent);
  }

  .mobile-nav span {
    font-weight: 800;
  }
}
