:root,
[data-theme="light"] {
  --bg: #f3efe8;
  --card: #faf7f2;
  --head: #ebe6dc;
  --border: #d8d0c4;
  --border-in: #ccc3b5;
  --red: #8a2020;
  --red-soft: #a84848;
  --text: #1c1916;
  --text-2: #2e2a25;
  --text-3: #3f3a33;
  --muted: #7a7266;
  --muted-2: #8a7d6e;
  --zero: #b0a89c;
  --row-b: #ebe6dc;
  --hover: #ebe4d8;
  --page-bg: #e8e2d6;
  --slash: #b0a89c;
  --dim: #9a9084;
  --chip: #7a7266;
  --chip-sep: #b0a89c;
  --btn-ghost: #7a7266;
  --btn-line: #6e665b;
  --deadline-tx: #6e665b;
  --bar-track: #e0d8cc;
  --warn-bg: #fff4e6;
  --warn-fg: #9c4a00;
  --warn-bd: #ffd8a8;
  --shadow: 0 12px 32px rgba(28, 25, 22, 0.12);
  --modal-backdrop: rgba(14, 13, 11, 0.45);
  --diff: #c45c26;
  --ok: #2f9e44;
  --err: #c92a2a;
  --other: #e67700;
}

[data-theme="dark"] {
  --bg: #161412;
  --card: #1a1815;
  --head: #161412;
  --border: #2a2723;
  --border-in: #322e29;
  --red: #8a2020;
  --red-soft: #c88;
  --text: #e8e0d2;
  --text-2: #d8cfc0;
  --text-3: #c4bbac;
  --muted: #6e665b;
  --muted-2: #8a7d6e;
  --zero: #403a32;
  --row-b: #221f1b;
  --hover: #201d19;
  --page-bg: #0e0d0b;
  --slash: #463f36;
  --dim: #5a5248;
  --chip: #7a7266;
  --chip-sep: #463f36;
  --btn-ghost: #7a7266;
  --btn-line: #9a9084;
  --deadline-tx: #9a9084;
  --bar-track: #161412;
  --warn-bg: #3b2a14;
  --warn-fg: #ffc078;
  --warn-bd: #5c3d1a;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  --modal-backdrop: rgba(0, 0, 0, 0.55);
  --diff: #c45c26;
  --ok: #2f9e44;
  --err: #f87171;
  --other: #ffc078;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text-2);
  font-family: "Oswald", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  padding: 32px 20px;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--bg);
  border-radius: 4px;
  padding: 1.75rem;
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 8px;
}

.sec-num {
  font-size: 12px;
  color: var(--red);
  font-weight: 700;
}

h1,
.page-title {
  font-size: 40px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 0.95;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sub {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 8px;
}

.lbl {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 6px;
}

.period-lbl {
  letter-spacing: 0.24em;
  margin-bottom: 16px;
}

.legend {
  margin: 8px 0 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  text-transform: none;
  font-weight: 400;
}

.legend strong {
  color: var(--text-3);
  font-weight: 500;
}

.hdr-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.hdr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

a.btn-ghost.logout-link {
  text-decoration: none;
}

.chips {
  display: flex;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--chip);
  font-weight: 700;
  margin-top: 12px;
}

.chips span.sep {
  margin: 0 10px;
  color: var(--chip-sep);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--btn-ghost);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}

.theme-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.period {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.25rem 1.5rem;
  background: var(--card);
  margin-bottom: 1.25rem;
}

.period-row,
.period-actions,
.tech-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.period-row {
  margin-bottom: 14px;
}

.period-actions {
  gap: 8px;
}

.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border-in);
  border-radius: 2px;
  padding: 9px 13px;
  cursor: pointer;
}

.date-pill .lab {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.date-pill input.val,
.date-pill .val {
  font-size: 14px;
  color: var(--text-2);
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.04em;
  background: transparent;
  border: none;
  outline: none;
  color-scheme: light dark;
  padding: 0;
  min-width: 8.5rem;
}

.btn-red {
  background: var(--red);
  border: none;
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 2px;
  cursor: pointer;
  font-family: inherit;
}

[data-theme="light"] .btn-red {
  color: #faf7f2;
}

.btn-line {
  background: transparent;
  border: 1px solid var(--border-in);
  color: var(--btn-line);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 8px 13px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-family: inherit;
}

.btn-line:disabled,
.btn-red:disabled {
  opacity: 0.5;
  cursor: default;
}

details.tech {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

details.tech summary {
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
}

details.tech summary::-webkit-details-marker {
  display: none;
}

.tech-row {
  margin-top: 12px;
  gap: 8px;
}

.file-picker {
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border-in);
  border-radius: 2px;
  padding: 9px 12px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}

.file-picker input {
  display: none;
}

.admin-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.tech-info {
  margin-top: 12px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

.tech-info.error {
  color: var(--err);
}

.plan {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--card);
  display: flex;
  flex-wrap: wrap;
}

.plan-chart-block {
  width: 100%;
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.75rem 1.5rem;
}

.plan-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 14px;
}

