:root {
  --paper: #f4eedf;
  --paper-deep: #ece3d0;
  --paper-card: rgba(255,255,255,.34);
  --ink: #123e79;
  --ink-soft: #6e83a1;
  --muted: #938d81;
  --red: #cb3c34;
  --line: rgba(18,62,121,.16);
  --line-soft: rgba(18,62,121,.09);
  --shadow: 0 12px 34px rgba(58,45,25,.10);
  --body: "Source Sans 3", system-ui, -apple-system, sans-serif;
  --hand-1: "Caveat", cursive;
  --hand-2: "Patrick Hand", cursive;
  --hand-3: "Reenie Beanie", cursive;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(255,255,255,.5), transparent 24%),
    repeating-linear-gradient(0deg, rgba(93,71,35,.025) 0, rgba(93,71,35,.025) 1px, transparent 1px, transparent 5px),
    var(--paper);
}
button, textarea { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 210px minmax(0, 760px); justify-content: center; gap: 32px; padding: 40px 28px 80px; }
.desktop-sidebar { position: sticky; top: 40px; height: fit-content; padding: 18px 10px; }
.brand { font-family: var(--hand-1); font-size: 42px; letter-spacing: 2px; font-weight: 600; transform: rotate(-1deg); }
.brand-small { font-size: 30px; margin: 4px 10px 24px; }
.desktop-sidebar nav { display: grid; gap: 8px; }
.nav-item { background: transparent; border: 0; text-align: left; padding: 11px 14px; border-radius: 12px; cursor: pointer; }
.nav-item.active { background: rgba(18,62,121,.07); }
.board-wrap { width: 100%; }
.topbar { display:flex; justify-content:space-between; align-items:flex-start; gap: 16px; }
.week-range { border: 0; background: transparent; padding: 0; margin-top: 2px; font-family: var(--hand-2); font-size: 21px; cursor: default; }
.menu-button { display:none; border:0; background:transparent; font-size:22px; margin-top:8px; }
.status-card { margin: 20px 0 22px; display:flex; gap:12px; align-items:center; padding: 12px 15px; border-radius: 13px; border: 1px solid var(--line-soft); background: rgba(18,62,121,.055); }
.status-card.urgent { color: var(--red); background: rgba(203,60,52,.065); border-color: rgba(203,60,52,.12); }
.status-icon { width: 28px; height: 28px; display:grid; place-items:center; font-size: 20px; }
.status-title { font-weight: 600; font-size: 16px; }
.status-subtitle { color: currentColor; opacity:.76; font-size: 13px; margin-top:1px; }
.member-strip { display:flex; gap: 20px; overflow-x:auto; padding: 2px 0 10px; scrollbar-width:none; }
.member-strip::-webkit-scrollbar { display:none; }
.member-button { min-width:68px; border:0; background:transparent; padding:0 0 5px; cursor:pointer; text-align:center; position:relative; }
.avatar { width:48px; height:48px; border-radius:50%; margin: 0 auto 5px; display:grid; place-items:center; font-weight:600; background: #ddd2bc; color:#5d513f; border:2px solid transparent; box-shadow:0 2px 8px rgba(0,0,0,.08); }
.member-button.active .avatar { border-color: var(--ink); }
.member-button.active::after { content:""; position:absolute; left:16px; right:16px; bottom:0; height:2px; background:var(--ink); transform:rotate(-2deg); border-radius:3px; }
.member-name { font-size:13px; }
.member-button[data-font="1"] .member-name { font-family:var(--hand-1); font-size:18px; }
.member-button[data-font="2"] .member-name { font-family:var(--hand-2); font-size:16px; }
.member-button[data-font="3"] .member-name { font-family:var(--hand-3); font-size:20px; }
.member-heading { display:flex; justify-content:space-between; align-items:end; margin-top: 14px; padding-bottom:6px; border-bottom: 1px solid var(--line); }
.member-heading h1 { font-family:var(--body); font-weight:700; font-size:17px; letter-spacing:.11em; margin:0; }
.member-heading p { margin:0; color:var(--muted); font-size:13px; }
.text-button { border:0; background:transparent; font-family:var(--hand-2); font-size:19px; cursor:pointer; padding:6px 2px; }
.text-button[disabled] { display:none; }
.add-commitment-button { border:1px solid rgba(18,62,121,.28); background:rgba(255,255,255,.24); color:var(--ink); border-radius:7px; padding:7px 11px; font-size:14px; font-weight:600; cursor:pointer; line-height:1; }
.add-commitment-button:hover { background:rgba(18,62,121,.06); border-color:rgba(18,62,121,.42); }
.add-commitment-button[disabled] { display:none; }
.task-section { margin-top: 22px; }
.section-heading { display:flex; justify-content:space-between; align-items:center; margin-bottom: 5px; }
.section-heading h2 { font-family:var(--hand-1); font-size:28px; margin:0; font-weight:600; }
.section-heading h2 span { font-family:var(--body); font-size:14px; font-weight:500; color:var(--ink-soft); }
.task-list { display:grid; gap:6px; }
.task-card { min-height:56px; display:flex; align-items:center; border-bottom:1px solid var(--line); background:transparent; transition: transform .2s ease, opacity .2s ease, background .2s ease; }
.task-card:hover { background: rgba(255,255,255,.18); }
.task-main { flex:1; min-width:0; border:0; background:transparent; text-align:left; padding:11px 8px 11px 14px; font-family:var(--hand-2); font-size:21px; cursor:pointer; }
.task-card.member-font-1 .task-main { font-family:var(--hand-1); font-size:23px; }
.task-card.member-font-2 .task-main { font-family:var(--hand-2); }
.task-card.member-font-3 .task-main { font-family:var(--hand-3); font-size:27px; }
.task-actions { display:flex; align-items:center; gap:4px; padding-right:4px; }
.task-menu, .carry-remove, .carry-keep { border:0; background:transparent; cursor:pointer; }
.task-menu { color:var(--muted); letter-spacing:1px; font-size:15px; padding:12px 8px; }
.carry-remove { font-size:20px; color:var(--ink-soft); }
.carry-keep { color:var(--ink); font-weight:600; font-size:13px; border:1px solid var(--line); border-radius:999px; padding:5px 10px; }
.task-card.completed { opacity:.58; }
.task-card.completed .task-main { text-decoration: line-through; text-decoration-thickness: 1px; }
.task-card.completed .task-main::before { content:"✓"; display:inline-block; margin-right:10px; font-family:var(--body); text-decoration:none; }
.task-card.carryover { opacity:.48; background:rgba(18,62,121,.025); }
.task-card.carryover .task-main::after { content:"from last week"; display:block; font-family:var(--body); font-size:11px; color:var(--muted); margin-top:1px; }
.empty { color:var(--muted); padding:14px 12px; font-size:14px; }
.hidden { display:none !important; }
.sheet { border:0; border-radius:22px; width:min(520px, calc(100vw - 24px)); color:var(--ink); background:var(--paper); box-shadow:0 24px 80px rgba(20,30,45,.24); padding:0; }
.sheet::backdrop { background:rgba(21,28,39,.36); backdrop-filter:blur(2px); }
.sheet form { padding:22px; }
.sheet-top { display:flex; align-items:center; justify-content:space-between; }
.sheet-top h2 { font-family:var(--hand-1); font-size:30px; margin:0; }
.icon-button { border:0; background:transparent; font-size:28px; cursor:pointer; }
.sheet label { display:block; margin:18px 0 7px; font-size:13px; font-weight:600; }
.sheet textarea { width:100%; min-height:120px; resize:vertical; border:1px solid var(--line); border-radius:14px; padding:14px; color:var(--ink); background:rgba(255,255,255,.42); font-family:var(--hand-2); font-size:22px; outline:none; }
.sheet textarea:focus { border-color:rgba(18,62,121,.38); box-shadow:0 0 0 3px rgba(18,62,121,.06); }
.helper { font-size:12px; color:var(--muted); margin-top:7px; }
.dialog-actions { display:flex; gap:8px; align-items:center; margin-top:18px; }
.spacer { flex:1; }
.dialog-actions button { border-radius:999px; padding:10px 16px; cursor:pointer; }
.primary { border:0; background:var(--ink); color:white; }
.secondary { border:1px solid var(--line); background:transparent; }
.danger-link { border:0; background:transparent; color:var(--red); padding-left:0 !important; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns:1fr; max-width:680px; margin:auto; padding:26px 20px 70px; }
  .desktop-sidebar { display:none; }
  .menu-button { display:block; }
}
@media (max-width: 520px) {
  .app-shell { padding:18px 16px 64px; }
  .brand { font-size:36px; }
  .status-card { margin-top:16px; }
  .member-strip { gap:12px; }
  .member-button { min-width:62px; }
  .avatar { width:44px; height:44px; }
  .member-heading h1 { font-size:16px; }
  .task-main { font-size:20px; padding-left:8px; }
}

