:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #697585;
  --line: #dce2e8;
  --accent: #256f68;
  --accent-2: #c4492d;
  --accent-3: #355f9d;
  --soft: #eef5f4;
  --warning: #fff1d6;
  --danger: #ffe4df;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: #14212b;
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 8px;
  background: var(--panel);
}

.login-brand {
  margin-bottom: 24px;
  color: var(--ink);
}

.login-brand span {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-form button {
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #14212b;
  color: #eef5f4;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 32px;
}

.brand-mark {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain;
  padding: 6px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aab7c2;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  color: #cbd6df;
  padding: 11px 12px;
  border-radius: 8px;
  text-decoration: none;
}

.nav a:hover,
.nav a.active {
  background: #223442;
  color: #ffffff;
}

.nav .add-nav {
  margin-block: 10px;
  background: var(--accent);
  color: #ffffff;
  text-align: center;
  font-weight: 800;
}

.session-card {
  display: grid;
  gap: 6px;
  margin-top: 28px;
  padding: 12px;
  border: 1px solid #2d4150;
  border-radius: 8px;
  background: #1b2c38;
}

.session-card span {
  color: #aab7c2;
  font-size: 13px;
}

.session-card button {
  height: 34px;
  margin-top: 6px;
  border: 1px solid #3c5364;
  border-radius: 8px;
  background: transparent;
  color: #eef5f4;
  font-weight: 800;
}

.session-card button:hover {
  background: #223442;
}

.dashboard {
  width: min(1480px, 100%);
  padding: 28px;
}

.topbar {
  display: grid;
  gap: 18px;
  margin-bottom: 22px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(5, minmax(180px, 1fr));
  gap: 12px;
}

.role-switch {
  display: inline-flex;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.role-switch button {
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.role-switch button.active {
  background: var(--accent);
  color: #ffffff;
}

.role-switch button:not(.active):hover {
  color: var(--accent);
}

.summary-button {
  width: fit-content;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.summary-button:hover {
  background: #1c5c56;
}

.toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input {
  width: 100%;
  padding: 0 12px;
}

textarea {
  min-height: 92px;
  width: 100%;
  padding: 10px 12px;
  resize: vertical;
}

select {
  min-width: 0;
  width: 100%;
  padding: 0 36px 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 111, 104, 0.14);
}

select:disabled {
  background: #eef2f5;
  color: var(--muted);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard.add-mode > .metrics-grid,
.dashboard.add-mode > .content-grid {
  display: none;
}

.dashboard.add-mode .toolbar,
.dashboard.add-mode .role-switch {
  display: none;
}

.add-page {
  display: grid;
  gap: 16px;
}

.add-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.add-card {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.add-card-create {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
}

.add-card-create span {
  display: block;
  width: auto;
  height: auto;
  font-size: 40px;
  line-height: 0.8;
  transform: translateY(-1px);
}

.add-card strong {
  font-size: 20px;
}

.add-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 111, 104, 0.12);
}

.add-card-list {
  min-width: 120px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.entity-form {
  display: grid;
  gap: 16px;
}

.entity-list-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.entity-list {
  display: grid;
  gap: 10px;
  max-height: min(62vh, 720px);
  overflow: auto;
  padding-right: 4px;
}

.entity-list-filter {
  display: grid;
  max-width: 360px;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.entity-list-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
}

.entity-list-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 111, 104, 0.12);
}

.entity-list-item strong,
.entity-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-list-item span {
  color: var(--muted);
  font-size: 13px;
}

.entity-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.entity-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.entity-fields label:has(textarea) {
  grid-column: 1 / -1;
}

.checkbox-group-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-group-field legend {
  padding: 0;
  margin-bottom: 6px;
}

.checkbox-group {
  display: grid;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.checkbox-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
}

.checkbox-option:hover {
  background: var(--soft);
}

.checkbox-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  justify-self: center;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.entity-actions button {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.entity-actions .secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.summary-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.summary-dialog::backdrop {
  background: rgba(15, 26, 34, 0.45);
}

.summary-dialog .panel-head {
  margin-bottom: 14px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.summary-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.summary-current-filters {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  min-height: 40px;
  color: var(--ink);
  font-weight: 700;
}

.summary-current-filters input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.summary-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.summary-actions button {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.summary-actions .secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.metric {
  min-height: 130px;
  padding: 18px;
}

.metric span,
.metric small {
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric strong {
  display: block;
  margin: 14px 0 8px;
  font-size: 36px;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(340px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
}

.content-grid:last-child {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.55fr);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

#workplan .panel-head {
  display: grid;
  grid-template-columns:
    minmax(88px, 0.5fr)
    minmax(238px, 1.55fr)
    minmax(82px, 0.45fr)
    minmax(76px, 0.4fr)
    minmax(84px, 0.45fr);
  align-items: center;
  gap: 8px;
}

.gantt-tools {
  display: contents;
}

.gantt-sort-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.gantt-period-controls {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.gantt-range-select {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.gantt-tools button,
.gantt-sort-group a,
.gantt-period-controls a,
.gantt-period-controls span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

#workplan .panel-head > div:first-child {
  min-width: 0;
}

#workplan .panel-head h2 {
  overflow-wrap: anywhere;
}

#ganttToggle {
  align-self: center;
  padding: 0 2px;
  font-size: 9px;
  line-height: 1.1;
}

.gantt-period-controls span {
  background: #f4f7f8;
  color: var(--muted);
  font-size: 12px;
  text-transform: capitalize;
}

.gantt-tools button:hover,
.gantt-sort-group a:hover,
.gantt-sort-group a.active,
.gantt-period-controls a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.gantt-sort-group a.active {
  background: var(--soft);
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.calendar-controls a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
}

.calendar-controls a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.calendar-day {
  display: grid;
  align-content: space-between;
  gap: 18px;
  min-height: 138px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.calendar-day.today {
  border-color: rgba(37, 111, 104, 0.55);
  background: var(--soft);
}

.calendar-day.open {
  border-color: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(53, 95, 157, 0.14);
}

.calendar-day strong,
.calendar-day span {
  display: block;
}

.calendar-day strong {
  font-size: 18px;
}

.calendar-day > div:first-child span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  text-transform: capitalize;
}

.calendar-counters {
  display: flex;
  gap: 8px;
}

.calendar-counters a,
.calendar-counters span {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 54px;
  height: 42px;
  border-radius: 8px;
  background: #e8f0f7;
  color: var(--accent-3);
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}

.calendar-counters a {
  border: 1px solid transparent;
}

.calendar-counters a:first-child:hover,
.calendar-counters a:first-child[aria-expanded="true"] {
  border-color: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(53, 95, 157, 0.12);
}

.calendar-counters a:last-child {
  background: #f4e7df;
  color: var(--accent-2);
}

.calendar-counters a:last-child:hover,
.calendar-counters a:last-child[aria-expanded="true"] {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(196, 73, 45, 0.12);
}

.calendar-counters b {
  font-size: 20px;
  line-height: 1;
}

.calendar-counters small {
  min-width: 0;
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-detail {
  grid-column: 1 / -1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  max-height: 380px;
  padding: 16px;
  border: 1px solid rgba(53, 95, 157, 0.35);
  border-radius: 8px;
  background: #f7fbff;
}

.calendar-detail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.calendar-detail-head h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.calendar-detail-head a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
}

.calendar-detail-head a:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.calendar-task-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.calendar-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.calendar-task strong {
  display: block;
  margin-bottom: 5px;
}

.calendar-task span {
  color: var(--muted);
  font-size: 13px;
}

.calendar-task[data-priority="срочный"] {
  border-color: #ffc3b8;
  background: var(--danger);
}

.calendar-task[data-priority="высокий"] {
  border-color: #ffd58c;
  background: var(--warning);
}

.event-detail {
  border-color: rgba(196, 73, 45, 0.32);
  background: #fff9f6;
}

.event-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.event-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-2);
}

.calendar-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #ffffff;
}

.calendar-event time,
.calendar-event strong,
.calendar-event span {
  display: block;
}

.calendar-event time {
  margin-bottom: 5px;
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 900;
}

.calendar-event strong {
  margin-bottom: 5px;
}

.calendar-event span {
  color: var(--muted);
  font-size: 13px;
}

.calendar-event[data-event-type="встреча"] {
  border-left-color: var(--accent);
}

.calendar-event[data-event-type="звонок"] {
  border-left-color: var(--accent-3);
}

.calendar-event[data-event-type="email"] {
  border-left-color: var(--accent-2);
}

.calendar-event[data-event-type="письмо"] {
  border-left-color: #b37418;
}

.calendar-event[data-event-type="визит"] {
  border-left-color: #6d5bd0;
}

.calendar-event[data-event-type="видеоконференция"] {
  border-left-color: #2f8aa0;
}

.event-legend span[data-event-type="встреча"] i {
  background: var(--accent);
}

.event-legend span[data-event-type="звонок"] i {
  background: var(--accent-3);
}

.event-legend span[data-event-type="email"] i {
  background: var(--accent-2);
}

.event-legend span[data-event-type="письмо"] i {
  background: #b37418;
}

.event-legend span[data-event-type="визит"] i {
  background: #6d5bd0;
}

.event-legend span[data-event-type="видеоконференция"] i {
  background: #2f8aa0;
}

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

.gantt-chart {
  overflow: hidden;
}

.gantt-viewport {
  max-height: 360px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
}

.gantt-viewport.expanded {
  max-height: min(76vh, 980px);
}

.gantt-scale {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(180px, 0.32fr) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: 64px;
  margin-bottom: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.gantt-timeline-head {
  position: relative;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.gantt-timeline-head time {
  position: absolute;
  top: 36px;
  transform: translateX(-4px) rotate(-45deg);
  transform-origin: left top;
  white-space: nowrap;
}

.gantt-rows {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.gantt-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.32fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 54px;
}

.gantt-label {
  display: grid;
  align-items: center;
  min-width: 0;
  min-height: 42px;
}

.gantt-label strong {
  display: -webkit-box;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gantt-track {
  position: relative;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

.gantt-gridline,
.gantt-deadline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(105, 117, 133, 0.18);
}

.gantt-deadline {
  width: 2px;
  background: rgba(196, 73, 45, 0.55);
}

.gantt-track i {
  position: absolute;
  top: 9px;
  bottom: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - var(--bar-left, 0%));
  min-width: 72px;
  padding: 0 10px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  white-space: nowrap;
}

.gantt-track i span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-track i[data-fit="medium"] {
  min-width: 58px;
  padding: 0 8px;
}

.gantt-track i[data-fit="tiny"] {
  min-width: 42px;
  padding: 0 7px;
  font-size: 11px;
}

.gantt-track i[data-status="в работе"] {
  background: #2563eb;
}

.gantt-track i[data-status="завершена"] {
  background: #16803f;
}

.gantt-track i[data-status="overdue"] {
  background: #c4492d;
}

.gantt-track i[data-status="закрыта"] {
  background: #697585;
}

.compact {
  gap: 8px;
}

.task-item,
.audit-item,
.timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.task-item {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.task-item strong {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.task-item span,
.timeline-item span,
.audit-item span,
.audit-item time {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.task-item[data-priority="срочный"] {
  background: var(--danger);
  border-color: #ffc3b8;
}

.task-item[data-priority="высокий"] {
  background: var(--warning);
  border-color: #ffd58c;
}

.clickable-card {
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.clickable-card:hover,
.clickable-card:focus-visible,
.clickable-card.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 112, 0.12);
  outline: none;
}

.clickable-card:active {
  transform: translateY(1px);
}

.overview-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(31, 122, 112, 0.24);
  border-radius: 8px;
  background: #f7fbfa;
}

.overview-detail div {
  min-width: 0;
}

.overview-detail span,
.overview-detail strong {
  display: block;
}

.overview-detail span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.overview-detail strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.overview-detail.event-detail {
  border-color: rgba(196, 73, 45, 0.28);
  background: #fff9f6;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

td {
  vertical-align: top;
}

td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

mark {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

mark[data-status="переговоры"] {
  background: var(--warning);
  color: #805200;
}

mark[data-status="расторгнут"] {
  background: var(--danger);
  color: #9c2a17;
}

.timeline {
  position: relative;
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.timeline-item time {
  color: var(--accent-3);
  font-size: 13px;
  font-weight: 800;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.task-column {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 260px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

.task-column h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 14px;
  text-transform: capitalize;
}

.task-column h3 span {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #dde8e7;
  color: var(--accent);
  font-size: 12px;
}

.audit-item {
  display: grid;
  gap: 4px;
  padding: 11px;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.fatal {
  max-width: 680px;
  margin: 80px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

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

  .nav a {
    text-align: center;
  }

  .metrics-grid,
  .content-grid,
  .content-grid:last-child {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide {
    grid-column: 1 / -1;
  }

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

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

  .summary-fields {
    grid-template-columns: 1fr;
  }

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

  .add-grid,
  .entity-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gantt-tools {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .dashboard {
    padding: 18px;
  }

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

  .role-switch {
    width: 100%;
  }

  .role-switch button {
    flex: 1;
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .nav a {
    flex: 0 0 auto;
  }

  .metrics-grid,
  .content-grid,
  .content-grid:last-child,
  .task-board,
  .calendar-grid,
  .add-grid,
  .entity-fields,
  .overview-detail {
    grid-template-columns: 1fr;
  }

  .entity-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head {
    flex-direction: column;
  }

  .gantt-tools,
  .gantt-period-controls,
  .gantt-range-select,
  .gantt-sort-group,
  .gantt-tools button,
  .gantt-period-controls a,
  .gantt-period-controls span,
  .gantt-sort-group a {
    width: 100%;
  }

  .gantt-scale,
  .gantt-row {
    grid-template-columns: minmax(130px, 0.38fr) minmax(0, 1fr);
    gap: 10px;
  }
}
