:root {
  color-scheme: dark;
  --bg: #0d0f10;
  --panel: #16191b;
  --panel-2: #1f2326;
  --line: #30363a;
  --text: #f2f5f0;
  --muted: #9aa39b;
  --accent: #c8ff00;
  --accent-soft: rgba(200, 255, 0, 0.12);
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

button:hover { border-color: var(--accent); }
button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
  font-weight: 800;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #101213;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  color: #111;
  font-weight: 900;
}

.brand strong, .brand small { display: block; }
.brand small, small, .selected-box span { color: var(--muted); }

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  width: 100%;
  text-align: left;
  background: transparent;
}

.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.selected-box {
  display: grid;
  gap: 6px;
  margin-top: 28px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.app {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 28px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; color: var(--muted); }
.topbar p { color: var(--muted); margin-bottom: 0; }

.view { display: none; }
.view.active { display: block; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

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

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #111416;
  color: var(--text);
  outline: none;
}

textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.checkline {
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: 40px;
}
.checkline input { width: auto; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  background: var(--panel);
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  background: #111416;
}

td { max-width: 230px; }
.muted { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

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

.span-2 { grid-column: 1 / -1; }
.fields.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.quick-filter {
  display: grid;
  gap: 12px;
}

.quick-row {
  display: grid;
  gap: 7px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segmented button {
  padding: 8px;
  font-size: 12px;
}

.segmented button.active {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
  font-weight: 800;
}

.verdict {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #111416;
  color: var(--muted);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.score-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.score-fields {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 180px 42px;
  gap: 12px;
  align-items: center;
}

.score-row input { accent-color: var(--accent); }
.score-value { text-align: right; font-weight: 900; color: var(--accent); }

.score-summary {
  position: sticky;
  top: 24px;
  align-self: start;
}

.score-summary strong {
  display: block;
  font-size: 42px;
  line-height: 1.1;
  margin: 8px 0;
}

.decision-note {
  margin: 8px 0 14px;
  color: var(--muted);
}

.score-scale {
  display: grid;
  gap: 6px;
}

.score-scale span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111416;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #111416;
  color: var(--text);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: var(--danger);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.flow {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 900px;
  margin: 0 auto;
}

.flow-step {
  width: min(100%, 440px);
  padding: 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  text-align: center;
  font-weight: 900;
}

.arrow {
  color: var(--muted);
  font-size: 22px;
}

.branches, .mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  width: 100%;
}

.mini-grid { grid-template-columns: repeat(5, minmax(110px, 1fr)); }
.branches.final { grid-template-columns: repeat(5, minmax(110px, 1fr)); }

.branches span, .mini-grid span {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

dialog {
  width: min(520px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
.dialog-form { padding: 18px; display: grid; gap: 14px; }
menu { display: flex; justify-content: flex-end; gap: 10px; padding: 0; margin: 0; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { margin-bottom: 16px; }
  .selected-box { margin-top: 16px; }
  .tabs { grid-template-columns: repeat(4, 1fr); }
  .tab { text-align: center; }
  .form-grid, .score-layout, .fields.two { grid-template-columns: 1fr; }
  .branches, .mini-grid, .branches.final { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 13px; }
  button { min-height: 42px; }
  .sidebar { padding: 14px; }
  .brand {
    gap: 10px;
    margin-bottom: 14px;
  }
  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }
  .tabs {
    grid-template-columns: 1fr;
    overflow-x: visible;
    padding-bottom: 0;
  }
  .tab {
    white-space: nowrap;
    padding: 9px 10px;
  }
  .selected-box {
    margin-top: 14px;
    padding: 12px;
  }
  .app { padding: 14px; }
  .topbar { display: grid; }
  .topbar .primary { width: 100%; }
  h1 { font-size: 24px; }
  h2 { font-size: 16px; }
  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .checkline {
    min-height: 0;
    align-items: center;
    padding: 10px 0 2px;
  }
  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }
  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  table {
    background: transparent;
  }
  thead { display: none; }
  tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    overflow: hidden;
  }
  td {
    max-width: none;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 11px;
    border-bottom: 1px solid var(--line);
  }
  td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }
  td:nth-child(1)::before { content: "Название"; }
  td:nth-child(2)::before { content: "Тип"; }
  td:nth-child(3)::before { content: "Аудитория"; }
  td:nth-child(4)::before { content: "Боль"; }
  td:nth-child(5)::before { content: "Монетизация"; }
  td:nth-child(6)::before { content: "Статус"; }
  td:nth-child(7)::before { content: "Балл"; }
  td:nth-child(8)::before { content: "Приоритет"; }
  td:nth-child(9)::before { content: "Создана"; }
  td:nth-child(10)::before { content: "Изменена"; }
  td:nth-child(11) {
    display: block;
    border-bottom: 0;
  }
  td:nth-child(11)::before { content: ""; }
  td:nth-child(11) button { width: 100%; }
  .panel { padding: 14px; }
  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .segmented { gap: 5px; }
  .segmented button {
    min-height: 38px;
    padding: 7px 6px;
  }
  .score-row { grid-template-columns: 1fr; }
  .score-row input { width: 100%; }
  .score-value { text-align: left; }
  .score-summary {
    position: static;
  }
  .score-summary strong {
    font-size: 36px;
  }
  .branches, .mini-grid, .branches.final { grid-template-columns: 1fr; }
  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
  menu {
    display: grid;
    grid-template-columns: 1fr;
  }
}
