/* ==========================================================================
   Портал школьного комплекса — единый каркас: шапка + сайдбар + рабочее поле
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

body.no-scroll {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg {
  display: block;
}

::selection {
  background: var(--primary);
  color: var(--on-primary);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--lg {
  width: 24px;
  height: 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Шапка
   -------------------------------------------------------------------------- */

.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--header-h);
  padding: 0 18px 0 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: blur(14px) saturate(1.2);
}

.app-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 4px;
  background: var(--header-accent);
  opacity: 1;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 4px 6px 4px 4px;
  border-radius: var(--radius-md);
  transition: background var(--dur) var(--ease);
}

.brand:hover {
  background: var(--header-hover);
}

.brand__plate {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 4px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-xs);
  flex: none;
}

.brand__plate img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.brand__name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand__sub {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
}

.header-divider {
  width: 1px;
  height: 30px;
  background: var(--border);
  flex: none;
}

.clock {
  display: flex;
  flex-direction: column;
  min-width: 84px;
  line-height: 1.15;
  padding-left: 2px;
}

.clock__time {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.clock__date {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.header-position {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.header-position .icon {
  width: 15px;
  height: 15px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.header-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.header-action:hover {
  background: var(--header-hover);
  color: var(--text);
}

.header-action .icon {
  width: 17px;
  height: 17px;
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.icon-btn.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.icon-btn__dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--brand-magenta);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}

/* Переключатель темы */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}

.theme-switch button {
  display: grid;
  place-items: center;
  width: 31px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-3);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.theme-switch button:hover {
  color: var(--text);
}

.theme-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.theme-switch .icon {
  width: 16px;
  height: 16px;
}

/* Профиль почты */
.mail-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease);
}

.mail-chip:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  background: var(--surface-2);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-purple));
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: none;
  overflow: hidden;
}

.avatar--sm {
  width: 24px;
  height: 24px;
  font-size: 9.5px;
}

.avatar--xs {
  width: 20px;
  height: 20px;
  font-size: 8px;
}