.plan-chart-sub {
  margin-bottom: 0;
  min-height: 0;
}

.plan-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: flex-end;
}

.plan-chart-leg {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--border-in);
  border-radius: 2px;
  background: #141210;
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e0d7c8;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

[data-theme="light"] .plan-chart-leg {
  background: #fffaf5;
  color: var(--text);
}

.plan-chart-leg:hover {
  border-color: #8a7d6e;
  color: #f2ebe0;
}

[data-theme="light"] .plan-chart-leg:hover {
  color: var(--text);
  border-color: var(--muted-2);
}

.plan-chart-leg.off {
  opacity: 1;
  color: #8a7d6e;
  background: transparent;
  border-style: dashed;
}

[data-theme="light"] .plan-chart-leg.off {
  color: var(--muted);
}

.plan-chart-leg.off .plan-chart-swatch {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.plan-chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 1px;
  flex-shrink: 0;
}

.plan-chart {
  width: 100%;
  min-height: 220px;
  overflow: visible;
  position: relative;
}

.plan-chart svg {
  display: block;
  width: 100%;
  height: 220px;
}

.plan-chart-empty {
  padding: 28px 0;
  text-align: center;
  color: #a89a86;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
}

.plan-chart .axis-label {
  fill: #a89a86;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
}

.plan-chart .grid-line {
  stroke: #322e29;
  stroke-width: 1;
}

[data-theme="light"] .plan-chart .axis-label {
  fill: #7a7266;
}

[data-theme="light"] .plan-chart .grid-line {
  stroke: #d8d0c4;
}

.plan-chart .line-series {
  opacity: 0.95;
}

.plan-chart .line-dot {
  cursor: default;
}

.plan-chart-tip {
  pointer-events: none;
  position: absolute;
  z-index: 8;
  background: #2a1e1a;
  border: 1px solid #8a2020;
  color: #f2ebe0;
  padding: 8px 11px;
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
  border-radius: 2px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, calc(-100% - 10px));
}

[data-theme="light"] .plan-chart-tip {
  background: #fffaf5;
  border-color: #8a2020;
  color: var(--text);
  box-shadow: 0 8px 20px rgba(28, 25, 22, 0.12);
}

.plan-col {
  flex: 1;
  min-width: 240px;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
}

.plan-div {
  width: 1px;
  background: var(--border);
  align-self: stretch;
}

.plan-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 16px;
}

.plan-top .plan-lbl {
  margin-bottom: 0;
}

.plan-seg {
  display: inline-flex;
  border: 1px solid var(--border-in);
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg);
  flex-shrink: 0;
}

.plan-sg {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  font-family: "Oswald", sans-serif;
  padding: 8px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.plan-sg + .plan-sg {
  border-left: 1px solid var(--border-in);
}

.plan-sg:hover {
  color: var(--text-2);
  background: var(--hover);
}

.plan-sg.act {
  background: #2a1e1a;
  color: #e0d7c8;
}

[data-theme="light"] .plan-sg.act {
  background: #f0e4dc;
  color: var(--text);
}

.plan-lbl {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 6px;
}

.plan-sub {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
  min-height: 14px;
}

.plan-num {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 56px;
  margin-bottom: 14px;
}

.plan-num .big {
  font-size: 56px;
  font-weight: 700;
  color: var(--text);
  line-height: 0.9;
}

.plan-num .plan-fact-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 56px;
  font-weight: 700;
  line-height: 0.9;
  color: var(--text);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.plan-num .plan-fact-btn:hover,
.plan-num .plan-fact-btn:focus-visible {
  border-bottom-color: var(--text);
  outline: none;
}

.plan-num .plan-fact-btn:disabled {
  cursor: default;
  opacity: 0.55;
  border-bottom-color: transparent;
}

.plan-num .slash {
  font-size: 32px;
  color: var(--slash);
}

.plan-num .dim {
  font-size: 56px;
  font-weight: 700;
  color: var(--dim);
  line-height: 0.9;
}

.bar {
  height: 4px;
  background: var(--bar-track);
  overflow: hidden;
}

.bar > i,
.bar > #plan-progress-bar {
  display: block;
  height: 100%;
  background: var(--red);
  font-style: normal;
}

.deadline {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  align-self: flex-start;
  border: 1px solid var(--border-in);
  border-radius: 2px;
  padding: 9px 13px;
}

.deadline .ic {
  color: var(--red);
  font-size: 14px;
}

.deadline .tx {
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--deadline-tx);
}

.deadline .tx b {
  color: var(--text);
}

.plan.done #plan-remaining {
  color: var(--ok);
}

.tbl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.sec-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.search-field {
  min-width: 200px;
}

input[type="text"],
input[type="search"],
select {
  background: var(--bg);
  border: 1px solid var(--border-in);
  border-radius: 2px;
  padding: 9px 12px;
  color: var(--text-2);
  font-size: 12px;
  letter-spacing: 0.05em;
  font-family: "Oswald", sans-serif;
  outline: none;
  width: 100%;
}

