/* panluminate collaborator tracker
   Built on the R&D tracker's instrument-panel look: an ink-blue dark theme with
   teal accents, and a brightfield light twin. Task sides get their own colors:
   teal for panluminate, violet for the partner lab. Every color is a token. */

:root, :root[data-theme="dark"] {
  --bg: #0b0e15;
  --bg-grad: radial-gradient(1200px 600px at 78% -10%, #121a2b 0%, #0b0e15 55%);
  --surface: #141a26;
  --surface-raised: #1a2130;
  --surface-glass: rgba(17, 23, 34, .78);
  --rule: #29303f;
  --rule-soft: #1f2532;
  --graphite: #e9edf4;
  --slate: #9aa5ba;
  --slate-light: #67718a;
  --teal: #2fd8c3;
  --teal-deep: #23b6a4;
  --teal-wash: rgba(47, 216, 195, .12);
  --teal-line: rgba(47, 216, 195, .35);
  --on-teal: #04120f;
  --violet: #a99cff;
  --violet-wash: rgba(169, 156, 255, .13);
  --violet-line: rgba(169, 156, 255, .38);
  --st-proposed: #79839a;
  --st-progress: #2fd8c3;
  --st-review: #f2b34d;
  --st-complete: #35d39a;
  --amber-wash: rgba(242, 179, 77, .14);
  --alert: #fb7185;
  --alert-wash: rgba(251, 113, 133, .13);
  --shadow-card: 0 1px 0 rgba(255,255,255,.02) inset, 0 2px 6px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.28);
  --shadow-pop: 0 24px 60px rgba(0,0,0,.55);
  --scrim: rgba(5, 8, 14, .62);
  --radius: 9px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eef1f6;
  --bg-grad: radial-gradient(1200px 600px at 80% -12%, #ffffff 0%, #eef1f6 55%);
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-glass: rgba(255, 255, 255, .8);
  --rule: #d9dfe9;
  --rule-soft: #e8ecf2;
  --graphite: #121722;
  --slate: #56617a;
  --slate-light: #7d879b;
  --teal: #0b9a99;
  --teal-deep: #087c81;
  --teal-wash: rgba(11, 154, 153, .10);
  --teal-line: rgba(11, 154, 153, .30);
  --on-teal: #ffffff;
  --violet: #5b4bd6;
  --violet-wash: rgba(91, 75, 214, .09);
  --violet-line: rgba(91, 75, 214, .30);
  --st-proposed: #7c869b;
  --st-progress: #0e9d9a;
  --st-review: #b36f0a;
  --st-complete: #12925f;
  --amber-wash: #fdf3e2;
  --alert: #d64d5c;
  --alert-wash: #fceef0;
  --shadow-card: 0 1px 2px rgba(20,25,35,.06), 0 6px 18px rgba(20,25,35,.07);
  --shadow-pop: 0 20px 50px rgba(20,25,35,.20);
  --scrim: rgba(20, 25, 35, .40);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--graphite);
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body { background: var(--bg-grad); background-attachment: fixed; }
h1, h2, h3 { font-family: "Archivo", system-ui, sans-serif; letter-spacing: -.02em; margin: 0; }
.mono, time { font-family: "IBM Plex Mono", ui-monospace, monospace; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal); text-decoration-color: var(--teal-line); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- controls ---------- */

.field-label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--slate-light);
  margin-bottom: 5px;
}
select, input[type="text"], input[type="date"], input[type="url"], input[type="password"], input[type="email"], textarea {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-width: 0;
  width: 100%;
  color: var(--graphite);
}
select:hover, input:hover, textarea:hover { border-color: var(--slate-light); }
textarea { resize: vertical; min-height: 72px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: var(--on-teal);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.btn.ghost { background: transparent; color: var(--teal); }
.btn.ghost:hover { background: var(--teal-wash); }
.btn.quiet { background: var(--surface); border-color: var(--rule); color: var(--slate); }
.btn.quiet:hover { background: var(--surface-raised); color: var(--graphite); border-color: var(--slate-light); }
.btn.danger { background: transparent; border-color: var(--alert); color: var(--alert); }
.btn.danger:hover { background: var(--alert-wash); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.full { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--teal); cursor: pointer; font-size: 12px; text-decoration: underline; text-decoration-color: var(--teal-line); }
.linkbtn.danger { color: var(--alert); text-decoration-color: var(--alert-wash); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 2px 8px;
  color: var(--slate);
  white-space: nowrap;
}
.chip.teal { border-color: var(--teal-line); color: var(--teal); background: var(--teal-wash); }
.chip.violet { border-color: var(--violet-line); color: var(--violet); background: var(--violet-wash); }
.chip.amber { border-color: var(--st-review); color: var(--st-review); background: var(--amber-wash); }
.chip.alert { border-color: var(--alert); color: var(--alert); background: var(--alert-wash); }

.err { color: var(--alert); font-size: 13px; margin: 0; }
.err:empty, .ok:empty { display: none; }
.ok { color: var(--st-complete); font-size: 13px; margin: 0; }
.muted { color: var(--slate); }
.faint { color: var(--slate-light); font-size: 12px; }

/* ---------- sign-in pages ---------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 30px 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.auth-card h1 { font-size: 23px; }
.auth-card p { margin: 0; }
.brandrow { display: flex; align-items: center; gap: 9px; font-family: "IBM Plex Mono", monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--slate); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px var(--teal-wash), 0 0 14px var(--teal); flex: none; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--slate-light); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-foot { display: flex; justify-content: space-between; font-size: 12px; }

/* ---------- app shell ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface-glass);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.wordmark { display: flex; align-items: center; gap: 10px; }
.wordmark strong { font-family: "Archivo", sans-serif; font-weight: 700; font-size: 15px; letter-spacing: -.03em; }
.wordmark span { font-family: "IBM Plex Mono", monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .18em; color: var(--slate-light); }
.topbar .spacer { flex: 1; }
.collab-select { width: auto; min-width: 200px; max-width: 320px; font-weight: 600; }
.whoami { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--slate); }
.theme-toggle { width: 34px; height: 32px; padding: 6px; }
.theme-toggle svg { width: 16px; height: 16px; display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .theme-toggle .i-moon { display: block; }

.viewtoggle { display: flex; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 2px; gap: 2px; }
.viewtoggle button {
  border: 0; background: transparent; padding: 6px 13px; cursor: pointer;
  border-radius: calc(var(--radius) - 3px);
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--slate);
}
.viewtoggle button[aria-pressed="true"] { background: var(--teal); color: var(--on-teal); font-weight: 500; }

.subbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px 6px; }
.subbar h2 { font-size: 19px; }
.subbar.stack { flex-direction: column; align-items: flex-start; gap: 4px; }
.subbar .desc { color: var(--slate); font-size: 13px; max-width: 70ch; }
.subbar .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.subbar select { width: auto; }

.banner {
  margin: 8px 20px 0;
  padding: 10px 14px;
  border: 1px solid var(--st-review);
  background: var(--amber-wash);
  border-radius: var(--radius);
  font-size: 13px;
}

/* ---------- board ---------- */

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 14px;
  padding: 12px 20px 48px;
  align-items: start;
}
.column { background: var(--rule-soft); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 10px; min-height: 160px; }
:root[data-theme="light"] .column { background: rgba(255,255,255,.45); }
.colhead { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; }
.colhead h3 { font-size: 12px; font-family: "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .12em; font-weight: 500; color: var(--slate); }
.colhead .swatch { width: 8px; height: 8px; border-radius: 50%; }
.colhead .count { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--slate-light); }
.col-proposed .swatch { background: var(--st-proposed); }
.col-in_progress .swatch { background: var(--st-progress); }
.col-review .swatch { background: var(--st-review); }
.col-complete .swatch { background: var(--st-complete); }
.cards { display: flex; flex-direction: column; gap: 10px; }
.empty-col { color: var(--slate-light); font-size: 12px; text-align: center; padding: 20px 6px; }

