:root, [data-theme="light"] {
  --blue: #1da7d8;
  --navy: #173a5e;
  --bg: #f4f8fb;
  --card: #ffffff;
  --line: #dbe7f0;
  --text: #1c2b3a;
  --muted: #5b7287;
  --green: #1f9d55;
  --red: #c0392b;
  --chip-bg: #e3f2fb;
  --chip-line: #bfe1f3;
  --claimed-bg: #f2faf5;
  --warn-bg: #fff7f5;
  --warn-line: #f3c1ba;
  --topbar-text: #ffffff;
}
[data-theme="dark"] {
  --bg: #0e151f;
  --card: #16202e;
  --line: #2a3a4e;
  --text: #e6edf5;
  --muted: #93a7bb;
  --green: #3fc380;
  --red: #e07060;
  --chip-bg: #1d2a3b;
  --chip-line: #31435a;
  --claimed-bg: #15251c;
  --warn-bg: #261a18;
  --warn-line: #4e2e29;
  --topbar-text: #e6edf5;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--navy); color: var(--topbar-text); padding: 0.7rem 1.2rem;
}
.brand { color: var(--topbar-text); text-decoration: none; font-weight: 700; font-size: 1.2rem; display: inline-flex; align-items: center; gap: 0.5rem; }
.brand-logo { height: 2rem; width: auto; display: block; }
.topbar nav { display: flex; gap: 1rem; align-items: center; }
.topbar nav a { color: var(--topbar-text); opacity: 0.85; text-decoration: none; }
.who { color: var(--topbar-text); opacity: 0.6; font-size: 0.9rem; }
.badge { background: var(--red); border-radius: 9px; padding: 0 6px; font-size: 0.75rem; }
.theme-toggle { background: transparent; border: 1px solid rgba(255,255,255,0.4); color: var(--topbar-text); border-radius: 8px; padding: 0.15rem 0.5rem; cursor: pointer; font-size: 1rem; }

.crew-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  max-width: 760px; margin: 0.9rem auto 0; padding: 0 1rem;
}
.crew-title { font-size: 0.95rem; color: var(--muted); }
.crew-title strong { color: var(--text); }

main { max-width: 760px; margin: 1.2rem auto 3rem; padding: 0 1rem; }
footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1rem; }

section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
section.warn { border-color: var(--warn-line); background: var(--warn-bg); }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; margin: 0.2rem 0 0.1rem; }
h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--blue); margin: 1rem 0 0.3rem; }
.sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.1rem; }

.roomie-strip { margin-bottom: 1rem; font-size: 0.92rem; }
.chip { background: var(--chip-bg); border: 1px solid var(--chip-line); border-radius: 999px; padding: 2px 10px; margin-left: 4px; font-size: 0.85rem; display: inline-block; }
.chip em { font-style: normal; color: var(--muted); font-size: 0.75rem; }

ul.items { list-style: none; margin: 0; padding: 0; }
ul.items li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.2rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
ul.items li:last-child { border-bottom: none; }
ul.items.plain li { color: var(--red); }
.item-name { flex: 1 1 12rem; }
.item-name.done { text-decoration: line-through; color: var(--muted); }
li.claimed { background: var(--claimed-bg); }
.claimer { color: var(--green); font-size: 0.88rem; }

.claim-form { display: flex; gap: 0.4rem; }
.claim-form input { width: 9rem; }

form { margin: 0; }
input[type=text], input[type=email], input[type=password] {
  padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; font-size: 0.92rem; width: 100%;
  background: var(--card); color: var(--text);
}
.claim-form input, .add-item input { width: auto; }
label { display: block; margin: 0.6rem 0; font-size: 0.9rem; }
select { padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; font-size: 0.9rem; background: var(--card); color: var(--text); }

