:root {
  --ink: #102a43;
  --paper: #f5f7fa;
  --accent: #d64545;
  --aqua: #56a3a6;
  --charcoal: #17202a;
  --muted: #6b7785;
  --line: rgba(16, 42, 67, .14);
  --drawer: #ffffff;
  --shadow: 0 18px 60px rgba(16, 42, 67, .12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(86, 163, 166, .22), transparent 36%),
    linear-gradient(180deg, #102a43, #0a1b2d);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.brand span {
  font-weight: 800;
  line-height: .95;
  text-transform: uppercase;
}

.nav-tabs {
  display: grid;
  align-content: start;
  gap: 8px;
}

.tab {
  width: 100%;
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 8px;
  color: rgba(255, 255, 255, .76);
  background: transparent;
  text-align: left;
  text-transform: uppercase;
  font-size: 13px;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.tab:hover,
.tab.is-active {
  color: #fff;
  background: rgba(255, 255, 255, .12);
  transform: translateX(2px);
}

.rail-note {
  border-top: 1px solid rgba(255, 255, 255, .18);
  padding-top: 16px;
  line-height: 1.45;
}

.rail-note span {
  display: block;
  color: rgba(255, 255, 255, .58);
  text-transform: uppercase;
  font-size: 12px;
}

.rail-note strong {
  display: block;
  margin-top: 4px;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.search input {
  width: min(330px, 34vw);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.primary-action,
.note-form button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.metric-strip {
  margin: 26px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .52);
}

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

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

.metric-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.metric-strip strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
  line-height: 1;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
  animation: rise .28s ease both;
}

.status-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, .88fr);
  gap: 22px;
  align-items: start;
}

.timeline-wall,
.detail-sheet,
.history-board,
.team-panel {
  min-width: 0;
}

.stage-filter {
  display: grid;
  grid-template-columns: repeat(5, minmax(86px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.stage-chip {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  color: var(--ink);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.stage-chip.is-active,
.stage-chip:hover {
  border-color: var(--aqua);
  box-shadow: 0 10px 24px rgba(86, 163, 166, .18);
  transform: translateY(-1px);
}

.case-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
}

.case-tile {
  min-height: 188px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  box-shadow: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.case-tile:hover,
.case-tile.is-selected {
  transform: translateY(-2px);
  border-color: rgba(214, 69, 69, .42);
  box-shadow: var(--shadow);
}

.tile-top,
.tile-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stage-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--aqua);
}

.stage-эффект .stage-dot {
  background: #27965f;
}

.stage-точка .stage-dot {
  background: var(--accent);
}

.stage-сортировка .stage-dot {
  background: #9b6b2f;
}

.tile-stage,
.tile-quality,
.tile-date {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
}

.tile-title {
  font-size: 24px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.tile-meta {
  color: var(--muted);
  line-height: 1.45;
}

.detail-sheet {
  position: sticky;
  top: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.empty-sheet,
.error-box,
.empty-list {
  min-height: 160px;
  display: grid;
  place-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.sheet-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.sheet-stage {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
}

.sheet-head h2 {
  margin-bottom: 8px;
}

.sheet-head p,
.effect-line p {
  color: var(--muted);
  line-height: 1.55;
}

.inventory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.inventory div {
  min-height: 74px;
  padding: 12px;
  background: #fff;
}

.inventory span,
.effect-line span {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
}

.inventory strong {
  display: block;
  margin-top: 6px;
  line-height: 1.25;
}

.effect-line {
  margin: 16px 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.note-form {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.note-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.note-form textarea,
.note-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  resize: vertical;
}

.note-form div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

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

.approval-list h3 {
  margin-bottom: 2px;
  font-size: 16px;
  text-transform: uppercase;
}

.approval-list article {
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.approval-list article span {
  float: right;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.approval-list article strong,
.approval-list article small {
  display: block;
}

.approval-list article small {
  margin-top: 4px;
  color: var(--muted);
}

.history-board {
  display: grid;
  gap: 18px;
}

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

.history-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 120px;
  gap: 18px;
  align-items: start;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.history-row span {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 12px;
}

.history-row p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.history-row time {
  color: var(--muted);
  text-align: right;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.workflow-step {
  min-height: 330px;
  padding: 22px;
  display: grid;
  align-content: space-between;
  background: #fff;
}

.workflow-step span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.workflow-step p {
  color: var(--muted);
  line-height: 1.6;
}

.team-panel {
  display: grid;
  gap: 18px;
}

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

.team-grid article {
  min-height: 190px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.team-grid span {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
}

.team-grid strong {
  font-size: 22px;
  line-height: 1.1;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .status-layout {
    grid-template-columns: 1fr;
  }

  .detail-sheet {
    position: static;
  }

  .workflow-grid,
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 16px;
  }

  .rail-note {
    display: none;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tab {
    min-height: 44px;
    padding: 8px;
    text-align: center;
    font-size: 11px;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .toolbar {
    display: grid;
    align-items: stretch;
  }

  .search input {
    width: 100%;
  }

  .metric-strip,
  .case-list,
  .workflow-grid,
  .team-grid,
  .stage-filter {
    grid-template-columns: 1fr;
  }

  .history-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .history-row time {
    text-align: left;
  }

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