.card {
  display: block; width: 100%; text-align: left;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 12px;
  cursor: pointer;
  color: inherit;
}
.card:hover { border-color: var(--teal-line); }
.card.pending { border-style: dashed; border-color: var(--st-review); }
.card .collab-tag { font-family: "IBM Plex Mono", monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--slate-light); margin-bottom: 4px; }
.card h4 { margin: 0 0 6px; font-family: "Archivo", sans-serif; font-size: 14.5px; line-height: 1.3; letter-spacing: -.01em; }
.card .dates { font-size: 11.5px; color: var(--slate); margin-bottom: 8px; }
.card .flags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }

.split { display: flex; flex-direction: column; gap: 5px; }
.splitrow { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: 8px; font-size: 11.5px; }
.splitrow .who { color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.splitrow .n { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--slate-light); text-align: right; }
.meter { height: 6px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; }
.meter.pl > i { background: var(--teal); }
.meter.partner > i { background: var(--violet); }

/* ---------- my tasks ---------- */

.list { padding: 12px 20px 48px; display: flex; flex-direction: column; gap: 8px; max-width: 900px; }
.listrow {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 11px 14px;
  cursor: pointer; text-align: left; color: inherit; width: 100%;
}
.listrow:hover { border-color: var(--teal-line); }
.listrow .t { font-weight: 600; }
.listrow .sub { font-size: 12px; color: var(--slate); }