/* Real-app gates + Supabase onboarding */
.gate { min-height:100vh; display:grid; place-items:center; padding:24px; }
.gate[hidden], .app-shell[hidden], form[hidden] { display:none !important; }
.gate-card, .setup-card { width:min(470px,100%); padding:30px; border:1px solid var(--line); border-radius:22px; background:rgba(255,255,255,.28); box-shadow:var(--shadow); }
.setup-card { width:min(540px,100%); }
.gate-card h1, .setup-card h1 { font-family:var(--hand-1); font-size:34px; margin:12px 0 2px; }
.eyebrow, .gate-note, .field-note { color:var(--muted); }
.stack-form { display:grid; gap:8px; margin-top:24px; }
.stack-form label, .typeface-picker legend { font-size:13px; font-weight:600; }
.stack-form input { width:100%; border:1px solid var(--line); border-radius:12px; padding:12px 13px; color:var(--ink); background:rgba(255,255,255,.42); outline:none; }
.stack-form input:focus { border-color:rgba(18,62,121,.38); box-shadow:0 0 0 3px rgba(18,62,121,.06); }
.wide { width:100%; }
.stack-form .primary { margin-top:10px; border-radius:999px; padding:12px 18px; cursor:pointer; }
.segmented { display:grid; grid-template-columns:1fr 1fr; padding:4px; margin-top:20px; border:1px solid var(--line); border-radius:999px; }
.segmented button { border:0; background:transparent; border-radius:999px; padding:9px 12px; cursor:pointer; }
.segmented button.active { background:rgba(18,62,121,.08); font-weight:600; }
.typeface-picker { border:0; padding:0; margin:14px 0 0; display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.typeface-picker legend { grid-column:1/-1; margin-bottom:4px; }
.typeface-picker label { display:flex; align-items:center; gap:7px; border:1px solid var(--line); border-radius:12px; padding:11px; cursor:pointer; font-size:20px; font-weight:400; }
.typeface-picker input { width:auto; }
.typeface-picker .font-1 { font-family:var(--hand-1); }
.typeface-picker .font-2 { font-family:var(--hand-2); }
.typeface-picker .font-3 { font-family:var(--hand-3); font-size:24px; }
.field-note { margin:0 0 2px; font-size:12px; }
.code-input { text-transform:uppercase; letter-spacing:.16em; font-weight:600; }
.error-text { min-height:20px; color:var(--red); font-size:13px; }
.status-copy { flex:1; min-width:0; }
.status-card.late-start { background:rgba(18,62,121,.055); border-color:var(--line-soft); }
.status-action { flex:none; border:0; background:var(--ink); color:#fff; border-radius:999px; padding:9px 13px; cursor:pointer; font-size:13px; }
.group-sheet { max-width:440px; }
.sheet-pad { padding:22px; }
.group-info-row { display:flex; justify-content:space-between; gap:18px; padding:14px 0; border-bottom:1px solid var(--line); font-size:14px; }
.group-info-row span { color:var(--muted); }
.group-info-row strong { text-align:right; overflow-wrap:anywhere; }
.code-pill { border:1px solid var(--line); background:rgba(255,255,255,.35); color:var(--ink); border-radius:999px; padding:5px 10px; font-weight:700; letter-spacing:.12em; cursor:pointer; }
.logout-button { margin-top:22px; border-radius:999px; padding:10px 16px; cursor:pointer; }
@media (max-width:520px) {
  .gate { padding:16px; align-items:start; padding-top:10vh; }
  .gate-card, .setup-card { padding:22px 18px; }
  .typeface-picker { grid-template-columns:1fr; }
  .status-card { align-items:flex-start; flex-wrap:wrap; }
  .status-action { margin-left:40px; }
}

/* Login gate refinements */
#authGate .gate-card > .brand {
  text-align:center;
}
#authGate .eyebrow {
  text-align:center;
  margin:8px 0 0;
}
#authGate .stack-form input,
#authGate .stack-form .primary {
  border-radius:10px;
}
#authGate .gate-note {
  text-align:center;
}

