@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("./fonts/manrope-cyrillic-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("./fonts/manrope-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("./fonts/manrope-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("./fonts/manrope-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============ Темы: серо-чёрная база (ТЗ, раздел 5) + светлая ============ */

:root,
:root[data-theme="dark"] {
  --bg: #141312;
  --bg-soft: #181716;
  --panel: #1d1b1a;
  --panel-soft: #232120;
  --panel-hover: #262322;
  --line: #2b2825;
  --line-strong: #3a3631;
  --ink: #ece7df;
  --muted: #a59d92;
  --faint: #766f66;
  --green: #8cc296;
  --green-soft: rgba(140, 194, 150, 0.14);
  --red: #e29486;
  --red-soft: rgba(226, 148, 134, 0.14);
  --amber: #d9b877;
  --amber-soft: rgba(217, 184, 119, 0.16);
  --blue: #94b9d4;
  --blue-soft: rgba(148, 185, 212, 0.14);
  --gray-pill: rgba(165, 157, 146, 0.16);
  --bar-track: #2a2724;
  --bar-neutral: #57514a;
  --chart-revenue: #6b645b;
  --chart-profit: #8cc296;
  --chart-line: #d9b877;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --sidebar-bg: #100f0e;
  --focus: #d9b877;
  color-scheme: dark;
}

:root[data-theme="light"] {
  /* чистая белая тема: нейтральные серые без тёплого подтона,
     тёплыми остаются только семантические акценты (светофор) */
  --bg: #f6f6f8;
  --bg-soft: #f0f0f3;
  --panel: #ffffff;
  --panel-soft: #f7f7f9;
  --panel-hover: #f1f1f4;
  --line: #e6e6ea;
  --line-strong: #d1d1d8;
  --ink: #191a1e;
  --muted: #62646c;
  --faint: #94969f;
  --green: #217a3f;
  --green-soft: #e4f3e9;
  --red: #c2453c;
  --red-soft: #fbe9e7;
  --amber: #9c6410;
  --amber-soft: #f8efd6;
  --blue: #31649b;
  --blue-soft: #e6eef7;
  --gray-pill: #ededf0;
  --bar-track: #ededf0;
  --bar-neutral: #b4b4bc;
  --chart-revenue: #d3d3da;
  --chart-profit: #45935d;
  --chart-line: #c07f1d;
  --shadow: 0 1px 2px rgba(20, 20, 25, 0.05);
  --sidebar-bg: #fbfbfc;
  --focus: #31649b;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-color: var(--line-strong) transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", ui-sans-serif, system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  font-weight: 450;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
}

button {
  font: inherit;
  color: inherit;
}

select,
input {
  font: inherit;
}

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

/* ============ Каркас ============ */

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px 16px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  font-weight: 750;
  font-size: 14px;
  letter-spacing: 0;
  flex-shrink: 0;
}

.brand-title {
  font-weight: 750;
  font-size: 15.5px;
  letter-spacing: 0;
}

.brand-subtitle {
  color: var(--faint);
  font-size: 11.75px;
  line-height: 1.35;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  margin: 10px 8px 5px;
  font-size: 10.75px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--faint);
}

.nav-label:first-child {
  margin-top: 0;
}

.nav-label-with-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-group-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #9a6700;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: none;
}

.nav-group-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c98a16;
  flex-shrink: 0;
}

:root[data-theme="dark"] .nav-group-status {
  color: #d7ad5d;
}

.nav-button {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.nav-button svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.nav-button:hover {
  background: var(--panel-hover);
  color: var(--ink);
}

.nav-button.active {
  background: var(--panel-soft);
  color: var(--ink);
  font-weight: 650;
}

:root[data-theme="light"] .nav-button:hover {
  background: #f0f0f3;
}

:root[data-theme="light"] .nav-button.active {
  background: #e9e9ee;
  box-shadow: none;
}

.nav-title {
  display: block;
  font-size: 13.5px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-note {
  display: block;
  font-size: 11px;
  line-height: 1.35;
  color: var(--faint);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding: 0 4px;
}

.theme-switch {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.theme-switch button {
  flex: 1;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font-size: 12.5px;
  padding: 6px 0;
  cursor: pointer;
}

.theme-switch button.active {
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.sidebar-status {
  font-size: 11.75px;
  color: var(--faint);
  line-height: 1.55;
  padding: 0 4px 2px;
}

.sidebar-status .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
}

/* ============ Верхняя панель ============ */

.workspace {
  min-width: 0;
  padding: 22px 28px 48px;
  max-width: 1360px;
}

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

.eyebrow {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: 0;
}

.topbar-meta {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
  text-align: right;
  color: var(--faint);
  font-size: 12.25px;
  line-height: 1.5;
  white-space: nowrap;
}

.topbar-meta b {
  color: var(--muted);
  font-weight: 650;
}

.session-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-profile-button {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 5px 7px 5px 5px;
  text-align: left;
  cursor: pointer;
}

.session-profile-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.session-profile-button > svg {
  width: 13px;
  height: 13px;
  color: var(--faint);
}

.session-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
}

.session-avatar img,
.access-avatar img,
.profile-photo-preview img,
.profile-head-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.session-identity {
  min-width: 0;
}

.session-identity strong,
.session-identity small {
  display: block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-identity strong {
  font-size: 10.5px;
  line-height: 1.25;
}

.session-identity small {
  color: var(--faint);
  margin-top: 2px;
  font-size: 8.5px;
}

.session-logout {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}

.login-shell {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

body.auth-pending .app-shell,
body.auth-screen .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.auth-pending .sidebar,
body.auth-screen .sidebar,
body.auth-pending .topbar,
body.auth-screen .topbar {
  display: none;
}

body.auth-pending .workspace,
body.auth-screen .workspace {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  padding: 0;
}

body.auth-pending .content,
body.auth-screen .content,
body.auth-screen .login-shell {
  min-height: 100vh;
}

body.auth-pending .content {
  align-content: center;
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
}

.login-panel {
  width: min(100%, 420px);
  display: grid;
  gap: 20px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel h2 {
  margin: 5px 0 0;
  font-size: 26px;
}

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

.login-panel input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
}

/* ============ Контент ============ */

.content {
  display: grid;
  gap: 14px;
}

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

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

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

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
}

.panel-subtitle {
  color: var(--faint);
  font-size: 12.25px;
  line-height: 1.45;
  margin-top: 3px;
}

.panel-aside {
  color: var(--faint);
  font-size: 12.25px;
  white-space: nowrap;
}

/* ============ Фильтры ============ */

.filter-panel {
  position: relative;
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 8px;
}

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

.filter-period-menu {
  position: relative;
  min-width: 238px;
}

.filter-period-menu summary {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 0 11px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.filter-period-menu summary::-webkit-details-marker {
  display: none;
}

.filter-period-menu summary:hover,
.filter-period-menu[open] summary {
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.filter-toolbar-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.filter-toolbar-icon svg,
.filter-toolbar-caret svg,
.filters-toggle svg,
.filter-reset-button svg,
.filter-date-separator svg {
  display: block;
  width: 100%;
  height: 100%;
}

.filter-toolbar-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.filter-toolbar-copy small,
.filter-toolbar-select > span {
  color: var(--faint);
  font-size: 9.75px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.filter-toolbar-copy b {
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-toolbar-caret,
.filters-caret {
  width: 15px;
  height: 15px;
  color: var(--faint);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.filter-period-menu[open] .filter-toolbar-caret,
.filter-panel.open .filters-caret {
  transform: rotate(180deg);
}

.filter-period-popover {
  position: absolute;
  z-index: 50;
  top: calc(100% + 7px);
  left: 0;
  width: min(440px, calc(100vw - 48px));
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  padding: 14px;
}

.filter-period-popover label,
.filter-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.filter-period-popover label > span,
.filter-grid label > span {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
}

.filter-period-popover select,
.filter-period-popover input[type="date"],
.filter-grid select {
  min-width: 0;
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 10px;
  outline: 0;
  font: inherit;
  font-size: 13.25px;
  font-variant-numeric: tabular-nums;
}

.filter-period-popover select:hover,
.filter-period-popover input[type="date"]:hover,
.filter-grid select:hover {
  border-color: var(--line-strong);
}

.filter-date-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}

.filter-date-separator {
  width: 16px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--faint);
}

.filter-date-separator svg {
  height: 15px;
}

.filter-period-popover input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}

.filter-toolbar-select {
  width: 150px;
  height: 48px;
  display: grid;
  align-content: center;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 5px 10px;
}

.filter-toolbar-select:focus-within,
.filter-toolbar-select:hover {
  border-color: var(--line-strong);
}

.filter-toolbar-select select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
}

.filter-toolbar-spacer {
  flex: 1;
}

.filters-toggle,
.filter-reset-button {
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 0 13px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
}

.filters-toggle:hover,
.filter-reset-button:hover,
.filter-panel.open .filters-toggle {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  color: var(--ink);
}

.filters-toggle > svg {
  width: 17px;
  height: 17px;
}

.filter-reset-button {
  width: 48px;
  padding: 0;
}

.filter-reset-button svg {
  width: 17px;
  height: 17px;
}

.filter-count {
  min-width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-size: 10.5px;
  font-weight: 750;
}

.filter-body {
  display: grid;
  gap: 9px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding: 10px 4px 2px;
}

.filter-panel:not(.open) .filter-body {
  display: none;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(148px, 1fr));
  gap: 8px;
  align-items: end;
}

.filter-grid-1 {
  grid-template-columns: minmax(180px, 1fr);
}

.filter-grid-2 {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.filter-grid-3 {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.filter-grid select {
  height: 38px;
}

.gran-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  flex-shrink: 0;
}

.gran-btn {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font-size: 12px;
  padding: 4px 9px;
  cursor: pointer;
  white-space: nowrap;
}

.gran-btn:hover {
  color: var(--ink);
}

.gran-btn.active {
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.fact-stack {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.fact-stack .fact {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 11px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.fact-stack .fact.clickable {
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.fact-stack .fact.clickable:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
}

.fact-stack .fact b {
  font-size: 17.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.fact-stack .fact span {
  color: var(--faint);
  font-size: 11.75px;
  text-align: right;
}

.ghost-button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 13px;
  cursor: pointer;
  white-space: nowrap;
}

.ghost-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--faint);
  font-size: 12.25px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 10px;
  font: inherit;
  font-size: 12.25px;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.chip .x {
  font-weight: 700;
  color: var(--faint);
}

/* ============ KPI ============ */

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

.overview-kpi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1.12fr) repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(96px, auto));
  gap: 12px;
}

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
  font: inherit;
  text-align: left;
}

button.kpi-card {
  appearance: none;
}

.kpi-card.kpi-featured {
  grid-column: span 2;
  grid-row: span 2;
  min-height: 216px;
  padding: 18px 20px 14px;
  overflow: hidden;
}

.kpi-featured .kpi-value {
  font-size: 34px;
}

.kpi-featured .kpi-foot {
  margin-top: 0;
}

.kpi-card.kpi-compact {
  min-height: 0;
  padding: 13px 15px;
  gap: 5px;
}

.kpi-compact .kpi-value {
  font-size: 22px;
}

.sparkline-chart {
  min-height: 72px;
  margin: 0 -3px;
}

.featured-chart {
  display: grid;
  gap: 3px;
  margin-top: 1px;
}

.featured-chart-legend {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.3;
}

.featured-chart-series {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 650;
}

.featured-chart-series i {
  width: 18px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--chart-revenue);
}

.featured-chart-endpoints {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--faint);
  font-size: 10.75px;
  line-height: 1.25;
}

