:root{
  --bg:#FBF6EE;
  --surface:#FFFFFF;
  --surface-2:#FBEEDC;
  --ink:#1D1C3E;
  --ink-soft:#58567A;
  --ink-faint:#8B899E;
  --border:#EAE1D2;
  --border-strong:#D9CDB8;
  --accent:#F7901E;
  --accent-soft:#FCE0B8;
  --good:#1F7A6C;
  --good-soft:#D9EDE8;
  --bad:#B23368;
  --bad-soft:#F5DCE7;
  --warn:#B5502C;
  --warn-soft:#F3DCCF;
  --shadow: 0 1px 2px rgba(29,28,62,0.07), 0 6px 16px rgba(29,28,62,0.06);
  --radius:12px;

  /* categorical palette used for people / project accents */
  --p1:#F7901E; --p1-soft:#FCE0B8; /* orange (accent) */
  --p2:#3568B0; --p2-soft:#DCE6F7; /* blue */
  --p3:#6952A3; --p3-soft:#E5DFF2; /* purple */
  --p4:#1F7A6C; --p4-soft:#D9EDE8; /* teal */
  --p5:#B5502C; --p5-soft:#F3DCCF; /* rust */
  --p6:#B23368; --p6-soft:#F5DCE7; /* pink */
  --p7:#71861F; --p7-soft:#E7EDC8; /* olive */
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#17151F;
    --surface:#201D31;
    --surface-2:#282239;
    --ink:#F3EFE4;
    --ink-soft:#B7B2C9;
    --ink-faint:#7D7893;
    --border:#362F4A;
    --border-strong:#473F5C;
    --accent:#FFA23D;
    --accent-soft:#4A331A;
    --good:#4FAE9B; --good-soft:#1E3A34;
    --bad:#E8749F; --bad-soft:#4A2436;
    --warn:#E08157; --warn-soft:#4A2C1E;
    --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 8px 20px rgba(0,0,0,0.4);
  }
}
:root[data-theme="dark"]{
  --bg:#17151F; --surface:#201D31; --surface-2:#282239;
  --ink:#F3EFE4; --ink-soft:#B7B2C9; --ink-faint:#7D7893;
  --border:#362F4A; --border-strong:#473F5C;
  --accent:#FFA23D; --accent-soft:#4A331A;
  --good:#4FAE9B; --good-soft:#1E3A34;
  --bad:#E8749F; --bad-soft:#4A2436;
  --warn:#E08157; --warn-soft:#4A2C1E;
  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 8px 20px rgba(0,0,0,0.4);
}

[hidden]{ display:none !important; }
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:'Public Sans', ui-sans-serif, system-ui, sans-serif;
}
h1,h2,h3{ margin:0; }
button{ font-family:inherit; }
input,select,textarea{ font-family:inherit; }

/* ---------- buttons ---------- */
.btn{
  font-family:'IBM Plex Mono', monospace;
  font-size:12.5px;
  font-weight:600;
  letter-spacing:0.02em;
  border-radius:8px;
  border:1px solid var(--border-strong);
  background:var(--surface);
  color:var(--ink);
  padding:9px 14px;
  cursor:pointer;
  transition:transform .05s ease, box-shadow .15s ease;
}
.btn:hover{ box-shadow:var(--shadow); }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn-ghost{ background:transparent; border-color:transparent; }
.btn-small{ padding:6px 10px; font-size:11.5px; }
.btn-danger{ background:var(--bad); border-color:var(--bad); color:#fff; }

/* ---------- lock / setup screens ---------- */
.lock-screen{
  position:fixed; inset:0; z-index:50;
  display:flex; align-items:center; justify-content:center;
  background:var(--bg);
  padding:24px;
}
.lock-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:32px 30px;
  max-width:420px;
  width:100%;
  text-align:center;
}
.setup-card{ max-width:460px; text-align:left; }
.logo-plate{
  background:#FFFDF8;
  border-radius:12px;
  padding:10px 18px;
  display:inline-flex;
  box-shadow:0 1px 2px rgba(29,28,62,0.12);
  border:1px solid rgba(29,28,62,0.08);
  margin-bottom:14px;
}
.setup-card .logo-plate{ display:flex; justify-content:center; width:100%; }
.lock-logo{ height:76px; display:block; }
.lock-title{
  font-family:'Permanent Marker', 'Baloo 2', sans-serif;
  font-weight:400;
  font-size:28px;
  margin-bottom:8px;
}
.setup-card .lock-title{ text-align:center; width:100%; }
.lock-sub{ color:var(--ink-soft); font-size:13.5px; margin:0 0 20px; line-height:1.5; }
#lock-form{ display:flex; gap:8px; }
#lock-form input{
  flex:1;
  padding:11px 12px;
  border-radius:8px;
  border:1px solid var(--border-strong);
  background:var(--bg);
  color:var(--ink);
  font-size:14px;
}
.lock-error{ color:var(--bad); font-size:12.5px; margin-top:12px; }
#setup-form{ display:flex; flex-direction:column; gap:12px; }
#setup-form label{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.05em;
  color:var(--ink-soft);
  display:flex; flex-direction:column; gap:5px;
}
#setup-form .hint{ text-transform:none; letter-spacing:0; font-weight:400; color:var(--ink-faint); }
#setup-form input{
  padding:10px 11px;
  border-radius:8px;
  border:1px solid var(--border-strong);
  background:var(--bg);
  color:var(--ink);
  font-size:13.5px;
  font-family:'Public Sans', sans-serif;
}