/* ---------- drawer ---------- */

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(980px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--rule);
  box-shadow: var(--shadow-pop);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.drawer-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 22px 14px;
  background: var(--surface-glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.drawer-head .titles { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 20px; line-height: 1.25; }
.drawer-head .eyebrow { font-family: "IBM Plex Mono", monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--slate-light); margin-bottom: 4px; }
.drawer-body { padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 22px; }
.section h3 { font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 18px; }
.facts .v { font-size: 13.5px; overflow-wrap: anywhere; }
.objective { white-space: pre-wrap; font-size: 13.5px; }
.statusrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.statusrow select { width: auto; }

.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.formgrid .wide { grid-column: 1 / -1; }
.formactions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.side { border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 12px; background: var(--surface); }
.side.pl { border-top: 3px solid var(--teal); }
.side.partner { border-top: 3px solid var(--violet); }
.side-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.side-head h4 { margin: 0; font-family: "Archivo", sans-serif; font-size: 14px; }
.side-head .n { margin-left: auto; font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--slate-light); }
.task {
  border: 1px solid var(--rule-soft); border-radius: var(--radius); padding: 10px; margin-bottom: 8px;
  background: var(--surface-raised); display: flex; flex-direction: column; gap: 6px;
}
.task.pending { border: 1px dashed var(--st-review); }
.task.done .ttitle { text-decoration: line-through; color: var(--slate); }
.task .ttop { display: flex; gap: 8px; align-items: flex-start; }
.task .ttitle { font-weight: 600; flex: 1; overflow-wrap: anywhere; }
.task .tmeta { display: flex; gap: 6px 10px; flex-wrap: wrap; font-size: 12px; color: var(--slate); align-items: center; }
.task .tnotes { font-size: 12.5px; color: var(--slate); white-space: pre-wrap; overflow-wrap: anywhere; }
.task select { width: auto; padding: 4px 8px; font-size: 12px; }
.task .tactions { display: flex; gap: 10px; flex-wrap: wrap; }
.overdue { color: var(--alert); }
.addtask { margin-top: 4px; }

.feed { display: flex; flex-direction: column; gap: 10px; }
.post { border: 1px solid var(--rule); border-radius: var(--radius); padding: 11px 13px; background: var(--surface); }
.post .phead { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--slate); margin-bottom: 6px; flex-wrap: wrap; }
.post .pbody { white-space: pre-wrap; overflow-wrap: anywhere; }
.post .plink { margin-top: 6px; font-size: 12.5px; overflow-wrap: anywhere; }
.composer { display: flex; flex-direction: column; gap: 8px; }

/* ---------- admin ---------- */

.admin { padding: 12px 20px 48px; display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 14px; }
.panel h3 { font-size: 14px; margin-bottom: 10px; }
.collab-list { display: flex; flex-direction: column; gap: 6px; }
.collab-item { text-align: left; width: 100%; background: transparent; border: 1px solid var(--rule); border-radius: var(--radius); padding: 9px 11px; cursor: pointer; color: inherit; }
.collab-item[aria-current="true"] { border-color: var(--teal); background: var(--teal-wash); }
.collab-item .sub { font-size: 11.5px; color: var(--slate); }
table.people { width: 100%; border-collapse: collapse; font-size: 13px; }
table.people th { text-align: left; font-family: "IBM Plex Mono", monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--slate-light); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--rule); }
table.people td { padding: 9px 8px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
table.people td .rowactions { display: flex; gap: 12px; flex-wrap: wrap; }
.linkbox { display: flex; gap: 8px; margin-top: 8px; }
.linkbox input { font-family: "IBM Plex Mono", monospace; font-size: 11.5px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--graphite); color: var(--bg);
  padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-pop); font-size: 13px; max-width: calc(100% - 32px);
}
.toast.bad { background: var(--alert); color: #fff; }

/* ---------- small screens ---------- */

@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .collab-select { min-width: 0; max-width: none; flex: 1 1 100%; order: 5; }
  .subbar, .list { padding-left: 16px; padding-right: 16px; }
  .banner { margin-left: 16px; margin-right: 16px; }
  .board { grid-template-columns: 1fr; padding: 12px 16px 40px; }
  .sides, .formgrid, .admin { grid-template-columns: 1fr; }
  .admin { padding: 12px 16px 40px; }
  .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; }
  .whoami .name { display: none; }
  table.people th:nth-child(3), table.people td:nth-child(3) { display: none; }
}