.featured-chart-endpoints span {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.featured-chart-endpoints .end {
  text-align: right;
}

.featured-chart-endpoints small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-chart-endpoints b {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.featured-single-day {
  gap: 9px;
  margin-top: 4px;
}

.featured-single-day .featured-chart-series i,
.single-day-row.current .single-day-track i {
  background: var(--green);
}

.single-day-bars {
  display: grid;
  gap: 10px;
  padding: 7px 0 3px;
}

.single-day-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 82px minmax(80px, 1fr) 88px;
  align-items: center;
  gap: 9px;
}

.single-day-row > span {
  overflow: hidden;
  color: var(--faint);
  font-size: 10.75px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.single-day-row > b {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}

.single-day-track {
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
}

.single-day-track i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--chart-revenue);
}

.single-day-row.previous .single-day-track i {
  background: var(--bar-neutral);
}

.weekday-radar-chart {
  min-height: 400px;
}

.category-donut-chart {
  min-height: 320px;
  overflow: hidden;
}

.kpi-card.clickable {
  cursor: pointer;
  transition: border-color 0.12s;
}

.kpi-card.clickable:hover {
  border-color: var(--line-strong);
}

.kpi-card.clickable:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.kpi-label {
  color: var(--muted);
  font-size: 12.25px;
  font-weight: 600;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}

.kpi-value {
  font-size: 25px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.kpi-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--faint);
  font-size: 11.75px;
}

.kpi-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 700;
}

.kpi-cta svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.mini-bars {
  height: 28px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin: 0 -1px;
  overflow: hidden;
}

.mini-bars i {
  min-width: 2px;
  flex: 1 1 0;
  max-width: 10px;
  border-radius: 2px 2px 0 0;
  background: var(--green);
  opacity: 0.75;
}

.mini-bars.blue i {
  background: var(--blue);
}

.mini-bars.amber i {
  background: var(--amber);
}

.table-spark {
  width: 94px;
}

.table-spark .mini-bars {
  height: 25px;
  gap: 1px;
}

.table-spark .mini-bars i {
  min-width: 2px;
  max-width: 7px;
}

