:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #22201d;
  --muted: #6f6a61;
  --accent: #b3872c;
  --accent-ink: #ffffff;
  --line: #e6ded2;
  --good: #1e7d46;
  --warn: #b3261e;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
.wrap.wide { max-width: 960px; }
header.brand { text-align: center; margin: 12px 0 20px; }
header.brand h1 { font-size: 1.5rem; margin: 0 0 4px; }
header.brand p { margin: 0; color: var(--muted); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card h2 { margin: 0 0 12px; font-size: 1.15rem; }
.card h3 { margin: 0 0 8px; font-size: 1rem; }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 0.95rem; }
label:first-of-type { margin-top: 0; }
input, select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
}
button {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
  margin-top: 18px;
}
button.secondary { background: #efe9df; color: var(--ink); }
button.danger { background: var(--warn); color: #fff; }
button.small { width: auto; padding: 8px 12px; font-size: 0.9rem; margin-top: 0; }
button:disabled { opacity: 0.55; cursor: default; }
.msg { border-radius: 10px; padding: 12px 14px; margin: 14px 0; white-space: pre-wrap; }
.msg.error { background: #fdecea; border: 1px solid #f3c1bd; color: #7a1d17; }
.msg.ok { background: #e8f5ee; border: 1px solid #bfe3cf; color: #14532d; }
.msg.info { background: #eef3fb; border: 1px solid #c9d8f2; color: #1e3a5f; }
.links { text-align: center; margin-top: 16px; color: var(--muted); }
.links a, a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; background: #efe9df; color: var(--ink);
}
.badge.active { background: #d9efe2; color: #14532d; }
.badge.pending_approval { background: #fdf0d3; color: #7a5410; }
.badge.rejected { background: #f8d7d4; color: #7a1d17; }
.badge.deactivated { background: #e2e2e2; color: #444; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { width: auto; margin-top: 0; background: #efe9df; color: var(--ink); }
.tabs button.on { background: var(--accent); color: var(--accent-ink); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 0.95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
pre.log { white-space: pre-wrap; word-break: break-word; font-size: 0.85rem; }
.class-list { list-style: none; margin: 0; padding: 0; }
.class-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.class-item:last-child { border-bottom: none; padding-bottom: 2px; }
.class-item .when { font-weight: 600; }
.class-item.cancelled { opacity: 0.55; }
.earn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; margin-bottom: 6px; }
.earn-grid .figure { font-size: 1.35rem; font-weight: 700; }
.earn-grid .label { color: var(--muted); font-size: 0.85rem; }
.guests { margin-top: 6px; }
.guest-toggle {
  width: auto; margin: 0; padding: 2px 0; background: none; color: var(--accent);
  font-size: 0.9rem; font-weight: 600; text-align: left;
}
.guest-list { margin-top: 4px; }
.guest-list ul { list-style: none; margin: 0; padding: 0 0 0 2px; }
.guest-list li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 3px 0; font-size: 0.95rem; }
.guest-list p { margin: 2px 0; }
.guest-tag { font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.guest-tag.paid { background: #d9efe2; color: #14532d; }
.guest-tag.free { background: #efe9df; color: var(--muted); }
.cancel-zone { margin-top: 8px; }
.link-zone { margin-top: 8px; }
.cancel-pending { color: var(--warn); font-weight: 600; margin: 4px 0 0; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(34, 32, 29, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  width: 100%; max-width: 440px;
  max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 24px 20px 20px;
}
.modal-card h2 { margin: 0 30px 10px 0; font-size: 1.2rem; }
.modal-card p { margin: 0 0 10px; }
.modal-class { font-weight: 700; font-size: 1.05rem; }
.modal-close {
  position: absolute; top: 6px; right: 6px;
  width: auto; margin: 0; padding: 6px 11px;
  background: none; color: var(--muted);
  font-size: 1.35rem; line-height: 1; font-weight: 400;
}
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.modal-actions button { margin-top: 0; }
@media (min-width: 480px) {
  .modal-actions { flex-direction: row; }
  .modal-actions button { flex: 1; }
}
.badge.pending { background: #fdf0d3; color: #7a5410; }
.badge.cancelled { background: #f8d7d4; color: #7a1d17; }
.badge.aborted { background: #e2e2e2; color: #444; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-preview { display: block; max-width: 100%; height: auto; margin-top: 8px; border-radius: 8px; }
@media (max-width: 560px) { .photo-grid { grid-template-columns: 1fr; } }

/* Install-as-app box (added 2026-10-29) */
.install-box { margin: 0 0 14px; }
.install-box button { margin-top: 0; }
.install-help { background: var(--card); border: 1px solid #e5ded2; border-radius: 10px; padding: 10px 12px; font-size: 0.92rem; margin-top: 8px; }

/* Work Study Portal additions (2026-10-29) */
.course-link { display: block; text-align: center; text-decoration: none; }
.app-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.app-row:last-child { border-bottom: none; padding-bottom: 2px; }
.app-row .app-name { font-weight: 700; font-size: 1.05rem; }
.app-row .app-sub { color: var(--muted); font-size: 0.9rem; margin: 2px 0 10px; }
.store-btns { display: flex; gap: 10px; }
.store-btns a {
  flex: 1; text-align: center; text-decoration: none;
  border-radius: 10px; padding: 11px 10px; font-weight: 600; font-size: 0.98rem;
  background: #efe9df; color: var(--ink);
}
.store-btns a:active { opacity: 0.75; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.task-item:last-child { border-bottom: none; padding-bottom: 2px; }
.task-item input[type="checkbox"] {
  width: 26px; height: 26px; flex: 0 0 auto; margin: 1px 0 0;
  accent-color: var(--accent); cursor: pointer;
}
.task-item .task-main { flex: 1; min-width: 0; }
.task-item .task-title { font-weight: 600; }
.task-item .task-note { color: var(--muted); font-size: 0.9rem; }
.task-item .task-done { color: var(--good); font-size: 0.88rem; margin-top: 2px; }
.task-item.done .task-title { text-decoration: line-through; color: var(--muted); }
.name-row { display: flex; gap: 10px; align-items: flex-end; }
.name-row .grow { flex: 1; }
.name-row button { width: auto; margin-top: 0; }
.greeting { font-size: 1.2rem; font-weight: 700; margin: 0 0 4px; }
.person-block { margin-bottom: 22px; }
.person-block h3 { margin: 0 0 6px; }
.done-list { list-style: none; margin: 0; padding: 0; }
.done-list li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.done-list li:last-child { border-bottom: none; }
