:root {
  --page: #F4F5F7;
  --card: #FFFFFF;
  --line: #E3E5E9;
  --line-strong: #C9CDD4;
  --ink: #1B1D21;
  --muted: #6B7078;
  --quarter: #6B5BA8;

  --veeva: #2F5AA8;
  --veeva-track: #DCE6F6;
  --crio: #0F7B63;
  --crio-track: #D5EBE5;
  --ignite: #8A3B6B;
  --ignite-track: #F0DEEA;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  padding: 24px;
}

.board { max-width: 1160px; margin: 0 auto; }

.top { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font-size: 21px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.session { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { font-size: 13px; color: var(--muted); }

.controls { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
#year-label { font-size: 14px; min-width: 44px; text-align: center; }

button {
  font: inherit; font-size: 13px; padding: 7px 13px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  cursor: pointer;
}
button:hover { background: #EFF1F4; }
button:focus-visible { outline: 2px solid var(--veeva); outline-offset: 2px; }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.primary:hover { background: #34373D; }
button.danger { color: #9B2C2C; border-color: #E3C4C4; }
button.danger:hover { background: #FBEFEF; }

.chart { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.loading { padding: 28px; color: var(--muted); font-size: 14px; margin: 0; }

.gutter { width: 148px; flex: 0 0 148px; }

.quarters { display: flex; border-bottom: 1px solid var(--line); background: #FAF9FD; }
.quarters .grid, .months .grid { flex: 1; display: flex; }
.quarter {
  flex: 1; padding: 7px 10px; font-size: 12px; color: #4E4283;
  border-left: 2px solid var(--quarter); display: flex; justify-content: space-between; gap: 8px;
}
.quarter:first-child { border-left: none; }
.gate { color: var(--quarter); white-space: nowrap; }

.months { display: flex; border-bottom: 1px solid var(--line); }
.month {
  flex: 1; padding: 9px 0; text-align: center; font-size: 12px; color: var(--muted);
  border-left: 1px solid var(--line);
}
.month.q { border-left: 2px solid var(--quarter); }
.month:first-child { border-left: none; }

.lane { display: flex; border-bottom: 1px solid var(--line); }
.lane:last-child { border-bottom: none; }
.lane-name {
  padding: 14px 16px; font-size: 14px; font-weight: 500;
  border-right: 1px solid var(--line); display: flex; align-items: flex-start; gap: 9px;
}
.swatch { width: 10px; height: 10px; border-radius: 2px; margin-top: 5px; flex: 0 0 10px; }
.lane-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

.track { flex: 1; position: relative; padding: 10px 0; min-height: 62px; }
.gridlines { position: absolute; inset: 0; display: flex; pointer-events: none; }
.gridlines i { flex: 1; border-left: 1px solid var(--line); }
.gridlines i:first-child { border-left: none; }
.gridlines i.q { border-left: 2px solid var(--quarter); }
.gridlines i.q:first-child { border-left: none; }

.today { position: absolute; top: 0; bottom: 0; width: 1px; background: #C0392B; pointer-events: none; }
.today::after {
  content: "today"; position: absolute; top: 2px; left: 4px;
  font-size: 10px; color: #C0392B; white-space: nowrap;
}

.row { position: relative; height: 30px; margin-bottom: 6px; }
.row:last-child { margin-bottom: 0; }

.bar {
  position: absolute; top: 0; height: 30px; border-radius: 5px; overflow: hidden;
  border: none; padding: 0; display: block; min-width: 6px; font: inherit; text-align: left;
}
.bar[data-editable="true"] { cursor: pointer; }
.bar[data-editable="false"] { cursor: default; }
.bar:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.bar .fill { position: absolute; inset: 0 auto 0 0; }
.bar .label {
  position: relative; display: block; padding: 6px 9px; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff;
  text-shadow: 0 0 3px rgba(0, 0, 0, .35);
}
.bar.clip-start { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.clip-end { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.empty { padding: 8px 12px; font-size: 13px; color: var(--muted); }

.legend { display: flex; gap: 18px; flex-wrap: wrap; padding: 12px 2px 0; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 20px; height: 9px; border-radius: 2px; display: inline-block; }

.panel {
  margin-top: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px 20px;
}
.panel h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input, select {
  font: inherit; font-size: 14px; width: 100%; padding: 7px 9px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--veeva); outline-offset: -1px; border-color: var(--veeva); }
input[type=range] { padding: 0; border: none; }
.pct { font-size: 13px; color: var(--muted); margin-top: 4px; }
.panel-actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; }

.msg { font-size: 13px; margin: 10px 0 0; }
.msg.error { color: #9B2C2C; }
.msg.ok { color: #1E6B4E; }

.readonly-note { font-size: 13px; color: var(--muted); margin: 16px 2px 0; }

footer {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}

dialog {
  border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px;
  max-width: 340px; width: calc(100% - 32px); color: var(--ink); background: var(--card);
}
dialog::backdrop { background: rgba(20, 22, 26, .38); }
dialog h2 { font-size: 16px; font-weight: 600; margin: 0 0 14px; }
dialog label { margin-top: 12px; }
dialog label:first-of-type { margin-top: 0; }

@media (max-width: 720px) {
  body { padding: 12px; }
  .gutter, .lane-name { width: 96px; flex-basis: 96px; }
  .month { font-size: 11px; }
  .gate { display: none; }
}