.avatar--magenta { background: linear-gradient(135deg, #cb0666, #8a2c88); }
.avatar--orange { background: linear-gradient(135deg, #ec673a, #cb0666); }
.avatar--yellow { background: linear-gradient(135deg, #d8a202, #ec673a); color: #241c00; }
.avatar--green { background: linear-gradient(135deg, #1c8a5a, #32398e); }
.avatar--blue { background: linear-gradient(135deg, #32398e, #2450a4); }

.mail-chip__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.mail-chip__name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.mail-chip__mail {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  color: var(--text-3);
}

.logout-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.logout-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.mobile-menu-btn {
  display: none;
}

/* --------------------------------------------------------------------------
   Сайдбар
   -------------------------------------------------------------------------- */

.app-sidebar {
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: var(--sidebar-shadow);
  transition: width var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.sidebar-edge-toggle {
  position: absolute;
  top: 50%;
  right: -24px;
  z-index: 55;
  display: grid;
  place-items: center;
  width: 24px;
  height: 50px;
  padding: 0;
  border: 1px solid var(--sidebar-toggle-border);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: var(--sidebar-toggle-bg);
  color: var(--sidebar-toggle-color);
  box-shadow: var(--sidebar-toggle-shadow);
  transform: translateY(-50%);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.sidebar-edge-toggle:hover {
  background: var(--sidebar-bg);
  color: var(--sidebar-text-strong);
  border-color: var(--sidebar-border);
}

.sidebar-edge-toggle .icon {
  width: 17px;
  height: 17px;
  transition: transform var(--dur) var(--ease);
}

body.sidebar-collapsed .sidebar-edge-toggle .icon {
  transform: rotate(180deg);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-scroll-thumb) transparent;
}

.sidebar-section {
  margin-bottom: 14px;
}

.sidebar-section__title {
  padding: 0 10px;
  margin: 4px 0 6px;
  color: var(--sidebar-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity var(--dur) var(--ease);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  margin-bottom: 2px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  width: 100%;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-item .icon {
  width: 19px;
  height: 19px;
  color: var(--sidebar-icon);
  transition: color var(--dur) var(--ease);
}

.nav-item:hover {
  background: var(--nav-hover-bg);
  color: var(--sidebar-text-strong);
}

.nav-item:hover .icon {
  color: var(--nav-hover-icon);
}

.nav-item.is-active {
  background: var(--nav-active-bg);
  color: var(--sidebar-text-strong);
  font-weight: 600;
}

.nav-item.is-active .icon {
  color: var(--nav-active-icon);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--nav-active-bar);
  transform: translateY(-50%);
}

.nav-item__label {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--dur) var(--ease);
}

.nav-item__badge {
  margin-left: auto;
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--sidebar-badge-bg);
  color: var(--sidebar-badge-color);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  transition: opacity var(--dur) var(--ease);
}

.nav-item.is-active .nav-item__badge {
  background: var(--nav-active-badge-bg);
  color: var(--nav-active-badge-color);
}

.sidebar-footer {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-collapse {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-text);
  font-size: 12px;
  white-space: nowrap;
}

.sidebar-collapse:hover {
  background: var(--nav-hover-bg);
  color: var(--sidebar-text-strong);
}

.sidebar-collapse .icon {
  width: 18px;
  height: 18px;
  transition: transform var(--dur) var(--ease);
}

.sidebar-meta {
  margin-top: 8px;
  padding: 0 10px;
  color: var(--sidebar-meta);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-meta a {
  color: var(--sidebar-link);
  text-decoration: none;
}

.sidebar-meta a:hover {
  text-decoration: underline;
}

body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-w-collapsed);
}

body.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-w-collapsed);
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  gap: 0;
  padding: 0;
}

body.sidebar-collapsed .nav-item.is-active::before {
  left: -12px;
}

body.sidebar-collapsed .nav-item__label,
body.sidebar-collapsed .nav-item__badge,
body.sidebar-collapsed .sidebar-section__title,
body.sidebar-collapsed .sidebar-collapse__label,
body.sidebar-collapsed .sidebar-meta {
  display: none;
}

body.sidebar-collapsed .sidebar-collapse {
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .sidebar-collapse .icon {
  transform: rotate(180deg);
}

body.sidebar-collapsed .nav-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  z-index: 80;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--text);
  color: var(--surface);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  transform: translateY(-50%);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Рабочее поле
   -------------------------------------------------------------------------- */

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  padding-top: var(--header-h);
  transition: margin-left var(--dur) var(--ease);
}

.page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 22px 26px 40px;
  animation: page-in 240ms var(--ease) both;
}

.page--wide {
  max-width: none;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head__main {
  min-width: 0;
  flex: 1;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12.5px;
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--text-3);
  font-size: 11.5px;
}

.breadcrumbs .icon {
  width: 13px;
  height: 13px;
}

.breadcrumbs strong {
  color: var(--text-2);
  font-weight: 600;
}

.period-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
}

.period-chip .icon {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Базовые элементы
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn:active {
  transform: translateY(1px);
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-xs);
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--on-primary);
}

.btn--outline {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
}

.btn--outline:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
  color: var(--text);
}

.btn--soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn--soft:hover {
  background: var(--primary-soft-2);
  color: var(--primary);
}

.btn--ghost {
  color: var(--text-3);
}

.btn--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn--sm {
  height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
}

.btn--sm .icon {
  width: 15px;
  height: 15px;
}

.btn--icon {
  width: 36px;
  padding: 0;
}

.btn--icon.btn--sm {
  width: 30px;
}

.btn[disabled],
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.input,
.select {
  height: 36px;
  padding: 0 11px;
}

.textarea {
  min-height: 96px;
  padding: 9px 11px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.select {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 15px, calc(100% - 12px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.field__hint {
  color: var(--text-3);
  font-size: 11px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.search-box .input {
  padding-left: 33px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.toolbar__grow {
  flex: 1;
  min-width: 160px;
}

.toolbar .search-box {
  max-width: 300px;
}

.toolbar__sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.chip.is-active {
  background: var(--primary-soft);
  border-color: var(--primary-soft-2);
  color: var(--primary);
  font-weight: 650;
}

.chip .icon {
  width: 14px;
  height: 14px;
}

.chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge .icon {
  width: 12px;
  height: 12px;
}

.badge--level-L3 { background: rgba(50, 57, 142, 0.12); color: var(--primary); }
.badge--level-L2 { background: rgba(138, 44, 136, 0.13); color: var(--dir-kachestvo); }
.badge--level-L1 { background: rgba(236, 103, 58, 0.14); color: var(--dir-resursy); }
.badge--level-L0 { background: var(--surface-3); color: var(--text-3); }
.badge--global { background: rgba(254, 203, 55, 0.22); color: var(--warning); }
.badge--urgent { background: var(--danger-soft); color: var(--danger); }
.badge--clone { background: var(--info-soft); color: var(--info); }
.badge--neutral { background: var(--surface-3); color: var(--text-3); }

[data-theme="dark"] .badge--level-L3 { background: rgba(142, 150, 232, 0.16); }
[data-theme="dark"] .badge--level-L2 { background: rgba(215, 154, 214, 0.15); }
[data-theme="dark"] .badge--level-L1 { background: rgba(246, 160, 125, 0.15); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--st-plans-soft);
  color: var(--st-plans);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.status__icon {
  font-size: 9px;
  line-height: 1;
}

.status--plans { background: var(--st-plans-soft); color: var(--st-plans); }
.status--issued { background: var(--st-issued-soft); color: var(--st-issued); }
.status--work { background: var(--st-work-soft); color: var(--st-work); }
.status--review { background: var(--st-review-soft); color: var(--st-review); }
.status--returned { background: var(--st-returned-soft); color: var(--st-returned); }
.status--done { background: var(--st-done-soft); color: var(--st-done); }

.direction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
}

.direction__dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--dir-color, var(--text-3));
  flex: none;
}

.direction--vospitanie { --dir-color: var(--dir-vospitanie); }
.direction--kachestvo { --dir-color: var(--dir-kachestvo); }
.direction--soderzhanie { --dir-color: var(--dir-soderzhanie); }
.direction--resursy { --dir-color: var(--dir-resursy); }

.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.progress__track {
  position: relative;
  flex: 1;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 400ms var(--ease);
}

.progress--success .progress__fill { background: var(--success); }
.progress--warning .progress__fill { background: var(--warning); }
.progress--danger .progress__fill { background: var(--danger); }

.progress__value {
  min-width: 30px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.deadline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.deadline .icon {
  width: 12px;
  height: 12px;
}

.deadline--soon { color: var(--warning); font-weight: 600; }
.deadline--overdue { color: var(--danger); font-weight: 600; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.card__title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
}

.card__title .icon {
  width: 17px;
  height: 17px;
  color: var(--primary);
}

.card__sub {
  color: var(--text-3);
  font-size: 11px;
}

.card__link {
  margin-left: auto;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.card__link:hover {
  text-decoration: underline;
}

.card__body {
  padding: 14px 16px;
}

.divider {
  height: 1px;
  background: var(--border-soft);
  border: 0;
  margin: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.muted {
  color: var(--text-3);
}

.nowrap {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Кабинет
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 24px 26px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--hero-grad);
  box-shadow: var(--shadow-xs);
}

.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -90px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--brand-blue), var(--brand-purple), var(--brand-magenta), var(--brand-orange), var(--brand-yellow), var(--brand-blue));
  opacity: 0.1;
  filter: blur(2px);
}

.hero__main {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.hero__title {
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.hero__text {
  margin-top: 7px;
  max-width: 660px;
  color: var(--text-2);
  font-size: 13px;
}

.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.hero__actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
}

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

.kpi {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  text-align: left;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.kpi:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.kpi__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}

.kpi__icon .icon {
  width: 21px;
  height: 21px;
}

.kpi--magenta .kpi__icon { background: var(--dir-vospitanie-soft); color: var(--dir-vospitanie); }
.kpi--orange .kpi__icon { background: var(--dir-resursy-soft); color: var(--dir-resursy); }
.kpi--yellow .kpi__icon { background: var(--warning-soft); color: var(--warning); }
.kpi--green .kpi__icon { background: var(--success-soft); color: var(--success); }

.kpi__body {
  min-width: 0;
  flex: 1;
}

.kpi__value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.kpi__delta {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--text-3);
}

.kpi__delta--bad { color: var(--danger); }
.kpi__delta--good { color: var(--success); }

.kpi__label {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Мини-список задач */
.mini-task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

.mini-task:last-child {
  border-bottom: 0;
}

.mini-task:hover {
  background: var(--surface-2);
}

.mini-task__level {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 800;
  flex: none;
}

.mini-task__level--L3 { background: var(--primary-soft); color: var(--primary); }
.mini-task__level--L2 { background: var(--dir-kachestvo-soft); color: var(--dir-kachestvo); }
.mini-task__level--L1 { background: var(--dir-resursy-soft); color: var(--dir-resursy); }

.mini-task__body {
  min-width: 0;
  flex: 1;
}

.mini-task__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.mini-task__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 10.5px;
}

.mini-task__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* Радар дедлайнов */
.radar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.radar-row + .radar-row {
  border-top: 1px solid var(--border-soft);
}

.radar-row__dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
}

.radar-row__label {
  flex: 1;
  font-size: 12px;
  color: var(--text-2);
}

.radar-row__value {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.radar-row__bar {
  width: 72px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.radar-row__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

/* Направления */
.direction-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.dir-card {
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.dir-card__head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-2);
}

.dir-card__dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
}

.dir-card__value {
  margin: 10px 0 7px;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.dir-card__value small {
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0;
}

.dir-card .progress__value {
  min-width: 28px;
}

/* --------------------------------------------------------------------------
   Доска
   -------------------------------------------------------------------------- */

.board-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--context-w);
  gap: 14px;
  align-items: start;
}

.board-canvas {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.board-scroll {
  overflow-x: auto;
  padding-bottom: 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), minmax(232px, 1fr));
  gap: 10px;
  align-items: start;
  min-height: 480px;
}

.board-col {
  display: flex;
  flex-direction: column;
  min-height: 470px;
  max-height: calc(100vh - 235px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.board-col--done {
  background: color-mix(in srgb, var(--st-done-soft) 34%, var(--surface));
}

.board-col__head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border-soft);
  flex: none;
}

.board-col__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--col-color, var(--text-3));
  flex: none;
}

.board-col__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.015em;
  color: var(--text-2);
  white-space: nowrap;
}

