:root {
  --ink: #0B2826;
  --muted: #606C66;
  --brand: #7B8E7B;
  --paper: #F6F8F2;
  --line: #DEEADD;
  --panel: #FCFDFA;
  --accent: #7B8E7B;
  --warn: #E6B14E;
  --high: #F07456;
  --low: #eef2ea;
  --row-h: 44px;
  --day-w: 34px;
  --table-w: 35%;
  --inspect-w: 24%;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, Onest, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(46, 111, 115, .35);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 18px;
  top: 18px;
  z-index: 5;
  background: #fff;
  padding: 10px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 244, .92);
  position: sticky;
  top: 0;
  z-index: 4;
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand img {
  width: 184px;
  max-width: 34vw;
  height: auto;
}

.brand p,
.report-header p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
}

h1 {
  font-size: clamp(18px, 2.2vw, 28px);
}

h2 {
  font-size: 16px;
}

h3 {
  font-size: 14px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions button,
.top-actions .nav-link,
#print-report {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 5px;
}

.top-actions .active {
  background: var(--ink);
  color: #fff;
}

.top-actions .nav-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.workspace {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.summary-strip article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 12px 14px;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.plan-grid {
  display: grid;
  grid-template-columns: minmax(260px, var(--table-w)) 8px minmax(440px, 1fr) 8px minmax(260px, var(--inspect-w));
  min-height: calc(100vh - 185px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.pane-title {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}

.pane-title span,
.legend {
  color: var(--muted);
  font-size: 12px;
}

.table-scroll,
.timeline-scroll,
.inspector-pane {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

th,
td {
  height: var(--row-h);
  padding: 0 10px;
  border-bottom: 1px solid #edf0ea;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

td:first-child {
  width: 42%;
}

.task-button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-1 .task-button {
  padding-left: 18px;
}

.level-2 .task-button {
  padding-left: 36px;
}

tr.selected td {
  background: #eef4f1;
}

tr.summary td {
  font-weight: 650;
}

.status,
.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2ea;
  color: var(--muted);
  font-size: 12px;
}

.risk-High {
  background: #fff0eb;
  color: var(--high);
}

.risk-Medium {
  background: #fff7e6;
  color: #8a5a10;
}

.splitter {
  width: 8px;
  min-width: 8px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  cursor: col-resize;
  background: linear-gradient(90deg, transparent 3px, #bac3b7 3px, #bac3b7 5px, transparent 5px);
}

.timeline-scroll {
  position: relative;
}

.timeline {
  position: relative;
  min-width: calc(var(--day-w) * 50);
  padding-top: 32px;
}

.time-header {
  position: absolute;
  left: 0;
  top: 0;
  height: 32px;
  width: 100%;
  background: repeating-linear-gradient(90deg, #f5f7f2 0, #f5f7f2 calc(var(--day-w) * 5 - 1px), var(--line) calc(var(--day-w) * 5 - 1px), var(--line) calc(var(--day-w) * 5));
  border-bottom: 1px solid var(--line);
}

.tick {
  position: absolute;
  top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.timeline-row {
  height: var(--row-h);
  position: relative;
  border-bottom: 1px solid #edf0ea;
  background: repeating-linear-gradient(90deg, #fff 0, #fff calc(var(--day-w) - 1px), #f0f3ee calc(var(--day-w) - 1px), #f0f3ee var(--day-w));
}

.bar {
  position: absolute;
  top: 10px;
  height: 24px;
  border: 1px solid rgba(23, 51, 56, .14);
  border-radius: 5px;
  background: #dfe8de;
  box-shadow: 0 1px 3px rgba(23, 51, 56, .12);
  cursor: grab;
  overflow: hidden;
}

.bar:active {
  cursor: grabbing;
}

.bar.summary {
  top: 8px;
  height: 28px;
  background: var(--ink);
}

.bar .fill {
  height: 100%;
  background: rgba(46, 111, 115, .36);
  pointer-events: none;
}

.bar.summary .fill {
  background: rgba(255, 255, 255, .18);
}

.bar.high {
  background: #f4d6cc;
}

.bar.medium {
  background: #f6e9c7;
}

.handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 100%;
  border-left: 1px solid rgba(23, 51, 56, .25);
  cursor: ew-resize;
  background: rgba(255, 255, 255, .38);
}

.milestone {
  position: absolute;
  top: 9px;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: grab;
  font-size: 0;
  overflow: hidden;
}

.milestone::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin: 4px;
  transform: rotate(45deg);
  background: var(--accent);
  border: 1px solid #fff;
  box-shadow: 0 1px 3px rgba(23, 51, 56, .18);
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dot,
.diamond {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  background: var(--accent);
}

.dot {
  border-radius: 50%;
}

.dot.risk {
  background: var(--warn);
}

.diamond {
  transform: rotate(45deg);
}

.inspector-pane {
  background: #fbfcf8;
}

#inspector-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  min-height: 36px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

input[type="range"] {
  padding: 0;
}

output {
  color: var(--ink);
  font-size: 13px;
}

.dependency-box {
  margin: 0 14px 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.report-view,
.resource-view,
.integration-view {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 22px;
}

.workspace[data-mode="report"] .plan-grid {
  display: none;
}

.workspace[data-mode="report"] .report-view {
  display: block;
}

.workspace[data-mode="resources"] .plan-grid,
.workspace[data-mode="resources"] .report-view,
.workspace[data-mode="resources"] .integration-view,
.workspace[data-mode="integration"] .plan-grid,
.workspace[data-mode="integration"] .report-view,
.workspace[data-mode="integration"] .resource-view {
  display: none;
}

.workspace[data-mode="resources"] .resource-view,
.workspace[data-mode="integration"] .integration-view {
  display: block;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.report-content {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 18px;
  margin-top: 18px;
}

.report-panel {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 16px;
}

.report-panel p,
.report-panel li {
  color: var(--muted);
  line-height: 1.5;
}

.asset-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.file-button,
.asset-actions button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.resource-grid,
.integration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.resource-item,
.toggle-row {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fbfcf8;
  padding: 14px;
}

.resource-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.resource-summary article {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 14px;
  background: #fbfcf8;
}

.resource-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.resource-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.resource-item strong,
.toggle-row strong {
  display: block;
  margin-bottom: 4px;
}

.resource-item p,
.toggle-row span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.toggle-row input {
  width: 42px;
  min-width: 42px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  resize: vertical;
}

@media (max-width: 1050px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .splitter {
    display: none;
  }

  .table-scroll,
  .timeline-scroll,
  .inspector-pane {
    max-height: none;
  }

  .timeline-pane,
  .inspector-pane {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 10px;
  }

  .summary-strip,
  .report-content,
  .resource-grid,
  .resource-summary,
  .integration-grid {
    grid-template-columns: 1fr;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand img {
    max-width: 220px;
  }

  th:nth-child(4),
  td:nth-child(4),
  th:nth-child(5),
  td:nth-child(5) {
    display: none;
  }
}

@media print {
  .topbar,
  .summary-strip,
  .plan-grid,
  #print-report {
    display: none;
  }

  .report-view {
    display: block;
    border: 0;
  }
}
