:root {
  --ink: #1d1c1a;
  --text: #24231f;
  --text2: #34322e;
  --muted: #45423d;
  --muted2: #55524c;
  --muted3: #5f5b54;
  --page: #eceae5;
  --card: #fff;
  --border: #cfcbc3;
  --border2: #b9b4ab;
  --divider: #dcd8d1;
  --divider2: #e2dfd8;
  --soft: #e6e3dc;
  --soft2: #f6f4ef;
  --blue: oklch(0.55 0.15 250);
  --green: oklch(0.58 0.15 150);
  --amber: oklch(0.8 0.15 75);
  --danger: oklch(0.5 0.17 25);
  --purple: oklch(0.55 0.17 300);
  --orange: oklch(0.62 0.19 35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'IBM Plex Sans', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); }
a:hover { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: 'IBM Plex Mono', monospace; }
#app { min-height: 100vh; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Auth screens ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 16px;
}
.auth-eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted2); }
.auth-title { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.auth-sub { font-size: 13px; color: #4f4c46; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text2); }
.field input, .field select, .field textarea {
  border: 1px solid var(--border2); border-radius: 8px; padding: 0 12px; font-size: 14px; background: #fbfaf8;
}
.field input, .field select { height: 40px; }
.field textarea { padding: 10px 12px; resize: vertical; }
.err-text { font-size: 13px; color: var(--danger); }
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 52px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; font-size: 11px; font-weight: 600; color: var(--muted2);
  padding: 4px 8px; cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); }
