/* ─── Reset & Base (参照BR: navy dark + soft blue) ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #4b7fb3;         --primary-dark: #2d4c6b;
  --primary-light: #90b0d0;   --primary-dim: rgba(75,127,179,.12);
  --dark: #061830;            --dark-light: #0d2240;
  --bg: linear-gradient(135deg, #061830 0%, #0d2240 100%);
  --card-bg: #132a4a;         --card-bg-hover: #1a3355;
  --nav-bg: #0a1e3a;         --float-bg: #162f50;
  --text: #e8edf2;           --text-dim: #90a8c0;
  --text-muted: #5a7a9a;
  --border: rgba(75,127,179,.2); --border-light: rgba(75,127,179,.1);
  --danger: #e74c3c;         --success: #43e97b;
  --radius-sm: 8px;          --radius: 12px;          --radius-lg: 16px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,.2);
  --shadow: 0 4px 12px rgba(0,0,0,.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.3);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg); background-attachment: fixed;
  color: var(--text); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--primary-light); 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: .65rem .85rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: .9rem;
  transition: border-color .15s;
}
input:focus { border-color: var(--primary-light); }
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: .6rem 1.1rem; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 500; cursor: pointer;
  transition: all .15s;
  background: var(--card-bg); color: var(--text);
  border: 1px solid var(--border);
}
.btn:hover { background: var(--card-bg-hover); border-color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-block { width: 100%; }

/* ─── Page Container ─── */
.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(--primary-light); }

/* ─── 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);
  backdrop-filter: blur(8px);
}
.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(--primary-light); }
.nav-bar .action { font-size: .84rem; color: var(--primary-light); cursor: pointer; }
.nav-bar .action:hover { color: #fff; }

/* ─── 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;
  backdrop-filter: blur(8px);
}
.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-light); }
.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(6,24,48,.75); backdrop-filter: blur(4px);
  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-light); 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: rgba(75,127,179,.1); color: var(--primary-light);
  font-weight: 500; position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(75,127,179,.06); }

/* ─── 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 6px rgba(75,127,179,.4);
}
.score-value { min-width: 2.5rem; text-align: center; font-weight: 600; font-size: 1rem; }

/* ─── Tab bar inside page ─── */
.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);
}
.badge-draft { background: #5a7a9a; }
.badge-active { background: var(--primary); }
.badge-scored { background: var(--success); color: #061830; }
.badge-signed { background: #9b59b6; }

/* ─── Signature Pad ─── */
.signature-pad {
  border: 1px dashed rgba(255,255,255,.3);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.9); 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-light); }
.right { text-align: right; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
h4 { font-size: .95rem; color: var(--primary-light); font-weight: 500; }