.performance-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.performance-stat {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 12px 15px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.performance-stat:last-child {
  border-right: 0;
}

.performance-stat:hover {
  background: var(--panel-hover);
}

.performance-stat > span {
  align-self: center;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.performance-stat > b {
  grid-row: span 2;
  align-self: center;
  color: var(--ink);
  font-size: 19px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.performance-stat > small {
  min-width: 0;
  color: var(--faint);
  font-size: 10.75px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.performance-stat.positive > b {
  color: var(--green);
}

.performance-stat.negative > b {
  color: var(--red);
}

.performance-stat.forecast > b {
  color: var(--blue);
}

.overview-primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 14px;
}

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

.overview-trend-panel {
  min-height: 430px;
}

.attention-panel {
  min-height: 430px;
}

.echart {
  width: 100%;
  min-width: 0;
}

.chart-note {
  color: var(--faint);
  font-size: 11.25px;
  line-height: 1.4;
  margin-top: 3px;
}

.signal-list {
  display: grid;
}

.signal-list button {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 2px;
  text-align: left;
  cursor: pointer;
}

.signal-list button:hover span,
.signal-list button:hover b {
  color: var(--green);
}

.signal-list button > span {
  color: var(--muted);
  font-size: 11.5px;
}

.signal-list button > b {
  grid-row: span 2;
  align-self: center;
  max-width: 180px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signal-list button > small {
  color: var(--faint);
  font-size: 10.75px;
}

.network-footprint {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 15px;
  color: var(--faint);
  font-size: 11.25px;
}

.network-footprint span {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.network-footprint b {
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

/* Светофор из ТЗ: зелёный рост, красный падение, жёлтый ±3%, серый нет данных */
.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 7px;
  padding: 2.5px 7px;
  font-size: 11.75px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.delta.up {
  background: var(--green-soft);
  color: var(--green);
}

.delta.down {
  background: var(--red-soft);
  color: var(--red);
}

.delta.flat {
  background: var(--amber-soft);
  color: var(--amber);
}

.delta.none {
  background: var(--gray-pill);
  color: var(--faint);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2.5px 9px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--gray-pill);
  color: var(--muted);
}

.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }

/* ============ Графики ============ */

.chart-box {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
}

.chart-box svg {
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend .sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}

.chart-tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--panel-soft);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 260px;
}

.chart-tip b {
  color: var(--ink);
  font-weight: 650;
}

.bar-col {
  cursor: pointer;
}

.bar-col rect.hover-zone {
  fill: transparent;
}

.bar-col:hover rect.hover-zone {
  fill: rgba(128, 128, 128, 0.08);
}

/* ============ Горизонтальные списки-бары ============ */

.bar-list {
  display: grid;
  gap: 4px;
}

.bar-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 92px;
  gap: 4px 10px;
  align-items: center;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}

.bar-row:hover {
  background: var(--panel-hover);
}

.bar-row.static {
  cursor: default;
}

.bar-rank {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bar-name {
  min-width: 0;
  font-size: 13.25px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-name small {
  color: var(--faint);
  margin-left: 6px;
}

.bar-value {
  color: var(--muted);
  font-size: 12.75px;
  font-weight: 550;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-track {
  grid-column: 2 / 4;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bar-track);
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--bar-neutral);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-fill.green { background: var(--chart-profit); }
.bar-fill.amber { background: var(--chart-line); }
.bar-fill.blue { background: var(--blue); }

.check-equation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
}

.check-equation > div {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 17px 18px;
  border-left: 3px solid var(--line-strong);
  background: var(--panel-soft);
}

.check-equation > div.result {
  border-left-color: var(--green);
}

.check-equation > div span,
.check-equation > div small {
  color: var(--faint);
  font-size: 11.5px;
}

.check-equation > div b {
  font-size: 24px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.check-equation > i {
  align-self: center;
  color: var(--faint);
  font-size: 24px;
  font-style: normal;
}

.check-insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.check-insights button {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 9px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 13px 14px;
  text-align: left;
  cursor: pointer;
}

.check-insights button:last-child {
  border-right: 0;
}

.check-insights button:hover {
  background: var(--panel-hover);
}

.check-insights b {
  font-size: 17px;
  white-space: nowrap;
}

.check-insights span {
  color: var(--faint);
  font-size: 11.5px;
}

/* ============ Таблицы ============ */

.table-wrap {
  overflow-x: auto;
  margin: 0 -6px;
}

.table-toolbar {
  display: flex;
  justify-content: flex-end;
  min-height: 30px;
  margin: -4px 0 6px;
}

.table-action {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.table-action:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.table-action svg {
  width: 15px;
  height: 15px;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.icon-action {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-action:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.icon-action.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.25px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
  user-select: none;
}

th.sortable {
  cursor: pointer;
}

th.sortable:hover {
  color: var(--muted);
}

th .arrow {
  font-size: 9px;
  margin-left: 3px;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.dim {
  color: var(--muted);
}

tbody tr {
  transition: background 0.1s;
}

tbody tr:hover {
  background: var(--panel-hover);
}

tbody tr.clickable {
  cursor: pointer;
}

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

tr.total-row td {
  border-top: 1.5px solid var(--line-strong);
  border-bottom: 0;
  font-weight: 700;
}

.cell-main {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.cell-sub {
  display: block;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.4;
  margin-top: 2px;
}

.show-more {
  margin-top: 10px;
  text-align: center;
}

.search-input {
  height: 32px;
  width: 220px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 10px;
  outline: 0;
  font-size: 13px;
}

.search-input::placeholder {
  color: var(--faint);
}

.abc-table-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.abc-filter {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 3px;
}

.abc-filter-button {
  height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--faint);
  padding: 0 8px;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  white-space: nowrap;
}

.abc-filter-button:hover {
  color: var(--ink);
}

.abc-filter-button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-weight: 700;
}

.abc-filter-button.abc-a.active {
  color: var(--green);
}

.abc-filter-button.abc-b.active {
  color: var(--amber);
}

.abc-filter-button.abc-c.active {
  color: var(--red);
}

.abc-filter-button b {
  min-width: 16px;
  color: inherit;
  font-size: 9.75px;
  font-weight: 700;
  text-align: right;
}

/* ============ Матрицы и сравнения ============ */

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

.calendar-weekdays {
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
  text-align: center;
}

.calendar-day {
  min-width: 0;
  height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  padding: 6px 7px;
  cursor: pointer;
}

.calendar-day:hover {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.calendar-day.blank {
  visibility: hidden;
}

.calendar-day span {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1;
}

.calendar-day b {
  max-width: 100%;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matrix-wrap {
  overflow: auto;
  max-height: 620px;
  margin: 0 -6px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.matrix-table {
  width: max-content;
  min-width: 100%;
}

.matrix-table th,
.matrix-table td {
  height: 40px;
  min-width: 92px;
  border-right: 1px solid var(--line);
}

.matrix-table th:first-child,
.matrix-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 210px;
  max-width: 260px;
  background: var(--panel);
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--panel);
}

.matrix-table thead th:first-child {
  z-index: 4;
}

.heat-cell {
  cursor: pointer;
  transition: box-shadow 0.12s;
}

.heat-cell:hover {
  box-shadow: inset 0 0 0 2px var(--green);
}

.cell-link {
  max-width: 240px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-link:hover {
  color: var(--green);
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.toggle-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.score-cell {
  display: inline-grid;
  min-width: 42px;
  height: 26px;
  place-items: center;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 750;
}

/* ============ Академия ============ */

.subnav {
  display: flex;
  gap: 4px;
  padding-bottom: 2px;
  overflow-x: auto;
}

.subnav-button {
  height: 36px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.subnav-button:hover {
  color: var(--ink);
  background: var(--panel-hover);
}

.subnav-button.active {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.check-list {
  display: grid;
}

.check-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

.check-item > span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
}

.check-item.done > span {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.check-item b,
.check-item small {
  display: block;
}

.check-item b {
  font-size: 13.5px;
}

.check-item small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 11.75px;
}

.academy-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 14px;
}

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

.program-card {
  min-width: 0;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.program-card:hover {
  border-color: var(--green);
  background: var(--panel-hover);
}

.program-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.program-index {
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.program-card strong {
  font-size: 15px;
  line-height: 1.35;
}

.program-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11.75px;
  line-height: 1.5;
}

.program-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: auto;
  color: var(--faint);
  font-size: 10.5px;
}

.academy-actions {
  display: flex;
  flex-direction: column;
}

.academy-actions > button {
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 2px;
  text-align: left;
  cursor: pointer;
}

.academy-actions > button:hover span {
  color: var(--green);
}

.academy-actions > button span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.academy-actions > button b {
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
}

.academy-mode {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  margin-top: auto;
  padding-top: 14px;
}

.academy-mode .dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.academy-mode b,
.academy-mode small {
  display: block;
}

.academy-mode b {
  font-size: 12px;
}

.academy-mode small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10.75px;
  line-height: 1.4;
}

.module-list,
.spec-list,
.benchmark-list {
  display: grid;
}

.module-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.module-row > span {
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.module-row b,
.module-row small {
  display: block;
}

.module-row b {
  font-size: 13px;
}

.module-row small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 10.75px;
  line-height: 1.5;
}

.module-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.spec-list > div,
.benchmark-list > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.spec-list span,
.benchmark-list span {
  color: var(--muted);
  font-size: 11.75px;
}

.spec-list b,
.benchmark-list b {
  min-width: 0;
  max-width: 260px;
  font-size: 12.5px;
  text-align: right;
}

.benchmark-list small {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 10.75px;
  text-align: right;
}

.primary-button {
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--ink);
  color: var(--bg);
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover {
  opacity: 0.86;
}

.spec-list + .primary-button {
  width: 100%;
  margin-top: 14px;
}

.assignment-form {
  display: grid;
  gap: 12px;
}

.assignment-form label {
  display: grid;
  gap: 5px;
}

.assignment-form label > span {
  color: var(--faint);
  font-size: 10.75px;
  font-weight: 650;
  text-transform: uppercase;
}

.assignment-form select,
.assignment-form input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 10px;
}

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

.knowledge-item {
  min-width: 0;
  min-height: 145px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 13px 14px;
}

.knowledge-item > span {
  color: var(--blue);
  font-size: 10.75px;
  font-weight: 700;
  text-transform: uppercase;
}

.knowledge-item strong {
  font-size: 13.5px;
  line-height: 1.4;
}

.knowledge-item div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.knowledge-item small {
  border-radius: 6px;
  background: var(--gray-pill);
  color: var(--muted);
  padding: 2px 6px;
  font-size: 9.75px;
}

.knowledge-item em {
  margin-top: auto;
  color: var(--faint);
  font-size: 9.75px;
  font-style: normal;
}

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

.progress-cell > span {
  height: 7px;
  flex: 1;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bar-track);
}

.progress-cell i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.progress-cell b {
  min-width: 34px;
  color: var(--muted);
  font-size: 10.75px;
  text-align: right;
}

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

.integration-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 13px 14px;
}

.integration-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.integration-item strong {
  font-size: 13px;
}

.integration-item p {
  margin: 9px 0 0;
  color: var(--faint);
  font-size: 10.75px;
  line-height: 1.45;
}

/* ============ Разное ============ */

.drill-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 13px 16px;
}

.drill-hero.compact {
  padding-block: 11px;
}

.drill-hero h2 {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0;
}

.drill-hero .hero-sub {
  color: var(--faint);
  font-size: 12.25px;
  margin-top: 2px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.back-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.empty-state {
  min-height: 180px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 22px 24px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 13px;
  line-height: 1.55;
}

.empty-state strong {
  color: var(--ink);
  font-size: 15px;
}

.stub-page {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 34px 36px;
  max-width: 760px;
}

.stub-page h2 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 750;
}

.stub-page p {
  color: var(--muted);
  line-height: 1.6;
  margin: 8px 0;
}

.stub-facts {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stub-facts .fact {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px 14px;
}

.stub-facts .fact b {
  display: block;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.stub-facts .fact span {
  color: var(--faint);
  font-size: 11.5px;
}

.note-line {
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.5;
  margin-top: 10px;
}

.insight-list {
  display: grid;
  gap: 10px;
}

.insight {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.insight b {
  color: var(--ink);
}

/* ============ Скелетоны и ошибки ============ */

.skeleton-grid {
  display: grid;
  gap: 14px;
}

.sk {
  border-radius: 8px;
  background: linear-gradient(100deg, var(--panel) 40%, var(--panel-soft) 50%, var(--panel) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border: 1px solid var(--line);
}

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

.sk-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.error-state {
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--red);
  text-align: center;
}

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

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
    /* шапка — по контенту, всё свободное место — контенту,
       иначе на коротких страницах grid растягивает шапку */
    grid-template-rows: auto 1fr;
    align-content: start;
  }

  /* Сайдбар превращается в компактную шапку: бренд + тема,
     разделы — горизонтальная скролл-лента чипов */
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
  }

  .brand {
    padding: 0;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 12px;
  }

  .brand-subtitle {
    display: none;
  }

  .nav {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-label {
    display: none;
  }

  .nav-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: auto;
    flex-shrink: 0;
    min-height: 38px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-soft);
  }

  .nav-button.active,
  :root[data-theme="light"] .nav-button.active,
  :root[data-theme="dark"] .nav-button.active {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
    box-shadow: none;
  }

  .nav-button svg {
    width: 15px;
    height: 15px;
  }

  .nav-note {
    display: none;
  }

  .nav-title {
    font-size: 12.5px;
  }

  .sidebar-bottom {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    grid-row: 1;
    grid-column: 2;
  }

  .sidebar-status {
    display: none;
  }

  .theme-switch {
    padding: 2px;
  }

  .theme-switch button {
    padding: 5px 10px;
  }

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

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

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

  .overview-bottom-grid .category-chart-panel {
    grid-column: 1 / -1;
  }

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

  .topbar-data-meta {
    display: none;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 14px 12px 34px;
  }

  .topbar {
    margin-bottom: 12px;
  }

  .weekday-radar-chart {
    height: 330px !important;
    min-height: 330px;
  }

  .category-donut-chart {
    height: 300px !important;
    min-height: 300px;
  }

  h1 {
    font-size: 21px;
  }

  .content {
    gap: 11px;
  }

  /* Фильтры сворачиваются в одну строку-кнопку */
  .filter-panel {
    padding: 7px;
  }

  .filter-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .filter-period-menu {
    min-width: 210px;
    flex: 1 1 230px;
  }

  .filter-toolbar-select {
    width: 120px;
  }

  .filter-toolbar-spacer {
    display: none;
  }

  .filters-toggle {
    margin-left: auto;
  }

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

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

  .filter-grid select {
    height: 40px; /* тач-таргет */
  }

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

  .overview-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    gap: 9px;
  }

  .kpi-card.kpi-featured {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 198px;
  }

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

  .performance-stat:nth-child(2) {
    border-right: 0;
  }

  .performance-stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

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

  .overview-bottom-grid .category-chart-panel {
    grid-column: auto;
  }

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

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

  .check-equation {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .check-equation > i {
    justify-self: center;
    font-size: 18px;
  }

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

  .check-insights button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .check-insights button:last-child {
    border-bottom: 0;
  }

  .kpi-card {
    min-height: 0;
    padding: 12px 13px;
    gap: 6px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .kpi-featured .kpi-value {
    font-size: 29px;
  }

  .kpi-label {
    font-size: 11.5px;
  }

  .panel {
    padding: 13px 14px;
    border-radius: 8px;
  }

  .overview-trend-panel,
  .attention-panel {
    min-height: 0;
  }

  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .matrix-wrap {
    max-height: 520px;
  }

  .matrix-table th:first-child,
  .matrix-table td:first-child {
    min-width: 160px;
    max-width: 190px;
  }

  .table-toolbar {
    margin-top: 0;
  }

  table {
    font-size: 12.5px;
  }

  th,
  td {
    padding: 7px 7px;
  }

  .cell-main {
    max-width: 210px;
  }

  .bar-row {
    grid-template-columns: 18px minmax(0, 1fr) 86px;
    padding: 7px 6px;
    margin: 0 -6px;
  }

  .drill-hero {
    flex-wrap: wrap;
    padding: 12px 13px;
  }

  .drill-hero h2 {
    font-size: 18px;
  }

  .stub-page {
    padding: 22px 18px;
  }

  .stub-facts {
    grid-template-columns: 1fr;
  }

  .search-input {
    width: 100%;
  }

  .abc-table-controls {
    width: 100%;
    justify-content: space-between;
  }

  .abc-table-controls .search-input {
    min-width: 180px;
    flex: 1;
  }

  .show-more .ghost-button {
    width: 100%;
    height: 40px;
  }
}

@media (max-width: 440px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-period-menu {
    flex-basis: 100%;
    width: 100%;
  }

  .filter-toolbar-select {
    width: auto;
    flex: 1;
  }

  .filters-toggle {
    flex: 1;
    margin-left: 0;
  }

  .filter-period-popover {
    width: calc(100vw - 40px);
  }

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

  .filter-date-range {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-date-separator {
    display: none;
  }

  .kpi-value {
    font-size: 18px;
  }

  .performance-stat {
    padding: 10px 11px;
  }

  .performance-stat > b {
    font-size: 16px;
  }

  .network-footprint {
    gap: 7px 10px;
  }

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

  .calendar-weekdays,
  .calendar-grid {
    gap: 3px;
  }

  .calendar-day {
    height: 46px;
    padding: 5px;
  }

  .calendar-day b {
    font-size: 9.5px;
  }

  .chart-legend {
    gap: 8px;
    font-size: 11px;
  }
}
  .abc-filter {
    width: 100%;
  }

  .abc-filter-button {
    flex: 1;
    justify-content: center;
  }
  .single-day-row {
    grid-template-columns: 70px minmax(54px, 1fr) 74px;
    gap: 6px;
  }

  .single-day-row > b {
    font-size: 10.5px;
  }

/* ============ Кастомные фильтры ============ */

body.filter-drawer-open {
  overflow: hidden;
}

.filter-period-control,
.custom-filter-select {
  position: relative;
  min-width: 0;
}

.filter-period-control {
  width: 238px;
  flex: 0 0 238px;
}

.custom-filter-select.compact {
  width: 150px;
  flex: 0 0 150px;
}

.filter-period-trigger,
.custom-select-trigger {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 0 11px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.filter-period-trigger:hover,
.filter-period-control.open .filter-period-trigger,
.custom-select-trigger:hover,
.custom-filter-select.open .custom-select-trigger {
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.custom-select-copy {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 1px;
}

.custom-select-copy small {
  color: var(--faint);
  font-size: 9.75px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.custom-select-copy b {
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-caret,
.filters-arrow {
  width: 15px;
  height: 15px;
  color: var(--faint);
  flex: 0 0 15px;
  transition: transform 0.18s ease;
}

.custom-select-caret svg,
.filters-arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.custom-filter-select.open .custom-select-caret,
.filter-period-control.open .filter-toolbar-caret {
  transform: rotate(180deg);
}

.custom-select-menu,
.period-menu-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  left: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-5px);
  transition:
    opacity 0.14s ease,
    transform 0.14s ease,
    visibility 0.14s;
}

.custom-select-menu {
  width: max(100%, 248px);
  padding: 7px;
}

.period-menu-popover {
  width: 352px;
  padding: 13px;
}

.custom-filter-select.open > .custom-select-menu,
.filter-period-control.open > .period-menu-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.custom-select-search {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 0 10px;
  margin-bottom: 6px;
  color: var(--faint);
}

.custom-select-search:focus-within {
  border-color: var(--line-strong);
  color: var(--ink);
}

.custom-select-search svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.custom-select-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.custom-select-search input::placeholder {
  color: var(--faint);
}

.custom-select-options {
  max-height: 286px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.custom-select-option {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 8px 9px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.custom-select-option:hover {
  background: var(--panel-hover);
  color: var(--ink);
}

.custom-select-option.active {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 650;
}

.custom-select-option svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  opacity: 0;
}

.custom-select-option.active svg {
  opacity: 1;
}

.custom-select-empty {
  color: var(--faint);
  padding: 16px 9px;
  text-align: center;
  font-size: 12.5px;
}

.period-menu-header,
.filter-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.period-menu-header > div {
  display: grid;
  gap: 2px;
}

.period-menu-header b {
  color: var(--ink);
  font-size: 14px;
}

.period-menu-header span {
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.35;
}

.icon-action {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 0;
  cursor: pointer;
}

.icon-action:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  color: var(--ink);
}

.icon-action svg {
  width: 16px;
  height: 16px;
}

.period-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 12px;
}

.period-quick-grid button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 5px 7px;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
}

.period-quick-grid button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.period-quick-grid button.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.period-calendar-label {
  color: var(--faint);
  margin: 13px 0 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.period-range-source {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.period-menu-popover .flatpickr-calendar.inline {
  width: 100%;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.period-menu-popover .flatpickr-rContainer,
.period-menu-popover .flatpickr-days,
.period-menu-popover .dayContainer {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
}

.period-menu-popover .flatpickr-months {
  margin-bottom: 4px;
}

.period-menu-popover .flatpickr-months .flatpickr-month,
.period-menu-popover .flatpickr-current-month,
.period-menu-popover .flatpickr-weekdays {
  background: transparent;
  color: var(--ink);
  fill: var(--ink);
}

.period-menu-popover .flatpickr-current-month {
  font-size: 13px;
  padding-top: 6px;
}

.period-menu-popover .flatpickr-current-month .flatpickr-monthDropdown-months,
.period-menu-popover .flatpickr-current-month input.cur-year {
  color: var(--ink);
  font: inherit;
  font-weight: 650;
}

.period-menu-popover .flatpickr-weekday {
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
}

.period-menu-popover .flatpickr-day {
  max-width: none;
  height: 37px;
  line-height: 37px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 11.5px;
}

.period-menu-popover .flatpickr-day:hover,
.period-menu-popover .flatpickr-day:focus {
  border-color: var(--line);
  background: var(--panel-hover);
  color: var(--ink);
}

.period-menu-popover .flatpickr-day.today {
  border-color: var(--line-strong);
}

.period-menu-popover .flatpickr-day.prevMonthDay,
.period-menu-popover .flatpickr-day.nextMonthDay,
.period-menu-popover .flatpickr-day.flatpickr-disabled {
  color: var(--line-strong);
}

.period-menu-popover .flatpickr-day.inRange {
  border-color: transparent;
  background: var(--green-soft);
  box-shadow: -5px 0 0 var(--green-soft), 5px 0 0 var(--green-soft);
  color: var(--green);
}

.period-menu-popover .flatpickr-day.selected,
.period-menu-popover .flatpickr-day.startRange,
.period-menu-popover .flatpickr-day.endRange {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.period-menu-popover .flatpickr-prev-month,
.period-menu-popover .flatpickr-next-month {
  color: var(--muted);
  fill: var(--muted);
}

.period-menu-popover .flatpickr-prev-month:hover svg,
.period-menu-popover .flatpickr-next-month:hover svg {
  fill: var(--ink);
}

.filter-drawer-backdrop {
  position: fixed;
  z-index: 990;
  inset: 0;
  border: 0;
  background: rgba(18, 20, 24, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  cursor: default;
  transition:
    opacity 0.2s ease,
    visibility 0.2s;
}

.filter-drawer {
  position: fixed;
  z-index: 1000;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -18px 0 54px rgba(0, 0, 0, 0.2);
  transform: translateX(102%);
  transition: transform 0.24s ease;
}

.filter-panel.open .filter-drawer-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.filter-panel.open .filter-drawer {
  transform: translateX(0);
}

.filter-drawer-header {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  padding: 15px 18px;
}

.filter-drawer-header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.filter-drawer-header > div > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
}

.filter-drawer-header > div > span svg {
  width: 18px;
  height: 18px;
}

.filter-drawer-header > div > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.filter-drawer-header b {
  color: var(--ink);
  font-size: 16px;
}

.filter-drawer-header small {
  overflow: hidden;
  color: var(--faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-drawer-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
}

.drawer-active-filters {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.drawer-active-filters > span {
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.drawer-filter-fields .custom-filter-select {
  width: 100%;
}

.drawer-filter-fields .custom-select-trigger {
  height: 54px;
  background: var(--panel-soft);
}

.drawer-filter-fields .custom-select-menu {
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  border-color: transparent;
  box-shadow: none;
  transform: none;
  transition:
    max-height 0.2s ease,
    opacity 0.14s ease,
    margin 0.2s ease,
    padding 0.2s ease,
    border-color 0.2s ease,
    visibility 0.14s;
}

.drawer-filter-fields .custom-filter-select.open > .custom-select-menu {
  max-height: 348px;
  overflow: visible;
  border-color: var(--line);
  padding: 7px;
  margin-top: 6px;
}

.drawer-filter-fields .custom-select-options {
  max-height: 282px;
}

.filter-drawer-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
}

.drawer-reset,
.drawer-done {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.drawer-reset {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
}

.drawer-reset:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--ink);
}

.drawer-reset:disabled {
  cursor: default;
  opacity: 0.42;
}

.drawer-done {
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
}

.drawer-done:hover {
  filter: brightness(1.05);
}

.drawer-reset svg,
.drawer-done svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 680px) {
  .filter-panel {
    padding: 6px;
  }

  .filter-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .filter-period-control {
    width: auto;
    flex: 1 1 190px;
  }

  .custom-filter-select.compact {
    width: auto;
    flex: 1 1 120px;
  }

  .filter-toolbar-spacer {
    display: none;
  }

  .filters-toggle {
    flex: 1 1 auto;
  }

  .filter-reset-button {
    flex: 0 0 48px;
  }

  .period-menu-popover {
    position: fixed;
    z-index: 1010;
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .filter-drawer {
    width: 100vw;
    border-left: 0;
  }
}

@media (max-width: 420px) {
  .filter-period-control {
    flex-basis: 100%;
  }

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

  .filter-drawer-content {
    padding: 14px;
  }

  .filter-drawer-header,
  .filter-drawer-footer {
    padding-right: 14px;
    padding-left: 14px;
  }
}

/* ============ Состав категорий ============ */

body.category-breakdown-open {
  overflow: hidden;
}

.category-all-action {
  flex: 0 0 auto;
}

.category-breakdown-backdrop {
  position: fixed;
  z-index: 990;
  inset: 0;
  border: 0;
  background: rgba(18, 20, 24, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s;
}

.category-breakdown-drawer {
  position: fixed;
  z-index: 1000;
  top: 0;
  right: 0;
  width: min(480px, 100vw);
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -18px 0 54px rgba(0, 0, 0, 0.2);
  transform: translateX(102%);
  transition: transform 0.24s ease;
}

body.category-breakdown-open .category-breakdown-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.category-breakdown-open .category-breakdown-drawer {
  transform: translateX(0);
}

.category-breakdown-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 15px 18px;
}

.category-breakdown-header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.category-breakdown-header > div > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
}

.category-breakdown-header > div > span svg {
  width: 19px;
  height: 19px;
}

.category-breakdown-header > div > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.category-breakdown-header b {
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-breakdown-header small {
  color: var(--faint);
  font-size: 11.5px;
}

.category-breakdown-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.category-breakdown-summary > div {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
}

.category-breakdown-summary > div:first-child {
  border-right: 1px solid var(--line);
}

.category-breakdown-summary span {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
}

.category-breakdown-summary b {
  color: var(--ink);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.category-breakdown-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}

.category-breakdown-search {
  min-width: 0;
  height: 40px;
  display: flex;
  align-items: center;
  flex: 1;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--faint);
  padding: 0 11px;
}

.category-breakdown-search:focus-within {
  border-color: var(--line-strong);
  color: var(--ink);
}

.category-breakdown-search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.category-breakdown-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.category-breakdown-search input::placeholder {
  color: var(--faint);
}

.category-show-all {
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 0 11px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
}

.category-show-all:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.category-breakdown-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 7px 18px 18px;
}

.category-breakdown-row {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 9px 4px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.category-breakdown-row:hover {
  background: var(--panel-hover);
  color: var(--ink);
}

.category-breakdown-rank {
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.category-breakdown-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.category-breakdown-copy > b {
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-breakdown-copy > span {
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--panel-soft);
}

.category-breakdown-copy i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.category-breakdown-value {
  display: grid;
  gap: 2px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.category-breakdown-value b {
  color: var(--ink);
  font-size: 12.5px;
  white-space: nowrap;
}

.category-breakdown-value small {
  color: var(--faint);
  font-size: 10.5px;
}

.category-breakdown-row > svg {
  width: 16px;
  height: 16px;
  color: var(--faint);
}

.category-breakdown-empty {
  color: var(--faint);
  padding: 28px 8px;
  text-align: center;
  font-size: 12.5px;
}

@media (max-width: 520px) {
  .category-breakdown-drawer {
    width: 100vw;
    border-left: 0;
  }

  .category-breakdown-header,
  .category-breakdown-tools,
  .category-breakdown-list {
    padding-right: 14px;
    padding-left: 14px;
  }

  .category-breakdown-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .category-show-all {
    width: 100%;
  }

  .category-breakdown-row {
    grid-template-columns: 20px minmax(0, 1fr) auto 16px;
    gap: 7px;
  }
}

/* ============ Пользователи, роли и доступ ============ */

.access-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  margin-bottom: 12px;
}

.access-overview > div {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.access-overview > div:last-child {
  border-right: 0;
}

.access-overview span,
.access-overview b,
.access-overview small {
  display: block;
}

.access-overview > div > span {
  color: var(--faint);
  font-size: 11px;
}

.access-overview > div > b {
  margin-top: 6px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.access-overview > div > small {
  margin-top: 6px;
  overflow: hidden;
  color: var(--faint);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-mode-badge {
  display: inline-flex !important;
  align-items: center;
  width: max-content;
  gap: 6px;
  min-height: 25px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted) !important;
  margin-top: 6px;
  padding: 0 8px;
  font-size: 11px !important;
  font-weight: 700;
}

.access-mode-badge > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.access-mode-badge.live > span {
  background: var(--green);
}

.access-notice {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--green) 28%, var(--line));
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--ink);
  margin-bottom: 12px;
  padding: 8px 10px 8px 12px;
  font-size: 12px;
}

.access-notice > svg {
  width: 16px;
  height: 16px;
  color: var(--green);
}

.access-notice > span {
  min-width: 0;
  overflow: hidden;
  flex: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-notice button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.access-notice button svg {
  width: 15px;
  height: 15px;
}

.access-workspace {
  padding: 0;
  overflow: hidden;
}

.access-workspace-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px 0 10px;
}

.access-workspace-head > span {
  color: var(--faint);
  font-size: 11px;
  white-space: nowrap;
}

.access-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
}

.access-tabs button {
  height: 51px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 650;
}

.access-tabs button:hover {
  color: var(--ink);
}

.access-tabs button.active {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

.access-tabs button b {
  min-width: 20px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--faint);
  padding: 0 5px;
  font-size: 10px;
}

.access-tabs button.active b {
  background: var(--ink);
  color: var(--bg);
}

.access-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

.access-search {
  width: min(360px, 100%);
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 0 10px;
}

.access-search svg {
  width: 15px;
  height: 15px;
  color: var(--faint);
  flex-shrink: 0;
}

.access-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.access-toolbar-actions {
  display: flex;
  gap: 7px;
}

.access-toolbar-actions .primary-button,
.access-toolbar-actions .secondary-button,
.access-editor-actions .primary-button,
.access-editor-actions .secondary-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 7px;
  padding: 0 12px;
  font-size: 11.5px;
}

.access-toolbar-actions svg,
.access-editor-actions svg {
  width: 15px;
  height: 15px;
}

.access-list,
.access-role-list {
  display: grid;
}

.access-user-row,
.access-partner-row,
.access-role-row {
  min-width: 0;
  min-height: 67px;
  display: grid;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
}

.access-user-row {
  grid-template-columns: 36px minmax(150px, 1.3fr) minmax(130px, 0.9fr) minmax(150px, 1fr) 78px 18px;
}

.access-partner-row {
  grid-template-columns: 36px minmax(190px, 1.2fr) minmax(210px, 1.3fr) 105px 18px;
}

.access-role-row {
  grid-template-columns: 38px minmax(220px, 1.5fr) 55px 55px minmax(145px, 0.8fr) 18px;
}

.access-user-row:last-child,
.access-partner-row:last-child,
.access-role-row:last-child {
  border-bottom: 0;
}

.access-user-row:hover,
.access-partner-row:hover,
.access-role-row:hover {
  background: var(--panel-hover);
}

.access-user-row.disabled {
  opacity: 0.58;
}

.access-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.access-avatar.partner {
  background: var(--blue-soft);
  color: var(--blue);
}

.access-avatar.small {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 9px;
}

.access-user-main,
.access-scope,
.access-location-stack,
.access-role-copy {
  min-width: 0;
}

.access-user-main strong,
.access-user-main small,
.access-scope b,
.access-scope small,
.access-location-stack b,
.access-location-stack small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-user-main strong,
.access-scope b,
.access-location-stack b {
  font-size: 12px;
}

.access-user-main small,
.access-scope small,
.access-location-stack small {
  color: var(--faint);
  margin-top: 3px;
  font-size: 10.5px;
}

.access-role-chip,
.access-scope-mode,
.access-status {
  width: max-content;
  max-width: 100%;
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 0 8px;
  font-size: 10.5px;
  font-weight: 650;
}

.access-status {
  justify-self: end;
}

.access-status.active {
  background: var(--green-soft);
  color: var(--green);
}

.access-row-arrow {
  display: grid;
  place-items: center;
  color: var(--faint);
}

.access-row-arrow svg {
  width: 16px;
  height: 16px;
}

.access-role-icon,
.access-editor-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
}

.access-role-icon svg,
.access-editor-icon svg {
  width: 18px;
  height: 18px;
}

.access-role-copy > span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.access-role-copy strong {
  overflow: hidden;
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-role-copy em {
  min-height: 19px;
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--faint);
  padding: 0 6px;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.access-role-copy em.custom {
  background: var(--blue-soft);
  color: var(--blue);
}

.access-role-copy > small {
  display: block;
  overflow: hidden;
  color: var(--faint);
  margin-top: 3px;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-role-metric {
  text-align: right;
}

.access-role-metric b,
.access-role-metric small {
  display: block;
}

.access-role-metric b {
  font-size: 14px;
}

.access-role-metric small {
  color: var(--faint);
  font-size: 9.5px;
}

.access-partner-summary {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 9px 14px;
  color: var(--faint);
  font-size: 10.5px;
}

.access-partner-summary b {
  color: var(--ink);
  margin-right: 4px;
  font-size: 11.5px;
}

.access-empty-filter {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--faint);
  text-align: center;
}

.access-empty-filter[hidden] {
  display: none;
}

.access-empty-filter strong,
.access-empty-filter span {
  display: block;
}

.access-empty-filter strong {
  color: var(--ink);
  font-size: 13px;
}

.access-empty-filter span {
  margin-top: -64px;
  font-size: 11px;
}

.access-loading {
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.access-loading > span {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: access-spin 0.75s linear infinite;
}

@keyframes access-spin {
  to { transform: rotate(360deg); }
}

.access-drawer-backdrop {
  position: fixed;
  z-index: 119;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(2px);
}

.access-drawer {
  position: fixed;
  z-index: 120;
  top: 0;
  right: 0;
  width: min(590px, 100vw);
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -20px 0 48px rgba(0, 0, 0, 0.18);
}

.access-drawer-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
}

.access-drawer-close:hover {
  background: var(--panel-hover);
  color: var(--ink);
}

.access-drawer-close svg {
  width: 16px;
  height: 16px;
}

.access-editor-form {
  min-height: 100%;
  padding: 18px 18px 84px;
}

.access-editor-heading {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding-right: 48px;
}

.access-editor-heading small,
.access-editor-heading h2 {
  display: block;
}

.access-editor-heading small {
  color: var(--faint);
  font-size: 10px;
  text-transform: uppercase;
}

.access-editor-heading h2 {
  margin: 3px 0 0;
  font-size: 19px;
  line-height: 1.25;
}

.access-form-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.access-form-section h3 {
  margin: 0 0 10px;
  font-size: 12.5px;
}

.access-form-section > p {
  color: var(--faint);
  margin: -3px 0 10px;
  font-size: 10.5px;
  line-height: 1.45;
}

.access-editor-form label > span:first-child:not(:only-child),
.access-editor-form > label > span:first-child {
  display: block;
  color: var(--faint);
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 650;
}

.access-editor-form input[type="text"],
.access-editor-form input[type="email"],
.access-editor-form input[type="password"],
.access-editor-form input:not([type]),
.access-editor-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 9px 10px;
  font-size: 12px;
}

.access-editor-form input {
  min-height: 38px;
}

.access-editor-form input:focus,
.access-editor-form textarea:focus {
  border-color: var(--focus);
}

.access-editor-form input[readonly] {
  color: var(--faint);
}

.password-input-wrap {
  position: relative;
  display: block;
}

.access-editor-form .password-input-wrap > input {
  padding-right: 46px;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transform: translateY(-50%);
}

.password-visibility-toggle:hover {
  background: var(--panel);
  color: var(--ink);
}

.password-visibility-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.password-visibility-toggle svg {
  width: 18px;
  height: 18px;
}

.access-editor-form textarea {
  resize: vertical;
}

.access-editor-form label + label {
  display: block;
  margin-top: 10px;
}

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

.access-field-grid label + label {
  margin-top: 0;
}

.access-choice-grid,
.access-store-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.access-choice,
.access-check-card {
  margin: 0 !important;
  cursor: pointer;
}

.access-choice > input,
.access-check-card > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.access-choice > span,
.access-check-card > span {
  min-height: 54px;
  display: flex !important;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink) !important;
  margin: 0 !important;
  padding: 8px 9px;
}

.access-choice > span > svg,
.access-check-card > span > svg {
  width: 17px;
  height: 17px;
  color: var(--faint);
  flex-shrink: 0;
}

.access-choice b,
.access-choice small,
.access-check-card b,
.access-check-card small {
  display: block;
}

.access-choice b,
.access-check-card b {
  font-size: 10.5px;
}

.access-choice small,
.access-check-card small {
  overflow: hidden;
  color: var(--faint);
  margin-top: 2px;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-choice input:checked + span,
.access-check-card input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
}

.access-choice input:checked + span > svg,
.access-check-card input:checked + span > svg {
  color: var(--green);
}

.access-scope-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.access-scope-choices label {
  margin: 0 !important;
  cursor: pointer;
}

.access-scope-choices input {
  position: absolute;
  opacity: 0;
}

.access-scope-choices label > span {
  min-height: 58px;
  display: grid !important;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink) !important;
  margin: 0 !important;
  padding: 8px 10px;
}

.access-scope-choices b,
.access-scope-choices small {
  display: block;
}

.access-scope-choices b {
  font-size: 10.5px;
}

.access-scope-choices small {
  color: var(--faint);
  margin-top: 3px;
  font-size: 9px;
}

.access-scope-choices input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
}

.access-info-banner {
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--muted);
  margin-top: 15px;
  padding: 10px 11px;
  font-size: 10.5px;
  line-height: 1.45;
}

.access-permission-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.access-permission-title > span {
  color: var(--faint);
  font-size: 10px;
}

.access-permission-title b {
  color: var(--ink);
}

.access-permission-groups {
  display: grid;
  gap: 8px;
}

.access-permission-groups fieldset {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  margin: 0;
  padding: 0 10px 6px;
}

.access-permission-groups legend {
  width: calc(100% + 2px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  padding: 9px 0 7px;
  font-size: 11px;
  font-weight: 750;
}

.access-permission-groups legend small {
  color: var(--faint);
  font-size: 9.5px;
}

.access-permission-groups label {
  min-height: 43px;
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  margin: 0 !important;
  cursor: pointer;
}

.access-permission-groups input {
  width: 15px;
  height: 15px;
  min-height: 0;
  accent-color: var(--green);
}

.access-permission-groups label > span {
  margin: 0 !important;
}

.access-permission-groups b,
.access-permission-groups small {
  display: block;
}

.access-permission-groups b {
  font-size: 10.5px;
}

.access-permission-groups small {
  color: var(--faint);
  margin-top: 2px;
  font-size: 9px;
}

.access-active-toggle {
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  margin-top: 18px !important;
  padding: 10px;
}

.access-active-toggle input {
  width: 16px;
  height: 16px;
  min-height: 0;
  accent-color: var(--green);
}

.access-active-toggle > span {
  color: var(--ink) !important;
  margin: 0 !important;
}

.access-active-toggle b,
.access-active-toggle small {
  display: block;
}

.access-active-toggle b {
  font-size: 10.5px;
}

.access-active-toggle small {
  color: var(--faint);
  margin-top: 2px;
  font-size: 9px;
}

.access-editor-actions {
  position: fixed;
  z-index: 3;
  right: 0;
  bottom: 0;
  width: min(590px, 100vw);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 18px;
}

.access-editor-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.access-form-error {
  border: 1px solid color-mix(in srgb, var(--red) 35%, var(--line));
  border-radius: 7px;
  background: var(--red-soft);
  color: var(--red);
  margin-top: 14px;
  padding: 9px 10px;
  font-size: 10.5px;
}

.access-form-error:empty {
  display: none;
}

.access-partner-scope-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  margin-top: 18px;
  padding: 12px;
}

.access-partner-scope-preview > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.access-partner-scope-preview > div b {
  font-size: 22px;
}

.access-partner-scope-preview > div span {
  color: var(--faint);
  font-size: 10.5px;
}

.access-partner-scope-preview ul {
  display: grid;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
  margin: 11px 0 0;
  padding: 0;
  list-style: none;
}

.access-partner-scope-preview li {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10.5px;
}

.access-partner-scope-preview li svg {
  width: 14px;
  height: 14px;
  color: var(--green);
}

.access-linked-users {
  display: grid;
  gap: 6px;
}

.access-linked-users > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 7px;
}