.board-col__count {
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.board-col__add {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-3);
  opacity: 0;
  transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}

.board-col:hover .board-col__add {
  opacity: 1;
}

.board-col__add:hover {
  background: var(--surface-3);
  color: var(--text);
}

.board-col__body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* Карточка задачи */
.task-card {
  position: relative;
  padding: 9px 10px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.task-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.task-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.task-card.is-selected::after {
  content: "✓";
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 9px;
  font-weight: 800;
}

.task-card__top {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.task-card__top .direction {
  margin-left: auto;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-card__title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

.task-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--text-3);
  font-size: 10px;
  min-width: 0;
}

.task-card__assignee {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card__meta .deadline {
  margin-left: auto;
}

.task-card__progress {
  margin-top: 7px;
}

.task-card__footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--text-3);
  font-size: 9.5px;
}

.task-card__footer .icon {
  width: 11px;
  height: 11px;
}

.task-card__stages {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.task-card__tag {
  margin-left: auto;
}

/* Контекстная панель */
.context-panel {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--header-h) - 32px);
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.context-panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  flex: none;
}

.context-panel__title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
}

.context-panel__title .icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.context-panel__body {
  padding: 13px 14px;
  overflow-y: auto;
  flex: 1;
}

.ctx-section + .ctx-section {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--border-soft);
}

.ctx-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ctx-label .icon {
  width: 13px;
  height: 13px;
}

.ctx-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  padding: 0;
}

.ctx-list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.ctx-list__item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.ctx-list__item.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.ctx-list__item .icon {
  width: 14px;
  height: 14px;
  color: var(--text-3);
}

.ctx-list__item.is-active .icon {
  color: var(--primary);
}

.ctx-list__item span:last-child {
  margin-left: auto;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
}

.ctx-search {
  margin-bottom: 10px;
}

.ctx-task__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.ctx-task__title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.ctx-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 10px;
  margin: 12px 0;
}

.ctx-meta__item {
  min-width: 0;
}

.ctx-meta__label {
  display: block;
  color: var(--text-3);
  font-size: 9.5px;
  margin-bottom: 2px;
}

.ctx-meta__value {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}

.ctx-meta__value .avatar {
  width: 19px;
  height: 19px;
  font-size: 7.5px;
}

.ctx-progress {
  margin: 12px 0;
}

.ctx-progress__head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 10.5px;
  color: var(--text-3);
}

.ctx-progress__head strong {
  color: var(--text);
  font-size: 11px;
}

.ctx-stages {
  display: flex;
  flex-direction: column;
  gap: 5px;
  list-style: none;
  padding: 0;
}

.ctx-stage {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--text-2);
}

.ctx-stage__box {
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  margin-top: 1px;
  border: 1.5px solid var(--border-strong);
  border-radius: 3px;
  flex: none;
  color: transparent;
  font-size: 8px;
}

.ctx-stage.is-done .ctx-stage__box {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.ctx-stage.is-done {
  color: var(--text-3);
  text-decoration: line-through;
}

.ctx-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 14px;
}

.ctx-clarification {
  display: flex;
  gap: 7px;
  padding: 7px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 10.5px;
  line-height: 1.35;
}

.ctx-clarification__icon {
  color: var(--warning);
  flex: none;
}

.ctx-clarification__author {
  font-weight: 650;
}

/* Сравнение */
.compare-view {
  display: none;
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.board-shell.is-compare .board-canvas,
.board-shell.is-compare .context-panel {
  display: none;
}

.board-shell.is-compare .compare-view {
  display: block;
  animation: page-in 200ms var(--ease) both;
}

.compare-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.compare-head__title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
}

.compare-head__title .icon {
  color: var(--primary);
}

.compare-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 8px;
  color: var(--text-3);
  font-size: 10.5px;
}

.compare-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.compare-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.compare-head__actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

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

.compare-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
}

.compare-table th,
.compare-table td {
  padding: 9px 13px;
  border-bottom: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

.compare-table th:last-child,
.compare-table td:last-child {
  border-right: 0;
}

.compare-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.compare-table tbody th {
  width: 160px;
  min-width: 130px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  position: sticky;
  left: 0;
  z-index: 1;
}

.compare-col-head {
  min-width: 190px;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
}

.compare-col-head__meta {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}

.compare-row--diff th {
  color: var(--warning);
}

.compare-cell--a {
  background: color-mix(in srgb, var(--danger-soft) 55%, transparent);
}

.compare-cell--b {
  background: color-mix(in srgb, var(--success-soft) 55%, transparent);
}

.compare-empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--text-3);
}

.select-compare-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 4px 4px 4px 10px;
  border: 1px solid var(--primary-soft-2);
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 650;
}

.select-compare-bar__count {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 10px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Список задач
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 12px;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table tbody td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  max-width: 420px;
}

.table__title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.table__sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 9.5px;
}

.table__person {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.table__progress {
  min-width: 110px;
}

.table__num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table__empty {
  padding: 34px 20px !important;
  text-align: center;
  color: var(--text-3);
}

.table-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 11px;
}

.table-footer__pages {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Календарь
   -------------------------------------------------------------------------- */

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 14px;
  align-items: start;
}

.calendar {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.calendar__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.calendar__month {
  font-size: 14.5px;
  font-weight: 700;
  min-width: 148px;
}

.calendar__range {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 190px;
}

.calendar__range-label {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.2;
}

.calendar__range-hint {
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.calendar-window-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 650;
}

.calendar__nav {
  display: flex;
  gap: 2px;
}

.calendar__today {
  margin-left: auto;
}

.calendar__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 0 6px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}

.calendar__weekday {
  padding: 7px 9px;
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: right;
}

.calendar__weekday--weekend {
  color: var(--danger);
}

.calendar__weeks {
  display: flex;
  flex-direction: column;
}

.calendar__month-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar__month-sep::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--primary);
}

.calendar__week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  position: relative;
}

.calendar__week--current {
  background: color-mix(in srgb, var(--primary-soft) 10%, transparent);
}

.calendar__day {
  position: relative;
  min-width: 0;
  min-height: 156px;
  padding: 8px 8px 7px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.calendar__day:hover {
  background: var(--surface-2);
  box-shadow: var(--shadow-pop);
  transform: translateY(-1px);
  z-index: 1;
}

.calendar__day:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.calendar__day--weekend {
  background: color-mix(in srgb, var(--surface-2) 45%, var(--surface));
}

.calendar__day--has-tasks {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 26%, var(--surface)) 0%, var(--surface) 44%);
}

.calendar__day--today {
  background: color-mix(in srgb, var(--primary-soft) 62%, var(--surface));
}

.calendar__day--today::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid color-mix(in srgb, var(--primary) 55%, transparent);
  border-radius: inherit;
  pointer-events: none;
}

.calendar__week--current .calendar__day {
  background: color-mix(in srgb, var(--primary-soft) 12%, var(--surface));
}

.calendar__week--current .calendar__day--weekend {
  background: color-mix(in srgb, var(--primary-soft) 9%, var(--surface-2));
}

.calendar__week--current .calendar__day--has-tasks {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 30%, var(--surface)) 0%, color-mix(in srgb, var(--primary-soft) 10%, var(--surface)) 52%);
}

.calendar__week--current .calendar__day--today {
  background: color-mix(in srgb, var(--primary-soft) 68%, var(--surface));
}