/* V1.2 visual hierarchy: dark desk + light paper workspace */
:root {
  --desk: #1f2932;
  --desk-2: #172028;
  --desk-text: #e9e1d2;
  --paper: #f4eedf;
  --paper-card: #f8f3e8;
}

body {
  background:
    radial-gradient(circle at 18% 5%, rgba(255,255,255,.045), transparent 25%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0, rgba(255,255,255,.012) 1px, transparent 1px, transparent 6px),
    linear-gradient(145deg, var(--desk), var(--desk-2));
}

/* Structural UI uses the clean sans serif; handwriting is reserved for "ink" content. */
.week-range {
  font-family: var(--body);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .01em;
}
.member-heading h1 {
  font-family: var(--body);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* The paper itself becomes the focused working surface. */
.board-wrap {
  background:
    radial-gradient(circle at 10% 0%, rgba(255,255,255,.45), transparent 28%),
    repeating-linear-gradient(0deg, rgba(93,71,35,.024) 0, rgba(93,71,35,.024) 1px, transparent 1px, transparent 5px),
    var(--paper);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 24px;
  padding: 28px 30px 36px;
  box-shadow: 0 24px 70px rgba(0,0,0,.24);
}

.desktop-sidebar {
  color: var(--desk-text);
}
.desktop-sidebar .nav-item {
  color: rgba(233,225,210,.78);
}
.desktop-sidebar .nav-item.active {
  color: #fffaf0;
  background: rgba(244,238,223,.10);
}

/* Auth/setup cards are pieces of paper sitting on the darker canvas. */
.gate-card,
.setup-card {
  background:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,.45), transparent 32%),
    var(--paper-card);
  border-color: rgba(255,255,255,.20);
  box-shadow: 0 30px 90px rgba(0,0,0,.30);
}

