/* ─── Reset & Base (浅色主题) ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #4b7fb3;         --primary-dark: #3a6a99;
  --primary-light: #6a9fd6;   --primary-dim: rgba(75,127,179,.08);
  --bg: #f0f2f5;              --bg-light: #f8f9fa;
  --card-bg: #fff;            --card-hover: #f5f7fa;
  --nav-bg: #fff;             --float-bg: #fff;
  --text: #1a1a2e;           --text-dim: #6c757d;
  --text-muted: #adb5bd;
  --border: #dee2e6;         --border-light: #e9ecef;
  --danger: #e74c3c;         --success: #28a745;
  --radius-sm: 8px;          --radius: 12px;          --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 2px 8px rgba(0,0,0,.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.12);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--primary); text-decoration: none; }
input, button, select, textarea {
  font: inherit; color: inherit; outline: none; border: none;
}
.hidden { display: none !important; }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); font-size: .85rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; } .flex-1 { flex: 1; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }

/* ─── Form ─── */
input[type="text"], input[type="number"], input[type="date"],
input[type="tel"], input[type="password"], select, textarea {
  width: 100%; padding: .6rem .85rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: .9rem;
  transition: border-color .15s;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--bg-light) inset !important;
  -webkit-text-fill-color: var(--text) !important;
}
input:focus { border-color: var(--primary); }
label { display: block; font-size: .82rem; color: var(--text-dim); margin-bottom: .25rem; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .35rem; padding: .55rem 1rem; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 500; cursor: pointer;
  transition: all .15s;
  background: var(--bg-light); color: var(--text);
  border: 1px solid var(--border);
}
.btn:hover { background: var(--card-hover); border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fce4e4; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; }

/* ─── Page ─── */
.page { display: none; padding: 1rem; max-width: 800px; margin: 0 auto; }
.page.active { display: block; }
.page-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 1rem; color: var(--text); }

/* ─── Card ─── */
.card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 1rem; margin-bottom: .65rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

/* ─── Nav Bar ─── */
.nav-bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--nav-bg); padding: .65rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.nav-bar .back { font-size: 1.3rem; cursor: pointer; padding: .2rem .4rem; color: var(--text); }
.nav-bar .title { font-weight: 600; flex: 1; color: var(--text); }
.nav-bar .action { font-size: .84rem; color: var(--primary); cursor: pointer; }
.nav-bar .action:hover { color: var(--primary-dark); }

/* ─── Bottom Tab ─── */
.bottom-tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--nav-bg);
  border-top: 1px solid var(--border); z-index: 10;
}
.bottom-tabs .tab {
  flex: 1; text-align: center; padding: .45rem 0 .35rem;
  font-size: .68rem; color: var(--text-muted); cursor: pointer;
  transition: color .15s;
}
.bottom-tabs .tab.active { color: var(--primary); }
.bottom-tabs .tab .icon { font-size: 1.25rem; display: block; margin-bottom: .05rem; }

/* ─── Toast ─── */
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: var(--float-bg); color: var(--text);
  padding: .55rem 1.1rem; border-radius: var(--radius-sm);
  z-index: 100; font-size: .88rem;
  box-shadow: var(--shadow);
  transition: opacity .3s;
  border: 1px solid var(--border);
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* ─── Loading ─── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center; z-index: 99;
}
.spinner { width: 30px; height: 30px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Table ─── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm);
  border: 1px solid var(--border-light); }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
th, td { padding: .45rem .55rem; text-align: left;
  border-bottom: 1px solid var(--border-light); }
th { background: var(--bg-light); color: var(--text-dim);
  font-weight: 500; position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--primary-dim); }

/* ─── Slider ─── */
.score-slider-wrap { display: flex; align-items: center; gap: .75rem; }
.score-slider-wrap input[type="range"] {
  flex: 1; -webkit-appearance: none; height: 4px;
  background: var(--border); border-radius: 2px; cursor: pointer;
}
.score-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px;
  background: var(--primary); border-radius: 50%; cursor: pointer;
  box-shadow: 0 0 4px rgba(75,127,179,.3);
}
.score-value { min-width: 2.5rem; text-align: center; font-weight: 600; font-size: 1rem; }

/* ─── Page tabs ─── */
.page-tabs {
  display: flex; gap: 0; margin-bottom: .8rem;
  background: var(--card-bg); border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border);
}
.page-tabs .tab-item {
  flex: 1; text-align: center; padding: .5rem; font-size: .84rem;
  cursor: pointer; color: var(--text-dim); transition: all .15s;
}
.page-tabs .tab-item.active {
  background: var(--primary); color: #fff; font-weight: 500;
}

/* ─── Badge ─── */
.badge {
  display: inline-block; padding: .1rem .4rem; border-radius: 3px;
  font-size: .73rem; background: var(--border-light);
  color: var(--text-dim);
}
.badge-draft { background: #e9ecef; color: #6c757d; }
.badge-active { background: var(--primary); color: #fff; }
.badge-scored { background: var(--success); color: #fff; }
.badge-signed { background: #6f42c1; color: #fff; }

/* ─── Signature Pad ─── */
.signature-pad {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-light); cursor: crosshair;
  touch-action: none; width: 100%; height: 150px;
}

/* ─── Misc ─── */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state .icon { font-size: 2.8rem; margin-bottom: .4rem; display: block; }
.list-item { padding: .7rem 0; border-bottom: 1px solid var(--border-light);
  cursor: pointer; }
.list-item:last-child { border-bottom: none; }
.list-item:hover { color: var(--primary); }
.right { text-align: right; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
h4 { font-size: .95rem; color: var(--text); font-weight: 500; }
