:root {
  --bar: #cf2030;
  --ink: #1c2230;
  --muted: #5b6475;
  --line: #e4e7ee;
  --bg: #f1f1f3;
  --card: #fff;
  --ok: #1d7a46;
  --warn: #b7791f;
  --r: 8px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); font-weight: 400; }
.deny { padding: 40px 16px; text-align: center; }

.bar { background: var(--bar); color: #fff; position: sticky; top: 0; z-index: 10; }
.bar-in {
  max-width: 980px; margin: 0 auto; padding: 14px max(16px, env(safe-area-inset-left, 0px)) 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.who { font-size: 13px; opacity: 0.9; }
.tabs { max-width: 980px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left, 0px)); display: flex; gap: 4px; }
.tab {
  background: transparent; color: #fff; border: 0; padding: 10px 14px; font: inherit;
  border-bottom: 3px solid transparent; cursor: pointer;
}
.tab.active { border-bottom-color: #fff; font-weight: 600; }

main {
  max-width: 980px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left, 0px)) 48px;
}
input, select, button { font: inherit; }
input, select {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: #fff; color: var(--ink);
  min-width: 0;
}
button {
  border: 0; border-radius: 6px; padding: 8px 14px; background: var(--bar); color: #fff; cursor: pointer;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filters select { flex: 1 1 160px; }

.progress {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  height: 30px; overflow: hidden; margin-bottom: 14px;
}
.bar-fill { height: 100%; background: #f5d6d9; width: 0; transition: width .3s; }
.progress span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}

.group {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; overflow: hidden;
}
.group > summary { padding: 12px 14px; font-weight: 600; cursor: pointer; background: #fafbfc; }

.task, .person {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--line);
}
.task .body, .person .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.title { font-weight: 500; overflow-wrap: anywhere; }
.task.st-done .title { text-decoration: line-through; color: var(--muted); }
.task.st-doing .title { color: var(--warn); }
.meta { display: flex; gap: 6px; flex-wrap: wrap; }
.meta select, .meta input { flex: 1 1 130px; }
.meta .due { flex: 0 1 150px; }
.meta .amt { flex: 0 1 160px; }
.note { width: 100%; font-size: 13px; }
.by { font-size: 12px; color: var(--muted); }
.chk { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; }
.del { background: transparent; color: var(--muted); padding: 0 6px; font-size: 20px; line-height: 1; }

.add {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px;
  margin-top: 16px; display: grid; gap: 8px; grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .add { grid-template-columns: 1.4fr 2fr 1fr 150px auto; align-items: center; }
  #people-form.add { grid-template-columns: 2fr 1fr 1fr auto; }
  .add h2 { grid-column: 1 / -1; }
}

.toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 14px; z-index: 20;
}

/* Lịch trình và hướng dẫn */
.day, .guide-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 14px;
}
.day h2, .guide-card h2 { font-size: 16px; margin: 0 0 10px; }
.date {
  display: inline-block; background: var(--bar); color: #fff; border-radius: 6px;
  padding: 2px 8px; font-size: 13px; margin-right: 6px;
}
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { display: flex; gap: 12px; padding: 6px 0 6px 14px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px;
  background: var(--bar); border-radius: 50%;
}
.time { flex: 0 0 110px; font-weight: 600; font-variant-numeric: tabular-nums; }
.text { flex: 1; min-width: 0; }
.guide-card ul { margin: 0; padding-left: 18px; }
.guide-card li { margin: 4px 0; }

.sub { font-size: 16px; margin: 18px 0 8px; }

.note-top { padding: 10px 0 0; font-size: 13px; }
