:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f1;
  --ink: #172027;
  --muted: #65727d;
  --line: #d8dee4;
  --line-strong: #aeb8c1;
  --primary: #2f6f63;
  --primary-dark: #22564d;
  --blue: #476d9a;
  --amber: #c98a24;
  --red: #b64a4a;
  --green: #3c7a52;
  --graphite: #343b42;
  --shadow: 0 14px 35px rgba(23, 32, 39, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 248, 0.96);
  backdrop-filter: blur(14px);
}

.header-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px 12px;
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.project-meta {
  margin: 7px 0 0;
  color: var(--muted);
}

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

.text-button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 7px 12px;
  font-weight: 700;
}

.text-button:hover,
.text-button:focus-visible {
  border-color: var(--primary);
  color: var(--primary-dark);
  outline: none;
}

.text-button.danger {
  border-color: #d8b5b5;
  color: var(--red);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(132px, 1fr));
  gap: 10px;
  padding: 0 24px 16px;
}

.metric-card {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: 0 6px 18px rgba(23, 32, 39, 0.04);
}

.metric-label {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-value {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
}

.metric-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 24px 28px;
}

.sidebar,
.content-area {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 158px;
  align-self: start;
  padding: 16px;
}

.filter-block {
  margin-bottom: 18px;
}

.field-label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.text-input,
.select-input,
.date-input,
.number-input,
.textarea-input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
}

.text-input:focus,
.select-input:focus,
.date-input:focus,
.number-input:focus,
.textarea-input:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(47, 111, 99, 0.14);
}

.textarea-input {
  min-height: 88px;
  resize: vertical;
}

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

.check-row,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.check-row input,
.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.filter-grid {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
}

.toggle-stack {
  display: grid;
  gap: 10px;
}

.content-area {
  min-width: 0;
  overflow: hidden;
}

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

.view-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.view-button {
  min-width: 92px;
  min-height: 36px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  padding: 7px 13px;
  font-weight: 800;
}

.view-button:last-child {
  border-right: 0;
}

.view-button.is-active {
  background: var(--primary);
  color: #fff;
}

.visible-count {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.view-root {
  min-height: 540px;
}

.empty-state {
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

.gantt-board {
  overflow: auto;
}

.gantt-header,
.gantt-row {
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(760px, 1fr);
}

.gantt-header {
  position: sticky;
  top: 0;
  z-index: 4;
  min-width: 1070px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.gantt-title-cell {
  border-right: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.gantt-scale-wrap {
  position: relative;
}

.week-scale,
.week-grid {
  display: grid;
  grid-template-columns: repeat(var(--week-count), minmax(46px, 1fr));
}

.week-scale {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.week-cell {
  min-height: 38px;
  border-right: 1px solid var(--line);
  padding: 10px 5px;
  text-align: center;
}

.participant-band {
  min-width: 1070px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 8px 12px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.gantt-row {
  min-width: 1070px;
  border-bottom: 1px solid var(--line);
}

.gantt-row:hover {
  background: #fbfcfd;
}

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

.task-id {
  display: inline-flex;
  align-items: center;
  min-width: 60px;
  color: var(--graphite);
  font-weight: 900;
}

.task-title {
  margin: 5px 0 7px;
  font-weight: 700;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--muted);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
}

.pill.status-done {
  background: #e5f1e9;
  color: var(--green);
}

.pill.status-work {
  background: #e8eef8;
  color: var(--blue);
}

.pill.status-risk,
.pill.status-pause {
  background: #fbeddc;
  color: var(--amber);
}

.pill.risk,
.pill.overdue,
.pill.decision {
  background: #f8e6e6;
  color: var(--red);
}

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

.week-grid {
  position: absolute;
  inset: 0;
}

.week-grid .week-cell {
  min-height: 78px;
  padding: 0;
}

.gantt-bar {
  position: absolute;
  top: 22px;
  height: 24px;
  min-width: 8px;
  border-radius: 4px;
  background: var(--bar-color, var(--primary));
  box-shadow: 0 4px 10px rgba(23, 32, 39, 0.12);
  overflow: hidden;
}

.gantt-bar.is-overdue {
  background: var(--red);
}

.gantt-progress {
  display: block;
  height: 100%;
  background: rgba(255, 255, 255, 0.36);
}

.today-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--red);
}

.today-marker::after {
  position: absolute;
  top: 6px;
  left: 6px;
  content: "сегодня";
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.gantt-canvas .today-marker::after {
  content: none;
}

.gantt-scale-wrap .today-marker {
  top: 0;
  bottom: 0;
}

.today-marker-label::after {
  top: 4px;
  border-radius: 4px;
  background: #fbfcfd;
  padding: 1px 4px;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--graphite);
  color: #fff;
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  background: #fff;
}

.data-table tr:hover td {
  background: #fbfcfd;
}

.narrow {
  width: 84px;
}

.wide-action {
  min-width: 260px;
}

.table-control {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 5px 7px;
  width: 100%;
}

.progress-cell {
  display: grid;
  grid-template-columns: 1fr 40px;
  align-items: center;
  gap: 7px;
}

.progress-cell input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.date-pair {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.instruction-view {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.instruction-row {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.instruction-step {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(440px, 100%);
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -18px 0 40px rgba(23, 32, 39, 0.16);
  transform: translateX(105%);
  transition: transform 180ms ease;
}

.detail-drawer.is-open {
  transform: translateX(0);
}

.drawer-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.drawer-header {
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.drawer-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-title {
  margin: 0;
  font-size: 18px;
}

.close-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

.drawer-body {
  display: grid;
  gap: 13px;
  overflow: auto;
  padding: 18px;
}

.drawer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.drawer-actions {
  display: flex;
  gap: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .summary-strip {
    grid-template-columns: repeat(3, minmax(132px, 1fr));
  }

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

  .sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .header-main {
    padding: 16px 14px 10px;
  }

  .header-main,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .summary-strip {
    grid-template-columns: 1fr 1fr;
    padding: 0 14px 14px;
  }

  .workspace {
    padding: 14px;
  }

  h1 {
    font-size: 24px;
  }

  .view-switch,
  .view-button {
    width: 100%;
  }

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

@media (max-width: 460px) {
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .text-button {
    flex: 1 1 112px;
  }
}