.calendar__week--current .calendar__day:hover {
  background: var(--surface-2);
}

.calendar__day-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.calendar__num {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.calendar__day--today .calendar__num {
  background: var(--primary);
  color: var(--on-primary);
}

.calendar__month-tag {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.calendar__count {
  margin-left: auto;
  min-width: 16px;
  padding: 1px 4px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 8px;
  font-weight: 750;
  line-height: 1.35;
  text-align: center;
}

.calendar__day--has-tasks .calendar__count {
  background: var(--primary);
  color: var(--on-primary);
}

.calendar__events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  margin-top: 4px;
}

.cal-event {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 3px 5px;
  border: 0;
  border-left: 2.5px solid var(--dir-color, var(--primary));
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 9.5px;
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  transition: background var(--dur) var(--ease);
}

.calendar__day:hover .cal-event {
  background: var(--surface-3);
  color: var(--text);
}

.cal-event__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-event--done {
  opacity: 0.55;
  text-decoration: line-through;
}

.cal-more {
  padding: 2px 5px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 600;
  text-align: left;
}

/* Подробная повестка дня */
.cal-day {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cal-day__empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 38px 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-3);
  text-align: center;
}

.cal-day__empty svg {
  width: 26px;
  height: 26px;
}

.cal-day__empty-title {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

.cal-day__empty-text {
  max-width: 380px;
  font-size: 11.5px;
  line-height: 1.45;
}

.cal-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.cal-detail--done {
  opacity: 0.82;
}

.cal-detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cal-detail__title {
  min-width: 0;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
}

.cal-detail__head .btn {
  flex: 0 0 auto;
}

.cal-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--text-2);
  font-size: 10.5px;
}

.cal-detail__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.cal-detail__desc {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-line;
}

.cal-detail__progress {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
}

.cal-detail__progress .progress {
  flex: 1;
  margin: 0;
}

.planner {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.planner__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.planner__date {
  font-size: 12.5px;
  font-weight: 700;
}

.planner__body {
  padding: 6px 0;
}

.planner__item {
  display: flex;
  gap: 9px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

.planner__item:hover {
  background: var(--surface-2);
}

.planner__time {
  min-width: 34px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.planner__body-text {
  min-width: 0;
  flex: 1;
}

.planner__title {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}

.planner__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 9.5px;
}

.planner__head--preview {
  align-items: flex-start;
}

.planner__body--day {
  padding: 4px 0 8px;
}

.planner__item--rich {
  align-items: flex-start;
}

.planner__item--rich .planner__meta {
  row-gap: 4px;
}

.planner__sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 9.5px;
}

.planner__person {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.planner__person .avatar {
  flex: none;
}

.planner__item--rich .progress {
  margin-top: 5px;
}

.planner__item--rich .progress__value {
  font-size: 8.5px;
}

.planner__more {
  padding: 8px 14px 6px;
  color: var(--text-3);
  font-size: 9.5px;
  line-height: 1.45;
}

.planner__empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Заявки
   -------------------------------------------------------------------------- */

.request-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.request-stat {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  text-align: left;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.request-stat:hover {
  border-color: var(--border-strong);
}

.request-stat.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.request-stat__label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

.request-stat__label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.request-stat__value {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.request-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 230px;
}

.request-title__body {
  min-width: 0;
}

.request-title__text {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}

.request-title__sub {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 9.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}

.cost {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}

.cost--empty {
  color: var(--text-3);
  font-weight: 400;
}

.priority-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.priority-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
}

.priority-dot--urgent {
  color: var(--danger);
}

.priority-dot--urgent i {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.priority-dot--normal {
  color: var(--warning);
}

.priority-dot--normal i {
  background: var(--warning);
}

/* Таймлайн заявки */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline__item {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 0 0 16px 0;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  width: 14px;
}

.timeline__dot {
  width: 9px;
  height: 9px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--border-strong);
  flex: none;
}

.timeline__item.is-done .timeline__dot {
  background: var(--success);
}

.timeline__item.is-current .timeline__dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.timeline__line {
  position: absolute;
  top: 14px;
  bottom: -6px;
  width: 1.5px;
  background: var(--border);
}

.timeline__item:last-child .timeline__line {
  display: none;
}

.timeline__body {
  min-width: 0;
  font-size: 11.5px;
}

.timeline__title {
  font-weight: 650;
}

.timeline__meta {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 10px;
}

/* --------------------------------------------------------------------------
   Заглушки разделов, справочники, настройки
   -------------------------------------------------------------------------- */

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

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

.info-card {
  display: flex;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.info-card__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}

.info-card__title {
  font-size: 12.5px;
  font-weight: 650;
  margin-bottom: 3px;
}

.info-card__text {
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.45;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row__body {
  flex: 1;
  min-width: 0;
}

.settings-row__title {
  font-size: 12.5px;
  font-weight: 650;
}

.settings-row__text {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11px;
}

.settings-row .select {
  width: auto;
  min-width: 150px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

.segmented button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.role-line {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.perm-code {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 9.5px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Пустые состояния и подсказки (вариант empty.html)
   -------------------------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 38px 24px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  text-align: center;
}

.empty-state--compact {
  padding: 24px 16px;
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  box-shadow: 0 0 0 1px var(--border), var(--shadow-xs);
}

.empty-state__icon .icon {
  width: 22px;
  height: 22px;
}

.empty-state__title {
  font-size: 13.5px;
  font-weight: 700;
}

.empty-state__text {
  max-width: 430px;
  margin-top: 5px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.5;
}

.empty-state__actions {
  display: flex;
  gap: 7px;
  margin-top: 14px;
}

.hint {
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px dashed var(--primary-soft-2);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--primary-soft) 55%, transparent);
}

.hint__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hint__head .icon {
  width: 13px;
  height: 13px;
}

.hint ul {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.hint li {
  position: relative;
  padding-left: 13px;
  color: var(--text-2);
  font-size: 10.5px;
  line-height: 1.45;
}

.hint li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.65;
}

body.hints-hidden .hint,
body.hints-hidden .empty-state__hint {
  display: none;
}

.empty-card {
  display: flex;
  flex-direction: column;
  min-height: 170px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.empty-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.empty-card__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-3);
  flex: none;
}

.empty-card__icon .icon {
  width: 17px;
  height: 17px;
}

.empty-card__title {
  font-size: 12.5px;
  font-weight: 700;
}

.empty-card__status {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.empty-card__slot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 76px;
  padding: 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: 10.5px;
  text-align: center;
  line-height: 1.45;
}

.empty-col-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 86px;
  padding: 10px 8px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  color: var(--text-3);
  text-align: center;
}

.empty-col-slot strong {
  color: var(--text-2);
  font-size: 10px;
  font-weight: 650;
}

.empty-col-slot span {
  font-size: 9px;
  line-height: 1.35;
}

.skeleton-line {
  height: 8px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 2.4s linear infinite;
}

.skeleton-line + .skeleton-line {
  margin-top: 8px;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist__item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}

.checklist__item:last-child {
  border-bottom: 0;
}

.checklist__mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 50%;
  color: transparent;
  font-size: 9px;
  flex: none;
}

.checklist__item.is-done .checklist__mark {
  border-style: solid;
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.checklist__title {
  font-size: 11.5px;
  font-weight: 600;
}

.checklist__text {
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.4;
}

.hints-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
}

