:root {
  --primary: #a0202f;
  --primary-soft: #f7ecEE;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1f2937;
  --text-sub: #6b7280;
  --text-faint: #9ca3af;
  --line: #e5e7eb;
  --am: #1d4ed8;
  --am-bg: #eef4ff;
  --pm: #b45309;
  --pm-bg: #fef3e2;
  --highlight: #fde68a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

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

button { font-family: inherit; }

/* ---------- header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.brand-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
}

.brand-title {
  font-size: 13px;
  color: var(--text-sub);
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.nav-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.week-info {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}

#week-select {
  width: 100%;
  max-width: 260px;
  font-size: 16px;
  font-weight: 600;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  text-align: center;
  text-align-last: center;
}

.week-range {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 4px;
}

.search-wrap {
  position: relative;
}

#search-input {
  width: 100%;
  font-size: 15px;
  padding: 10px 38px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fafb;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
}

#search-input:focus {
  border-color: var(--primary);
  background: var(--card);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: #e5e7eb;
  color: var(--text-sub);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- main ---------- */

.app-main {
  padding: 12px;
  max-width: 640px;
  margin: 0 auto;
}

.loading, .error {
  text-align: center;
  color: var(--text-sub);
  padding: 40px 12px;
}

.error {
  color: var(--primary);
}

.week-meta {
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 12px;
}

/* ---------- day & meeting ---------- */

.day-section { margin-bottom: 16px; }

.day-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 2px 8px;
  font-size: 13px;
  color: var(--text-sub);
}

.day-header .day-date { font-weight: 600; font-size: 14px; color: var(--text); }
.day-header .day-weekday { color: var(--text-faint); }

.meeting-card {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px;
  margin-bottom: 10px;
  transition: box-shadow 0.15s ease;
}

.meeting-card.is-highlight {
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px rgba(253, 230, 138, 0.6);
  animation: fadeHighlight 1.6s ease 1;
}

@keyframes fadeHighlight {
  0% { background: #fffbea; }
  100% { background: var(--card); }
}

.mc-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.period-pill {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 1px;
}
.period-pill.am { color: var(--am); background: var(--am-bg); }
.period-pill.pm { color: var(--pm); background: var(--pm-bg); }

.mc-time {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.mc-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.mc-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  font-size: 14px;
}

.mc-row .mc-label {
  flex: 0 0 auto;
  color: var(--text-faint);
}

.mc-row .mc-value {
  color: var(--text);
  word-break: break-word;
}

.mc-toggle {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-soft);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.mc-detail {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.mc-detail .mc-row:first-child { margin-top: 0; }

.day-empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 10px;
}

/* ---------- week remark ---------- */

.week-remark {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 4px;
}

.remark-label {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.remark-content {
  font-size: 14px;
  color: var(--text);
  white-space: pre-wrap;
}

/* ---------- search ---------- */

.search-summary {
  font-size: 13px;
  color: var(--text-sub);
  margin: 4px 2px 12px;
}

.search-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.search-item:active { background: var(--primary-soft); }

.si-date {
  font-size: 12px;
  color: var(--text-faint);
}

.si-title {
  font-size: 15px;
  font-weight: 600;
  margin: 4px 0;
}

.si-meta {
  font-size: 13px;
  color: var(--text-sub);
}