select {
  cursor: pointer;
  min-width: 120px;
}

input[type="search"]::placeholder {
  color: var(--muted);
}

.ladder-filters {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.ladder-filter {
  min-width: 120px;
}

.ladder-dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ladder-date-pill {
  padding: 7px 10px;
}

.ladder-date-pill input.val {
  min-width: 7.5rem;
  font-size: 12px;
}

.ladder-apply-btn {
  padding: 8px 14px;
  font-size: 10px;
}

.tbl-wrap {
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  background: var(--card);
}

.scroll {
  overflow-x: auto;
}

.scroll::-webkit-scrollbar {
  height: 10px;
}

.scroll::-webkit-scrollbar-track {
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.scroll::-webkit-scrollbar-thumb {
  background: #3a322b;
  border: 2px solid var(--bg);
}

[data-theme="light"] .scroll::-webkit-scrollbar-thumb {
  background: #b8aea0;
  border-color: var(--bg);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.matrix-table th {
  text-align: center;
  padding: 10px 4px;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 700;
  line-height: 1.3;
  border-bottom: 1px solid var(--border);
  background: var(--head);
}

.matrix-table th.op-name,
.matrix-table th.nm {
  text-align: left;
  padding: 12px 14px;
  letter-spacing: 0.16em;
}

.matrix-table th.tag-col {
  max-width: 88px;
  white-space: normal;
  word-break: break-word;
}

.matrix-table td {
  text-align: center;
  padding: 11px 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  border-bottom: 1px solid var(--row-b);
  white-space: nowrap;
  vertical-align: middle;
}

.matrix-table td.op-name,
.matrix-table td.nm {
  text-align: left;
  padding: 11px 14px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
  font-family: "Oswald", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  background: var(--card);
  position: sticky;
  left: 0;
  z-index: 1;
}

.matrix-table thead th.op-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--head);
}

.matrix-table tbody.body tr:hover td {
  background: var(--hover);
}

.matrix-table tbody.body tr:hover td.op-name {
  background: var(--hover);
}

.matrix-table tfoot td {
  background: var(--head) !important;
  border-top: 2px solid var(--border) !important;
  border-bottom: none !important;
  color: var(--text);
  font-weight: 700;
}

.matrix-table tfoot td.op-name {
  color: var(--text);
  font-weight: 700;
}

.bitrix-warn {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 2px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-bd);
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.02em;
}

.btn-more-wrap {
  padding: 12px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.btn-more {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red-soft);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.btn-more:hover {
  background: #1e1614;
  color: var(--text);
}

[data-theme="light"] .btn-more:hover {
  background: #f0e4dc;
}

.note {
  margin-top: 10px;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

.grp-head {
  cursor: pointer;
  color: var(--red-soft) !important;
  border-left: 1px solid #3a2020;
  border-right: 1px solid #3a2020;
  background: #1e1614 !important;
}

.grp-head-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.grp-head:hover {
  color: #fff !important;
  background: #241a18 !important;
}

[data-theme="light"] .grp-head {
  background: #f0e4dc !important;
  border-left-color: #c9a99a;
  border-right-color: #c9a99a;
}

td.grp-sum {
  background: #1e1614;
  border-left: 1px solid #3a2020;
  border-right: 1px solid #3a2020;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: #c9a99a;
  font-weight: 500;
}

td.grp-sum.z {
  color: var(--zero);
}

tbody.body tr:hover td.grp-sum {
  background: #241a18;
}

[data-theme="light"] td.grp-sum {
  background: #f0e4dc;
  border-left-color: #c9a99a;
  border-right-color: #c9a99a;
  color: #8a4a3a;
}

td.grp-detail,
th.grp-det-head {
  background: #1c1512;
}

th.grp-det-head {
  cursor: pointer;
  color: var(--red-soft) !important;
}

th.grp-det-first,
td.grp-det-first {
  border-left: 1px solid #3a2020;
}

th.grp-det-last,
td.grp-det-last {
  border-right: 1px solid #3a2020;
}

tbody.body tr:hover td.grp-detail {
  background: #221815;
}

[data-theme="light"] td.grp-detail,
[data-theme="light"] th.grp-det-head {
  background: #f5ebe4;
}

.matrix-table tfoot td.grp-sum,
.matrix-table tfoot td.grp-detail {
  background: #1e1614 !important;
}

[data-theme="light"] .matrix-table tfoot td.grp-sum,
[data-theme="light"] .matrix-table tfoot td.grp-detail {
  background: #f0e4dc !important;
}

.scroll.on {
  overflow-x: auto;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  body {
    padding: 16px 12px;
  }

  .panel {
    padding: 1.2rem;
  }

  h1,
  .page-title {
    font-size: 30px;
  }

  .plan-div {
    display: none;
  }

  .plan-num .big,
  .plan-num .dim,
  .plan-num .plan-fact-btn {
    font-size: 42px;
  }
}
