@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Open+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #FAF5FF;
  --surface: #FFFFFF;
  --ink: #1E1B2E;
  --ink-soft: #8B8599;
  --border: #EFE7FC;
  --accent: #7C3AED;
  --accent-hover: #6D28D9;
  --accent-soft: #EDE4FD;

  --cat-生意: #7C3AED;
  --cat-生意-bg: #EDE4FD;
  --cat-個人: #059669;
  --cat-個人-bg: #DCFCE9;
  --cat-客戶: #EA580C;
  --cat-客戶-bg: #FFE9D9;
  --cat-其他: #DB2777;
  --cat-其他-bg: #FCE4F0;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(30, 27, 46, 0.06), 0 6px 18px rgba(30, 27, 46, 0.07);
  --shadow-hover: 0 4px 8px rgba(30, 27, 46, 0.08), 0 14px 30px rgba(30, 27, 46, 0.1);
  --ease: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "PingFang HK", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 90px;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}

.app-header {
  background: linear-gradient(135deg, var(--accent) 0%, #9F5CF0 100%);
  border-radius: 0 0 28px 28px;
  padding: 22px 20px 20px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.28);
}
.header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.app-header h1 {
  font-family: "Poppins", sans-serif;
  font-size: 21px;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.week-strip {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}
.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  padding: 8px 0;
  border-radius: 14px;
  transition: background var(--ease);
}
.week-day .wd-label { font-size: 11px; opacity: 0.75; font-weight: 600; }
.week-day .wd-num {
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  font-weight: 600;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.week-day .wd-dot { width: 4px; height: 4px; border-radius: 50%; background: #fff; opacity: 0; }
.week-day.has-event .wd-dot { opacity: 0.9; }
.week-day.today .wd-num { background: #fff; color: var(--accent); }
.week-day.today { background: rgba(255, 255, 255, 0.12); }

.tabs {
  display: flex;
  gap: 8px;
  padding: 18px 20px 12px;
}
.tab-btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background var(--ease), color var(--ease), transform var(--ease);
}
.tab-btn:hover { transform: translateY(-1px); }
.tab-btn.active {
  background: var(--accent);
  color: #fff;
}

main { padding: 4px 20px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.event-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-row {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  transition: box-shadow var(--ease), transform var(--ease);
}
.event-row:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }

.event-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 15px;
}

.event-info { flex: 1; min-width: 0; }
.event-title { font-weight: 600; font-size: 15px; margin-bottom: 5px; }
.event-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.event-time { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), color var(--ease);
}
.icon-btn:hover { background: var(--cat-客戶-bg); color: var(--cat-客戶); }
.icon-btn svg { width: 16px; height: 16px; }

.empty-hint {
  text-align: center;
  color: var(--ink-soft);
  padding: 48px 20px;
  font-size: 14.5px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.follow-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 14px;
  min-height: 108px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow var(--ease), transform var(--ease);
}
.follow-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.follow-card .card-title { font-weight: 700; font-size: 15px; color: var(--ink); }

.fab {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.4);
  cursor: pointer;
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
}
.fab:hover { background: var(--accent-hover); transform: scale(1.06) translateY(-2px); }
.fab svg { width: 24px; height: 24px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 46, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(2px);
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  border-radius: 22px 22px 0 0;
  padding: 24px 20px 28px;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-content h2 { margin-top: 0; font-size: 18px; font-weight: 700; font-family: "Poppins", sans-serif; }

#add-form { display: flex; flex-direction: column; gap: 14px; }
#add-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}
#add-form input[type="text"],
#add-form input[type="date"],
#add-form select,
#add-form textarea {
  font-size: 15px;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  transition: border-color var(--ease);
}
#add-form input:focus, #add-form select:focus, #add-form textarea:focus {
  border-color: var(--accent);
  outline: none;
}
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-weight: 400;
}
.checkbox-row label {
  flex-direction: row;
  align-items: center;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.checkbox-row input { width: auto; accent-color: var(--accent); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.btn-primary, .btn-secondary, .btn-danger {
  flex: 1;
  padding: 13px 0;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg); color: var(--ink-soft); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--cat-客戶-bg); color: var(--cat-客戶); }

.detail-meta { font-size: 13px; color: var(--ink-soft); margin-top: -8px; font-weight: 600; }
.detail-notes { font-size: 15px; line-height: 1.7; white-space: pre-wrap; }
