:root {
  color-scheme: light;
  --forest: #122a22;
  --green: #214f3c;
  --mint: #cbe8b6;
  --canvas: #f4f6f0;
  --paper: #fff;
  --ink: #172a21;
  --muted: #51645a;
  --line: #dce5da;
  --ochre: #a45722;
  --ochre-bg: #f9eee0;
  --safe-top: var(--discord-safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-right: var(--discord-safe-area-inset-right, env(safe-area-inset-right, 0px));
  --safe-bottom: var(--discord-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-left: var(--discord-safe-area-inset-left, env(safe-area-inset-left, 0px));
  font: 100%/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--forest); color: var(--ink); }
button, select { font: inherit; }
button, a, select { touch-action: manipulation; }
a { color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #347855; outline-offset: 3px; }
.rail :focus-visible { outline-color: var(--mint); }
h1, h2, h3, p { margin: 0; }
.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100dvh;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}
.rail {
  display: flex;
  flex-direction: column;
  align-self: start;
  position: sticky;
  top: var(--safe-top);
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  padding: 28px 20px;
  color: #e8f3e8;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 1.15rem; font-weight: 720; text-decoration: none; }
.brand-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 10px 0;
  border-radius: 12px;
  background: var(--mint);
}
.brand-icon i { width: 5px; height: 13px; border-radius: 2px; background: var(--green); }
.brand-icon i:nth-child(2) { height: 21px; }
.brand-icon i:nth-child(3) { height: 16px; }
.navigation { display: grid; gap: 5px; margin-top: 40px; }
.navigation a { padding: 11px 12px; border-radius: 10px; text-decoration: none; font-size: .9375rem; }
.navigation a:hover { background: #254237; }
.navigation [aria-current="page"] { color: var(--mint); background: #284439; font-weight: 700; }
.connection { margin-top: auto; padding: 25px 0 0 10px; color: #c3d3ca; font-size: .875rem; }

main { min-width: 0; padding: clamp(20px, 4vw, 52px); background: var(--canvas); }
.page-header, #view { width: min(100%, 1240px); margin-inline: auto; }
.page-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 24px; margin-bottom: 27px; }
.date-line { color: var(--muted); font-size: .9375rem; margin-bottom: 5px; }
h1 { font: 400 clamp(2.1rem, 3.8vw, 3.65rem)/1.07 Georgia, serif; letter-spacing: -.05em; }
h2 { font-size: 1.2rem; line-height: 1.2; letter-spacing: -.025em; }
.demo-label { padding: 5px 12px; font-size: .875rem; color: var(--green); border: 1px solid #c8d8c9; border-radius: 999px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.metric { min-width: 0; padding: 17px 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); }
.metric dt { font-weight: 620; font-size: .9rem; }
.metric dd { margin: 4px 0 0; font: 400 2.45rem/1.1 Georgia, serif; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric small { display: block; color: var(--muted); margin-top: 3px; font-size: .82rem; }
.metric:first-child { background: var(--forest); border-color: var(--forest); color: #fff; }
.metric:first-child small { color: #c4d7ca; }
.metric.overdue { background: #fcf6ed; border-color: #ebdcc7; }
.metric.overdue dd { color: var(--ochre); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.panel { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.segmented { display: flex; max-width: 100%; gap: 3px; padding: 4px; background: #edf2eb; border-radius: 10px; }
.segmented button, .control {
  border: 1px solid transparent;
  background: transparent;
  color: var(--green);
  padding: 7px 10px;
  font-weight: 650;
  white-space: nowrap;
  font-size: .875rem;
  border-radius: 7px;
  min-height: 36px;
}
.segmented [aria-pressed="true"], .control {
  background: var(--paper);
  border-color: var(--line);
}
.control:hover { background: #ebf2e9; }
.period { margin-top: 9px; color: var(--muted); font-size: .875rem; }
.legend { display: flex; flex-wrap: wrap; gap: 3px 17px; margin: 15px 0 10px; font-size: .875rem; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.reported { background-color: #d39561; }
.resolved { background-color: #458568; }
.chart { display: grid; gap: 3px; }
.chart-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 5px 13px 5px 8px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  font-size: .875rem;
}
.chart-row:hover, .chart-row[aria-pressed="true"] { background: #f0f5ee; border-color: #d5e5d7; }
.bars { display: grid; gap: 5px; border-inline-start: 1px solid var(--line); }
.bar { display: block; width: var(--length); height: 9px; border-radius: 0 4px 4px 0; }
.chart-detail { min-height: 3rem; padding: 10px 0 0; margin-top: 10px; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); }
.chart-detail strong { color: var(--ink); }
.event-list { display: grid; gap: 0; list-style: none; padding: 0; margin: 13px 0 0; }
.event-link, .event-record { display: flex; align-items: center; gap: 11px; }
.event-link { padding: 10px 0; text-decoration: none; }
.event-link:hover .event-title { text-decoration: underline; }
.event-list li + li { border-top: 1px solid var(--line); }
.event-date { flex: 0 0 48px; display: grid; place-items: center; align-content: center; min-height: 51px; border-radius: 9px; background: #eaf3e8; color: var(--green); line-height: 1.14; }
.event-date strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.event-date small { font-size: .8125rem; }
.event-title { font-weight: 630; font-size: .9375rem; }
.panel-link { display: inline-flex; font-weight: 650; color: var(--green); margin-top: 12px; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; align-items: start; }
.lane { min-width: 0; min-height: 185px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #eaf0e8; }
.lane.drop-target { border-color: #3e7659; background: #dcecdc; }
.lane-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 13px; }
.lane-heading span { font-weight: 700; color: var(--muted); }
.task { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.task + .task { margin-top: 9px; }
.task[draggable="true"] { cursor: grab; }
.task.dragging { opacity: .48; }
.task h3 { font-size: 1rem; line-height: 1.3; }
.task-meta { color: var(--muted); font-size: .875rem; }
.task-meta.late { color: var(--ochre); font-weight: 650; }
.stage-select {
  appearance: none;
  width: 100%;
  min-height: 41px;
  padding: 7px 28px 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--green);
  background: #f5f8f3;
  font-size: .875rem;
  cursor: pointer;
}
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--green);
  border-bottom: 1.5px solid var(--green);
  transform: rotate(45deg);
  position: absolute;
  top: 15px;
  right: 12px;
  pointer-events: none;
}
.lane-empty { color: var(--muted); font-size: .875rem; }

.calendar-header { padding-bottom: 12px; }
.month-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.date-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.day-name { text-align: center; color: var(--muted); font-size: .875rem; padding-block: 4px; }
.day {
  position: relative;
  min-height: 47px;
  padding: 9px 0 12px;
  font-size: .9375rem;
  color: var(--ink);
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.day:hover { background: #edf3ec; }
.day.outside-month { color: var(--muted); opacity: .75; }
.day[aria-pressed="true"] { background: #e4efe2; border-color: #8ab59a; font-weight: 700; }
.day[aria-current="date"] { font-weight: 750; color: #276046; text-decoration: underline; text-underline-offset: 3px; }
.day.has-event::after {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--ochre);
  border-radius: 50%;
  position: absolute;
  bottom: 5px;
  left: calc(50% - 3px);
}
.calendar-detail { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 15px; min-height: 90px; }
.calendar-detail h3 { font-size: 1rem; }
.calendar-detail p, .calendar-detail ul { margin: 5px 0 0; color: var(--muted); }
.calendar-detail ul { padding-inline-start: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 1020px) {
  .workspace { grid-template-columns: 180px minmax(0, 1fr); }
  .rail { padding-inline: 14px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .workspace { display: block; }
  .rail { position: static; min-height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 13px 6px; padding: 13px 14px 10px; }
  .brand { gap: 8px; font-size: 1rem; }
  .brand-icon { width: 32px; height: 32px; padding: 6px 0; }
  .connection { margin: 0; padding: 0; font-size: .8125rem; text-align: right; align-self: center; }
  .navigation { grid-row: 2; grid-column: 1 / -1; display: flex; gap: 5px; margin: 0; }
  .navigation a { display: grid; place-items: center; min-height: 44px; padding: 6px 9px; font-size: .875rem; }
  main { padding: 18px 13px 24px; }
  .page-header { margin-bottom: 17px; }
  .metric { padding: 12px; }
  .metric dd { font-size: 2.1rem; }
  .panel { padding: 15px; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .lane { min-height: 0; }
  .stage-select { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

.flow-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(145px, auto);
  gap: 12px 20px;
  align-items: start;
  background: #e8f0e5;
}
.flow-header h2 { font: 400 clamp(1.45rem, 3vw, 2.25rem)/1.15 Georgia, serif; }
.flow-header > .flow-state { justify-self: start; grid-row: 2; }
.flow-stages {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.flow-stages li { padding: 5px 10px; border: 1px solid #cbd9cc; border-radius: 999px; font-size: .875rem; color: var(--muted); }
.flow-stages li.done { background: var(--green); color: #fff; border-color: var(--green); }
.flow-stages li.available { background: white; color: var(--ink); }
.flow-stages span { margin-inline-start: 5px; }
.workflow-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(200px, 1fr); gap: 16px; align-items: start; }
.flow-stack { display: grid; gap: 14px; min-width: 0; }
.flow-panel, .flow-form { display: grid; gap: 12px; }
.flow-note { font-size: .875rem; color: var(--muted); }
.flow-state { width: fit-content; padding: 4px 10px; border-radius: 6px; background: #e3efe1; color: var(--green); font-size: .875rem; font-weight: 680; }
.flow-notice { margin: 7px 0; color: var(--green); font-weight: 650; }
.flow-notice:empty { margin: 0 0 14px; }
.flow-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.flow-button {
  width: fit-content;
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid var(--green);
  color: var(--green);
  background: var(--paper);
  border-radius: 8px;
  font-weight: 650;
  font-size: .9rem;
  text-align: left;
}
.flow-button.primary { background: var(--green); color: #fff; }
.flow-button:hover { box-shadow: inset 0 0 0 2px #a5c7ae; }
.flow-header label, .flow-form label { display: grid; gap: 4px; min-width: 0; font-size: .875rem; font-weight: 630; }
.flow-header select, .flow-form :is(input, select, textarea) {
  width: 100%;
  min-height: 42px;
  padding: 7px 9px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #b9cbbd;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 400;
}
.flow-form textarea { resize: vertical; font-family: inherit; }
.flow-form.inline { display: flex; align-items: end; flex-wrap: wrap; }
.role-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; color: var(--muted); font-size: .875rem; }
.quote-grid, .vote-tallies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quote-card, .vote-tallies div, .mail-preview { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #f3f7f1; }
.quote-card { display: grid; gap: 5px; align-content: start; }
.quote-card h3, .mail-preview h3 { font-size: 1rem; }
.quote-price { font: 1.65rem Georgia, serif; color: var(--green); }
.quote-price small { font: .8rem system-ui, sans-serif; }
.vote-tallies { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.vote-tallies dt { font-size: .9rem; }
.vote-tallies dd { margin: 0; font: 1.7rem Georgia, serif; }
.mail-preview { display: grid; gap: 9px; }
.mail-preview p { white-space: pre-wrap; overflow-wrap: anywhere; }
.flow-edit > summary { cursor: pointer; color: var(--green); font-weight: 650; }
.flow-edit > form { margin-top: 10px; }
.audit-panel ol { list-style: none; margin: 0; padding: 0; }
.audit-panel li { display: grid; gap: 2px; padding: 8px 0; font-size: .9rem; }
.audit-panel li + li { border-top: 1px solid var(--line); }
.audit-panel small { color: var(--muted); font-size: .82rem; }
.document-dialog {
  width: min(94vw, 630px);
  max-height: 86dvh;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
}
.document-dialog::backdrop { background: #122a22b8; }
.document-dialog img { display: block; max-width: 100%; max-height: 60dvh; margin: 10px auto; }
.doc-controls { justify-content: center; font-size: .875rem; }
.doc-controls button:disabled { opacity: .55; cursor: default; }
.doc-controls a { color: var(--green); padding: 5px; }

@media (max-width: 1020px) {
  .workflow-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .navigation { flex-wrap: wrap; }
  .navigation a { padding-inline: 8px; }
  .flow-header { grid-template-columns: minmax(0, 1fr); }
  .flow-header > .flow-state { grid-row: auto; }
  .flow-button { min-height: 44px; }
  .quote-card { padding: 10px; }
  .quote-card .flow-button { padding-inline: 8px; }
}
