:root {
  color-scheme: light;
  --page: #eef2f6;
  --panel: #ffffff;
  --text: #15191f;
  --muted: #667085;
  --line: #d8dde6;
  --danger: #c3261f;
  --success: #067647;
  --focus: #155eef;
  --ink: #101828;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--page); }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--text); }
button, input, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
  background: var(--panel);
}
.top-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.brand-logo { width: min(52vw, 210px); height: auto; display: block; }
.admin-login-button {
  min-width: 56px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}
.page-title { margin: 2px 0 18px; }
h1 { margin: 0 0 8px; font-size: 23px; line-height: 1.25; letter-spacing: 0; }
p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.ok { color: var(--success); font-weight: 800; }
.warn { color: #9a6700; font-weight: 800; }
.leave-form { display: grid; gap: 16px; }
.form-section, .check-list { display: grid; gap: 10px; }
.field-label, .check-row > span { font-size: 16px; line-height: 1.35; font-weight: 800; }
b { color: var(--danger); }
textarea, .admin-dialog input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  padding: 12px;
  outline: none;
}
textarea { min-height: 94px; resize: vertical; }
textarea:focus, .admin-dialog input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.12); }
.floor-grid, .switches { display: grid; gap: 8px; }
.floor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.switches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.floor-grid label, .switches label {
  position: relative;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}
.floor-grid input, .switches input { position: absolute; opacity: 0; pointer-events: none; }
.floor-grid label:has(input:checked), .switches label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.check-list { gap: 14px; }
.check-row { display: grid; gap: 8px; }
.camera-box {
  min-height: 230px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.camera-placeholder { color: var(--muted); font-size: 15px; font-weight: 700; text-align: center; padding: 18px; }
.camera-placeholder::before {
  content: "📷";
  display: block;
  margin-bottom: 8px;
  font-size: 28px;
}
.camera-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
#photo-preview { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
#camera-view[hidden],
#photo-preview[hidden],
#photo-canvas[hidden],
#camera-placeholder[hidden] {
  display: none;
}
#photo-preview[hidden] { display: none; }
.camera-box.has-photo {
  min-height: 0;
  aspect-ratio: auto;
  display: block;
  background: #fff;
  overflow: visible;
}
.camera-box.has-photo #photo-preview {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}
.camera-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.camera-actions button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}
#start-camera, #capture-photo { grid-column: 1 / -1; background: var(--focus); color: #fff; border-color: var(--focus); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0.01; overflow: hidden; pointer-events: none; }
.camera-status { min-height: 20px; font-size: 14px; font-weight: 800; }
.camera-status.ok { color: var(--success); }
.camera-status.error { color: var(--danger); }
.submit-bar {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 10px;
  margin: 4px -14px -22px;
  padding: 10px 14px max(14px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
}
.time-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.time-card strong { color: var(--ink); font-size: 14px; }
.submit-button { border: 0; border-radius: 6px; min-height: 52px; padding: 12px 18px; background: #020b12; color: #fff; font-size: 18px; font-weight: 800; }
.submit-button:disabled { cursor: wait; opacity: 0.72; }
.status-message { min-height: 22px; font-size: 15px; font-weight: 800; }
.status-message.success { color: var(--success); }
.status-message.error { color: var(--danger); }
.admin-dialog { width: min(92vw, 360px); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28); }
.admin-dialog::backdrop { background: rgba(15, 23, 42, 0.42); }
.admin-dialog form { display: grid; gap: 14px; padding: 20px; }
.admin-dialog h2 { margin: 0; font-size: 20px; }
.admin-login-status { min-height: 20px; color: var(--danger); font-size: 14px; font-weight: 800; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dialog-actions button { min-height: 42px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-weight: 800; }
.dialog-actions .primary { background: #020b12; color: #fff; border-color: #020b12; }
.permission-dialog {
  width: min(88vw, 360px);
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: transparent;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.28);
}
.permission-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
}
.permission-card {
  display: grid;
  gap: 12px;
  padding: 22px 18px 16px;
  border-radius: 18px;
  background: #fff;
  text-align: center;
}
.permission-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 2px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #eef4ff;
  font-size: 28px;
}
.permission-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.35;
}
.permission-card p {
  color: var(--muted);
  font-size: 14px;
}
.permission-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  margin-top: 4px;
}
.permission-actions button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}
.permission-actions .primary {
  border-color: var(--focus);
  background: var(--focus);
  color: #fff;
}
@media (min-width: 720px) {
  body { padding: 24px 0; }
  .app-shell { min-height: auto; border-radius: 8px; box-shadow: 0 18px 50px rgba(15, 23, 42, 0.10); }
}
