:root {
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  color: #21302a;
  background: #f3f6f4;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #80c7a0;
  outline-offset: 2px;
}

#app { display: grid; grid-template-columns: 258px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; min-width: 0;
  padding: 28px 17px 20px; color: #d8e7dc;
  background: linear-gradient(160deg, #182b23 0%, #15231f 100%);
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; min-width: 0; }
.sidebar > .brand { padding: 2px 9px 34px; }
.brand-mark {
  display: grid; place-items: center; flex: 0 0 36px; height: 36px;
  color: #163d2a; background: #a8e0b6; border-radius: 11px;
  font-size: 22px; font-weight: 900; letter-spacing: -.1em;
}
.brand-copy { display: grid; min-width: 0; line-height: 1.05; }
.brand-copy strong { font-size: 18px; letter-spacing: -.04em; white-space: nowrap; }
.brand-copy small { margin-top: 4px; color: #a6c4b2; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.workspace { display: grid; gap: 9px; padding: 0 9px; }
.aside-label, .eyebrow { color: #82968b; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.aside-label { color: #9eb8a6; }
.workspace select {
  width: 100%; min-width: 0; height: 42px; padding: 0 11px;
  color: #f1f7f3; background: #293f33;
  border: 1px solid #4c6555; border-radius: 10px;
}
.side-add {
  width: 100%; min-height: 36px; padding: 7px 10px;
  color: #bce9c8; background: transparent;
  border: 1px dashed #557965; border-radius: 9px; font-size: 12px; font-weight: 700;
}
.side-add:hover { background: #294537; }
nav { display: grid; gap: 5px; margin-top: 34px; }
nav button {
  width: 100%; min-height: 43px; padding: 10px 16px;
  text-align: left; color: #bbcfbf; background: transparent;
  border: 0; border-radius: 10px; font-weight: 700;
}
nav button:hover { background: #294336; color: #fff; }
nav button.active { color: #fff; background: #315e43; box-shadow: inset 3px 0 #a8e0b6; }
.mobile-label { display: none; }
.aside-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: auto; padding: 20px 9px 0; border-top: 1px solid #3b5144;
  color: #afc5b6; font-size: 13px;
}
.aside-foot button { color: #d4e9da; background: transparent; border: 0; padding: 6px; }
.aside-foot button:hover { color: #fff; text-decoration: underline; }
.aside-foot #profile { min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; }

main { width: 100%; min-width: 0; max-width: 1570px; padding: 42px clamp(24px, 4vw, 64px) 72px; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
h1 { margin: 7px 0 0; font-size: clamp(27px, 2.6vw, 36px); line-height: 1.15; letter-spacing: -.045em; }
h2 { margin: 0 0 18px; font-size: 19px; letter-spacing: -.025em; }
.header-right { display: flex; align-items: center; gap: 13px; color: #788b7f; font-size: 13px; white-space: nowrap; }
.pill, .badge { display: inline-block; padding: 6px 10px; color: #345544; background: #e7f0e9; border-radius: 999px; font-size: 12px; font-weight: 750; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card, .panel { min-width: 0; background: #fff; border: 1px solid #e0e9e2; border-radius: 17px; box-shadow: 0 7px 30px #1b38220a; }
.card { position: relative; overflow: hidden; min-height: 142px; padding: 22px; }
.card::after { content: ""; position: absolute; top: 0; right: 0; width: 72px; height: 72px; border-radius: 0 0 0 72px; background: #e9f5eb; }
.card .label { position: relative; z-index: 1; max-width: 165px; color: #64796b; font-size: 13px; font-weight: 600; }
.card strong { position: relative; z-index: 1; display: block; margin-top: 18px; font-size: 35px; letter-spacing: -.04em; }
.panel { margin-top: 22px; padding: 24px; }
.bar { display: flex; height: 12px; margin: 22px 0 12px; overflow: hidden; background: #e8eeea; border-radius: 99px; }
.bar span { height: 100%; }
.pass { background: #27a66d; }.fail { background: #de6471; }.block { background: #e9ad54; }.skip { background: #9caaa1; }
.legend { display: flex; flex-wrap: wrap; gap: 11px 23px; color: #617369; font-size: 13px; }
.legend b { color: #26362b; }
.panel > p { margin-bottom: 0; }
.panel > p button { margin: 5px 6px 0 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; margin-bottom: 18px; }
.toolbar h2 { margin: 0; }
.toolbar .spacer { flex: 1 1 15px; }
.toolbar input, .toolbar select, .form input, .form select, .form textarea {
  min-height: 42px; min-width: 0; padding: 9px 12px;
  color: #23372b; background: #fff; border: 1px solid #cfdbd1; border-radius: 10px;
}
.toolbar input { flex: 1 1 240px; min-width: 180px; }
.toolbar select { flex: 0 1 170px; max-width: 220px; }
.toolbar input::placeholder, .form input::placeholder, .form textarea::placeholder { color: #9aa9a0; }
.primary, .secondary { min-height: 42px; padding: 10px 16px; border-radius: 10px; font-weight: 750; }
.primary { color: #fff; background: #267a54; border: 1px solid #267a54; box-shadow: 0 4px 10px #267a5426; }
.primary:hover { background: #1c6846; border-color: #1c6846; }
.secondary { color: #276349; background: #fff; border: 1px solid #aac9b3; }
.secondary:hover { background: #f0f7f1; }
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 13px; color: #7b8f81; border-bottom: 1px solid #e5ece6; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.table td { padding: 15px 13px; border-bottom: 1px solid #edf1ed; font-size: 13px; line-height: 1.45; vertical-align: top; overflow-wrap: anywhere; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f7fbf7; }
.table td:nth-child(2) { min-width: 240px; }
.link { padding: 0; color: #206e4c; background: none; border: 0; font-weight: 750; text-align: left; line-height: 1.4; overflow-wrap: anywhere; }
.link:hover { color: #144e36; text-decoration: underline; }
.muted { color: #819086; font-size: 12px; overflow-wrap: anywhere; }
.priority { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 7px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.priority-P1 { color: #a82d37; background: #fce7e8; }
.priority-P2 { color: #ae5a1c; background: #fff0de; }
.priority-P3 { color: #665d29; background: #f5f2db; }
.priority-P4 { color: #287451; background: #e4f3e9; }
.priority-P5 { color: #497469; background: #e8f1ee; }
.priority-other { color: #596b5f; background: #edf1ee; }
.case-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 15px; }
.page-controls { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.page-controls span { color: #52675a; font-size: 13px; font-weight: 700; }
.page-controls button:disabled { opacity: .45; cursor: default; }
.case-card { display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 170px; padding: 18px; color: #25352b; background: #fff; border: 1px solid #dde8df; border-radius: 13px; text-align: left; box-shadow: 0 3px 15px #1b382207; }
.case-card:hover { background: #f9fcf9; border-color: #69ad7f; box-shadow: 0 8px 24px #1b38221a; }
.case-card:focus-visible { outline-offset: 3px; }
.case-card-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.case-id { color: #216849; font-size: 12px; font-weight: 850; letter-spacing: .02em; }
.case-open { margin-left: auto; color: #71977a; font-size: 12px; font-weight: 700; }
.case-title { display: block; margin-top: 14px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.case-annotation { display: -webkit-box; overflow: hidden; margin-top: 7px; color: #687a6d; font-size: 13px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.case-card-foot { display: flex; flex-wrap: wrap; gap: 5px 11px; margin-top: auto; padding-top: 12px; color: #7a8e80; font-size: 11px; overflow-wrap: anywhere; }
.case-workspace { display: grid; grid-template-columns: 245px minmax(0,1fr); gap: 18px; align-items: start; }
.case-workspace > .panel { margin-top: 0; }
.case-tree { position: sticky; top: 22px; max-height: calc(100dvh - 44px); overflow-y: auto; padding: 17px 12px; }
.case-tree h2 { margin: 0 8px 12px; font-size: 16px; }
.tree-item { display: flex; align-items: start; justify-content: space-between; gap: 8px; width: 100%; min-height: 36px; padding: 8px 9px; color: #435a49; background: transparent; border: 0; border-radius: 8px; text-align: left; font-size: 12px; }
.tree-item:hover { background: #eef6ef; }
.tree-item.selected { color: #135e3e; background: #e4f2e7; font-weight: 800; }
.tree-item span { overflow-wrap: anywhere; }
.tree-item b { flex-shrink: 0; color: #789784; }
.tree-heading { margin: 13px 9px 6px; color: #819588; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.tree-children { margin-left: 12px; padding-left: 7px; border-left: 1px solid #d9e8dd; }
.case-path { margin: 0 0 6px; color: #456f55; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.history { display: grid; gap: 6px; margin-top: 12px; }
.history > div { padding: 10px 12px; background: #f5f9f5; border-radius: 8px; font-size: 12px; }
.history small { display: block; margin-top: 4px; color: #708173; overflow-wrap: anywhere; }
.user-list, .activity-list { display: grid; gap: 9px; }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #e9eee9; }
.user-row small { display: block; margin-top: 5px; color: #788a7b; overflow-wrap: anywhere; }
.presence { display: inline-block; margin-left: 7px; padding: 3px 7px; border-radius: 6px; color: #79867e; background: #eff2ef; font-size: 11px; font-weight: 700; }
.presence.online { color: #14734d; background: #e2f4e9; }
.activity-row { display: grid; grid-template-columns: 155px 120px minmax(0,1fr); gap: 4px 10px; padding: 11px 0; border-bottom: 1px solid #e9eee9; font-size: 12px; overflow-wrap: anywhere; }
.activity-date { color: #78907e; }
.activity-row small { grid-column: 3; color: #78907e; }
.check-label { display: flex !important; align-items: center; gap: 9px !important; }
.check-label input { min-height: auto; }
.status { display: inline-block; padding: 6px 9px; border-radius: 7px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status.PASSED { color: #127044; background: #e0f3e6; }
.status.FAILED, .status.ERROR { color: #ad3447; background: #fce7e9; }
.status.BLOCKED { color: #92600d; background: #fff0d8; }
.status.SKIPPED, .status.NOT_RUN, .status.INPROGRESS { color: #64776b; background: #ebf0ec; }
.run-card { display: flex; justify-content: space-between; gap: 18px; margin-top: 12px; padding: 19px 20px; border: 1px solid #e2eae3; border-radius: 12px; cursor: pointer; }
.run-card:hover { border-color: #80b993; background: #f8fcf8; }
.run-card strong { display: block; margin-bottom: 7px; line-height: 1.35; }
.run-card small { display: block; color: #849288; overflow-wrap: anywhere; }
.run-card .numbers { display: flex; align-items: start; gap: 15px; flex-wrap: wrap; color: #5a6c60; font-size: 13px; }
.run-pass { color: #148453; }
.run-fail { color: #bd4557; }
.section-title { margin: 30px 0 12px; }
.empty { padding: 35px; color: #819086; text-align: center; }
.error { color: #b33449; font-size: 13px; }

.login { display: grid; place-items: center; min-height: 100dvh; padding: 18px; background: radial-gradient(circle at 78% 18%, #3e6d4e 0, transparent 34%), linear-gradient(135deg, #13241e, #284333); }
.login-card { width: min(430px, 100%); padding: 34px; background: #fff; border: 1px solid #d8e7d9; border-radius: 22px; box-shadow: 0 24px 80px #0b1e1370; }
.brand-login { margin-bottom: 42px; color: #1c3325; }
.brand-login .brand-copy small { color: #638e6d; }
.login-card h1 { margin-top: 10px; font-size: 29px; }
.login-card p { margin: 10px 0 28px; color: #75877a; line-height: 1.5; }
.login-card label { display: grid; gap: 7px; margin: 16px 0; font-size: 13px; font-weight: 750; }
.login-card input { min-height: 46px; padding: 11px 12px; border: 1px solid #cbd9ce; border-radius: 10px; }
.login-card .primary { width: 100%; margin-top: 8px; }
.login-card .error { min-height: 18px; margin-top: 12px; }

.scrim { position: fixed; inset: 0; z-index: 20; background: #0c1c1599; }
.drawer-panel { position: fixed; inset: 0 0 0 auto; z-index: 21; width: min(740px, 100vw); padding: 38px 42px 60px; overflow-y: auto; background: #fff; box-shadow: -14px 0 40px #1124193b; }
.drawer-panel h2 { padding-right: 45px; font-size: 23px; line-height: 1.35; overflow-wrap: anywhere; }
.close { position: sticky; top: 0; float: right; display: grid; place-items: center; width: 38px; height: 38px; color: #365744; background: #edf4ee; border: 0; border-radius: 10px; font-size: 25px; }
.close:hover { background: #dcebe0; }
.meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 28px; }
.detail { margin: 24px 0; }
.detail h3 { margin: 0 0 10px; color: #667a6c; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.detail p { margin: 0; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.step { margin-bottom: 10px; padding: 16px; border: 1px solid #e2ebe3; border-radius: 11px; background: #fbfdfb; }
.step b { display: block; line-height: 1.45; overflow-wrap: anywhere; }
.step p { margin: 7px 0 0; color: #65796a; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice { margin: 17px 0; padding: 14px 16px; color: #80570e; background: #fff3dd; border-radius: 9px; line-height: 1.5; }
.failure { padding: 17px; color: #6e2d36; background: #fff4f5; border-left: 4px solid #db6473; border-radius: 8px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.form { display: grid; gap: 13px; }
.form label { display: grid; gap: 7px; min-width: 0; font-size: 13px; font-weight: 750; }
.form textarea { min-height: 90px; resize: vertical; }
.form button { justify-self: start; }
.form h3 { margin: 18px 0 0; font-size: 15px; }
.select-list { max-height: 430px; overflow-y: auto; border: 1px solid #e0e9e2; border-radius: 12px; }
.select-case { display: flex !important; grid-template-columns: none; align-items: start; gap: 10px !important; padding: 11px 13px; border-bottom: 1px solid #edf1ed; font-weight: 400 !important; }
.select-case:last-child { border-bottom: 0; }
.select-case[hidden] { display: none !important; }
.select-case input { min-height: auto; margin-top: 3px; }
.select-case small, .plan-case small { display: block; margin-top: 4px; color: #788b7f; overflow-wrap: anywhere; }
.plan-case-list { max-height: 440px; overflow-y: auto; border: 1px solid #e0e9e2; border-radius: 12px; }
.plan-case { padding: 13px 15px; border-bottom: 1px solid #edf1ed; overflow-wrap: anywhere; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.plan-actions button:disabled { opacity: .48; cursor: not-allowed; }
.secret { padding: 12px; overflow-wrap: anywhere; user-select: all; background: #edf4ee; border-radius: 9px; }
.step-editor { display: grid; grid-template-columns: 1fr 1fr auto; gap: 9px; align-items: end; margin: 9px 0; padding: 12px; background: #f7faf7; border: 1px solid #e1eae2; border-radius: 10px; }
.step-editor input { width: 100%; }

@media (max-width: 1150px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-list { grid-template-columns: 1fr; }
  .case-workspace { grid-template-columns: 210px minmax(0,1fr); }
  .toolbar select { flex: 1 1 145px; }
}
@media (max-width: 840px) {
  .case-workspace { display: block; }
  .case-tree { position: static; max-height: 220px; margin-bottom: 12px; }
  .activity-row { grid-template-columns: 120px minmax(0,1fr); }
  .activity-row span:nth-child(3), .activity-row small { grid-column: 1 / -1; }
  #app { display: block; }
  .sidebar {
    position: sticky; z-index: 10; top: 0; width: 100%; height: auto;
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand foot" "workspace workspace" "nav nav";
    gap: 9px 15px; padding: 12px 20px 0;
    box-shadow: 0 8px 22px #0d281720;
  }
  .sidebar > .brand { grid-area: brand; padding: 0; }
  .sidebar .brand-mark { flex-basis: 32px; height: 32px; font-size: 19px; }
  .sidebar .brand-copy strong { font-size: 16px; }
  .workspace { grid-area: workspace; display: flex; align-items: center; gap: 8px; padding: 0; }
  .workspace .aside-label { display: none; }
  .workspace select { width: min(280px, 70vw); height: 38px; }
  .side-add { width: auto; min-height: 38px; white-space: nowrap; }
  nav { grid-area: nav; display: flex; gap: 4px; margin: 0; overflow-x: auto; }
  nav button { flex: 1 0 auto; }
  nav button { min-height: 39px; padding: 8px; text-align: center; border-radius: 9px 9px 0 0; }
  nav button.active { box-shadow: inset 0 -3px #a8e0b6; }
  .aside-foot { grid-area: foot; gap: 4px; margin: 0; padding: 0; border: 0; }
  .aside-foot #profile span { display: none; }
  .aside-foot #profile::before { content: "Профиль"; }
  main { max-width: none; padding: 30px 26px 60px; }
  .header-right { display: none; }
}
@media (max-width: 1100px) {
  .page-header { margin-bottom: 20px; }
  .panel { padding: 18px; }
  .toolbar { align-items: stretch; }
  .toolbar input, .toolbar select { max-width: none; flex: 1 1 170px; }
  .toolbar .spacer { display: none; }
  .toolbar .primary { flex: 1 1 100%; }
  .table-wrap { overflow: visible; }
  .table, .table tbody { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; margin: 0 0 12px; padding: 15px; border: 1px solid #e0e9e2; border-radius: 12px; background: #fff; }
  .table td, .table td:nth-child(2), .table tr:last-child td { display: block; min-width: 0; padding: 4px 0; border: 0; overflow-wrap: anywhere; }
  .table tbody tr:hover td { background: transparent; }
  .table td::before { display: block; margin-bottom: 5px; color: #849689; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
  .table td:nth-child(1), .table td:nth-child(2), .results-table td:nth-child(5) { grid-column: 1 / -1; }
  .table td:nth-child(2) { font-size: 14px; }
  .table td.empty { grid-column: 1 / -1; }
  .table td.empty::before { display: none; }
  .results-table td:nth-child(1)::before { content: "Статус"; }
  .results-table td:nth-child(2)::before { content: "Кейс / автотест"; }
  .results-table td:nth-child(3)::before { content: "Роль"; }
  .results-table td:nth-child(4)::before { content: "Приоритет"; }
  .results-table td:nth-child(5)::before { content: "Шаг падения"; }
  .run-card { flex-direction: column; gap: 12px; }
  .run-card .numbers { white-space: normal; }
}
@media (max-width: 520px) {
  .case-card { min-height: 0; padding: 15px; }
  .sidebar { padding: 10px 14px 0; gap: 7px 9px; }
  .workspace select { flex: 1 1 auto; width: 0; }
  .side-add { flex: 0 0 auto; max-width: 142px; overflow: hidden; text-overflow: ellipsis; }
  main { padding: 23px 14px 40px; }
  .grid { gap: 10px; }
  .card { min-height: 115px; padding: 15px; }
  .card strong { margin-top: 12px; font-size: 29px; }
  .panel { margin-top: 14px; padding: 15px; }
  .toolbar input, .toolbar select { flex-basis: calc(50% - 6px); }
  .toolbar input { flex-basis: 100%; }
  .toolbar .secondary { flex: 0 0 auto; }
  .drawer-panel { width: 100vw; height: 100dvh; padding: 21px 18px 45px; }
  .drawer-panel h2 { font-size: 21px; }
  .step-editor { grid-template-columns: 1fr; }
  .login-card { padding: 26px 23px; border-radius: 18px; }
  .brand-login { margin-bottom: 34px; }
}
@media (max-width: 360px) {
  .desktop-label { display: none; }
  .mobile-label { display: inline; }
  .toolbar select { flex-basis: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .run-card { transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
}