.access-linked-users b,
.access-linked-users small {
  display: block;
}

.access-linked-users b {
  font-size: 10.5px;
}

.access-linked-users small {
  color: var(--faint);
  margin-top: 2px;
  font-size: 9px;
}

.access-form-divider {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  margin: 18px 0 0;
  font-size: 9.5px;
}

.access-form-divider::before,
.access-form-divider::after {
  height: 1px;
  background: var(--line);
  content: "";
  flex: 1;
}

.access-inline-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--faint);
  padding: 14px;
  text-align: center;
  font-size: 10.5px;
}

@media (max-width: 980px) {
  .access-overview {
    grid-template-columns: 1fr 1fr;
  }

  .access-overview > div:nth-child(2) {
    border-right: 0;
  }

  .access-overview > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .access-user-row {
    grid-template-columns: 36px minmax(150px, 1fr) minmax(130px, 0.8fr) 78px 18px;
  }

  .access-user-row .access-scope {
    display: none;
  }

  .access-role-row {
    grid-template-columns: 38px minmax(190px, 1fr) 55px 55px 18px;
  }

  .access-role-row .access-scope-mode {
    display: none;
  }
}

@media (max-width: 700px) {
  .access-workspace-head {
    align-items: stretch;
    flex-direction: column;
    gap: 0;
    padding: 0 8px;
  }

  .access-workspace-head > span {
    display: none;
  }

  .access-tabs {
    overflow-x: auto;
  }

  .access-tabs button {
    flex: 1;
  }

  .access-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .access-search {
    width: 100%;
  }

  .access-toolbar-actions {
    width: 100%;
  }

  .access-toolbar-actions button {
    flex: 1;
  }

  .access-user-row,
  .access-partner-row,
  .access-role-row {
    min-height: 72px;
    gap: 9px;
    padding: 9px 10px;
  }

  .access-user-row {
    grid-template-columns: 34px minmax(0, 1fr) 18px;
  }

  .access-user-row .access-role-chip,
  .access-user-row .access-scope,
  .access-user-row .access-status {
    display: none;
  }

  .access-partner-row {
    grid-template-columns: 34px minmax(0, 1fr) auto 18px;
  }

  .access-partner-row .access-location-stack small {
    display: none;
  }

  .access-role-row {
    grid-template-columns: 34px minmax(0, 1fr) 44px 18px;
  }

  .access-role-row .access-role-metric:nth-of-type(2),
  .access-role-row .access-scope-mode {
    display: none;
  }

  .access-partner-summary {
    overflow-x: auto;
    white-space: nowrap;
  }

  .access-drawer {
    width: 100vw;
    border-left: 0;
  }

  .access-editor-actions {
    width: 100vw;
  }

  .access-field-grid,
  .access-choice-grid,
  .access-store-grid,
  .access-scope-choices {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 440px) {
  .access-overview {
    grid-template-columns: 1fr;
  }

  .access-overview > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .access-overview > div:last-child {
    border-bottom: 0;
  }

  .access-tabs button {
    padding: 0 8px;
    font-size: 11px;
  }

  .access-toolbar-actions .secondary-button span {
    display: none;
  }

  .access-editor-form {
    padding-right: 12px;
    padding-left: 12px;
  }
}

/* ============ Личный профиль ============ */

body.profile-drawer-open {
  overflow: hidden;
}

.profile-drawer-backdrop {
  position: fixed;
  z-index: 149;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(2px);
}

.profile-drawer {
  position: fixed;
  z-index: 150;
  top: 0;
  right: 0;
  width: min(620px, 100vw);
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -24px 0 56px rgba(0, 0, 0, 0.22);
}

.profile-drawer-close {
  position: absolute;
  z-index: 3;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
}

.profile-drawer-close:hover {
  background: var(--panel-hover);
  color: var(--ink);
}

.profile-drawer-close svg {
  width: 16px;
  height: 16px;
}

.profile-drawer-head {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid var(--line);
  padding: 16px 62px 16px 20px;
}

.profile-head-avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--green) 28%, var(--line));
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 15px;
  font-weight: 800;
  flex: 0 0 54px;
}