.btn {
  display: inline-block; background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 0.5rem 0.9rem; font-size: 0.92rem; cursor: pointer; text-decoration: none; text-align: center;
}
.btn.primary { width: 100%; margin-top: 0.4rem; background: var(--navy); }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.83rem; }
.btn.ghost { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn.google { width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.btn:hover { filter: brightness(1.07); }

.checkbox {
  width: 1.4rem; height: 1.4rem; border: 2px solid var(--blue); border-radius: 6px;
  background: var(--card); cursor: pointer; color: #fff; font-size: 0.9rem; line-height: 1;
}
.checkbox.on { background: var(--green); border-color: var(--green); }

.auth-card { max-width: 380px; margin: 2.5rem auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; }
.auth-hero { display: flex; align-items: center; justify-content: center; gap: 2.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
.auth-hero .auth-card { margin: 0; flex: 0 1 380px; }
.auth-mascot { max-height: 340px; width: auto; flex: 0 0 auto; }
@media (max-width: 640px) { .auth-mascot { max-height: 140px; } .auth-hero { gap: 1rem; } }
.divider { display: flex; align-items: center; color: var(--muted); margin: 0.8rem 0; font-size: 0.8rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.divider span { padding: 0 0.6rem; }
details { margin: 0.8rem 0; }
details summary { cursor: pointer; color: var(--blue); font-size: 0.9rem; }
.add-item form { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }

.error { background: #fdecea; border: 1px solid #f5c6c0; color: #c0392b; padding: 0.5rem 0.8rem; border-radius: 8px; font-size: 0.9rem; }
.notice { background: #e8f6ee; border: 1px solid #bfe3cd; color: #1f9d55; padding: 0.5rem 0.8rem; border-radius: 8px; font-size: 0.9rem; }

table.users { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.users th, table.users td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); }
.status { border-radius: 999px; padding: 2px 10px; font-size: 0.8rem; }
.status.pending { background: #fff4d6; color: #8a6d1a; }
.status.approved, .status.admin { background: #e8f6ee; color: #1f9d55; }
.status.denied { background: #fdecea; color: #c0392b; }
form.inline { display: inline-flex; gap: 0.3rem; }

/* --- my list / print --- */
.list-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.print-only { display: none; }
@media print {
  .topbar, .crew-banner, footer, .no-print, .theme-toggle { display: none !important; }
  .print-only { display: block; }
  span.print-only.printbox { display: inline; font-size: 1.05rem; }
  body { background: #fff; color: #000; }
  section { border: none; padding: 0; margin-bottom: 1rem; break-inside: avoid-page; }
  main { max-width: none; margin: 0; }
  h3 { color: #000; }
  ul.items li { border-bottom-color: #ccc; padding: 0.2rem 0; }
  .item-name.done { color: #555; }
  .print-header h1 { margin-bottom: 0; }
  .print-header p { margin-top: 0.2rem; color: #444; }
}

/* --- discussion --- */
.posts { margin: 1rem 0; }
.post { border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.9rem; margin-bottom: 0.7rem; }
.post-head { display: flex; align-items: baseline; gap: 0.6rem; }
.post-head form { margin-left: auto; }
.post-delete { background: none; border: none; color: var(--muted); cursor: pointer; }
.post-delete:hover { color: var(--red); }
.post-body { margin: 0.3rem 0 0.2rem; white-space: pre-wrap; }
.post-photo { max-width: 260px; max-height: 220px; border-radius: 8px; margin-top: 0.3rem; display: block; }
.post-form textarea { width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
.post-form-row { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-top: 0.4rem; flex-wrap: wrap; }

/* --- tour --- */
.tour-step { border-left: 3px solid var(--blue); padding: 0.1rem 0 0.1rem 1rem; margin: 1rem 0; }
.tour-step h3 { margin: 0 0 0.2rem; text-transform: none; letter-spacing: 0; font-size: 1rem; }
.tour .btn.primary { width: auto; display: inline-block; margin-top: 0.5rem; }

footer a { color: var(--muted); }

.crew-card { border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; margin: 0.8rem 0; }
.crew-card h4 { margin: 0 0 0.3rem; }
.crew-card .members { margin: 0.4rem 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
