:root {
  /* Northwood colors, taken from northwoodbaptist.com */
  --sage: #7fa88b;
  --sage-light: #b1d3bb;
  --green: #3f7652;
  --navy: #2b4256;
  --blue: #416381;
  --ink: #16212b;

  --bg: #f3f6f4;
  --panel: #ffffff;
  --side: var(--navy);
  --side-text: #ffffff;
  --side-muted: #b4c4d1;
  --side-active: var(--blue);
  --text: var(--ink);
  --heading: var(--navy);
  --muted: #5b6770;
  --line: #dfe5e1;
  --hover: #eaf1ec;
  --accent: var(--sage);
  --accent-text: var(--ink);
  --link: var(--green);
  --late: #b93a2b;
  --soon: var(--green);
  --shadow: 0 8px 30px rgba(22, 33, 43, .16);
  --font: "Avenir Next", Avenir, "Nunito Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16212b;
    --panel: #1f2d3a;
    --side: #101921;
    --side-active: #2b4256;
    --text: #e8eef0;
    --heading: #ffffff;
    --muted: #9fb0bb;
    --line: #314253;
    --hover: #283848;
    --link: var(--sage-light);
    --late: #f08a7b;
    --soon: var(--sage-light);
    --shadow: 0 8px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
}
h1 { font-size: 21px; margin: 0; color: var(--heading); font-weight: 700; }
h2 { font-size: 16px; margin: 0; color: var(--heading); }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--muted); margin: 22px 0 8px; }
p { margin: 0 0 10px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 12px 24px; }
.spacer { flex: 1; }

input, select, textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  max-width: 100%;
}
textarea { resize: vertical; width: 100%; }

.btn {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 50px;
  padding: 6px 16px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-block;
}
.btn:hover { background: var(--hover); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; font-size: 12.5px; padding: 8px 18px;
}
.btn.primary:hover { background: var(--sage-light); border-color: var(--sage-light); }
.btn.danger { color: var(--late); }
.btn.wide { width: 100%; padding: 10px; }
.btn:disabled { opacity: .6; cursor: default; }
.done-btn { color: var(--soon); border-color: var(--soon); font-weight: 600; }
.link { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; }
.link:hover { text-decoration: underline; }
.icon-btn {
  background: none; border: 0; border-radius: 6px; cursor: pointer;
  width: 30px; height: 30px; font-size: 18px; line-height: 1; flex: none;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn.faint { color: var(--muted); opacity: 0; }
*:hover > .icon-btn.faint, .icon-btn.faint:focus-visible { opacity: 1; }
@media (hover: none) { .icon-btn.faint { opacity: 1; } }

/* ---------- sign in ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--sage); }
.auth-card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 8px; font-size: 22px; }
.auth-card .btn { margin: 8px 0 12px; text-align: center; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 16px 12px; }
.brand-logo { width: 100%; max-width: 200px; height: auto; display: block; }
.brand-sub { font-size: 11px; font-weight: 700; letter-spacing: .34em; text-transform: uppercase; color: var(--sage-light); }
.brand.big { padding: 0 0 18px; }
.brand.big .brand-logo { max-width: 300px; }
.brand.big .brand-sub { color: #fff; font-size: 12.5px; }
.auth-wrap { width: 100%; max-width: 400px; }
.field { display: block; margin: 12px 0; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }
.form-error { color: var(--late); font-size: 14px; }

/* ---------- frame ---------- */
.shell { display: flex; height: 100vh; height: 100dvh; }
.side {
  width: 250px; flex: none; background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; overflow-y: auto;
}
.nav { display: flex; align-items: center; gap: 9px; padding: 8px 12px; margin: 1px 8px; border-radius: 8px; }
.nav:not(:has(.dot)) { text-transform: uppercase; letter-spacing: .1em; font-size: 12.5px; font-weight: 600; }
.nav:hover { background: var(--side-active); }
.nav.active { background: var(--side-active); font-weight: 700; box-shadow: inset 3px 0 0 var(--sage); }
.side .dot { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .75); }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .count { color: var(--side-muted); font-size: 12px; font-weight: 400; }
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 12px 4px 20px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--sage-light);
}
.side-head .icon-btn { color: var(--side-text); }
.side-head .icon-btn:hover, .side .link:hover { background: var(--side-active); }
.side-empty { padding: 4px 20px; color: var(--side-muted); }
.side-foot {
  margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, .08); position: sticky; bottom: 0; background: var(--side);
}
.me-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.side .link { color: var(--side-muted); font-size: 13px; padding: 4px 6px; border-radius: 5px; text-decoration: none; }

.search-wrap { position: relative; margin: 0 12px 10px; }
.search {
  width: 100%; background: rgba(255, 255, 255, .12); border-color: transparent; color: var(--side-text); border-radius: 50px; padding-left: 14px;
}
.search::placeholder { color: var(--side-muted); }
.search-results {
  position: absolute; left: 0; top: 100%; width: 320px; max-width: 80vw; margin-top: 4px; z-index: 30;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: var(--shadow); max-height: 60vh; overflow-y: auto; padding: 4px;
}
.search-hit {
  display: flex; flex-direction: column; width: 100%; text-align: left; background: none; border: 0;
  padding: 7px 9px; border-radius: 6px; cursor: pointer;
}
.search-hit:hover { background: var(--hover); }
.search-hit.done .hit-title { text-decoration: line-through; color: var(--muted); }