.profile-drawer-head > div {
  min-width: 0;
}

.profile-drawer-head small,
.profile-drawer-head h2,
.profile-drawer-head p {
  display: block;
}

.profile-drawer-head small {
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.profile-drawer-head h2 {
  overflow: hidden;
  margin: 3px 0 0;
  font-size: 19px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-drawer-head p {
  overflow: hidden;
  color: var(--faint);
  margin: 3px 0 0;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-tabs {
  position: sticky;
  z-index: 2;
  top: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  padding: 0 14px;
  backdrop-filter: blur(12px);
}

.profile-tabs button {
  position: relative;
  height: 46px;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.profile-tabs button::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  background: transparent;
  content: "";
}

.profile-tabs button:hover,
.profile-tabs button.active {
  color: var(--ink);
}

.profile-tabs button.active::after {
  background: var(--green);
}

.profile-pane {
  padding: 18px 20px 32px;
}

.profile-drawer .primary-button,
.profile-drawer .secondary-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 7px;
  padding: 0 13px;
  font-size: 10.5px;
  font-weight: 700;
}

.profile-drawer .secondary-button {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
}

.profile-drawer .secondary-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  color: var(--ink);
}

.profile-drawer .primary-button svg,
.profile-drawer .secondary-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.profile-form {
  padding-bottom: 0;
}

.profile-photo-editor {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 2px 0 18px;
}

.profile-photo-preview {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--green);
  font-size: 23px;
  font-weight: 800;
}

