:root {
  --bg: #f6f4ef;
  --ink: #111;
  --muted: #6f6a61;
  --line: #d8d1c4;
  --paper: #fffdf8;
  --accent: #174f3f;
  --accent-2: #a93024;
  --accent-3: #315f90;
  --note: #a36b10;
  --soft: #ece4d6;
  --p1: #a93024;
  --p2: #a36b10;
  --p3: #174f3f;
  --p4: #315f90;
  --p5: #6f6a61;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
input {
  font: inherit;
}

.top-nav {
  display: flex;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
  padding-bottom: 14px;
}

.top-nav a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.top-nav a.active {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 24px;
  margin-bottom: 28px;
}

.compact-header {
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.compact-header strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  line-height: 1;
  font-weight: 500;
}

h1 {
  margin: 0;
  font-weight: 500;
  line-height: .9;
  font-size: clamp(42px, 7vw, 96px);
}

h2,
h3,
p {
  margin: 0;
}

.eyebrow,
.summary span,
.section-head span,
.side-note span,
.chart-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.updated {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  border: 1px solid var(--ink);
  background: var(--paper);
  margin-bottom: 28px;
}

.summary div {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.summary div:last-child {
  border-right: 0;
}

.summary strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  font-weight: 500;
}

.summary div:first-child {
  background: var(--ink);
  color: var(--paper);
}

.summary div:first-child span {
  color: #d8d1c4;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 28px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr);
  gap: 18px;
  align-items: start;
}

.feature-panel {
  grid-row: span 3;
}

.panel,
.priority-block,
.completed,
.product-card,
.email-alert {
  border: 1px solid var(--ink);
  background: var(--paper);
}

.panel {
  padding: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.section-head a,
.section-head strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

details > summary {
  cursor: pointer;
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

.mini-list,
.task-list,
.completed-list,
.meeting-list {
  display: grid;
  gap: 10px;
}

.mini-task,
.task-row,
.meeting-note,
.completed-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
}

.mini-task button,
.task-row button,
.meeting-note button {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
}

.mini-task button:hover,
.task-row button:hover,
.meeting-note button:hover {
  background: var(--accent);
}

.mini-task strong,
.completed-row strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.priority-stack {
  display: grid;
  gap: 18px;
}

.priority-head {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 14px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

.priority-head span {
  font-size: 26px;
  line-height: 1;
  font-weight: 500;
}

.priority-head h2 {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1;
  font-weight: 500;
}

.priority-head strong {
  color: var(--muted);
  font-weight: 500;
}

.priority-block.P1 .priority-head span,
.priority-chip.P1 {
  color: var(--p1);
}

.priority-block.P2 .priority-head span,
.priority-chip.P2 {
  color: var(--p2);
}

.priority-block.P3 .priority-head span,
.priority-chip.P3 {
  color: var(--p3);
}

.priority-block.P4 .priority-head span,
.priority-chip.P4 {
  color: var(--p4);
}

.priority-block.P5 .priority-head span,
.priority-chip.P5 {
  color: var(--p5);
}

.task-list {
  padding: 18px;
}

.task-row {
  grid-template-columns: 24px 1fr;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.task-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.task-title-line {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 4px;
}

.priority-chip {
  min-width: 28px;
  font-size: 12px;
  font-weight: 600;
}

.task-row h3 {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
}

.task-row p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.completed {
  margin-top: 28px;
  padding: 18px;
  background: #fbf7ee;
}

.completed .section-head {
  margin-bottom: 0;
  border-bottom-color: var(--ink);
}

.completed[open] .section-head {
  margin-bottom: 14px;
}

.completed .section-head strong::before {
  content: "▸ ";
  color: var(--ink);
}

.completed[open] .section-head strong::before {
  content: "▾ ";
}

.completed-row {
  grid-template-columns: 1fr auto;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.completed-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.completed-row button,
.email-alert button,
.add-form button {
  border: 1px solid var(--ink);
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
}

.completed-row button:hover,
.email-alert button:hover,
.add-form button:hover {
  background: var(--ink);
  color: var(--paper);
}

.product-list {
  display: grid;
  gap: 18px;
}

.automation-list {
  display: grid;
  gap: 18px;
}

.product-card {
  display: grid;
  grid-template-columns: 180px 1fr 320px 220px;
  gap: 20px;
  padding: 18px;
}

.automation-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--ink);
  background: var(--paper);
}

.automation-card.attention {
  border-color: var(--p1);
}

.automation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.issue-panel {
  border-color: var(--p1);
  margin-bottom: 28px;
}

.issue-list {
  display: grid;
  gap: 8px;
}

.issue-list p {
  color: var(--p1);
  font-size: 14px;
  line-height: 1.4;
}

.system-list {
  display: grid;
  gap: 10px;
}

.system-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.system-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.system-row strong {
  font-size: 14px;
  font-weight: 500;
}

.system-row span,
.health-mini span,
.health-mini small {
  color: var(--muted);
  font-size: 12px;
}

.system-row.attention span,
.health-mini.attention strong {
  color: var(--p1);
}

.health-mini {
  display: grid;
  gap: 6px;
}

.health-mini strong {
  font-size: 18px;
  font-weight: 500;
}

.gantt-shell {
  border: 1px solid var(--ink);
  background: var(--paper);
  padding: 18px;
  min-width: 0;
}

.gantt-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.gantt-toolbar strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 500;
}

.gantt-actions {
  display: flex;
  gap: 10px;
}

.gantt-actions button,
.gantt-task-source {
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
}

.gantt-actions button {
  padding: 8px 12px;
}

.gantt-actions button:hover,
.gantt-task-source:hover,
.gantt-task-source.selected {
  background: var(--ink);
  color: var(--paper);
}

.gantt-workspace {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 16px;
  min-height: 620px;
}

.gantt-sidebar {
  border-right: 1px solid var(--line);
  padding-right: 16px;
  min-width: 0;
}

.gantt-sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.gantt-sidebar-head span,
.gantt-mobile-hint {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.gantt-mobile-hint {
  display: none;
  margin-bottom: 12px;
  text-transform: none;
  letter-spacing: 0;
}

.gantt-task-pool {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  max-height: 640px;
  overflow: auto;
  padding-right: 6px;
}

.gantt-task-source {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  text-align: left;
  padding: 10px;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.gantt-task-source:hover {
  transform: translateY(-1px);
}

.gantt-task-source.done {
  opacity: .55;
}

.gantt-task-source strong {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
}

.gantt-task-source small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
}

.gantt-task-source.selected small,
.gantt-task-source:hover small {
  color: #d8d1c4;
}

.gantt-board {
  min-width: 0;
  overflow: hidden;
}

.gantt-scroll {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--ink);
  background: #fbf7ee;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}

.gantt-canvas {
  position: relative;
  min-height: 620px;
}

.gantt-dates {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  height: 42px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.gantt-date {
  flex: 0 0 auto;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.gantt-date.today {
  color: var(--ink);
  background: #ece4d6;
  font-weight: 600;
}

.gantt-lanes {
  position: relative;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 92px 54px;
}

.gantt-lane {
  width: 100%;
}

.gantt-bar {
  position: absolute;
  z-index: 3;
  height: 36px;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 0 10px;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: grab;
  font-size: 13px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.gantt-bar:hover,
.gantt-bar.selected {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgb(17 17 17 / 12%);
}

.gantt-bar.P1 { background: var(--p1); }
.gantt-bar.P2 { background: var(--p2); }
.gantt-bar.P3 { background: var(--p3); }
.gantt-bar.P4 { background: var(--p4); }
.gantt-bar.P5 { background: var(--p5); }

.gantt-today-line {
  position: absolute;
  top: 0;
  z-index: 2;
  width: 2px;
  background: var(--accent-2);
  pointer-events: none;
}

.gantt-status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.product-image,
.product-thumb {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--soft);
}

.product-image {
  min-height: 210px;
}

.product-image img,
.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  mix-blend-mode: multiply;
}

.product-image span,
.product-thumb span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.product-card h2 {
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 500;
  line-height: 1;
  margin: 8px 0 8px;
}

.variant {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-grid div {
  padding: 14px 12px 14px 0;
}

.metric-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 500;
}

.chart-box {
  display: grid;
  align-content: center;
  gap: 10px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0 18px;
}

.sparkline {
  width: 100%;
  height: auto;
  overflow: visible;
}

.sparkline line {
  stroke: var(--line);
  stroke-width: 1;
}

.sparkline polyline {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.empty-chart {
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 28px 12px;
  text-align: center;
  font-size: 13px;
}

.side-note {
  display: grid;
  align-content: start;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.shopping-mini-list {
  display: grid;
  gap: 12px;
}

.shopping-mini-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.shopping-mini-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.product-thumb {
  aspect-ratio: 1;
}

.shopping-mini-card strong,
.work-log-row strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.shopping-mini-card span,
.shopping-mini-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.side-note strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 500;
}

.alert-strip {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.email-alert {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 16px;
  border-color: var(--p1);
}

.email-alert span {
  color: var(--p1);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.email-alert strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  margin-top: 4px;
}

.email-alert p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.meeting-note {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.meeting-note.checked {
  opacity: .45;
}

.meeting-note.checked span {
  text-decoration: line-through;
}

.add-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 18px;
}

.daily-work-log {
  display: grid;
  gap: 14px;
}

.compact-add {
  margin-bottom: 0;
}

.work-log-list {
  display: grid;
  gap: 10px;
}

.work-log-row {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.work-log-row time,
.work-log-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.work-log-row span {
  grid-column: 2;
}

.work-log-row.archived {
  opacity: .72;
}

.archive-actions {
  display: flex;
  justify-content: flex-end;
}

.archive-actions button {
  border: 1px solid var(--ink);
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
}

.archive-actions button:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

.archive-actions button:disabled {
  color: var(--muted);
  border-color: var(--line);
  cursor: default;
}

.history-drawer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.history-drawer summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.history-drawer summary span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.history-list {
  margin-top: 12px;
  max-height: 360px;
  overflow: auto;
}

.add-form input {
  min-width: 0;
  border: 1px solid var(--ink);
  background: transparent;
  padding: 10px 12px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 10px);
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 12px 16px;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

@media (max-width: 820px) {
  main {
    width: min(100vw - 24px, 1180px);
    padding-top: 20px;
  }

  header,
  .summary,
  .two-column,
  .home-grid,
  .product-card,
  .automation-card,
  .automation-grid,
  .gantt-workspace {
    grid-template-columns: 1fr;
  }

  .gantt-toolbar {
    display: grid;
    align-items: start;
  }

  .gantt-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .gantt-shell {
    padding: 12px;
  }

  .gantt-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 14px;
  }

  .gantt-mobile-hint {
    display: block;
  }

  .gantt-task-pool {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-height: none;
    padding-bottom: 4px;
  }

  .gantt-task-source {
    flex: 0 0 220px;
  }

  .gantt-scroll {
    max-height: 620px;
  }

  .feature-panel {
    grid-row: auto;
  }

  .updated {
    text-align: left;
  }

  .summary div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary div:last-child {
    border-bottom: 0;
  }

  .top-nav {
    overflow-x: auto;
    white-space: nowrap;
  }

  .priority-head {
    grid-template-columns: 48px 1fr auto;
  }

  .task-title-line {
    display: grid;
    gap: 4px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .chart-box {
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 16px 0;
  }

  .add-form,
  .email-alert,
  .work-log-row,
  footer {
    grid-template-columns: 1fr;
    display: grid;
  }

  .work-log-row span {
    grid-column: auto;
  }
}