/* ---------- app shell ---------- */
.app{ min-height:100%; }
.topbar{
  display:flex; align-items:center; gap:20px;
  padding:14px 24px;
  background:var(--surface);
  border-bottom:2px solid var(--border-strong);
  flex-wrap:wrap;
  position:sticky; top:0; z-index:10;
}
.brand{ display:flex; align-items:center; gap:12px; flex:none; }
.brand .logo-plate{ margin-bottom:0; padding:6px 12px; }
.brand-logo{ height:36px; display:block; }
.brand-text h1{
  font-family:'Permanent Marker', 'Baloo 2', sans-serif;
  font-weight:400;
  font-size:20px;
  line-height:1.1;
}
.brand-text .kicker{
  margin:2px 0 0;
  font-family:'IBM Plex Mono', monospace;
  font-size:10px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--accent);
  font-weight:600;
}
.tabs{ display:flex; align-items:center; gap:4px; flex:1; flex-wrap:wrap; }
.tabs-people{ display:flex; gap:4px; }
.tab{
  border:none; background:transparent;
  font-family:'Baloo 2', sans-serif;
  font-weight:600;
  font-size:14.5px;
  color:var(--ink-soft);
  padding:9px 14px;
  border-radius:9px;
  cursor:pointer;
}
.tab:hover{ background:var(--surface-2); color:var(--ink); }
.tab.active{ background:var(--accent); color:#fff; }
.topbar-right{ display:flex; align-items:center; gap:8px; flex:none; }
.sync-status{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  color:var(--good);
  white-space:nowrap;
}
.sync-status.syncing{ color:var(--accent); }
.sync-status.error{ color:var(--bad); }

.page{ max-width:1300px; margin:0 auto; padding:28px 24px 80px; }

/* ---------- section heads ---------- */
.section-head{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:16px; gap:12px; flex-wrap:wrap;
}
.section-head h2{
  font-family:'Baloo 2', sans-serif;
  font-weight:800;
  font-size:22px;
}
.section-head .sub{ color:var(--ink-soft); font-size:13px; margin-top:2px; }

/* ---------- stat row ---------- */
.stats-row{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px,1fr));
  gap:12px;
  margin-bottom:24px;
}
.stat-tile{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  padding:14px 16px;
  box-shadow:var(--shadow);
}
.stat-tile .num{ font-family:'Baloo 2',sans-serif; font-weight:800; font-size:28px; }
.stat-tile .label{ font-family:'IBM Plex Mono',monospace; font-size:10.5px; text-transform:uppercase; letter-spacing:0.05em; color:var(--ink-soft); margin-top:2px; }

/* ---------- timeline (overview) ---------- */
.timeline-wrap{
  overflow-x:auto;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface);
  box-shadow:var(--shadow);
  margin-bottom:28px;
}
.timeline{
  display:grid;
  min-width:900px;
}
.timeline-row{
  display:grid;
  grid-template-columns:220px 1fr;
  border-bottom:1px solid var(--border);
}
.timeline-row:last-child{ border-bottom:none; }
.timeline-head-row{
  grid-template-columns:220px 1fr;
  background:var(--surface-2);
  position:sticky; top:0;
}
.timeline-label{
  padding:12px 14px;
  display:flex; align-items:center; gap:8px;
  border-right:1px solid var(--border-strong);
  font-size:13px;
  font-weight:600;
  position:sticky; left:0;
  background:inherit;
}
.timeline-label .dot{ width:9px; height:9px; border-radius:50%; flex:none; }
.timeline-track{
  position:relative;
  min-height:52px;
  display:flex;
  align-items:center;
  padding:8px 14px;
}
.timeline-months{
  display:flex;
  font-family:'IBM Plex Mono',monospace;
  font-size:10.5px;
  text-transform:uppercase;
  letter-spacing:0.05em;
  color:var(--ink-soft);
  padding:10px 14px;
}
.timeline-months span{ flex:1; }
.timeline-bar{
  position:absolute;
  height:26px;
  border-radius:7px;
  display:flex; align-items:center;
  padding:0 10px;
  font-family:'IBM Plex Mono',monospace;
  font-size:11.5px;
  font-weight:600;
  color:#fff;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  box-shadow:0 1px 1px rgba(0,0,0,0.1);
  cursor:pointer;
}