.profile-photo-editor strong,
.profile-photo-editor small {
  display: block;
}

.profile-photo-editor strong {
  font-size: 12px;
}

.profile-photo-editor small {
  max-width: 310px;
  color: var(--faint);
  margin-top: 4px;
  font-size: 9.5px;
  line-height: 1.45;
}

.profile-photo-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.profile-photo-actions label {
  display: inline-flex;
  cursor: pointer;
}

.profile-photo-actions .secondary-button,
.profile-photo-actions .icon-action {
  min-height: 34px;
}

.profile-section {
  border-top: 1px solid var(--line);
  padding: 17px 0 2px;
}

.profile-section + .profile-section {
  margin-top: 18px;
}

.profile-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.profile-section-heading h3,
.profile-section-heading p {
  margin: 0;
}

.profile-section-heading h3 {
  font-size: 12.5px;
}

.profile-section-heading p {
  color: var(--faint);
  margin-top: 3px;
  font-size: 9.5px;
  line-height: 1.45;
}

.profile-section-heading > svg,
.profile-section-heading > span:not(.profile-count) {
  width: 17px;
  height: 17px;
  color: var(--faint);
  flex: 0 0 17px;
}

.profile-count {
  min-width: 28px;
  border-radius: 6px;
  background: var(--gray-pill);
  color: var(--muted);
  padding: 3px 7px;
  text-align: center;
  font-size: 9.5px;
  font-weight: 750;
}

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