.btn-primary {
  height: 42px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 600; font-size: 14px;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-plain { border: 0; background: transparent; font-size: 13px; color: var(--muted); }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
header.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 24px;
  background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.live-dot-wrap { display: flex; align-items: center; gap: 6px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: oklch(0.82 0.17 150); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: oklch(0.78 0.2 150); box-shadow: 0 0 0 3px oklch(0.78 0.2 150 / .25); animation: pulse 2s ease-in-out infinite; }
nav.top-nav { display: flex; gap: 4px; margin-left: 8px; }
nav.top-nav button { height: 32px; padding: 0 12px; border-radius: 6px; border: 0; color: #fff; font-size: 13px; background: transparent; }
nav.top-nav button.active { background: rgba(255,255,255,.16); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who-name { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.who-name .name { font-size: 13px; font-weight: 500; }
.who-name .role { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: oklch(0.85 0.1 75); }
.btn-signout { height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; font-size: 13px; }
.btn-signout:hover { background: rgba(255,255,255,.12); }

.viewer-banner { padding: 8px 24px; background: oklch(0.9 0.08 75); font-size: 12px; font-weight: 500; color: #3a2a0c; }

.view-as-banner {
  padding: 8px 24px; background: var(--purple); color: #fff; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 6;
}
.view-as-banner button {
  margin-left: auto; height: 26px; padding: 0 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,.5);
  background: transparent; color: #fff; font-size: 12px; font-weight: 600;
}
.view-as-banner button:hover { background: rgba(255,255,255,.15); }

main.board-main { flex: 1; display: flex; flex-wrap: wrap; gap: 20px; padding: 20px 24px 40px; align-items: flex-start; }

/* ---------- Schedule panel ---------- */
aside.schedule { display: flex; flex-direction: column; gap: 20px; flex: 1 1 260px; max-width: 320px; min-width: 0; }
.sched-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sched-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--divider); font-size: 13px; font-weight: 600; }
.sched-day { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--soft); }
.sched-day-row { display: flex; justify-content: space-between; align-items: center; }
.sched-day-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); }
.today-tag { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #fff; background: var(--orange); border-radius: 3px; padding: 1px 6px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: #24231f; }
.sched-none { font-size: 12px; color: #6f6b64; }

/* ---------- Board ---------- */
.board-col { flex: 999 1 520px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.board-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.board-tab {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border2); background: #fff; color: var(--text);
  font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.board-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.board-tab .dot { width: 8px; height: 8px; border-radius: 50%; }
.board-tab .count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500; opacity: .75; }

.no-boards { background: var(--card); border: 1px dashed #8f8a81; border-radius: 10px; padding: 28px; font-size: 14px; color: var(--text2); text-align: center; }

.lane { border: 1px solid; border-top: 5px solid; border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.lane-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lane-name { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.lane-tag { font-size: 12px; font-weight: 600; color: #fff; border-radius: 999px; padding: 2px 10px; }
.lane-mini-tag { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .06em; color: var(--text2); border: 1px solid var(--border2); border-radius: 3px; padding: 1px 5px; }
.lane-mini-tag.muted { color: var(--muted3); border: none; }
.btn-add-task { margin-left: auto; height: 32px; padding: 0 14px; border-radius: 6px; border: 0; color: #fff; font-size: 13px; font-weight: 600; }
.btn-add-task:hover { filter: brightness(1.08); }

.cols-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.col { background: rgba(255,255,255,.55); border: 1px solid; border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; }
.col-head .label { font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.col-head .count { margin-left: auto; font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500; background: rgba(255,255,255,.3); border-radius: 4px; padding: 0 6px; }
.col-empty { font-size: 12px; color: #6f6b64; padding: 10px 4px; }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: 7px; padding: 10px 11px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.card-top { display: flex; align-items: flex-start; gap: 8px; }
.card-title { flex: 1; font-size: 13.5px; line-height: 1.35; font-weight: 500; }
.repeat-badge { flex: none; font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 500; letter-spacing: .06em; color: #fff; background: var(--purple); border-radius: 3px; padding: 1px 6px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-pri { font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: .05em; border-radius: 3px; padding: 2px 6px; }
.chip-due { font-size: 11px; font-weight: 600; border-radius: 3px; padding: 2px 7px; }
.card-notes { font-size: 12px; line-height: 1.45; color: var(--text2); background: var(--soft2); border-radius: 5px; padding: 6px 8px; white-space: pre-wrap; }
.file-chip { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; padding: 2px 6px; border-radius: 4px; background: var(--soft); color: var(--text2); text-decoration: none; }
.card-meta { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--muted2); line-height: 1.4; }
.card-actions { display: flex; gap: 6px; align-items: center; }
.btn-back { height: 26px; width: 28px; border-radius: 5px; border: 1px solid var(--border2); background: #fff; font-size: 12px; }
.btn-back:hover { background: var(--soft); }
.btn-next { height: 26px; padding: 0 10px; border-radius: 5px; border: 0; font-size: 12px; font-weight: 600; }
.btn-next:hover { filter: brightness(1.08); }
.card-manage { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.link-btn { border: 0; background: transparent; font-size: 11px; font-weight: 500; color: var(--text2); padding: 0; }
.link-btn:hover { color: var(--ink); text-decoration: underline; }
.link-btn.danger:hover { color: var(--danger); }
.footer-note { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted3); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(29,28,26,.35); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal-card { width: 100%; max-width: 420px; background: #fff; border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.18); max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-secondary { height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--border2); background: #fff; font-size: 13px; }
.btn-dark { height: 36px; padding: 0 16px; border-radius: 6px; border: 0; background: var(--ink); color: #fff; font-size: 13px; font-weight: 500; }
.hint { font-size: 12px; color: #4f4c46; margin-top: -6px; }

/* ---------- Users & access ---------- */
main.users-main { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 880px; width: 100%; }
.users-title { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.users-desc { font-size: 13px; color: #4f4c46; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.user-row { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,.9fr) minmax(0,1.1fr) 170px 100px; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--soft); }
.user-row .name { font-size: 14px; font-weight: 500; }
.user-row .sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.user-row .last-seen { font-size: 11px; color: var(--muted3); }
.tag-temp { font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 500; color: #3a2a0c; background: oklch(0.9 0.08 75); border-radius: 3px; padding: 1px 5px; }
.username-mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; }
.board-cell { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.board-cell .board-name { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #24231f; min-width: 0; }
.board-cell .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.btn-dashed { height: 26px; padding: 0 10px; border-radius: 5px; border: 1px dashed #8f8a81; background: transparent; font-size: 12px; color: #24231f; }
.btn-dashed:hover { background: var(--soft2); }
.role-select { height: 32px; border: 1px solid var(--border2); border-radius: 6px; padding: 0 8px; font-size: 12px; background: #fbfaf8; }
.row-end { justify-self: end; display: flex; align-items: center; gap: 12px; }
.switch { width: 40px; height: 22px; border-radius: 999px; border: 0; position: relative; }
.switch .knob { position: absolute; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--divider); }
.panel-head .title { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 600; }
.panel-head .desc { font-size: 12px; color: #4f4c46; font-weight: 400; }
.shared-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--divider2); }
.shared-row .name { flex: 1; font-size: 13px; font-weight: 600; }
.add-form { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.add-form-title { font-size: 13px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 10px; }
.form-grid input, .form-grid select { height: 36px; border: 1px solid var(--border2); border-radius: 6px; padding: 0 10px; font-size: 13px; background: #fbfaf8; }
.checkbox-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #24231f; }
.padded-empty { padding: 12px 16px; font-size: 12px; color: var(--muted3); }

.activity-row { display: flex; align-items: baseline; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--soft); font-size: 13px; }
.activity-who { font-weight: 600; flex: none; }
.activity-text { flex: 1; color: var(--text2); }
.activity-time { flex: none; font-size: 11px; color: var(--muted3); }
.activity-row-danger { background: oklch(0.96 0.03 25); }
.activity-row-danger .activity-text { color: oklch(0.45 0.15 25); }

.loading-wrap { min-height: 100vh; display: grid; place-items: center; color: var(--muted2); font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