.hints-toggle__switch {
  position: relative;
  width: 26px;
  height: 15px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background var(--dur) var(--ease);
}

.hints-toggle__switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur) var(--ease);
}

.hints-toggle[aria-pressed="true"] .hints-toggle__switch {
  background: var(--primary);
}

.hints-toggle[aria-pressed="true"] .hints-toggle__switch::after {
  transform: translateX(11px);
}

.template-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--primary-soft-2);
  border-radius: var(--radius-lg);
  background: var(--hero-grad);
}

.template-banner__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
  flex: none;
}

.template-banner__body {
  flex: 1;
  min-width: 0;
}

.template-banner__title {
  font-size: 12.5px;
  font-weight: 700;
}

.template-banner__text {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Модальные окна, дроверы, уведомления, тосты
   -------------------------------------------------------------------------- */

.modal-root {
  position: relative;
  z-index: 120;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms var(--ease), visibility 200ms var(--ease);
}

.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.99);
  transition: transform 220ms var(--ease);
}

.modal-backdrop.is-open .modal {
  transform: none;
}

.modal--wide {
  max-width: 720px;
}

.modal--drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(580px, 100%);
  max-height: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  transform: translateX(24px);
}

.modal-backdrop--drawer.is-open .modal--drawer {
  transform: none;
}

.modal__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}

.modal__head-main {
  flex: 1;
  min-width: 0;
}

.modal__eyebrow {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.modal__title {
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.modal__sub {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 11.5px;
}

.modal__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  flex: none;
}

.modal__close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal__body {
  padding: 18px;
}

.modal__foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
}

.modal__foot-info {
  margin-right: auto;
  color: var(--text-3);
  font-size: 10.5px;
}

.stub-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 38px 24px;
  text-align: center;
}

.stub-box__icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 13px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}

.stub-box__icon .icon {
  width: 25px;
  height: 25px;
}

.stub-box__title {
  font-size: 15px;
  font-weight: 700;
}

.stub-box__text {
  max-width: 380px;
  margin-top: 5px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}

.stub-box__note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 13px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 9.5px;
  font-weight: 650;
}

/* Уведомления */
.notif-panel {
  position: fixed;
  top: calc(var(--header-h) - 2px);
  right: 18px;
  z-index: 90;
  width: 340px;
  max-height: min(480px, calc(100vh - var(--header-h) - 20px));
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease), visibility 160ms;
}

.notif-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.notif-panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.notif-panel__title {
  font-size: 12px;
  font-weight: 700;
}

.notif-panel__mark {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 600;
}

.notif-item {
  display: flex;
  gap: 9px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11px;
  line-height: 1.4;
  transition: background var(--dur) var(--ease);
}

.notif-item:hover {
  background: var(--surface-2);
}

.notif-item:last-child {
  border-bottom: 0;
}

.notif-item__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}

.notif-item__icon .icon {
  width: 14px;
  height: 14px;
}

.notif-item__text {
  color: var(--text-2);
}

.notif-item__text strong {
  color: var(--text);
  font-weight: 650;
}

.notif-item__time {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 9.5px;
}

/* Тосты */
.toast-stack {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 8px;
  width: min(430px, calc(100vw - 32px));
  max-width: none;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.4;
  pointer-events: auto;
  animation: toast-in 220ms var(--ease) both;
}

.toast__icon {
  flex: none;
  width: 17px;
  height: 17px;
  color: var(--primary);
}

.toast--success .toast__icon { color: var(--success); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--danger .toast__icon { color: var(--danger); }

.toast.is-out {
  animation: toast-out 180ms var(--ease) both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-6px) scale(0.98); }
}

