:root {
  --bg: #eef6ff;
  --card: rgba(255, 255, 255, 0.9);
  --text: #14213d;
  --muted: #68758a;
  --primary: #2f80ed;
  --primary-dark: #1767cf;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #ef4444;
  --border: #d9e6f5;
  --shadow: 0 20px 55px rgba(38, 80, 145, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(47, 128, 237, 0.22), transparent 34rem),
    linear-gradient(135deg, #f8fbff 0%, var(--bg) 100%);
}

button, input { font: inherit; }

.app-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 1;
  letter-spacing: -0.06em;
}

.subtitle {
  max-width: 620px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.today-card, .panel, .modal-card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.today-card {
  min-width: 170px;
  display: grid;
  place-content: center;
  padding: 24px;
  border-radius: 28px;
  text-align: center;
}

.today-card span {
  color: var(--muted);
  font-size: 14px;
}

.today-card strong {
  margin-top: 8px;
  font-size: 38px;
  letter-spacing: -0.04em;
}

.panel {
  margin-top: 18px;
  padding: 22px;
  border-radius: 30px;
}

.medicine-form {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr auto;
  gap: 16px;
  align-items: end;
}

label {
  display: grid;
  gap: 8px;
  color: #31415a;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 15px 16px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}

input:focus {
  border-color: rgba(47, 128, 237, 0.7);
  box-shadow: 0 0 0 4px rgba(47, 128, 237, 0.12);
}

.time-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.primary-btn, .ghost-btn, .danger-btn {
  border: 0;
  border-radius: 18px;
  padding: 15px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
}

.primary-btn {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 12px 24px rgba(47, 128, 237, 0.25);
}

.primary-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

.ghost-btn {
  color: var(--primary);
  border: 1px solid #c7dcf7;
  background: #f5f9ff;
}

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

.notice-permission {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
  font-size: 24px;
}

.summary-text {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px dashed #bdd1eb;
  border-radius: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-icon { font-size: 46px; }

.medicine-list {
  display: grid;
  gap: 14px;
}

.medicine-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fff;
  transition: background 0.2s, border-color 0.2s;
}

/* ── 卡片状态变体 ─────────────────────────── */
.status-card--upcoming {
  background: #f8fafc;
  opacity: 0.82;
}
.status-card--pending {
  background: #fff;
  border-color: #fbbf24;
  box-shadow: inset 4px 0 0 #f59e0b;
}
.status-card--taken {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.status-card--skipped {
  background: #fffbeb;
  border-color: #fde68a;
}
.status-card--missed {
  background: #fff5f5;
  border-color: #fecaca;
}

.time-badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 22px;
  color: var(--primary);
  background: #edf5ff;
  font-size: 20px;
  font-weight: 900;
  transition: background 0.2s, color 0.2s;
}

/* ── 时间牌状态变体 ─────────────────────────── */
.time-badge--upcoming { color: var(--primary);  background: #edf5ff; }
.time-badge--pending  { color: #92400e;          background: #fef3c7; }
.time-badge--taken    { color: var(--green);     background: #dcfce7; }
.time-badge--skipped  { color: #92400e;          background: #fef3c7; }
.time-badge--missed   { color: #991b1b;          background: #fee2e2; }

.medicine-main h3 {
  margin: 0 0 6px;
  font-size: 21px;
}

.question {
  margin: 0 0 10px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 900;
}

.status-upcoming    { color: #475569; background: #f1f5f9; }
.status-pending-due { color: #92400e; background: #fef3c7; }
.status-taken       { color: #166534; background: #dcfce7; }
.status-skipped     { color: #92400e; background: #ffedd5; }
.status-missed      { color: #991b1b; background: #fee2e2; }

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.check-btn, .miss-btn, .delete-btn, .reset-btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 13px;
  font-weight: 900;
  cursor: pointer;
}

.check-btn { color: #fff; background: var(--green); }
.check-btn.primary-action { padding: 11px 20px; font-size: 15px; }
.miss-btn  { color: #fff; background: var(--orange); }
.delete-btn { color: #64748b; background: #eef2f7; }
.reset-btn  { color: var(--primary); background: #e8f0fd; }

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.45);
  z-index: 10;
}

.modal.hidden { display: none; }

.modal-card {
  position: relative;
  width: min(430px, 100%);
  padding: 32px;
  border-radius: 32px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #eef2f7;
  cursor: pointer;
  font-size: 24px;
}

.modal-icon { margin: 0; font-size: 54px; }
.modal-card h2 { margin: 12px 0 8px; font-size: 30px; }
#modalQuestion { margin: 0 0 24px; color: var(--muted); font-size: 18px; }
.modal-actions { display: grid; gap: 10px; }

@media (max-width: 760px) {
  .hero, .medicine-form { grid-template-columns: 1fr; display: grid; }
  .today-card { min-width: auto; }
  .medicine-card { grid-template-columns: 1fr; }
  .time-badge { width: 100%; height: auto; padding: 14px; }
  .card-actions { justify-content: stretch; }
  .card-actions button { flex: 1; }
}

/* ── 首次访问通知授权 Toast ─────────────────── */
.notify-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: min(540px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(38, 80, 145, 0.18);
  z-index: 20;
  animation: toastSlideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.notify-toast.hidden { display: none; }

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.notify-toast-icon { font-size: 26px; flex-shrink: 0; }

.notify-toast-text {
  flex: 1;
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.notify-toast-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.notify-toast-btn { padding: 10px 16px; font-size: 14px; border-radius: 14px; }

.notify-toast-dismiss {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
}

.notify-toast-dismiss:hover { color: var(--text); }

@media (max-width: 600px) {
  .notify-toast { flex-wrap: wrap; bottom: 16px; }
  .notify-toast-actions { width: 100%; justify-content: flex-end; }
}
