:root {
  --accent: #3D7BF5;
  --accent-deep: #1B4DD8;
  --accent-soft: rgba(61, 123, 245, 0.14);
  --accent-text: #9CC0FF;

  --success: #3ED6A4;
  --success-bg: rgba(62, 214, 164, 0.13);
  --success-text: #6FE7C1;

  --warning-bg: rgba(255, 181, 71, 0.14);
  --warning-text: #FFC978;

  --danger: #FF6B6B;
  --danger-bg: rgba(255, 107, 107, 0.13);
  --danger-text: #FF9A9A;

  --surface-0: #0A0F19;
  --surface-1: #161E2E;
  --surface-2: #0E1420;
  --surface-3: #1C2637;

  --text-primary: #F2F5FA;
  --text-secondary: #8FA3C0;
  --text-muted: #6B7A94;

  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  --radius: 14px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }

html { background: var(--surface-0); }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--surface-0);
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface-2);
  padding: 20px 16px 100px;
  position: relative;
}

.center-shell {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  background: var(--surface-2);
}

h1, h2, h3 { font-weight: 500; margin: 0; letter-spacing: -0.2px; }
h1 { font-size: 22px; }
h2 { font-size: 15px; color: var(--text-primary); }
p { margin: 0; }

.label {
  font-size: 11px;
  color: var(--text-muted);
  margin: 16px 0 7px;
  display: block;
  letter-spacing: 0.3px;
}
.label:first-child { margin-top: 0; }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238FA3C0' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
input[type="date"] { color-scheme: dark; }
textarea { height: auto; padding: 12px 14px; min-height: 72px; resize: vertical; line-height: 1.6; }
::placeholder { color: var(--text-muted); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button { font-family: inherit; cursor: pointer; }

.btn {
  height: 50px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s, filter 0.15s;
}
.btn:active { transform: scale(0.985); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  border: none;
  color: #fff;
  box-shadow: 0 4px 16px rgba(27, 77, 216, 0.35);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
}
.btn-sm { height: 36px; font-size: 12px; }

.seg { display: grid; gap: 8px; margin-bottom: 4px; }
.seg button {
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-1);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.seg button:hover { border-color: var(--border-strong); color: var(--text-primary); }
.seg button.active {
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  border-color: transparent;
  color: #fff;
  font-weight: 500;
}

.card {
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s, background 0.15s;
}
a.card:hover { border-color: var(--border-strong); background: var(--surface-3); }

.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}
.stat-card .label { color: var(--text-muted); margin: 0 0 4px; }
.stat-card .value {
  font-size: 30px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.stat-card-accent {
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  border: none;
  box-shadow: 0 6px 22px rgba(27, 77, 216, 0.3);
}
.stat-card-accent .label { color: rgba(255, 255, 255, 0.72); }
.stat-card-accent .value { color: #fff; }

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

.pill {
  font-size: 11px;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 500;
  white-space: nowrap;
}
.pill-success { background: var(--success-bg); color: var(--success-text); }
.pill-warning { background: var(--warning-bg); color: var(--warning-text); }

.row { display: flex; justify-content: space-between; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }

.muted { color: var(--text-secondary); font-size: 13px; }
.hint { color: var(--text-muted); font-size: 12px; line-height: 1.5; }

.divider { border-top: 1px solid var(--border); margin: 20px 0; }

.bottom-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--surface-2) 72%, rgba(14, 20, 32, 0));
  padding: 16px 0 10px;
}

.nav-tabs {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(22, 30, 46, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 0 12px;
}
.nav-tabs a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  padding-top: 6px;
  transition: color 0.15s;
}
.nav-tabs a.active { color: var(--accent); font-weight: 500; }
.nav-tabs .icon { font-size: 20px; display: block; margin-bottom: 3px; filter: grayscale(1) opacity(0.6); }
.nav-tabs a.active .icon { filter: none; }

.error-box {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(255, 107, 107, 0.25);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.error-box.show { display: block; }

.star-row { display: flex; gap: 8px; margin-bottom: 4px; }
.star-row .star {
  font-size: 28px;
  cursor: pointer;
  color: var(--border-strong);
  transition: color 0.15s, transform 0.1s;
}
.star-row .star:active { transform: scale(1.15); }
.star-row .star.on { color: #FFC24B; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data-table th, table.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 6px;
  text-align: left;
}
table.data-table th { color: var(--text-muted); font-weight: 500; }

.bar-row { margin-bottom: 12px; }
.bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 6px;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  border-radius: 6px;
  transition: width 0.4s ease;
}

.empty-state {
  text-align: center;
  padding: 44px 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.spinner-text { text-align: center; color: var(--text-muted); font-size: 13px; padding: 24px; }
