:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #18201d;
  --muted: #66736d;
  --line: #dfe7e3;
  --green: #1f8a63;
  --green-dark: #17694d;
  --coral: #e45c3f;
  --amber: #bd7b18;
  --blue: #2869b8;
  --shadow: 0 18px 40px rgba(25, 47, 39, .09);
}

* { box-sizing: border-box; }

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

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #10231d;
  color: #f6fbf8;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 14px;
  border-bottom: 1px solid rgba(255,255,255,.14);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #25a474;
  font-weight: 800;
  font-size: 22px;
}

.brand strong, .brand span { display: block; }
.brand span { margin-top: 4px; color: #b8cbc3; font-size: 12px; }

.side-nav, .mobile-tabs, .role-switch { display: flex; gap: 8px; }
.side-nav { flex-direction: column; }

.nav-btn, .role-btn, .tab-btn, .icon-btn {
  border: 0;
  cursor: pointer;
  transition: .18s ease;
}

.nav-btn {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #dce9e4;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn.active, .nav-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

.notice {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 8px;
  background: rgba(255,255,255,.07);
}

.notice span { color: #9fd7c2; font-size: 12px; }
.notice strong { display: block; margin-top: 8px; font-size: 13px; line-height: 1.6; }

.workspace { padding: 28px; min-width: 0; }

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

.topbar p { margin: 0 0 6px; color: var(--green); font-weight: 700; }
.topbar h1 { margin: 0; font-size: 28px; line-height: 1.25; letter-spacing: 0; }

.role-switch {
  padding: 4px;
  background: #e7eeea;
  border-radius: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.role-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.role-btn.active { background: var(--panel); color: var(--ink); box-shadow: 0 6px 16px rgba(0,0,0,.08); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 8px; font-size: 25px; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr);
  gap: 18px;
  align-items: start;
}

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

.panel-head {
  min-height: 58px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2 { margin: 0; font-size: 17px; letter-spacing: 0; }
.panel-body { padding: 16px; }

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

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: #fff;
}

.item-main {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: #e7eeea;
}

.receipt-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.shot-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-shot {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfa;
}

.money-thumb {
  display: grid;
  place-items: center;
  color: var(--green-dark);
  font-weight: 900;
  font-size: 24px;
}

.title { margin: 0 0 6px; font-weight: 800; line-height: 1.35; }
.meta { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

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

.tag {
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf4f0;
  color: var(--green-dark);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}

.tag.warn { background: #fff0db; color: var(--amber); }
.tag.blue { background: #eaf2ff; color: var(--blue); }
.tag.red { background: #ffece8; color: var(--coral); }

.primary, .secondary, .danger {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary { background: var(--green); color: white; }
.primary:hover { background: var(--green-dark); }
.secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.danger { background: #fff2ef; color: var(--coral); border-color: #ffd5cc; }

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

.task-type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border-radius: 8px;
  background: #e7eeea;
}

.task-type-switch button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.task-type-switch button.active {
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

.form-grid { display: grid; gap: 12px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 10px;
  background: #fbfdfc;
  color: var(--ink);
}
.field textarea { min-height: 88px; resize: vertical; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e8efeb;
  overflow: hidden;
}
.progress span { display: block; height: 100%; background: var(--green); }

.stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.stepper span {
  min-height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #edf2ef;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.stepper span.done {
  background: #dff3ea;
  color: var(--green-dark);
  font-weight: 800;
}

.stepper.failed span:first-child {
  background: #ffece8;
  color: var(--coral);
  font-weight: 800;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.table th { color: var(--muted); font-weight: 700; background: #f8fbfa; }

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

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #10231d;
  color: #fff;
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .workspace { padding: 18px 14px 82px; }
  .topbar { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .mobile-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    padding: 8px;
    background: rgba(255,255,255,.96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 24px rgba(0,0,0,.08);
  }
  .tab-btn {
    flex: 1;
    min-height: 46px;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
  }
  .tab-btn.active { background: #e8f4ef; color: var(--green-dark); font-weight: 800; }
}

@media (max-width: 620px) {
  .topbar h1 { font-size: 23px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; }
  .stat strong { font-size: 20px; }
  .item-main { grid-template-columns: 60px minmax(0, 1fr); }
  .item-main > .actions { grid-column: 1 / -1; }
  .thumb { width: 60px; height: 60px; }
  .two-col { grid-template-columns: 1fr; }
  .table { min-width: 560px; }
  .table-wrap { overflow-x: auto; }
  .role-switch { width: 100%; justify-content: stretch; }
  .role-btn { flex: 1; padding: 0 8px; }
}
