:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1677ff;
  --primary-soft: #eff6ff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --radius: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px 16px calc(84px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.topbar h1 {
  font-size: 20px;
  margin: 0;
}

.date-badge {
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.05);
  border: 1px solid rgba(229, 231, 235, 0.7);
}

.login-wrapper {
  max-width: 400px;
  margin: 12vh auto 0;
  padding: 0 16px;
}

.login-card {
  text-align: center;
  padding: 28px 22px;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  background: #fff;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 10px;
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.slot-title {
  font-size: 17px;
  font-weight: 700;
}

.status-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.status-done {
  background: var(--success-soft);
  color: var(--success);
}

.status-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preview-box {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.thumb-img {
  width: 84px;
  height: 84px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f3f4f6;
  cursor: pointer;
  flex-shrink: 0;
}

.meta-info {
  flex: 1;
  min-width: 0;
}

.meta-time {
  font-weight: 600;
  font-size: 14px;
}

.meta-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  word-break: break-word;
}

.options-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.month-label {
  font-size: 18px;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.summary-item {
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}

.summary-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.summary-label {
  font-size: 12px;
  color: var(--muted);
}

.cal-weekdays, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.cal-weekdays span {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  background: #f9fafb;
}

.cal-day.empty {
  background: transparent;
  cursor: default;
}

.cal-day.today {
  border-color: var(--primary);
  font-weight: 700;
}

.cal-day.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.cal-dots {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  height: 6px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d1d5db;
}

.dot.ok {
  background: var(--success);
}

.history-day-card {
  padding: 14px;
}

.history-date-title {
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.history-slot-box {
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid var(--border);
}

.history-slot-box img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 6px;
  cursor: pointer;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 16px;
  cursor: pointer;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 20px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 100;
}

.modal img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 12px;
  object-fit: contain;
}

.modal-bar {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.warn-banner {
  background: var(--warn-soft);
  color: #92400e;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