/* Slightly more deliberate login composition. */
#authGate .gate-card {
  padding: 36px 34px 32px;
}
#authGate .eyebrow {
  color: #756f64;
  font-size: 15px;
}

@media (max-width: 900px) {
  .app-shell {
    max-width: 760px;
    padding: 22px 18px 60px;
  }
  .board-wrap {
    padding: 24px 22px 34px;
  }
}

@media (max-width: 520px) {
  body {
    background: var(--desk);
  }
  .app-shell {
    padding: 12px 10px 28px;
  }
  .board-wrap {
    border-radius: 20px;
    padding: 20px 16px 30px;
  }
  #authGate .gate-card {
    padding: 28px 20px 24px;
  }
}

/* V1.3 supplied IN INK wordmark */
.brand {
  font-family: initial;
  font-size: initial;
  letter-spacing: initial;
  font-weight: initial;
  transform: none;
  line-height: 0;
}
.brand img {
  display: block;
  width: 132px;
  height: auto;
  object-fit: contain;
}
#authGate .gate-card > .brand img,
#setupGate .setup-card > .brand img,
#configGate .gate-card > .brand img {
  margin: 0 auto;
  width: 156px;
}
.topbar .brand img {
  width: 128px;
}
@media (max-width:520px) {
  .topbar .brand img { width: 116px; }
  #authGate .gate-card > .brand img,
  #setupGate .setup-card > .brand img,
  #configGate .gate-card > .brand img { width: 144px; }
}