/* Подложка мобильного сайдбара */
.sidebar-backdrop {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 45;
  background: var(--overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}

body.sidebar-mobile-open .sidebar-backdrop {
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   Адаптив
   -------------------------------------------------------------------------- */

@media (max-width: 1360px) {
  .header-action span:not(.badge) {
    display: none;
  }

  .header-action {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .mail-chip__name,
  .mail-chip__mail {
    max-width: 118px;
  }

  .request-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .board-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .context-panel {
    position: static;
    min-height: 0;
    max-height: none;
  }

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

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

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

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

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

@media (max-width: 980px) {
  :root {
    --header-h: 62px;
  }

  .mobile-menu-btn {
    display: inline-grid;
  }

  .brand__text,
  .header-divider,
  .header-position {
    display: none;
  }

  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-edge-toggle {
    display: none;
  }

  body.sidebar-mobile-open .app-sidebar {
    transform: none;
  }

  body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-w);
  }

  body.sidebar-collapsed .nav-item {
    justify-content: flex-start;
    gap: 11px;
    padding: 0 10px;
  }

  body.sidebar-collapsed .nav-item__label,
  body.sidebar-collapsed .nav-item__badge,
  body.sidebar-collapsed .sidebar-section__title,
  body.sidebar-collapsed .sidebar-collapse__label,
  body.sidebar-collapsed .sidebar-meta {
    display: block;
  }

  body.sidebar-collapsed .sidebar-collapse {
    justify-content: flex-start;
    padding: 0 10px;
  }

  body.sidebar-collapsed .sidebar-collapse .icon {
    transform: none;
  }

  .app-main,
  body.sidebar-collapsed .app-main {
    margin-left: 0;
  }

  .header-actions {
    gap: 3px;
  }

  .clock {
    min-width: 72px;
  }

  .mail-chip__text {
    display: none;
  }

  .mail-chip {
    width: 38px;
    height: 38px;
    padding: 3px;
    justify-content: center;
  }

  .logout-btn {
    width: 34px;
    height: 34px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .clock__date {
    display: none;
  }

  .clock {
    min-width: 58px;
  }

  .clock__time {
    font-size: 13px;
  }

  .header-action {
    display: none;
  }

  .theme-switch button {
    width: 28px;
  }

  .page {
    padding: 16px 14px 32px;
  }

  .page-title {
    font-size: 20px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi {
    padding: 11px;
    gap: 9px;
  }

  .kpi__icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .kpi__value {
    font-size: 21px;
  }

  .kpi__label {
    font-size: 10.5px;
  }

  .kpi__delta {
    display: none;
  }

  .hero__title {
    font-size: 21px;
  }

  .direction-cards {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

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

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

  .section-grid,
  .section-grid--3 {
    grid-template-columns: 1fr;
  }

  .page-head {
    flex-direction: column;
    gap: 10px;
  }

  .page-head__actions {
    justify-content: flex-start;
    width: 100%;
  }

  .calendar__range {
    min-width: 0;
  }

  .calendar__range-label {
    font-size: 12px;
  }

  .calendar__range-hint,
  .calendar__month-tag,
  .calendar__count {
    display: none;
  }

  .calendar__weekdays {
    gap: 3px;
    padding: 0 3px;
  }

  .calendar__week {
    gap: 3px;
    padding: 3px;
  }

  .calendar__day {
    min-height: 108px;
    padding: 5px;
    border-radius: var(--radius-sm);
  }

  .calendar__day-head {
    justify-content: center;
  }

  .cal-event {
    padding: 2px 4px;
  }

  .cal-event__title {
    display: none;
  }

  .cal-event::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    margin: 0 auto;
  }

  .calendar__weekday {
    font-size: 8.5px;
    text-align: center;
    padding: 6px 2px;
  }

  .calendar__events {
    align-items: center;
  }

  .cal-more {
    display: none;
  }

  .cal-detail__head {
    flex-direction: column;
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal--drawer {
    position: static;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border);
    transform: translateY(18px);
  }

  .notif-panel {
    right: 10px;
    left: 10px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Новые сценарии ТЗ: клоны, этапы, уточнения, шаблоны, глобальные задачи
   -------------------------------------------------------------------------- */

.badge--success {
  background: var(--success-soft);
  color: var(--success);
}

.badge--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.assignee-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 216px;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.assignee-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.assignee-option:hover {
  border-color: var(--border-strong);
}

.assignee-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.assignee-option input {
  flex: none;
  accent-color: var(--primary);
}

.assignee-option__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.assignee-option__body strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignee-option__body small {
  overflow: hidden;
  color: var(--text-3);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-suggest {
  margin-top: 6px;
  max-height: 210px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.field__hint--warning {
  color: var(--danger);
  font-weight: 600;
}

.progress-stack {
  display: flex;
  gap: 3px;
  height: 4px;
  margin-top: 5px;
}

.progress-stack__bar {
  flex: 1;
  height: 4px;
  min-width: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  background-image: linear-gradient(to right, var(--bar-color, var(--primary)) var(--bar-width, 0%), transparent var(--bar-width, 0%));
}

.ctx-progress__stack {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.ctx-progress__stack .progress-stack {
  flex: 1;
  margin-top: 0;
}

.ctx-stage__box {
  appearance: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ctx-stage__box:not(:disabled):hover {
  border-color: var(--primary);
}

.ctx-stage__box.is-checked {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.ctx-stage--child {
  padding-left: 18px;
}

.stage-add {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.stage-add .select {
  max-width: 190px;
}

.stage-add .input {
  flex: 1;
  min-width: 150px;
}

.clar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.clar-item {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.clar-item.is-answered {
  opacity: 0.78;
}

.clar-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-3);
}

.clar-item__text {
  margin-top: 5px;
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.45;
}

.clar-item__answer {
  display: flex;
  gap: 5px;
  align-items: flex-start;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 11px;
}

.clarify-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.clarify-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inline-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
}

.inline-confirm__title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.inline-confirm__actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.wizard-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.check-row input {
  margin-top: 2px;
  accent-color: var(--primary);
}

.check-row span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.check-row strong {
  font-size: 11.5px;
}

.check-row small {
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.35;
}

.stage-checks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
}

.stage-check {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px 5px calc(8px + var(--stage-depth, 0) * 16px);
  border-radius: 7px;
  background: var(--surface);
}

.stage-check input {
  flex: none;
  accent-color: var(--primary);
}

.stage-check__title {
  flex: 1;
  min-width: 0;
  font-size: 11px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  overflow: auto;
  border-bottom: 1px solid var(--border);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.tab__count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 9.5px;
}

.tab.is-active .tab__count {
  background: var(--primary-soft);
  color: var(--primary);
}

.ctx-filters {
  display: grid;
  gap: 7px;
}

.ctx-filter {
  display: grid;
  gap: 3px;
  color: var(--text-3);
  font-size: 10px;
}

.ctx-filter .select {
  height: 30px;
  font-size: 11px;
}

.batch-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
}

.batch-panel__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.batch-panel__body strong {
  font-size: 11.5px;
}

.batch-panel__body span {
  color: var(--text-2);
  font-size: 10.5px;
  line-height: 1.4;
}

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

.global-card__text {
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.45;
}

.global-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 9px 0;
  color: var(--text-3);
  font-size: 10.5px;
}

.global-card__tasks {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 9px 0;
}

.global-card__tasks .mini-task {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-2);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.global-card__tasks .mini-task:hover {
  border-color: var(--primary);
}

.global-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.template-card__stages {
  margin: 8px 0;
}

.template-stage {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  color: var(--text-2);
  font-size: 11px;
}

.template-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.template-card__actions {
  display: flex;
  gap: 6px;
}

.task-card__stages--alarm {
  color: var(--danger);
  font-weight: 700;
}

/* Область видимости доски и дерево ветки */
.scope-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10.5px;
  line-height: 1.45;
}

.board-globals {
  margin-bottom: 10px;
  padding: 8px 9px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.board-globals__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 700;
}

.board-globals__head .icon {
  width: 13px;
  height: 13px;
  color: var(--primary);
}

.board-globals__hint {
  margin-left: auto;
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 500;
}

.board-globals__list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.global-mini {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 185px;
  max-width: 260px;
  padding: 6px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.global-mini:hover,
.global-mini.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.global-mini > .icon {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.global-mini__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.global-mini__title {
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-mini__meta {
  color: var(--text-3);
  font-size: 9px;
  white-space: nowrap;
}

.global-mini > .badge {
  margin-left: auto;
  flex: none;
}

.branch-tree {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.branch-tree__list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 3px 0 0 12px;
  padding: 0 0 0 8px;
  border-left: 1px solid var(--border);
  list-style: none;
}

.branch-tree__item {
  min-width: 0;
  list-style: none;
}

.branch-tree__node {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.branch-tree__node:hover {
  border-color: var(--border);
  background: var(--surface-2);
}

.branch-tree__title {
  overflow: hidden;
  flex: 1;
  min-width: 0;
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-tree__meta {
  flex: none;
  max-width: 46%;
  overflow: hidden;
  color: var(--text-3);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subtask-empty {
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-3);
  font-size: 10.5px;
}

.subtask-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.subtask-row__head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.subtask-row__hint {
  color: var(--text-3);
  font-size: 9.5px;
}

.subtask-field.is-disabled,
#subtask-field.is-disabled {
  opacity: 0.65;
}

#subtask-add {
  margin-top: 7px;
}

@media (max-width: 980px) {
  .global-grid,
  .template-grid,
  .assignee-picker {
    grid-template-columns: 1fr;
  }
}

/* Тестовый режим: переключение роли и редактирование подзадач */
.role-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 6px 0 4px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}

.role-switch__badge {
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  background: var(--warning-soft);
  color: var(--text-2);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.role-switch select {
  max-width: 200px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.role-switch__return {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  padding: 0 5px 0 7px;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.role-switch__return:hover {
  color: var(--primary-strong, var(--primary));
  text-decoration: underline;
}

.role-switch__return[hidden] {
  display: none;
}

.textarea--sm {
  min-height: 54px;
  padding: 7px 9px;
  font-size: 11.5px;
}

.subtask-assignees {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-height: 168px;
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.mini-assignee {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 10px;
  cursor: pointer;
}

.mini-assignee:hover {
  border-color: var(--border-strong);
}

.mini-assignee:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.mini-assignee input {
  flex: none;
  width: 12px;
  height: 12px;
  accent-color: var(--primary);
}

.mini-assignee__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.2;
}

.mini-assignee__name {
  overflow: hidden;
  color: inherit;
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-assignee__role {
  overflow: hidden;
  color: var(--text-3);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-assignee:has(input:checked) .mini-assignee__role {
  color: var(--text-2);
}

.ctx-task__desc {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.5;
}

.child-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}

.child-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}

.child-item:hover {
  border-color: var(--border-strong);
}

.child-item__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.child-item__meta {
  flex: none;
  color: var(--text-3);
  font-size: 9.5px;
}

.child-form {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
  background: var(--surface-2);
}

@media (max-width: 980px) {
  .role-switch__badge {
    display: none;
  }

  .role-switch select {
    max-width: 108px;
  }

  .role-switch__return {
    padding: 0 5px;
    border-left: 0;
  }

  .role-switch__return span {
    display: none;
  }

  .subtask-assignees {
    grid-template-columns: 1fr;
  }
}

/* Карточка выдачи: компактный верх, свёрнутые подзадачи, этапы-чек-лист */
.task-create {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-create .field {
  gap: 4px;
}

.task-create .field__label {
  font-size: 11px;
}

.task-create .field__hint {
  font-size: 10px;
}

.task-create .input,
.task-create .select {
  height: 34px;
  padding: 0 9px;
  font-size: 12px;
}

.task-create .select {
  padding-right: 28px;
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
}

.task-create .textarea--sm {
  min-height: 48px;
  font-size: 12px;
}

.task-create .search-box .input {
  padding-left: 30px;
}

.task-create__top {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.task-create__template {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-create__template .template-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 12;
  margin-top: 0;
  max-height: 190px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

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

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

.task-create__subhead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1px;
}

.task-create__subhead .badge {
  margin-left: auto;
}

.template-applied {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--text-2);
  font-size: 11px;
}

.template-applied strong {
  color: var(--text);
}

.template-applied .btn {
  margin-left: auto;
}

.subtask-summary[hidden],
.subtask-body[hidden],
.task-create .template-suggest[hidden] {
  display: none !important;
}

.subtask-row.is-collapsed {
  padding: 4px 8px;
  background: var(--surface-2);
}

.subtask-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 4px 2px;
}

.subtask-summary__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtask-summary__meta {
  flex: none;
  max-width: 45%;
  overflow: hidden;
  color: var(--text-3);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtask-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.subtask-stages {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 7px;
  border-top: 1px dashed var(--border);
}

.subtask-stages__head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.subtask-stage-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.subtask-stage {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--surface);
}

.subtask-stage label {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
}

.subtask-stage label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtask-stage input {
  width: 13px;
  height: 13px;
  accent-color: var(--primary);
}

.subtask-row__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .task-create__top {
    grid-template-columns: 1fr;
  }

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

/* ==========================================================================
   Вход по школьной почте
   ========================================================================== */

body.auth-open {
  overflow: hidden;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow: auto;
  background:
    radial-gradient(900px 520px at 12% 4%, rgba(50, 57, 142, 0.18), transparent 62%),
    radial-gradient(760px 480px at 92% 96%, rgba(203, 6, 102, 0.14), transparent 60%),
    var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  padding: 30px 30px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

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

.auth-brand__logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}

.auth-brand__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-brand__text {
  display: grid;
  gap: 2px;
}

.auth-brand__text strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.auth-brand__text span {
  color: var(--text-3);
  font-size: 12px;
}

.auth-lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.auth-title {
  margin-bottom: 8px;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin-bottom: 22px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}

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

.auth-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.auth-field .input {
  width: 100%;
  min-height: 44px;
  font-size: 14px;
}

.auth-error,
.auth-warning {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 500;
}

.auth-error {
  border: 1px solid rgba(168, 30, 43, 0.24);
  background: var(--danger-soft);
  color: var(--danger);
}

.auth-warning {
  border: 1px solid rgba(138, 90, 0, 0.24);
  background: var(--warning-soft);
  color: var(--warning);
}

.auth-error[hidden],
.auth-warning[hidden] {
  display: none;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  justify-content: center;
  margin-top: 2px;
}

.auth-submit:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.auth-hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.5;
}

/* ==========================================================================
   Почтовый клиент
   ========================================================================== */

.mail-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 22px 26px 40px;
}

/* Почтовый поддомен: только почта, без сайдбара и лишней шапки. */
html.mail-only .app-sidebar,
html.mail-only .sidebar-backdrop,
html.mail-only .sidebar-edge-toggle,
html.mail-only .mobile-menu-btn,
html.mail-only .header-divider,
html.mail-only .clock,
html.mail-only .header-position,
html.mail-only .role-switch,
html.mail-only .header-action,
html.mail-only #notif-toggle {
  display: none !important;
}

html.mail-only .app-main,
html.mail-only body.sidebar-collapsed .app-main {
  margin-left: 0;
}

html.mail-only .app-header {
  gap: 12px;
  padding: 0 22px;
}

html.mail-only .app-header .brand {
  margin-right: auto;
}

html.mail-only .mail-page {
  max-width: none;
  padding: 24px 26px 44px;
}

.mail-head {
  margin-bottom: 0;
}

.mail-layout {
  display: grid;
  grid-template-columns: 214px minmax(300px, 0.95fr) minmax(340px, 1.1fr);
  gap: 14px;
  align-items: start;
}

.mail-folders,
.mail-list-pane,
.mail-reader {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.mail-folders {
  padding: 14px 12px;
  position: sticky;
  top: 14px;
}

.mail-folders__title {
  margin: 2px 8px 10px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.mail-folders__list {
  display: grid;
  gap: 3px;
}

.mail-folder {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.mail-folder:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.mail-folder.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 650;
}

.mail-folder__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-folder__unread {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
}

.mail-folders__account {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
}

.mail-folders__account > span:last-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.mail-folders__account strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-folders__account span span {
  overflow: hidden;
  color: var(--text-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 560px;
  max-height: calc(100vh - 210px);
  overflow: hidden;
}

.mail-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
}

.mail-list-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.mail-list-count {
  color: var(--text-3);
  font-size: 11.5px;
}

.mail-search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 12px 10px;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-3);
}

.mail-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.mail-search input {
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
}

.mail-list {
  flex: 1;
  overflow: auto;
  border-top: 1px solid var(--border-soft);
}

.mail-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.mail-row:hover {
  background: var(--surface-hover);
}

.mail-row.is-active {
  background: var(--primary-soft);
}

.mail-row__dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: transparent;
}

.mail-row.is-unread .mail-row__dot {
  background: var(--primary);
}

.mail-row__main {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.mail-row__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.mail-row__from {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-row__date {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 10.5px;
}

.mail-row__subject {
  overflow: hidden;
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-row.is-unread .mail-row__subject {
  font-weight: 750;
}

.mail-row__preview {
  overflow: hidden;
  color: var(--text-3);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-row__clip {
  flex: 0 0 auto;
  margin-top: 3px;
  color: var(--text-3);
}

.mail-reader {
  display: flex;
  flex-direction: column;
  min-height: 560px;
  max-height: calc(100vh - 210px);
  overflow: hidden;
}

.mail-reader__head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.mail-reader__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.mail-reader__subject {
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.mail-reader__meta {
  display: grid;
  gap: 3px;
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mail-reader__meta strong {
  color: var(--text-3);
  font-weight: 600;
}

.mail-reader__body {
  flex: 1;
  padding: 18px;
  overflow: auto;
}

.mail-body {
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.mail-body--text {
  white-space: pre-wrap;
}

.mail-body--empty {
  color: var(--text-3);
}

.mail-body img {
  max-width: 100%;
  height: auto;
}

.mail-body a {
  color: var(--primary);
}

.mail-body blockquote {
  margin: 10px 0;
  padding-left: 12px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-2);
}

.mail-body table {
  max-width: 100%;
  border-collapse: collapse;
}

.mail-body td,
.mail-body th {
  padding: 4px 6px;
  border: 1px solid var(--border);
}

.mail-pane-empty,
.mail-pane-error {
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 34px 20px;
  color: var(--text-3);
  text-align: center;
}

.mail-pane-empty .icon {
  width: 34px;
  height: 34px;
  opacity: 0.55;
}

.mail-pane-empty strong {
  color: var(--text-2);
  font-size: 13px;
}

.mail-pane-empty span,
.mail-pane-error span {
  max-width: 280px;
  font-size: 11.5px;
  line-height: 1.5;
}

.mail-pane-empty--reader {
  min-height: 100%;
}

.mail-pane-error {
  color: var(--danger);
}

.mail-pane-error strong {
  color: var(--danger);
  font-size: 13px;
}

.mail-pane-error .btn {
  margin-top: 4px;
}

.mail-list-loading,
.mail-reader__loading {
  padding: 14px;
}

.mail-skeleton {
  display: grid;
  gap: 6px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.mail-skeleton__line {
  display: block;
  height: 9px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--surface-3), var(--surface-hover), var(--surface-3));
  background-size: 220% 100%;
  animation: mail-shimmer 1.4s linear infinite;
}

.mail-skeleton__line--short {
  height: 7px;
  opacity: 0.75;
}

@keyframes mail-shimmer {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -220% 0;
  }
}

.mail-compose {
  display: grid;
  gap: 13px;
}

.mail-compose__field {
  display: grid;
  gap: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.mail-compose__field .input {
  width: 100%;
  font-weight: 400;
}

.mail-recipient {
  position: relative;
}

.mail-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 90;
  max-height: 286px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.mail-suggest[hidden] {
  display: none;
}

.mail-suggest__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.mail-suggest__item:hover,
.mail-suggest__item.is-active {
  background: var(--surface-hover);
}

.mail-suggest__avatar {
  width: 32px;
  height: 32px;
  flex: none;
  font-size: 11px;
}

.mail-suggest__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.mail-suggest__name {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-suggest__meta {
  overflow: hidden;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-suggest__empty {
  padding: 10px 12px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 400;
}

.mail-compose__field textarea {
  min-height: 210px;
  resize: vertical;
  line-height: 1.55;
}

.mail-form-error {
  padding: 9px 11px;
  border: 1px solid rgba(168, 30, 43, 0.24);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 500;
}

.mail-form-error[hidden] {
  display: none;
}

.mail-compose__hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 11px;
}

@media (max-width: 1280px) {
  .mail-layout {
    grid-template-columns: 190px minmax(280px, 1fr) minmax(320px, 1fr);
  }
}

@media (max-width: 1120px) {
  .mail-layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .mail-reader {
    grid-column: 1 / -1;
    max-height: none;
    min-height: 420px;
  }

  .mail-folders {
    position: static;
  }
}

@media (max-width: 760px) {
  .mail-page,
  html.mail-only .mail-page {
    padding: 16px 14px 32px;
  }

  html.mail-only .app-header {
    padding: 0 12px;
  }

  .mail-layout {
    grid-template-columns: 1fr;
  }

  .mail-folders {
    padding: 10px;
  }

  .mail-folders__list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .mail-folder {
    flex: 0 0 auto;
    width: auto;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--border-soft);
  }

  .mail-folder__label {
    flex: 0 0 auto;
  }

  .mail-folders__account {
    display: none;
  }

  .mail-list-pane,
  .mail-reader {
    min-height: 0;
    max-height: none;
  }

  .mail-list-pane {
    max-height: 62vh;
  }

  .auth-card {
    padding: 24px 20px 22px;
  }
}

/* ==========================================================================
   Сообщения в кабинете
   ========================================================================== */

.messages-card {
  margin-bottom: 16px;
}

.messages__head {
  flex-wrap: wrap;
}

.messages__head .card__title {
  margin-right: auto;
}

.messages__head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.messages__tabs {
  display: flex;
  gap: 2px;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
  scrollbar-width: none;
}

.messages__tabs::-webkit-scrollbar {
  display: none;
}

.messages__tab {
  flex: 0 0 auto;
  padding: 8px 10px 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
}

.messages__tab:hover {
  color: var(--text);
}

.messages__tab.is-active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.messages__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.messages__filter {
  height: 25px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.messages__filter:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.messages__filter.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.messages__list {
  display: flex;
  flex-direction: column;
}

.msg + .msg {
  border-top: 1px solid var(--border-soft);
}

.msg__open {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.msg__open:hover {
  background: var(--surface-2);
}

.msg.is-unread .msg__open {
  background: linear-gradient(90deg, var(--primary-soft), transparent 46%);
}

.msg.is-unread .msg__open:hover {
  background: linear-gradient(90deg, var(--primary-soft), var(--surface-2) 58%);
}

.msg__avatar {
  flex: 0 0 auto;
}

.msg__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.msg__top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.msg__author {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
}

.msg__position {
  color: var(--text-3);
  font-size: 11px;
}

.msg__time {
  margin-left: auto;
  color: var(--text-3);
  font-size: 10.5px;
  white-space: nowrap;
}

.msg__unread {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.msg__title {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.35;
}

.msg__text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.msg.is-unread .msg__text {
  color: var(--text);
}

.msg__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}

.msg-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 19px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
}

.msg-tag .icon {
  width: 11px;
  height: 11px;
}

.msg-tag--direction {
  background: var(--primary-soft);
  color: var(--primary);
}

.msg-tag--building {
  background: var(--warning-soft);
  color: var(--warning);
}

.messages__more {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  border-top: 1px solid var(--border-soft);
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
}

.messages__more:hover {
  background: var(--surface-2);
}

.messages-card .empty-state {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.msg-detail__text {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}

.msg-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.messages-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.messages-form__types {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.messages-form__types .messages-type:only-child {
  grid-column: 1 / -1;
}

.messages-type {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.messages-type input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.messages-type > span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 650;
}

.messages-type small {
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.35;
}

.messages-type.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.messages-type.is-active > span {
  color: var(--primary);
}

.messages-form__info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.messages-form__radios {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.messages-radio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.messages-radio:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.messages-radio input {
  accent-color: var(--primary);
}

.messages-form__checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.messages-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 11.5px;
  cursor: pointer;
}

.messages-check input {
  accent-color: var(--primary);
}

.messages-form__copy {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
}

.messages-form__copy input {
  accent-color: var(--primary);
}

.messages-form__note {
  min-height: 14px;
  color: var(--text-3);
  font-size: 11px;
}

.messages-form__error {
  color: var(--danger);
  font-size: 11.5px;
}

@media (max-width: 760px) {
  .messages__head {
    align-items: flex-start;
  }

  .messages__head-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .messages__tabs {
    padding-left: 12px;
    padding-right: 12px;
  }

  .messages__filters {
    padding-left: 12px;
    padding-right: 12px;
  }

  .msg__open {
    padding: 11px 12px;
  }

  .msg__time {
    width: 100%;
    margin-left: 0;
  }

  .messages-form__types,
  .messages-form__checks {
    grid-template-columns: 1fr;
  }
}