.profile-form label,
.profile-password-form label {
  min-width: 0;
}

.profile-form label > span:first-child,
.profile-password-form label > span:first-child {
  display: block;
  color: var(--faint);
  margin-bottom: 5px;
  font-size: 9.5px;
  font-weight: 650;
}

.profile-form input,
.profile-form textarea,
.profile-password-form input {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 9px 10px;
  font-size: 11.5px;
}

.profile-form textarea {
  min-height: 88px;
  resize: vertical;
}

.profile-form input:focus,
.profile-form textarea:focus,
.profile-password-form input:focus {
  border-color: var(--focus);
}

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

.profile-prefixed-input {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.profile-prefixed-input:focus-within {
  border-color: var(--focus);
}

.profile-prefixed-input i {
  color: var(--faint);
  font-size: 11px;
  font-style: normal;
  text-align: center;
}

.profile-prefixed-input input {
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
}

.profile-account-line {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 0;
}

.profile-account-line > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--faint);
}

.profile-account-line svg {
  width: 15px;
  height: 15px;
}

.profile-account-line small,
.profile-account-line strong {
  display: block;
}

.profile-account-line small {
  color: var(--faint);
  font-size: 8.5px;
}

.profile-account-line strong {
  overflow: hidden;
  margin-top: 2px;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-account-line em {
  color: var(--faint);
  font-size: 8.5px;
  font-style: normal;
}

.profile-drawer-actions {
  position: sticky;
  z-index: 2;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  margin: 22px -20px 0;
  padding: 12px 20px;
  backdrop-filter: blur(12px);
}

.profile-drawer-actions button:disabled,
.profile-password-form button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.profile-form-error {
  border-radius: 7px;
  background: var(--red-soft);
  color: var(--red);
  margin-top: 12px;
  padding: 9px 10px;
  font-size: 10px;
}

.profile-form-error:empty {
  display: none;
}

.profile-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--green) 24%, var(--line));
  background: var(--green-soft);
  color: var(--green);
  padding: 9px 20px;
  font-size: 10px;
  font-weight: 650;
}

