:root {
  --primary: #3b5bfd;
  --primary-dark: #2c45d8;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #6b7280;
  --border: #e5e9f2;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #b45309;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--red); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; border-color: var(--red); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.input, .select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 91, 253, .12); }
.input.inline, .select.inline { width: auto; }

label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); display: inline-block; }
.user-chip { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }

.tabs { display: flex; gap: 4px; margin: 20px 0 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}
.range-row:last-child { border-bottom: none; }
.day-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.day-row:last-child { border-bottom: none; }
.day-label { width: 56px; font-weight: 600; font-size: 14px; flex-shrink: 0; }

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

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.badge.green { background: #dcfce7; color: var(--green); }
.badge.gray { background: #f3f4f6; color: var(--muted); }
.badge.red { background: #fee2e2; color: var(--red); }
.badge.blue { background: #dbeafe; color: #1d4ed8; }

.empty { text-align: center; color: var(--muted); padding: 36px 0; font-size: 14px; }
.hint { background: #f0f4ff; border: 1px solid #d6e0ff; color: #3348b0; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin: 12px 0; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; text-align: center; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.qr-frame { width: 220px; height: 220px; border: 1px solid var(--border); border-radius: 12px; margin: 0 auto; overflow: hidden; background: #fff; }
.qr-frame iframe { width: 100%; height: 100%; border: none; }

.slots-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 24px 0; }
.date-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.date-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
}
.date-chip .d { font-weight: 700; font-size: 15px; display: block; }
.date-chip.active { border-color: var(--primary); background: var(--primary); color: #fff; }

.slot-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.slot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s;
}
.slot-item:hover { border-color: var(--primary); }
.slot-time { font-weight: 700; font-size: 16px; }
.slot-duration { color: var(--muted); font-size: 13px; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal h3 { margin-bottom: 4px; }
.modal .close { float: right; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }

.success-icon { width: 56px; height: 56px; border-radius: 50%; background: #dcfce7; color: var(--green); display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 12px; }
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px;
  z-index: 99; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

.code-box {
  background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px;
  padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; word-break: break-all;
}

.hidden { display: none !important; }

.spin { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