/* ---------- who's doing what ---------- */
.assign-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(260px,1fr));
  gap:16px;
}
.assign-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.assign-card .head{
  display:flex; align-items:center; gap:10px;
  padding:12px 16px;
  border-bottom:1px solid var(--border);
}
.avatar{
  width:32px; height:32px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-family:'Baloo 2',sans-serif; font-weight:700; font-size:13px; color:#fff;
  flex:none;
}
.assign-card .head .name{ font-family:'Baloo 2',sans-serif; font-weight:700; font-size:16px; }
.assign-card .body{ padding:10px 16px 14px; }
.assign-proj{
  display:flex; align-items:center; justify-content:space-between;
  gap:8px;
  padding:8px 0;
  border-bottom:1px solid var(--border);
  font-size:13px;
}
.assign-proj:last-child{ border-bottom:none; }
.badge{
  font-family:'IBM Plex Mono',monospace;
  font-size:10px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.03em;
  padding:3px 8px;
  border-radius:20px;
  white-space:nowrap;
}

/* ---------- project cards ---------- */
.project-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(280px,1fr));
  gap:16px;
}
.project-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-left:4px solid var(--accent);
  border-radius:12px;
  box-shadow:var(--shadow);
  padding:16px 18px;
  cursor:pointer;
  transition:transform .1s ease;
}
.project-card:hover{ transform:translateY(-2px); }
.project-card .top{ display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.project-card h3{ font-family:'Baloo 2',sans-serif; font-weight:700; font-size:17px; }
.project-card p.desc{ color:var(--ink-soft); font-size:12.5px; margin:8px 0 12px; line-height:1.5; min-height:2.6em; }
.project-card .meta{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.project-card .avatars{ display:flex; }
.project-card .avatars .avatar{ width:24px; height:24px; font-size:10px; margin-left:-8px; border:2px solid var(--surface); }
.project-card .avatars .avatar:first-child{ margin-left:0; }
.project-card .repo-link{ font-family:'IBM Plex Mono',monospace; font-size:10.5px; color:var(--ink-faint); margin-top:10px; display:block; text-decoration:none; }
.project-card .repo-link:hover{ color:var(--accent); }

/* ---------- person page ---------- */
.person-header{
  display:flex; align-items:center; gap:14px;
  margin-bottom:22px;
}
.person-header .avatar{ width:52px; height:52px; font-size:20px; }
.person-header h2{ font-family:'Permanent Marker',sans-serif; font-weight:400; font-size:26px; }
.person-header .sub{ color:var(--ink-soft); font-size:13px; }

.board-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(300px,1fr));
  gap:16px;
  margin-bottom:8px;
}
.board-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:var(--shadow);
  overflow:hidden;
  cursor:pointer;
}
.board-card.active{ outline:2px solid var(--accent); }
.board-card .head{ padding:14px 16px 10px; }
.board-card .head h3{ font-family:'Baloo 2',sans-serif; font-size:16px; }
.board-card .status-row{ display:flex; align-items:center; gap:8px; margin-top:8px; }
.board-card .body{ padding:0 16px 14px; color:var(--ink-soft); font-size:12.5px; }