.profile-notice svg {
  width: 14px;
  height: 14px;
}

.profile-refresh-line {
  position: sticky;
  z-index: 4;
  top: 45px;
  height: 2px;
  overflow: hidden;
  background: var(--line);
}

.profile-refresh-line::after {
  width: 38%;
  height: 100%;
  display: block;
  background: var(--green);
  content: "";
  animation: profile-refresh 0.9s ease-in-out infinite alternate;
}

@keyframes profile-refresh {
  from { transform: translateX(-100%); }
  to { transform: translateX(260%); }
}

.profile-role-hero {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 4px 0 17px;
}

.profile-role-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
}

.profile-role-icon svg {
  width: 21px;
  height: 21px;
}

.profile-role-hero small,
.profile-role-hero h3,
.profile-role-hero p {
  display: block;
  margin: 0;
}

.profile-role-hero small {
  color: var(--faint);
  font-size: 8.5px;
  text-transform: uppercase;
}

.profile-role-hero h3 {
  margin-top: 2px;
  font-size: 15px;
}

.profile-role-hero p {
  color: var(--faint);
  margin-top: 2px;
  font-size: 9.5px;
}

.profile-role-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  padding: 4px 7px;
  font-size: 9px;
  font-weight: 700;
}

.profile-role-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.profile-access-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.profile-access-metrics > div {
  min-width: 0;
  padding: 13px 12px;
}

.profile-access-metrics > div + div {
  border-left: 1px solid var(--line);
}

.profile-access-metrics span,
.profile-access-metrics b,
.profile-access-metrics small {
  display: block;
}

.profile-access-metrics span,
.profile-access-metrics small {
  color: var(--faint);
  font-size: 8.5px;
}

.profile-access-metrics b {
  overflow-wrap: anywhere;
  margin: 3px 0;
  font-size: 15px;
  line-height: 1.2;
}

.profile-scope-list {
  display: grid;
  gap: 6px;
}

.profile-scope-list > div:not(.profile-empty) {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  padding: 4px 0 8px;
}

.profile-scope-list > div > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
}

.profile-scope-list > div > span svg,
.profile-scope-list > div > svg {
  width: 14px;
  height: 14px;
}

.profile-scope-list > div > svg {
  color: var(--green);
}

.profile-scope-list b,
.profile-scope-list small {
  display: block;
}

.profile-scope-list b {
  font-size: 10.5px;
}

.profile-scope-list small {
  color: var(--faint);
  margin-top: 2px;
  font-size: 8.5px;
}

.profile-permission-groups {
  display: grid;
  gap: 7px;
}

.profile-permission-group {
  border-bottom: 1px solid var(--line);
}

.profile-permission-group summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.profile-permission-group summary::-webkit-details-marker {
  display: none;
}

.profile-permission-group summary b {
  min-width: 24px;
  border-radius: 5px;
  background: var(--gray-pill);
  padding: 2px 6px;
  text-align: center;
  font-size: 8.5px;
}

.profile-permission-group > div {
  padding: 0 0 7px;
}

.profile-permission-item {
  min-height: 41px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}

.profile-permission-item > svg {
  width: 15px;
  height: 15px;
  color: var(--green);
}

.profile-permission-item b,
.profile-permission-item small {
  display: block;
}

.profile-permission-item b {
  font-size: 10px;
}

.profile-permission-item small {
  color: var(--faint);
  margin-top: 2px;
  font-size: 8.5px;
}

.profile-access-origin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
}

.profile-access-origin small,
.profile-access-origin b {
  display: block;
}

.profile-access-origin small {
  color: var(--faint);
  font-size: 8.5px;
}

.profile-access-origin b {
  margin-top: 3px;
  font-size: 10px;
}

.profile-access-origin p {
  grid-column: 1 / -1;
  color: var(--faint);
  margin: 0;
  font-size: 9px;
  line-height: 1.5;
}

.profile-security-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  padding: 0 0 4px;
}

.profile-security-facts > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.profile-security-facts > div > svg {
  width: 16px;
  height: 16px;
  color: var(--faint);
}

.profile-security-facts small,
.profile-security-facts b {
  display: block;
}

.profile-security-facts small {
  color: var(--faint);
  font-size: 8.5px;
}

.profile-security-facts b {
  overflow: hidden;
  margin-top: 2px;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-password-form > label {
  display: block;
  margin-bottom: 10px;
}

.profile-password-form .profile-field-grid {
  margin-bottom: 10px;
}

.profile-password-form > button {
  margin-top: 10px;
}

.profile-activity-list > div:not(.profile-empty) {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 9px;
  min-height: 43px;
  padding: 5px 0;
}

.profile-activity-list > div > span {
  position: relative;
}

.profile-activity-list > div > span::before {
  position: absolute;
  z-index: 1;
  top: 7px;
  left: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.profile-activity-list > div > span::after {
  position: absolute;
  top: 13px;
  bottom: -12px;
  left: 5px;
  width: 1px;
  background: var(--line);
  content: "";
}

.profile-activity-list > div:last-child > span::after {
  display: none;
}

.profile-activity-list b,
.profile-activity-list small {
  display: block;
}

.profile-activity-list b {
  font-size: 10px;
}

.profile-activity-list small {
  color: var(--faint);
  margin-top: 2px;
  font-size: 8.5px;
}

.profile-logout-button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  margin-top: 20px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.profile-logout-button:hover {
  border-color: color-mix(in srgb, var(--red) 40%, var(--line));
  color: var(--red);
}

.profile-logout-button > svg:first-child {
  width: 17px;
  height: 17px;
  justify-self: center;
}

.profile-logout-button > svg:last-child {
  width: 14px;
  height: 14px;
}

.profile-logout-button b,
.profile-logout-button small {
  display: block;
}

.profile-logout-button b {
  font-size: 10.5px;
}

.profile-logout-button small {
  color: var(--faint);
  margin-top: 2px;
  font-size: 8.5px;
}

.profile-empty {
  color: var(--faint);
  padding: 15px 0;
  font-size: 9.5px;
  text-align: center;
}

.profile-loading,
.profile-load-error {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--faint);
  padding: 30px;
  text-align: center;
}

.profile-loading > span {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: access-spin 0.75s linear infinite;
}

.profile-loading strong,
.profile-load-error strong {
  color: var(--ink);
  font-size: 11px;
}

.profile-load-error > svg {
  width: 28px;
  height: 28px;
  color: var(--red);
}

.profile-load-error > span {
  font-size: 9.5px;
}

.access-avatar.has-photo {
  overflow: hidden;
  padding: 0;
}

.access-user-main strong {
  display: flex;
  align-items: center;
  gap: 6px;
}

.access-self-badge {
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 2px 5px;
  font-size: 8px;
  font-style: normal;
  font-weight: 750;
}

@media (max-width: 760px) {
  .session-profile-button {
    grid-template-columns: 30px 12px;
  }

  .session-identity {
    display: none;
  }

  .profile-drawer {
    width: 100vw;
    border-left: 0;
  }

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

  .profile-field-wide {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .profile-drawer-head {
    min-height: 82px;
    padding-left: 14px;
  }

  .profile-head-avatar {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .profile-drawer-head h2 {
    max-width: calc(100vw - 142px);
    font-size: 16px;
  }

  .profile-tabs {
    padding: 0 6px;
  }

  .profile-pane {
    padding-right: 14px;
    padding-left: 14px;
  }

  .profile-photo-editor {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 12px;
  }

  .profile-photo-preview {
    width: 74px;
    height: 74px;
    font-size: 18px;
  }

  .profile-photo-actions .secondary-button span,
  .profile-account-line em {
    display: none;
  }

  .profile-account-line {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .profile-drawer-actions {
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .profile-access-metrics > div {
    padding: 11px 7px;
  }

  .profile-access-metrics b {
    font-size: 12px;
  }

  .profile-security-facts {
    grid-template-columns: 1fr;
  }
}
