:root {
  --primary: #07c160;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #333333;
  --label: #555555;
  --muted: #999999;
  --border: #e5e5e5;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--primary);
  color: #fff;
  padding-top: env(safe-area-inset-top);
}

.app-title {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  padding: 12px 0 6px;
}

.tabs {
  display: flex;
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  padding: 10px 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.tab.active {
  color: #fff;
  font-weight: 600;
  border-bottom-color: #fff;
}

.tab-panel { padding: 12px; }
.hidden { display: none !important; }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 8px 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.form-item {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  border-bottom: 1px solid #f2f2f2;
}

.form-item:last-child { border-bottom: none; }

.form-label { font-size: 14px; color: var(--label); margin-bottom: 6px; }
.form-label.required::after { content: " *"; color: #f5222d; }

.form-item input[type="text"],
.form-item input[type="number"],
.form-item input[type="date"],
.form-item input[type="time"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 15px;
  background: #fafafa;
  color: var(--text);
}

.form-item input:focus { border-color: var(--primary); background: #fff; outline: none; }

.check-item { flex-direction: row; align-items: center; justify-content: space-between; }
.check-item .form-label { margin-bottom: 0; flex: 0 0 auto; width: 130px; }
.radio-group { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.radio-group label { font-size: 14px; display: flex; align-items: center; gap: 4px; }

.total-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background: #f0fff4;
  border-radius: 8px;
  padding: 12px;
  margin-top: 4px;
}
.total-row .form-label { color: var(--primary); font-weight: 600; margin: 0; }
.total-value { font-size: 22px; font-weight: 700; color: var(--primary); }

.sign-area {
  position: relative;
  width: 100%;
  height: 160px;
  background: #fafafa;
  border: 2px dashed var(--border);
  border-radius: 10px;
  margin: 8px 0;
  touch-action: none;
}
#signatureCanvas { width: 100%; height: 100%; display: block; }
.sign-placeholder {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #bbb;
  font-size: 14px;
  pointer-events: none;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  height: 48px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}
.btn-primary:active { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.6; }

.btn-secondary {
  width: 100%;
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 10px;
  height: 42px;
  font-size: 15px;
  cursor: pointer;
  margin-top: 10px;
}

.btn-outline {
  width: 100%;
  background: #fff;
  color: var(--label);
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 42px;
  font-size: 15px;
  cursor: pointer;
  margin-top: 10px;
}

.sync-status { font-size: 12px; color: var(--muted); text-align: center; min-height: 16px; margin-top: 8px; }
.tips { font-size: 12px; color: var(--muted); text-align: center; margin: 10px 0 24px; }

.filter-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 8px 0; }
.filter-item { flex: 1; display: flex; flex-direction: column; }
.filter-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.filter-item input { height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; background: #fafafa; }
.filter-separator { padding-bottom: 10px; color: var(--muted); }

.summary-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.summary-item {
  width: calc(50% - 5px);
  background: #fff;
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}
.summary-number { font-size: 26px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.summary-label { font-size: 13px; color: var(--label); }

.tab-bar { display: flex; background: #f5f5f5; border-radius: 10px; padding: 4px; gap: 4px; }
.tab-inner {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--label);
  font-size: 14px;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
}
.tab-inner.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }

.list-card { padding: 0; overflow: hidden; }
.list-header, .list-row { display: flex; padding: 12px 10px; }
.list-header { background: #f8f8f8; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.list-row { border-bottom: 1px solid #f5f5f5; font-size: 13px; }
.list-row:last-child { border-bottom: none; }
.list-cell { flex: 1; text-align: center; }
.key-cell { flex: 1.5; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .key-cell { font-weight: 500; }
.list-cell.highlight { color: var(--primary); font-weight: 600; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-icon { font-size: 44px; margin-bottom: 10px; }

@media (min-width: 600px) {
  .tab-panel { max-width: 560px; margin: 0 auto; }
}