/* ---------- project detail / sub tabs ---------- */
.detail-panel{
  margin-top:24px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.detail-panel .dp-head{
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px;
  padding:16px 20px;
  border-bottom:1px solid var(--border);
  background:var(--surface-2);
}
.detail-panel .dp-head h3{ font-family:'Baloo 2',sans-serif; font-size:19px; }
.subtabs{ display:flex; gap:4px; padding:10px 20px 0; border-bottom:1px solid var(--border); }
.subtab{
  border:none; background:transparent;
  font-family:'IBM Plex Mono',monospace;
  font-size:11.5px; font-weight:600; text-transform:uppercase; letter-spacing:0.04em;
  color:var(--ink-soft);
  padding:9px 12px;
  border-bottom:2px solid transparent;
  cursor:pointer;
}
.subtab.active{ color:var(--accent); border-bottom-color:var(--accent); }
.subtab-body{ padding:18px 20px 22px; }

/* kanban */
.kanban{ display:grid; grid-template-columns:repeat(4,minmax(180px,1fr)); gap:12px; overflow-x:auto; }
.kanban-col{ background:var(--surface-2); border-radius:10px; padding:10px; min-height:120px; }
.kanban-col h4{ font-family:'IBM Plex Mono',monospace; font-size:11px; text-transform:uppercase; letter-spacing:0.04em; color:var(--ink-soft); margin-bottom:8px; }
.kanban-card{
  background:var(--surface); border:1px solid var(--border); border-radius:8px;
  padding:9px 10px; margin-bottom:8px; font-size:12.5px; box-shadow:var(--shadow);
}
.kanban-card a{ color:var(--ink); text-decoration:none; font-weight:600; }
.kanban-card a:hover{ color:var(--accent); }
.kanban-card .labels{ display:flex; gap:4px; flex-wrap:wrap; margin-top:6px; }
.kanban-card .lbl{ font-size:9.5px; padding:2px 6px; border-radius:20px; font-family:'IBM Plex Mono',monospace; }

/* list rows (bugs, releases, milestones) */
.list-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:11px 4px; border-bottom:1px solid var(--border); font-size:13px; flex-wrap:wrap;
}
.list-row:last-child{ border-bottom:none; }
.list-row a{ color:var(--ink); font-weight:600; text-decoration:none; }
.list-row a:hover{ color:var(--accent); }
.list-row .meta{ color:var(--ink-faint); font-family:'IBM Plex Mono',monospace; font-size:11px; }

.progress-bar{ height:7px; border-radius:6px; background:var(--surface-2); overflow:hidden; margin-top:6px; }
.progress-bar > div{ height:100%; background:var(--accent); }

.empty-state{ text-align:center; padding:40px 20px; color:var(--ink-faint); font-size:13.5px; }
.loading-state{ text-align:center; padding:40px 20px; color:var(--ink-soft); font-size:13px; font-family:'IBM Plex Mono',monospace; }

/* ---------- settings ---------- */
.settings-grid{ display:grid; grid-template-columns:1fr 1fr; gap:20px; }
@media (max-width:900px){ .settings-grid{ grid-template-columns:1fr; } }
.settings-card{
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  box-shadow:var(--shadow); padding:18px 20px;
}
.settings-card h3{ font-family:'Baloo 2',sans-serif; font-size:16px; margin-bottom:12px; }
.people-list{ display:flex; flex-direction:column; gap:8px; margin-bottom:14px; }
.person-row{ display:flex; align-items:center; gap:10px; padding:8px; border:1px solid var(--border); border-radius:8px; }
.person-row .name{ flex:1; font-weight:600; font-size:13.5px; }
.swatches{ display:flex; gap:6px; }
.swatch{ width:20px; height:20px; border-radius:50%; cursor:pointer; border:2px solid transparent; }
.swatch.selected{ border-color:var(--ink); }
.field-row{ display:flex; gap:8px; margin-bottom:10px; }
.field-row input, .field-row select{
  flex:1; padding:8px 10px; border-radius:7px; border:1px solid var(--border-strong);
  background:var(--bg); color:var(--ink); font-size:13px;
}
.settings-note{ font-size:11.5px; color:var(--ink-faint); line-height:1.5; margin-top:8px; }

/* ---------- modal ---------- */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(29,28,62,0.45);
  display:flex; align-items:center; justify-content:center; z-index:100; padding:20px;
}
.modal{
  background:var(--surface); border-radius:14px; box-shadow:var(--shadow);
  max-width:520px; width:100%; max-height:88vh; overflow-y:auto; padding:24px 26px;
}
.modal h2{ font-family:'Baloo 2',sans-serif; font-size:20px; margin-bottom:16px; }
.modal label{
  display:block; font-family:'IBM Plex Mono',monospace; font-size:10.5px; text-transform:uppercase;
  letter-spacing:0.05em; color:var(--ink-soft); margin:12px 0 5px;
}
.modal input, .modal select, .modal textarea{
  width:100%; padding:9px 11px; border-radius:8px; border:1px solid var(--border-strong);
  background:var(--bg); color:var(--ink); font-size:13.5px; font-family:'Public Sans',sans-serif;
}
.modal textarea{ resize:vertical; min-height:60px; }
.checkbox-grid{ display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.check-pill{
  display:flex; align-items:center; gap:6px; padding:6px 10px; border-radius:20px;
  border:1px solid var(--border-strong); font-size:12.5px; cursor:pointer;
}
.check-pill.on{ background:var(--accent-soft); border-color:var(--accent); }
.modal-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:20px; }

::-webkit-scrollbar{ height:10px; width:10px; }
::-webkit-scrollbar-thumb{ background:var(--border-strong); border-radius:6px; }