.main { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.page-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 24px; flex-wrap: wrap;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.title-wrap h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }
.page { padding: 4px 24px 60px; }
.page.narrow { max-width: 900px; }
.project-desc { padding: 0 24px; color: var(--muted); max-width: 800px; white-space: pre-wrap; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); cursor: pointer; }
.hello { font-size: 18px; margin: 6px 0 14px; color: var(--heading); }
.empty {
  border: 1px dashed var(--line); border-radius: 12px; padding: 36px 20px; text-align: center; color: var(--muted); margin-top: 20px;
}

.tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab {
  padding: 8px 12px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px;
  text-transform: uppercase; letter-spacing: .1em; font-size: 12.5px; font-weight: 600;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--heading); border-color: var(--accent); font-weight: 700; }

.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.dot.big { width: 16px; height: 16px; border-radius: 5px; }
.count { color: var(--muted); font-size: 13px; font-weight: 400; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 20px; padding: 1px 9px; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 600;
  display: inline-grid; place-items: center; flex: none;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.nobody { border: 1.5px dashed var(--line); background: none; }

.banner {
  margin: 0 24px 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--hover);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between;
}

/* ---------- task lists ---------- */
.group { margin-bottom: 22px; }
.group-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; padding: 6px 0; color: var(--heading); }
.group-head.late { color: var(--late); }
.section-name {
  border-color: transparent; background: transparent; font-weight: 600; padding: 3px 6px; margin-left: -6px;
  field-sizing: content; min-width: 60px; max-width: 60%;
}
.section-name:hover, .section-name:focus { border-color: var(--line); background: var(--panel); }
.rows { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line);
  cursor: pointer; min-height: 42px;
}
.row:last-child { border-bottom: 0; }
.row:hover, .row.open { background: var(--hover); }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.done .row-title, .card.done .card-title, .cal-task.done { color: var(--muted); text-decoration: line-through; }
.meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.due { font-size: 13px; color: var(--muted); white-space: nowrap; }
.due.late { color: var(--late); font-weight: 600; }
.due.soon { color: var(--soon); font-weight: 600; }
.prio { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 20px; white-space: nowrap; }
.prio.high { background: #f9d9d3; color: #8f2a1e; }
.prio.medium { background: #f6e6bf; color: #7a5a10; }
.prio.low { background: #d9e6f5; color: #2b5286; }

.check {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--muted); background: none;
  cursor: pointer; flex: none; font-size: 12px; line-height: 1; padding: 0; color: var(--accent-text);
}
.check:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.check.on { background: var(--accent); border-color: var(--accent); }

.add-input { width: 100%; border: 0; border-radius: 0; background: transparent; padding: 10px 12px 10px 42px; }
.add-input::placeholder { color: var(--muted); }
.add-input:focus { outline: none; background: var(--hover); }
.add-section .add-input { border: 1px dashed var(--line); border-radius: 10px; padding-left: 12px; }

/* ---------- board ---------- */
.board { display: flex; gap: 14px; padding: 4px 24px 24px; overflow-x: auto; flex: 1; align-items: flex-start; }
.col {
  width: 290px; flex: none; background: color-mix(in srgb, var(--panel) 55%, transparent);
  border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; max-height: 100%;
}
.col.over { border-color: var(--accent); }
.col.ghost { background: none; border: 0; }
.col.ghost .add-input { border: 1px dashed var(--line); border-radius: 10px; padding-left: 12px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 4px 14px; }
.col-head .section-name { max-width: 70%; }
.cards { padding: 6px 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.cards .add-input { padding-left: 10px; border-radius: 8px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.card:hover { border-color: var(--muted); }
.card-top { display: flex; gap: 9px; align-items: flex-start; }
.card-title { overflow-wrap: anywhere; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 24px; }

/* ---------- calendar ---------- */
.cal-page { display: flex; flex-direction: column; flex: 1; }
.cal-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-bar h2 { margin-left: 10px; }
.cal {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.dow { background: var(--panel); padding: 5px 8px; font-size: 12px; color: var(--muted); }
.day { background: var(--panel); min-height: 104px; padding: 4px; display: flex; flex-direction: column; gap: 3px; }
.day.other { background: color-mix(in srgb, var(--panel) 55%, var(--bg)); }
.day.other .day-num { color: var(--muted); }
.day.over { box-shadow: inset 0 0 0 2px var(--accent); }
.day-num { font-size: 12px; padding: 1px 4px; width: fit-content; border-radius: 10px; }
.day.today .day-num { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.cal-task {
  display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--green);
  background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; padding: 2px 6px;
  font-size: 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.day .add-input { padding: 1px 6px; font-size: 12px; margin-top: auto; opacity: 0; border-radius: 4px; }
.day:hover .add-input, .day .add-input:focus { opacity: 1; }

/* ---------- task panel ---------- */
.drawer {
  width: 460px; flex: none; background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; box-shadow: var(--shadow); z-index: 10;
}
.drawer-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 14px 20px 40px; overflow-y: auto; flex: 1; }
.crumb { display: block; margin-bottom: 6px; font-size: 13px; }
.task-title {
  font-size: 21px; font-weight: 650; border-color: transparent; padding: 4px 6px; margin: 0 -6px 8px;
  width: calc(100% + 12px); resize: none; overflow: hidden; line-height: 1.3;
}
.task-title:hover, .task-title:focus { border-color: var(--line); }
.props { display: grid; grid-template-columns: 110px 1fr; gap: 10px 8px; align-items: center; }
.props select, .props input { width: fit-content; }
.prop-label { color: var(--muted); font-size: 13px; }
.due-edit { display: flex; align-items: center; gap: 10px; }
.notes { min-height: 96px; line-height: 1.5; }
.comment { display: flex; gap: 10px; margin-bottom: 12px; }
.comment-head { display: flex; gap: 8px; align-items: baseline; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-new { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; margin: 8px 0 20px; }

/* ---------- staff ---------- */
.person { cursor: default; flex-wrap: wrap; padding: 10px 12px; }
.person:hover { background: none; }
.person-info { flex: 1; min-width: 160px; display: flex; flex-direction: column; }

.checklist { border: 1px solid var(--line); border-radius: 9px; max-height: 220px; overflow-y: auto; padding: 4px; }
.check-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.check-row:hover { background: var(--hover); }
.check-row input { width: auto; flex: none; }
.role-help { margin-top: 16px; }
.role-help p { margin: 0 0 4px; }

/* ---------- pop-ups ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(15, 22, 19, .45); display: grid; place-items: center; padding: 16px; z-index: 50;
}
.modal {
  background: var(--panel); border-radius: 14px; padding: 22px; width: 100%; max-width: 460px;
  box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto;
}
.modal h2 { font-size: 18px; margin-bottom: 12px; }
.modal > input { width: 100%; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; flex: none; }
.swatch.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 9px; box-shadow: var(--shadow); z-index: 60; max-width: 90vw;
}

/* ---------- whiteboards ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.tile:hover { border-color: var(--muted); }
.tile-art {
  height: 90px; border-radius: 8px; background: var(--hover); display: grid; place-items: center;
  font-size: 30px; color: var(--muted); margin-bottom: 6px;
}
.tile-del { position: absolute; top: 6px; right: 6px; background: var(--panel); }

.wb-holder { display: flex; flex-direction: column; height: 100%; }
.wb-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; flex-wrap: wrap; }
.wb-name { font-weight: 600; font-size: 16px; border-color: transparent; background: transparent; min-width: 120px; flex: 0 1 300px; }
.wb-name:hover, .wb-name:focus { border-color: var(--line); background: var(--panel); }
.wb-tools {
  display: flex; align-items: center; gap: 4px; padding: 6px 16px 10px; flex-wrap: wrap;
}
.wb-tool { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; cursor: pointer; font-size: 14px; }
.wb-tool:hover:not(:disabled) { background: var(--hover); }
.wb-tool.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.wb-tool:disabled { opacity: .45; cursor: default; }
.wb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.wb-stage {
  position: relative; flex: 1; min-height: 300px; margin: 0 16px 16px; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; background: #fff;
  background-image: radial-gradient(#d9d5cb 1px, transparent 1px); background-size: 24px 24px;
}
.wb-canvas { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.wb-note { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .22)); }
.wb-note-text {
  width: 100%; height: 100%; padding: 10px; overflow: hidden; color: #1f2933;
  font: 15px/1.35 var(--font);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.wb-text { font: 20px/26px var(--font); white-space: pre; }
.wb-sel { fill: none; stroke: #3b6fb5; stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; vector-effect: non-scaling-stroke; }
.wb-handle { fill: #fff; stroke: #3b6fb5; stroke-width: 1.5; cursor: nwse-resize; }
.wb-edit {
  position: absolute; border: 1.5px solid #3b6fb5; border-radius: 3px; resize: none; padding: 0; line-height: 1.3;
  font-family: var(--font); outline: none;
}
.wb-edit.note { padding: 0.66em; line-height: 1.35; }

/* ---------- phones and small windows ---------- */
@media (max-width: 1100px) {
  .drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); }
}
@media (max-width: 760px) {
  .side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; transform: translateX(-100%); transition: transform .18s; box-shadow: var(--shadow); }
  .menu-open .side { transform: none; }
  .menu-btn { display: block; }
  .page-head, .tabs, .project-desc { padding-left: 16px; padding-right: 16px; }
  .page, .board { padding-left: 16px; padding-right: 16px; }
  .chip { max-width: 110px; }
  .day { min-height: 72px; }
  .wb-stage { margin: 0 8px 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
