:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --panel: #ffffff;
  --ink: #2f2b26;
  --muted: #767168;
  --line: #e5e1da;
  --soft: #f0f2ee;
  --active: #e9efe5;
  --accent: #587961;
  --accent-strong: #365942;
  --warn: #9a6500;
  --bad: #a33d32;
  --shadow: 0 18px 50px rgba(43, 34, 24, 0.16);
}

/* Taskbook mirrors the local three-pane work surface while using portal data contracts. */
body[data-view="tasks"] .sidebar,
body[data-view="tasks"] .topbar {
  display: none;
}

body[data-view="tasks"] .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body[data-view="tasks"] .workspace,
body[data-view="tasks"] #tasksView {
  height: 100vh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.taskbook-host,
.taskbook-shell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.taskbook-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #f7f8f6;
}

.taskbook-shell {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  background: #f7f8f6;
}

.taskbook-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 38px;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.taskbook-top nav,
.taskbook-view-toggle,
.taskbook-scope,
.taskbook-levels {
  display: flex;
  align-items: center;
  gap: 4px;
}

.taskbook-top button,
.taskbook-view-toggle button,
.taskbook-scope button,
.taskbook-levels button,
.taskbook-list-head button {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #5f5b54;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.taskbook-top button.active,
.taskbook-view-toggle button.active,
.taskbook-scope button.active,
.taskbook-levels button.active,
.taskbook-list-head button.active {
  border-color: #cfd9cd;
  background: var(--active);
  color: var(--accent-strong);
  font-weight: 700;
}

.taskbook-top nav button span {
  color: #8a857d;
  font-size: 10px;
}

.taskbook-refresh {
  width: 32px;
  padding: 0 !important;
  font-size: 18px !important;
}

.taskbook-body {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 244px minmax(420px, 1fr) 330px;
  overflow: hidden;
}

.taskbook-left,
.taskbook-right,
.taskbook-main {
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.taskbook-left,
.taskbook-right {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.taskbook-right {
  grid-template-rows: auto minmax(0, 1fr);
  border-right: 0;
  border-left: 1px solid var(--line);
}

.taskbook-left > header,
.taskbook-right > header {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}

.taskbook-left > header button,
.taskbook-right > header button {
  border: 0;
  background: transparent;
  color: #68635c;
  cursor: pointer;
}

.taskbook-scope,
.taskbook-levels {
  padding: 6px 8px 0;
  overflow-x: auto;
}

.taskbook-tree {
  min-height: 0;
  margin-top: 6px;
  padding: 4px 8px 18px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.taskbook-tree-all,
.taskbook-tree-line {
  width: 100%;
  min-height: 32px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
}

.taskbook-tree-all {
  display: flex;
  justify-content: space-between;
  padding: 5px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.taskbook-tree-all.selected,
.taskbook-tree-line.selected {
  background: var(--active);
  color: var(--accent-strong);
}

.taskbook-tree-line > button {
  min-width: 0;
  padding: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.taskbook-tree-line > button:last-child {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.taskbook-tree-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taskbook-tree small,
.taskbook-tree-all small {
  color: #9a958e;
  font-size: 10px;
}

.taskbook-tree-children {
  margin-left: 12px;
  border-left: 1px solid #ebe8e2;
  padding-left: 4px;
}

.taskbook-tree-spacer {
  width: 22px;
}

.taskbook-main {
  display: grid;
  grid-template-rows: minmax(220px, 1fr) minmax(190px, 31%);
  overflow: hidden;
}

.taskbook-list-zone {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.taskbook-list-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.taskbook-list-head h1,
.taskbook-list-head p {
  margin: 0;
}

.taskbook-list-head h1 {
  font-size: 16px;
}

.taskbook-list-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.taskbook-list-head > div:last-child {
  display: flex;
  gap: 4px;
}

.taskbook-warning {
  display: flex;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid #e7e2d6;
  background: #fbfaf5;
  color: #766f61;
  font-size: 11px;
}

.taskbook-table-wrap {
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.taskbook-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.taskbook-table th,
.taskbook-table td {
  max-width: 220px;
  padding: 7px 8px;
  border-bottom: 1px solid #ece9e3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.taskbook-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfaf8;
  color: #6e6961;
  font-size: 10px;
  text-transform: uppercase;
}

.taskbook-table tr {
  cursor: pointer;
}

.taskbook-table tr:hover,
.taskbook-table tr.selected {
  background: #f1f5ef;
}

.taskbook-select-col {
  width: 34px;
}

.taskbook-title-cell {
  width: 300px;
}

.taskbook-title-cell b,
.taskbook-title-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taskbook-title-cell small {
  margin-top: 2px;
  color: var(--muted);
}

.taskbook-status {
  display: inline-block;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef1ed;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taskbook-problem {
  color: #a34b3f;
}

.taskbook-board {
  min-height: 0;
  display: flex;
  gap: 10px;
  padding: 10px;
  overflow: auto;
}

.taskbook-board-column {
  width: 260px;
  min-width: 260px;
  align-self: stretch;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8f9f7;
  overflow: hidden;
}

.taskbook-board-column > header {
  display: flex;
  justify-content: space-between;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.taskbook-board-column > div {
  padding: 7px;
  overflow-y: auto;
}

.taskbook-board-card {
  width: 100%;
  display: grid;
  gap: 7px;
  margin-bottom: 7px;
  padding: 9px;
  border: 1px solid #e1ded7;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.taskbook-board-card.selected {
  border-color: var(--accent);
  box-shadow: inset 3px 0 var(--accent);
}

.taskbook-board-card small,
.taskbook-board-card span {
  color: var(--muted);
  font-size: 10px;
}

.taskbook-board-card footer {
  display: flex;
  justify-content: space-between;
}

.taskbook-assistant {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-top: 1px solid var(--line);
  overflow: hidden;
}

.taskbook-assistant > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}

.taskbook-assistant > header div {
  display: grid;
}

.taskbook-assistant > header small {
  color: var(--muted);
  font-size: 10px;
}

.taskbook-assistant > header button {
  border: 1px solid #d8d3ca;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.taskbook-agent-messages {
  min-height: 0;
  padding: 8px 12px;
  overflow-y: auto;
}

.taskbook-agent-message {
  max-width: 82%;
  margin-bottom: 7px;
  padding: 7px 9px;
  border-radius: 6px;
  background: #f0f2ee;
  font-size: 11px;
}

.taskbook-agent-message.user {
  margin-left: auto;
  background: #e7efe5;
}

.taskbook-agent-message span {
  color: var(--muted);
  font-size: 9px;
}

.taskbook-agent-message p {
  margin: 3px 0 0;
  white-space: pre-wrap;
}

.taskbook-agent-empty,
.taskbook-empty,
.taskbook-detail-empty,
.taskbook-empty-small {
  padding: 20px;
  color: var(--muted);
  font-size: 12px;
}

.taskbook-agent-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 7px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--line);
}

.taskbook-agent-form textarea {
  min-height: 38px;
  max-height: 90px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid #dcd8d0;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
}

.taskbook-agent-form button {
  border: 0;
  border-radius: 6px;
  background: var(--accent-strong);
  color: #fff;
  cursor: pointer;
}

.taskbook-right > header button {
  display: none;
}

.taskbook-detail {
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
}

.taskbook-detail-number {
  color: var(--muted);
  font-size: 11px;
}

.taskbook-detail h2 {
  margin: 6px 0 8px;
  font-size: 18px;
  line-height: 1.25;
}

.taskbook-detail-editable {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  align-items: start;
  gap: 6px;
}

.taskbook-detail-editable > button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.taskbook-detail-editable > button:hover {
  background: #f0eee9;
  color: var(--accent-strong);
}

.taskbook-detail-editable.description {
  margin-bottom: 4px;
}

.taskbook-detail-controls {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #faf9f6;
}

.taskbook-detail-controls label {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.taskbook-detail-controls select,
.taskbook-detail-controls input[type="date"] {
  min-width: 0;
  height: 30px;
  border: 1px solid #dcd8d0;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.taskbook-detail-controls .progress span {
  display: flex;
  justify-content: space-between;
}

.taskbook-detail-controls input[type="range"] {
  min-width: 0;
  accent-color: var(--accent-strong);
}

.taskbook-detail-description {
  color: #6e6961;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.taskbook-detail-warning {
  margin: 10px 0;
  padding: 8px;
  border: 1px solid #e4c7c1;
  border-radius: 5px;
  background: #fff4f1;
  color: #963e34;
  font-size: 11px;
}

.taskbook-detail dl {
  margin: 14px 0;
}

.taskbook-detail dl div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #eeeae4;
}

.taskbook-detail dt {
  color: var(--muted);
  font-size: 10px;
}

.taskbook-detail dd {
  margin: 0;
  font-size: 11px;
}

.taskbook-detail-files {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.taskbook-detail-files h3,
.taskbook-detail-files p {
  margin: 0;
}

.taskbook-detail-files > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.taskbook-detail-files > header label {
  position: relative;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--accent-strong);
  font-size: 10px;
  cursor: pointer;
}

.taskbook-detail-files > header input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.taskbook-file-list {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.taskbook-file-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 6px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.taskbook-file-list a {
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taskbook-file-list button {
  border: 0;
  background: transparent;
  color: #8b5149;
  cursor: pointer;
}

.taskbook-file-error {
  color: var(--bad) !important;
}

.taskbook-detail-files h3 {
  font-size: 13px;
}

.taskbook-detail-files p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.taskbook-edge {
  display: none;
}

.taskbook-loading {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
}

.taskbook-loading span {
  width: 28px;
  height: 28px;
  border: 3px solid #dce5da;
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: taskbook-spin .8s linear infinite;
}

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

@media (max-width: 1180px) {
  .taskbook-body {
    grid-template-columns: 220px minmax(400px, 1fr) 290px;
  }
}

@media (max-width: 860px) {
  .taskbook-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .taskbook-top {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding: 6px;
  }

  .taskbook-top nav {
    overflow-x: auto;
  }

  .taskbook-top nav button {
    flex: 0 0 auto;
  }

  .taskbook-refresh {
    display: none;
  }

  .taskbook-body {
    display: block;
  }

  .taskbook-main {
    width: 100%;
    height: 100%;
    grid-template-rows: minmax(260px, 1fr) minmax(180px, 36%);
  }

  .taskbook-left,
  .taskbook-right {
    position: absolute;
    inset-block: 0;
    z-index: 20;
    width: min(88vw, 340px);
    box-shadow: 0 12px 36px rgba(32, 29, 24, .2);
    transform: translateX(-105%);
    transition: transform .18s ease;
  }

  .taskbook-right {
    right: 0;
    left: auto;
    transform: translateX(105%);
  }

  .taskbook-shell.left-open .taskbook-left,
  .taskbook-shell.right-open .taskbook-right {
    transform: translateX(0);
  }

  .taskbook-right > header button {
    display: block;
  }

  .taskbook-edge {
    position: absolute;
    top: 8px;
    z-index: 12;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(33, 30, 25, .1);
  }

  .taskbook-edge.left { left: 8px; }
  .taskbook-edge.right { right: 8px; }

  .taskbook-list-head {
    padding-inline: 50px;
  }

  .taskbook-list-head > div:last-child {
    display: none;
  }

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

  .taskbook-table {
    min-width: 840px;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

body {
  overflow: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f3f5f1;
}

.auth-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 22px;
  padding: 30px;
  border: 1px solid #dde2da;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(43, 54, 44, 0.12);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #252923;
  font-size: 21px;
  font-weight: 750;
  line-height: 1.12;
  text-transform: uppercase;
}

.auth-brand img {
  width: 82px;
  height: 54px;
  object-fit: contain;
}

.auth-copy {
  display: grid;
  gap: 6px;
}

.auth-copy .eyebrow,
.auth-copy h1,
.auth-copy p {
  margin: 0;
}

.auth-copy h1 {
  font-size: 28px;
}

.auth-copy > p:last-child {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-methods {
  display: grid;
  gap: 10px;
}

.auth-method {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
}

.auth-method:hover:not(:disabled) {
  border-color: #94aa99;
  background: #f6f8f4;
}

.auth-method.primary {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #ffffff;
}

.auth-method.primary:hover:not(:disabled) {
  border-color: #294936;
  background: #294936;
}

.auth-method:disabled {
  cursor: default;
  opacity: 0.52;
}

.auth-method-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.auth-method-icon.yandex {
  color: #c43d2e;
}

.auth-method > span:last-child,
.auth-progress > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.auth-method small,
.auth-progress small {
  color: inherit;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.72;
}

.auth-progress {
  min-height: 54px;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid #dce4da;
  border-radius: 8px;
  background: #f4f7f2;
  font-size: 13px;
}

.auth-progress:not([hidden]) {
  display: grid;
}

.auth-progress-indicator {
  width: 20px;
  height: 20px;
  border: 2px solid #b8c8bb;
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: auth-spin 0.9s linear infinite;
}

.auth-reset {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

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

@media (max-width: 560px) {
  .auth-gate {
    padding: 16px;
  }

  .auth-panel {
    padding: 24px 20px;
  }
}

button {
  font: inherit;
  color: inherit;
}

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

.sidebar {
  height: 100vh;
  border-right: 1px solid var(--line);
  padding: 28px 22px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  width: 106px;
  height: 58px;
  border: 0;
  border-radius: 0;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: transparent;
  font-size: 24px;
  font-weight: 800;
  overflow: hidden;
}

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

.brand-title {
  font-size: 24px;
  line-height: 1.18;
  text-transform: uppercase;
  font-weight: 750;
}

.main-menu {
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.nav-item {
  min-height: 38px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  color: #514b44;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  background: var(--soft);
}

.nav-item:disabled,
.nav-item.disabled {
  color: #aaa39a;
  cursor: default;
  background: transparent;
}

.nav-item:disabled .nav-icon,
.nav-item.disabled .nav-icon {
  opacity: 0.45;
}

.nav-item:disabled:hover,
.nav-item.disabled:hover {
  background: transparent;
}

.nav-item.active {
  background: var(--active);
  color: #2f2b26;
  font-weight: 650;
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.nav-label {
  margin: 10px 10px 3px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
}

.current-user {
  margin-top: auto;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 16px 0 0;
  background: transparent;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.current-avatar,
.profile-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--active);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-strong);
  overflow: hidden;
}

.current-user-text {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.current-user-text b {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-user-text span {
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  min-width: 0;
  height: 100vh;
  overflow: auto;
  padding: 28px 32px 36px;
}

.mobile-header-handle {
  display: none;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 750;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

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

h2 {
  font-size: 18px;
}

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

.status-pill,
.workband-head span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(88, 121, 97, 0.24);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--accent-strong);
  background: #f5faf3;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.muted {
  color: var(--muted);
  background: #fbfaf8;
  border-color: var(--line);
}

.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.view {
  display: none;
}

.view.active-view {
  display: block;
}

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

.summary-tile,
.placeholder-card,
.module-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.summary-tile {
  min-height: 122px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.summary-tile.accent {
  border-top: 5px solid var(--accent);
}

.summary-tile span,
.module-card span,
.placeholder-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.summary-tile b,
.module-card b,
.placeholder-card b {
  font-size: 17px;
}

.summary-tile small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.workband {
  margin-top: 16px;
}

.workband-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.module-card {
  min-height: 112px;
  padding: 18px;
  display: grid;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.module-card:hover {
  border-color: rgba(88, 121, 97, 0.38);
  background: #fbfdf9;
}

.module-card:disabled,
.module-card.disabled-card {
  color: #aaa39a;
  cursor: default;
  background: #f5f4f1;
}

.module-card:disabled:hover,
.module-card.disabled-card:hover {
  border-color: var(--line);
  background: #f5f4f1;
}

.placeholder-card {
  min-height: 116px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.tg-monitor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.tg-monitor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.tg-monitor-stat {
  min-height: 92px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  border-right: 1px solid var(--line);
}

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

.tg-monitor-stat span,
.tg-monitor-stat small,
.tg-activity-row small,
.tg-activity-row time,
.tg-monitor-empty {
  color: var(--muted);
  font-size: 13px;
}

.tg-monitor-stat b {
  font-size: 17px;
}

.tg-monitor-headline,
.tg-monitor-empty {
  min-height: 48px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.text-button {
  width: auto;
  min-width: 86px;
  padding: 0 10px;
  font-weight: 700;
}

.tg-monitor-activity {
  display: grid;
}

.tg-activity-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(240px, 1.4fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

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

.tg-activity-row > span {
  min-width: 0;
}

.tg-activity-row b,
.tg-activity-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tg-activity-row > span:nth-child(2) {
  color: #5f564c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photobank-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

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

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: var(--soft);
}

.segmented-control button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: #5f564c;
  font-weight: 700;
  cursor: pointer;
}

.segmented-control button.active {
  background: var(--panel);
  color: var(--accent-strong);
  box-shadow: 0 1px 4px rgba(47, 42, 35, 0.08);
}

.photobank-queue {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.photobank-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.photobank-card {
  min-width: 0;
  background: var(--panel);
}

.photobank-media {
  aspect-ratio: 4 / 3;
  background: #eeeae3;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.photobank-media img,
.photobank-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photobank-media.is-pending {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.photobank-meta {
  min-height: 132px;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 7px;
}

.photobank-meta b,
.photobank-meta span,
.photobank-meta small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photobank-meta span,
.photobank-meta small {
  color: var(--muted);
  font-size: 13px;
}

.photobank-action {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-strong);
  background: #fbfdf9;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

body[data-view="photos"] .topbar {
  display: none;
}

body[data-view="photos"] .workspace {
  padding-top: 28px;
  overflow: hidden;
}

body[data-view="photos"] #photosView,
body[data-view="photos"] #photosView .workband {
  height: 100%;
  min-height: 0;
  margin-top: 0;
}

body[data-view="photos"] #photosView .workband-head {
  display: none;
}

body[data-view="photos"] #photosPanel {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.photo-sidebar-tree {
  margin: 4px 0 8px 8px;
  padding-left: 12px;
  padding-right: 4px;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 2px;
}

.photo-tree-node {
  min-height: 28px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: #4d463e;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.photo-tree-node:hover {
  background: var(--soft);
}

.photo-tree-node.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 650;
}

.photo-tree-node b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: inherit;
}

.photo-tree-node.level-1 { padding-left: 14px; }
.photo-tree-node.level-2 { padding-left: 24px; }
.photo-tree-node.level-3 { padding-left: 34px; }
.photo-tree-node.level-4 { padding-left: 44px; }

.photo-caret {
  width: 18px;
  height: 24px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: #8a8176;
  font-size: 15px;
  line-height: 1;
}

.photo-caret[data-photo-tree-toggle]:hover {
  background: var(--active);
}

.photobank-layout {
  height: 100%;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
}

.photobank-work {
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
}

.photo-head {
  position: relative;
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.photo-head h1 {
  margin: 0;
  font-size: 20px;
}

.photo-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.date-mode,
.comment-toggle,
.calendar-inputs button,
.show-more,
.tg-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: #4d4439;
  padding: 0 12px;
  cursor: pointer;
  text-decoration: none;
}

.date-mode.active {
  background: #ded6c8;
  font-weight: 700;
}

.comment-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.date-popover {
  position: absolute;
  right: 18px;
  top: 62px;
  z-index: 40;
  width: 330px;
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(28, 24, 18, 0.16);
  padding: 14px;
}

.calendar-head,
.calendar-inputs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calendar-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 42px;
  gap: 8px;
  align-items: end;
}

.calendar-head button,
.calendar-grid button {
  border: 0;
  background: var(--soft);
  border-radius: 6px;
  min-height: 28px;
  cursor: pointer;
}

.calendar-grid {
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  text-align: center;
}

.calendar-grid b {
  color: var(--muted);
  font-size: 12px;
}

.calendar-grid button.selected,
.calendar-grid button.range-start,
.calendar-grid button.range-end {
  background: #b8945e;
  color: #fff;
  font-weight: 700;
}

.calendar-grid button.in-range {
  background: #eadbc5;
  color: #4b3c28;
}

.calendar-inputs label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-inputs input {
  max-width: 120px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
}

.date-apply {
  width: 42px;
  min-width: 42px;
  height: 38px;
  padding: 0;
  background: #e7f2e7 !important;
  color: #3f7a45 !important;
  font-size: 20px;
  font-weight: 800;
}

.show-more {
  justify-self: center;
  margin: 0;
}

.photo-feed {
  min-height: 0;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-right: 8px;
}

.photo-day {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.photo-date-divider {
  position: sticky;
  top: 0;
  z-index: 6;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  background: rgba(247, 248, 246, 0.94);
  padding: 5px 16px;
  color: #655d53;
  font-size: 12px;
  white-space: nowrap;
}

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

.photo-day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  min-width: 0;
}

.photo-day-grid.comments-mode {
  align-items: start;
}

.photo-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: visible;
  background: var(--panel);
  cursor: pointer;
  padding: 0;
}

.comments-mode .photo-card {
  aspect-ratio: auto;
  min-height: 300px;
  display: grid;
  grid-template-rows: 170px auto;
  overflow: hidden;
}

.photo-card img,
.photo-card video,
.photo-missing {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #ebe6dc;
  border-radius: 8px;
}

.comments-mode .photo-card img,
.comments-mode .photo-card video,
.comments-mode .photo-missing {
  height: 170px;
  border-radius: 8px 8px 0 0;
}

.photo-card video,
.photo-thumbs video {
  display: block;
  background: #1f1d1a;
}

.media-kind-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 3;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #cde7f7;
  color: #2f6f95;
  box-shadow: 0 4px 12px rgba(30, 25, 19, 0.14);
}

.media-kind-badge svg,
.comment-mark svg,
.tg-button svg,
.photo-caption a svg,
.photo-hover a svg,
.thumb-comment-mark svg {
  width: 16px;
  height: 16px;
}

.video-card-progress {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  z-index: 4;
  height: 3px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 253, 250, 0.42);
  pointer-events: none;
}

.video-card-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: rgba(47, 111, 149, 0.9);
}

.comments-mode .video-card-progress {
  top: 160px;
  bottom: auto;
}

.photo-card time,
.comment-mark {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(255, 253, 250, 0.68);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.comment-mark {
  left: auto;
  right: 8px;
  top: 8px;
  bottom: auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #3f617d;
  background: #f2d884;
  z-index: 3;
}

.comments-mode .photo-card time {
  top: 170px;
  bottom: auto;
  z-index: 4;
  transform: translateY(calc(-100% - 8px));
}

.photo-hover {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 44px;
  z-index: 10;
  max-height: 220px;
  overflow: auto;
  background: rgba(255, 248, 215, 0.98);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(30, 25, 19, 0.18);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  text-align: left;
  transition: opacity 0.16s;
}

.photo-card.comment-open .photo-hover {
  opacity: 1;
  pointer-events: auto;
}

.photo-hover-overlay {
  position: fixed;
  left: var(--hover-left, 8px);
  top: var(--hover-top, 8px);
  right: auto;
  bottom: auto;
  z-index: 2300;
  width: min(340px, calc(100vw - 16px));
  opacity: 0;
  pointer-events: none;
}

.photo-hover-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.photo-hover b,
.photo-caption b,
.photo-comment b {
  display: block;
  font-size: 12px;
}

.photo-hover em,
.photo-caption em,
.photo-comment em {
  font-style: normal;
  color: var(--muted);
}

.photo-hover span,
.photo-caption span,
.photo-comment span {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #5f564c;
}

.photo-hover a,
.photo-caption a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #315f85;
  font-weight: 700;
  text-decoration: none;
}

.photo-caption {
  position: absolute;
  inset: auto 0 0 0;
  background: rgba(255, 248, 215, 0.97);
  padding: 8px 10px 30px;
  display: grid;
  gap: 3px;
  text-align: left;
  font-size: 12px;
}

.comments-mode .photo-caption {
  position: static;
  min-height: 130px;
  max-height: 260px;
  overflow: auto;
  padding: 10px 10px 12px;
}

.photo-empty {
  align-self: center;
  justify-self: center;
  margin-top: 12vh;
  color: var(--muted);
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 22px;
}

.photo-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2200;
  background: rgba(24, 22, 19, 0.32);
  display: grid;
  place-items: center;
  padding: 30px;
}

html.usedmat-viewer-open,
html.usedmat-viewer-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.usedmat-viewer-backdrop {
  overscroll-behavior: none;
}

.photo-viewer {
  position: relative;
  width: min(1240px, 96vw);
  height: min(860px, 92vh);
  background: #fffdfa;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  grid-template-rows: 1fr;
  overflow: hidden;
}

.photo-viewer > .modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 12;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(30, 25, 19, 0.16);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.photo-main-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}

.photo-large {
  position: relative;
  background: #ece7de;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 0;
}

.photo-large img,
.photo-large video {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.12s;
  will-change: transform;
  user-select: none;
}

.photo-large img {
  pointer-events: none;
}

.photo-large.pan-locked {
  cursor: grab;
}

.photo-large.pan-dragging {
  cursor: grabbing;
}

.photo-large .photo-missing.large {
  width: 100%;
  height: 100%;
}

#photoDrawCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#photoDrawCanvas.active {
  pointer-events: auto;
  cursor: crosshair;
}

.photo-large.drawing-enabled {
  cursor: crosshair;
}

.photo-main-time {
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: rgba(30, 26, 22, 0.62);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}

.photo-tags {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: grid;
  justify-items: end;
  gap: 7px;
}

.video-view-controls {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 5;
  width: min(440px, 48vw);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 253, 250, 0.9);
  box-shadow: 0 10px 26px rgba(30, 25, 19, 0.18);
}

.video-view-controls button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #cde7f7;
  color: #2f6f95;
  cursor: pointer;
}

.video-view-controls button svg {
  width: 17px;
  height: 17px;
}

.video-view-controls input {
  width: 100%;
  accent-color: #2f6f95;
}

.photo-tag-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: 360px;
}

.photo-tags button,
.photo-tag-list span {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 253, 250, 0.88);
  color: #4d4439;
  box-shadow: 0 8px 24px rgba(30, 25, 19, 0.14);
  cursor: pointer;
  font-size: 13px;
}

.photo-nav {
  position: absolute;
  left: 50%;
  width: 64px;
  height: 44px;
  margin-left: -32px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 253, 250, 0.92);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.32);
  font-size: 52px;
  line-height: 1;
  cursor: pointer;
}

.photo-nav.prev { top: 16px; }
.photo-nav.next { bottom: 16px; }
.photo-nav:disabled,
.thumb-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.photo-details {
  padding: 16px 22px 18px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(170px, 270px) minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}

.photo-details h2 {
  margin: 0;
  font-size: 20px;
}

.photo-details p {
  margin: 4px 0 0;
  color: var(--muted);
}

.photo-comment {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.photo-comment span {
  color: var(--muted);
  max-height: 90px;
  overflow: auto;
  white-space: normal;
  line-height: 1.35;
}

.photo-tools,
.photo-send-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-send-row {
  grid-column: 2 / 4;
}

.photo-details > .tg-button {
  grid-column: 1 / 2;
  grid-row: 2;
}

.pen-toggle,
.photo-send-row button {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 8px;
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
}

.pen-toggle {
  width: 36px;
  min-width: 36px;
  padding: 0;
  display: grid;
  place-items: center;
}

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

.pen-toggle.active {
  background: #eadbc5;
  font-weight: 700;
}

.pen-color {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--pen);
  cursor: pointer;
}

.pen-color.active {
  border-color: #2f2b26;
}

.photo-send-row input {
  width: min(440px, 32vw);
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.photo-send-row button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eaf2f8;
  color: #3f617d;
}

.tg-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  color: #315f85;
}

.tg-button.disabled {
  color: var(--muted);
  opacity: 0.58;
  pointer-events: none;
}

.photo-thumbs-panel {
  display: grid;
  grid-template-rows: 30px minmax(0, 1fr) 30px;
  gap: 8px;
  padding: 10px 8px 10px 14px;
  border-right: 1px solid var(--line);
  background: #fffdfa;
  min-height: 0;
}

.photo-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding: 4px 18px 4px 10px;
  margin-right: -4px;
  scrollbar-width: thin;
  align-items: center;
}

.photo-thumbs button {
  position: relative;
  width: 88px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: visible;
  padding: 0;
  background: var(--soft);
  cursor: pointer;
}

.photo-thumbs button.active {
  width: 100px;
  min-height: 84px;
  border-color: #111;
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.26), 0 8px 18px rgba(30, 25, 19, 0.18);
}

.photo-thumbs img,
.photo-thumbs video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

.photo-thumb-missing {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.photo-thumbs .media-kind-badge {
  left: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  z-index: 4;
}

.photo-thumbs .media-kind-badge svg {
  width: 13px;
  height: 13px;
}

.thumb-comment-mark {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #3f617d;
  background: #f2d884;
  box-shadow: 0 4px 12px rgba(30, 25, 19, 0.18);
  z-index: 4;
}

.thumb-comment-mark svg {
  width: 13px;
  height: 13px;
}

.thumb-hover {
  left: var(--hover-left, 8px);
  right: auto;
  bottom: auto;
  top: var(--hover-top, 8px);
}

.thumb-hover.hover-right,
.thumb-hover.hover-left {
  left: var(--hover-left, 8px);
  top: var(--hover-top, 8px);
  right: auto;
}

.thumb-comment-mark:hover ~ .thumb-hover,
.thumb-hover:hover {
  display: grid;
  opacity: 1;
  pointer-events: auto;
}

.thumb-arrow {
  border: 0;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  color: #5f574e;
  font-size: 24px;
}

.table-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

body[data-view="used_materials"] .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body[data-view="used_materials"] .sidebar,
body[data-view="used_materials"] .topbar {
  display: none;
}

body[data-view="used_materials"] .workspace {
  padding: 18px;
  overflow: hidden;
}

body[data-view="used_materials"] #usedMaterialsView .workband {
  margin-top: 0;
}

.usedmat-panel {
  height: calc(100vh - 84px);
  min-height: 620px;
}

.usedmat-shell {
  height: 100%;
  display: grid;
  grid-template-columns: var(--usedmat-left-width, 286px) 6px minmax(520px, 1fr) 6px var(--usedmat-right-width, 390px);
  min-width: 0;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.usedmat-shell.left-unpinned.right-pinned {
  grid-template-columns: minmax(520px, 1fr) 6px var(--usedmat-right-width, 390px);
}

.usedmat-shell.left-pinned.right-unpinned {
  grid-template-columns: var(--usedmat-left-width, 286px) 6px minmax(520px, 1fr);
}

.usedmat-shell.left-unpinned.right-unpinned {
  grid-template-columns: minmax(520px, 1fr);
}

.usedmat-left { grid-column: 1; }
.usedmat-left-resizer { grid-column: 2; }
.usedmat-center { grid-column: 3; }
.usedmat-right-resizer { grid-column: 4; }
.usedmat-right { grid-column: 5; }

.usedmat-shell.left-unpinned.right-pinned .usedmat-center { grid-column: 1; }
.usedmat-shell.left-unpinned.right-pinned .usedmat-right-resizer { grid-column: 2; }
.usedmat-shell.left-unpinned.right-pinned .usedmat-right { grid-column: 3; }

.usedmat-shell.left-pinned.right-unpinned .usedmat-left { grid-column: 1; }
.usedmat-shell.left-pinned.right-unpinned .usedmat-left-resizer { grid-column: 2; }
.usedmat-shell.left-pinned.right-unpinned .usedmat-center { grid-column: 3; }

.usedmat-shell.left-unpinned.right-unpinned .usedmat-center { grid-column: 1; }

.usedmat-shell.left-unpinned .usedmat-left,
.usedmat-shell.right-unpinned .usedmat-right {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 12;
  box-shadow: 0 14px 34px rgba(45, 39, 31, .18);
  transition: transform .22s ease;
}

.usedmat-shell.left-unpinned .usedmat-left {
  left: 0;
  width: var(--usedmat-left-width, 286px);
  transform: translateX(calc(-1 * var(--usedmat-left-width, 286px)));
}

.usedmat-shell.left-unpinned.left-open .usedmat-left {
  transform: translateX(0);
}

.usedmat-shell.right-unpinned .usedmat-right {
  right: 0;
  width: var(--usedmat-right-width, 390px);
  transform: translateX(var(--usedmat-right-width, 390px));
}

.usedmat-shell.right-unpinned.right-open .usedmat-right {
  transform: translateX(0);
}

.usedmat-shell.left-unpinned .usedmat-left-resizer,
.usedmat-shell.right-unpinned .usedmat-right-resizer {
  display: none;
}

.usedmat-edge {
  position: absolute;
  z-index: 10;
  width: 28px;
  height: 74px;
  border: 1px solid var(--line);
  background: #fff;
  color: #6f665c;
  cursor: pointer;
  display: none;
  place-items: center;
  box-shadow: 0 6px 20px rgba(45, 39, 31, .12);
}

.usedmat-edge-left {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  border-left: 0;
  border-radius: 0 10px 10px 0;
}

.usedmat-edge-right {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-right: 0;
  border-radius: 10px 0 0 10px;
}

.usedmat-shell.left-unpinned:not(.left-open) .usedmat-edge-left,
.usedmat-shell.right-unpinned:not(.right-open) .usedmat-edge-right {
  display: grid;
}

.usedmat-shell.left-unpinned .usedmat-edge-left:hover,
.usedmat-shell.right-unpinned .usedmat-edge-right:hover {
  background: var(--active);
}

.usedmat-resizer,
.usedmat-horizontal-resizer {
  background: #eee8de;
  cursor: col-resize;
  position: relative;
}

.usedmat-mobile-detail-resizer {
  display: none;
}

.usedmat-horizontal-resizer {
  cursor: row-resize;
  border-top: 1px solid #ddd3c4;
  border-bottom: 1px solid #ddd3c4;
}

.usedmat-resizer:hover,
.usedmat-horizontal-resizer:hover {
  background: #d8ccb9;
}

.usedmat-side,
.usedmat-center {
  min-height: 0;
  background: var(--panel);
  overflow: hidden;
}

.usedmat-side {
  min-width: 0;
  background: #fff;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.usedmat-right {
  grid-template-rows: auto minmax(0, 1fr);
}

.usedmat-detail-stack {
  min-height: 0;
  overflow: auto;
}

.usedmat-detail-stack .usedmat-detail,
.usedmat-detail-stack .usedmat-document-detail {
  overflow: visible;
}

.usedmat-side header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.usedmat-side header button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfaf7;
  color: #4b443b;
  cursor: pointer;
  padding: 0 12px;
  font: inherit;
  white-space: nowrap;
}

.usedmat-side header .text-button {
  min-width: 0;
  width: auto;
  font-weight: 400;
}

.usedmat-side header .icon-button {
  width: auto;
  height: auto;
  font-size: 16px;
  line-height: normal;
}

.usedmat-side header button.active {
  background: var(--active);
  border-color: var(--active-strong);
  font-weight: 650;
}

.usedmat-side-title {
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}

.usedmat-side-title span {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-side header b,
.usedmat-list-head h2,
.usedmat-detail h2,
.usedmat-assistant b,
.usedmat-source-box b,
.usedmat-docs b {
  font-weight: 760;
}

.usedmat-side header span,
.usedmat-list-head span,
.usedmat-detail p,
.usedmat-message small,
.usedmat-docs small {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-tree {
  min-height: 0;
  overflow: auto;
  padding: 8px 10px 14px;
}

.usedmat-tree.empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  padding: 14px;
}

.usedmat-tree-node {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  color: #4b443b;
  text-align: left;
  cursor: pointer;
}

.usedmat-tree-node:hover {
  background: #fbf8f1;
}

.usedmat-tree-node.active {
  background: var(--active);
}

.usedmat-tree-node b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.usedmat-tree-node.active b {
  font-weight: 650;
}

.usedmat-tree-node.level-1 { padding-left: 20px; }
.usedmat-tree-node.level-2 { padding-left: 34px; }
.usedmat-tree-node.level-3 { padding-left: 48px; }
.usedmat-tree-node.level-4 { padding-left: 62px; }
.usedmat-tree-node.level-5 { padding-left: 76px; }
.usedmat-tree-node.level-6 { padding-left: 90px; }

.usedmat-caret {
  color: var(--muted);
  text-align: center;
}

.usedmat-site-filter {
  margin: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.usedmat-site-filter b {
  color: #6f675e;
  font-size: 12px;
  text-transform: uppercase;
}

.usedmat-site-filter-item {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3f3932;
  font-size: 14px;
  cursor: pointer;
}

.usedmat-site-filter-item input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.usedmat-mobile-nav {
  display: none;
}

.usedmat-center {
  display: grid;
  grid-template-rows: minmax(0, calc(100% - var(--usedmat-assistant-height, 30%) - 6px)) 6px minmax(190px, var(--usedmat-assistant-height, 30%));
  overflow: hidden;
}

.usedmat-list-zone {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.usedmat-list-head {
  min-height: 58px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.usedmat-list-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.usedmat-list-action-group {
  display: grid;
  gap: 4px;
}

.usedmat-list-action-group > span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  text-align: left;
}

.usedmat-list-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.usedmat-list-actions .icon-button,
.usedmat-list-actions .icon-button.danger {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 0;
}

.usedmat-list-actions .icon-button.danger {
  border-color: #ead7d0;
  color: #9d3f2d;
}

.usedmat-list-actions .icon-button svg {
  width: 16px;
  height: 16px;
}

.usedmat-list-actions .icon-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.usedmat-lots {
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  user-select: none;
}

.usedmat-lots.table-scroll {
  overflow-x: auto;
}

.usedmat-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.usedmat-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  color: #5c5349;
  text-align: left;
  padding: 0 10px;
  font-weight: 650;
  white-space: nowrap;
  overflow: visible;
  box-sizing: border-box;
}

.usedmat-th-label {
  width: calc(100% - 12px);
  height: 34px;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  min-width: 0;
}

.usedmat-th-label span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usedmat-col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
}

.usedmat-col-resizer:hover {
  background: rgba(45, 110, 163, .18);
}

.usedmat-table td {
  height: 54px;
  border-bottom: 1px solid #f0ebe4;
  padding: 7px 10px;
  vertical-align: middle;
  overflow: visible;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.usedmat-table tbody tr {
  cursor: pointer;
}

.usedmat-table tbody tr:hover {
  background: #fbf8f1;
}

.usedmat-table tbody tr.selected {
  background: #f7f1e8;
}

.usedmat-row-check,
.usedmat-row-number {
  display: inline-grid;
  min-width: 0;
  width: 100%;
  place-items: center;
}

.usedmat-row-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.usedmat-row-number {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-expiry-marker {
  display: inline-grid;
  width: 100%;
  min-width: 24px;
  height: 30px;
  place-items: center;
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
  cursor: help;
}

.usedmat-expiry-marker.expired {
  color: #c63d32;
}

.usedmat-expiry-marker.expiring {
  color: #d77a00;
}

.usedmat-name-cell,
.usedmat-proof-cell {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 2px;
}

.usedmat-name-cell {
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
}

.usedmat-name-cell > span,
.usedmat-document-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.usedmat-hover-host {
  position: relative;
}

.usedmat-expand-material {
  width: 22px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #6e665d;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
}

.usedmat-name-cell b,
.usedmat-name-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usedmat-name-cell small {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-document-row td {
  height: 46px;
  background: #fcfaf6;
  color: #655d54;
}

.usedmat-document-row td:nth-child(4) {
  padding-left: 38px;
}

.usedmat-document-row.selected td {
  background: #f1eadf;
}

.usedmat-document-row.empty td {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-document-title b {
  font-size: 12px;
}

.usedmat-document-title small {
  color: var(--muted);
  font-size: 11px;
}

.usedmat-hover-popover {
  position: absolute;
  left: 0;
  top: calc(100% - 2px);
  z-index: 20;
  display: none;
  max-width: 280px;
  border: 1px solid #d9d1c4;
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: var(--shadow);
  padding: 8px;
}

.usedmat-hover-host > .usedmat-hover-popover,
.usedmat-proof-cell > .usedmat-hover-popover {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}

.usedmat-hover-popover.media {
  grid-template-columns: repeat(2, 86px);
  gap: 6px;
}

.usedmat-hover-overlay {
  position: fixed;
  left: 8px;
  top: 8px;
  z-index: 2300;
  display: none;
  width: max-content;
  max-width: min(360px, calc(100vw - 16px));
  max-height: min(310px, calc(100vh - 16px));
  overflow: auto;
  pointer-events: auto;
}

.usedmat-hover-popover.media a,
.usedmat-hover-proof-media a {
  display: block;
  width: 86px;
  height: 86px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--soft);
}

.usedmat-hover-popover.media img,
.usedmat-hover-popover.media i,
.usedmat-hover-proof-media img,
.usedmat-hover-proof-media i {
  width: 86px;
  height: 86px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--soft);
  overflow: hidden;
}

.usedmat-hover-popover.proof {
  gap: 5px;
  white-space: normal;
  line-height: 1.35;
}

.usedmat-proof-date {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}

.usedmat-hover-proof-media {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.usedmat-hover-documents {
  display: grid;
  gap: 3px;
}

.usedmat-hover-documents a {
  color: var(--accent-strong);
  text-decoration: underline;
}

.usedmat-hover-popover.proof small {
  color: var(--muted);
}

.usedmat-lot {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(120px, 0.6fr) minmax(160px, 0.8fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
}

.usedmat-lot:hover,
.usedmat-lot.active {
  background: #fbfdf9;
}

.usedmat-lot.active {
  box-shadow: inset 4px 0 0 var(--accent);
}

.usedmat-lot b,
.usedmat-lot small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usedmat-lot small,
.usedmat-lot i {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.usedmat-assistant {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.usedmat-assistant-box,
.usedmat-source-box {
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.usedmat-assistant-box {
  border-right: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 8px;
}

.usedmat-assistant-box span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.usedmat-source-box {
  display: grid;
  gap: 8px;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
}

.usedmat-source-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-height: 33px;
  background: #fffdfa;
  border-bottom: 1px solid var(--line);
}

.usedmat-source-head > span {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.usedmat-chat-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0;
}

.usedmat-chat-tabs button {
  position: relative;
  min-height: 30px;
  border: 1px solid #cfc8bc;
  border-bottom-color: #cfc8bc;
  border-radius: 4px 4px 0 0;
  background: #ebe7df;
  color: #3f3932;
  cursor: pointer;
  padding: 0 12px;
  font: inherit;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

.usedmat-chat-tabs button + button {
  margin-left: -1px;
}

.usedmat-chat-tabs button:hover {
  background: #f6f3ee;
  color: #1f1d1a;
}

.usedmat-chat-tabs button:disabled,
.usedmat-chat-tabs button.disabled {
  opacity: .48;
  cursor: default;
}

.usedmat-chat-tabs button.active {
  background: #fff;
  border-color: #cfc8bc;
  border-bottom-color: #fff;
  color: #1f1d1a;
  font-weight: 700;
  z-index: 1;
  box-shadow: none;
}

.usedmat-chat-timeline {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 4px 4px 12px;
}

.usedmat-date-divider {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(20px, 1fr) auto minmax(20px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  background: #fffdfa;
  color: #8a8177;
  font-size: 12px;
}

.usedmat-date-divider span {
  height: 1px;
  background: #ebe4da;
}

.usedmat-date-divider b {
  font-weight: 600;
}

.usedmat-message-bubble {
  max-width: min(560px, 92%);
  border: 1px solid #e0d8cc;
  border-radius: 12px;
  background: #fff;
  padding: 9px 10px;
  display: grid;
  gap: 7px;
  cursor: grab;
  box-shadow: 0 1px 0 rgba(64, 48, 32, .03);
}

.usedmat-message-bubble:active {
  cursor: grabbing;
}

.usedmat-message-bubble.document {
  background: #fbf8f1;
}

.usedmat-message-bubble.linked {
  border-color: rgba(88, 121, 97, .42);
  background: #f7fbf3;
  box-shadow: inset 3px 0 0 rgba(88, 121, 97, .45), 0 1px 0 rgba(64, 48, 32, .03);
}

.usedmat-message-bubble header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.usedmat-message-bubble header > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.usedmat-message-bubble header em {
  border-radius: 999px;
  background: #e5efdf;
  color: #37613f;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  padding: 2px 7px;
  text-transform: uppercase;
}

.usedmat-message-bubble header b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #37613f;
  font-size: 13px;
}

.usedmat-message-bubble time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.usedmat-message-bubble p {
  margin: 0;
  color: #3f3932;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.usedmat-tg-link {
  border: 1px solid #dbe8f2;
  background: #f4faff;
  color: #2f6c9f;
}

.usedmat-tg-link svg {
  width: 16px;
  height: 16px;
}

.usedmat-chat-media {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  gap: 6px;
}

.usedmat-chat-media a {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--line);
}

.usedmat-chat-media img,
.usedmat-chat-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.usedmat-chat-docs {
  display: grid;
  gap: 6px;
}

.usedmat-chat-docs a,
.usedmat-message-bubble.document > a:not(.usedmat-tg-link) {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  color: inherit;
  text-decoration: none;
  padding: 8px 9px;
  display: grid;
  gap: 2px;
}

.usedmat-chat-docs small {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-message {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.2fr) auto;
  gap: 10px;
  align-items: center;
}

.usedmat-message p {
  margin: 0;
  color: #5f564c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usedmat-message time,
.usedmat-message em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.usedmat-detail {
  min-height: 0;
  padding: 14px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
}

.usedmat-document-detail {
  min-height: 0;
  padding: 14px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
}

.usedmat-document-detail.empty {
  color: var(--muted);
  line-height: 1.45;
}

.usedmat-document-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.usedmat-document-detail-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.usedmat-document-detail-head span {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-balances {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.usedmat-balances > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  align-items: baseline;
}

.usedmat-balances span,
.usedmat-balances small {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-balances small {
  grid-column: 2;
}

.usedmat-detail.empty {
  color: var(--muted);
  line-height: 1.45;
}

.usedmat-detail dl,
.usedmat-document-detail dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.usedmat-detail dl > div,
.usedmat-document-detail dl > div {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.usedmat-detail dt,
.usedmat-document-detail dt {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-detail dd,
.usedmat-document-detail dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.usedmat-edit-grid,
.usedmat-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.usedmat-edit-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.usedmat-edit-field.wide {
  grid-column: 1 / -1;
}

.usedmat-edit-field span {
  color: var(--muted);
  font-size: 12px;
}

.usedmat-edit-field input,
.usedmat-edit-field select,
.usedmat-edit-field textarea,
.usedmat-role-select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.usedmat-edit-field input,
.usedmat-edit-field select,
.usedmat-role-select {
  min-height: 34px;
  padding: 0 9px;
}

.usedmat-edit-field textarea {
  min-height: 72px;
  resize: vertical;
  padding: 8px 9px;
}

.usedmat-save {
  justify-self: start;
}

.usedmat-readonly {
  margin-top: 2px;
}

.usedmat-detail dl > .usedmat-inline-meta,
.usedmat-document-detail dl > .usedmat-inline-meta {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

.usedmat-inline-meta dt {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.usedmat-inline-meta dt em {
  font-style: italic;
}

.usedmat-inline-meta dd {
  min-width: 0;
}

.usedmat-location-fields:not([hidden]) {
  display: contents;
}

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

.usedmat-source-document a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usedmat-inline-delete {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid #efd6cd;
  border-radius: 7px;
  background: #fff9f6;
  color: #9f3b25;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.usedmat-inline-delete svg {
  width: 15px;
  height: 15px;
}

.usedmat-inline-delete span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.usedmat-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: #5f564c;
}

.usedmat-docs {
  display: grid;
  gap: 8px;
}

.usedmat-docs a {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  color: inherit;
  text-decoration: none;
}

.usedmat-attachments,
.usedmat-events {
  display: grid;
  gap: 8px;
}

.usedmat-attachments > b,
.usedmat-events > b {
  font-size: 14px;
}

.usedmat-attachment {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 28px;
  align-items: center;
  gap: 8px;
}

.usedmat-attachment.has-media {
  align-items: start;
}

.usedmat-linked-card {
  grid-template-columns: minmax(112px, 1fr) minmax(132px, .82fr);
}

.usedmat-attachment > span,
.usedmat-attachment > a {
  min-width: 0;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usedmat-linked-message {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.usedmat-linked-message > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usedmat-linked-media {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 6px;
}

.usedmat-linked-media a {
  width: 100%;
  min-height: 112px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
}

.usedmat-linked-media .photo-media,
.usedmat-linked-media img,
.usedmat-linked-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.usedmat-linked-controls {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
}

.usedmat-linked-caption {
  min-width: 0;
  margin: 0;
  color: #5f564c;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.usedmat-linked-card .usedmat-linked-caption {
  grid-column: 1;
}

.usedmat-linked-card > .usedmat-linked-controls {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.usedmat-control-button,
.usedmat-role-select {
  width: 100%;
  min-height: 34px;
  box-sizing: border-box;
}

.usedmat-control-button {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdfa;
  color: #3f3932;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.1;
  padding: 0 9px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.usedmat-control-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.usedmat-control-button.danger {
  border-color: #efd6cd;
  background: #fff8f4;
  color: #a94d32;
}

.usedmat-control-button.disabled {
  opacity: 0.52;
  pointer-events: none;
  cursor: default;
}

.usedmat-events small {
  color: #5f564c;
  line-height: 1.35;
}

.usedmat-link-dropzone {
  min-height: 76px;
  border: 1px dashed #cfc8bc;
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px;
  display: grid;
  gap: 6px;
  color: #5f564c;
}

.usedmat-link-dropzone.drag-over {
  border-color: var(--accent);
  background: #f4f9f0;
}

.usedmat-link-dropzone > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.usedmat-pending-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.usedmat-pending-links em {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: #f6f3ee;
  color: #4b443b;
  font-size: 12px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state.compact {
  min-height: 42px;
  padding: 10px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  background: #fbfaf8;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 750;
}

.data-table td b,
.data-table td small {
  display: block;
}

.data-table td small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.role-list {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.role-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #443f39;
  line-height: 1.25;
}

.role-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-strong);
}

.small-action,
.table-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 0 12px;
  font-weight: 650;
}

.small-action:hover:not(:disabled),
.table-actions button:hover:not(:disabled) {
  border-color: rgba(88, 121, 97, 0.42);
}

.small-action:disabled,
.table-actions button:disabled {
  color: #aaa29a;
  cursor: default;
  background: #f5f4f1;
}

.state-badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--muted);
  background: #fbfaf8;
  white-space: nowrap;
}

.state-badge.ok {
  color: var(--accent-strong);
  border-color: rgba(88, 121, 97, 0.24);
  background: #f5faf3;
}

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

.access-table th:not(:first-child),
.access-table td:not(:first-child) {
  min-width: 132px;
  text-align: center;
}

.access-table th:first-child,
.access-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 300px;
  min-width: 300px;
  background: var(--panel);
  box-shadow: 1px 0 0 var(--line);
}

.access-table th:first-child {
  z-index: 3;
  background: #fbfaf8;
}

.access-root-row td {
  background: #fffdfa;
}

.access-child-row td:first-child {
  background: var(--panel);
}

.resource-cell {
  min-height: 32px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.resource-cell.depth-1 {
  padding-left: 22px;
}

.resource-cell.depth-2 {
  padding-left: 44px;
}

.resource-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.tree-toggle {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.tree-toggle:hover:not(:disabled) {
  background: var(--active);
}

.tree-toggle:disabled {
  cursor: default;
}

.access-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.access-icon {
  position: relative;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #a9a29a;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.access-icon[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 5px);
  z-index: 40;
  min-width: max-content;
  border: 1px solid #ded8cf;
  border-radius: 4px;
  padding: 4px 7px;
  background: #fffdfa;
  color: #3f3932;
  box-shadow: 0 1px 3px rgba(39, 35, 30, 0.08);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  white-space: nowrap;
}

.access-icon[data-tooltip]:hover::after,
.access-icon[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.access-icon:hover:not(:disabled) {
  border-color: var(--line);
  background: #fbfaf8;
  color: #514b44;
}

.access-icon:disabled {
  cursor: default;
}

.access-icon:disabled:not(.selected) {
  opacity: 0.45;
}

.access-icon.selected {
  border-color: currentColor;
  background: #fff;
  opacity: 1;
}

.access-icon.state-enabled.selected {
  color: var(--accent-strong);
  background: #f5faf3;
}

.access-icon.state-disabled.selected {
  color: var(--warn);
  background: #fffaf0;
}

.access-icon.state-hidden.selected {
  color: #6f675f;
  background: #f5f4f1;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.table-actions .primary-action {
  color: #ffffff;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.table-note,
.empty-state {
  margin: 0;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.employee-directory {
  display: grid;
  gap: 0;
}

.employee-filter {
  position: relative;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf8;
}

.department-picker {
  width: min(360px, 100%);
  min-height: 38px;
  border: 1px solid rgba(88, 121, 97, 0.24);
  border-radius: 8px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 12px;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 750;
}

.department-menu {
  position: absolute;
  left: 12px;
  top: calc(100% - 7px);
  z-index: 35;
  width: min(460px, calc(100vw - 52px));
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
}

.department-menu.open {
  display: grid;
}

.department-option {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 0 8px 0 calc(8px + var(--depth) * 18px);
  color: #4f4942;
  cursor: pointer;
  text-align: left;
}

.department-option:hover,
.department-option.active {
  background: var(--active);
}

.department-option b {
  color: var(--muted);
  font-size: 12px;
}

.department-tree-icon {
  color: var(--muted);
  font-size: 11px;
}

.employee-list-shell {
  display: grid;
}

.employee-list-head,
.employee-row-card {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(180px, 1fr) minmax(180px, 1fr) 132px;
  gap: 14px;
  align-items: center;
}

.employee-list-head {
  min-height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #fbfaf8;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.employee-list {
  display: grid;
}

.employee-row-card {
  width: 100%;
  min-height: 66px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
}

.employee-row-card:hover {
  background: #fbfdf9;
}

.employee-person {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.employee-person b,
.employee-person small,
.employee-contact,
.employee-department {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-person b {
  display: block;
  font-size: 14px;
}

.employee-person small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.employee-avatar,
.employee-photo {
  border-radius: 50%;
  background: var(--active);
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-weight: 800;
  overflow: hidden;
}

.employee-avatar {
  width: 42px;
  height: 42px;
  font-size: 12px;
}

.employee-avatar img,
.employee-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-contact,
.employee-department {
  color: #4f4942;
  font-size: 13px;
}

.employee-tg-status {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: var(--muted);
  background: #fbfaf8;
  font-size: 12px;
  font-weight: 700;
}

.employee-tg-status.online {
  color: var(--accent-strong);
  border-color: rgba(88, 121, 97, 0.28);
  background: #f5faf3;
}

.employee-tg-status.recent {
  color: var(--warn);
  border-color: rgba(154, 101, 0, 0.24);
  background: #fffaf0;
}

.employee-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(33, 28, 22, 0.24);
  display: grid;
  place-items: center;
  padding: 24px;
}

.employee-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdfa;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  padding: 22px;
}

.employee-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.employee-photo {
  width: 150px;
  height: 150px;
  align-self: start;
  font-size: 36px;
}

.employee-body {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.employee-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-right: 38px;
}

.employee-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.employee-fields {
  display: grid;
  gap: 8px;
  margin: 0;
}

.employee-fields div {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 12px;
  min-height: 30px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.employee-fields dt {
  color: var(--muted);
  font-size: 12px;
}

.employee-fields dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.employee-fields a,
.employee-activity-row {
  color: var(--accent-strong);
}

.employee-activity,
.employee-role-badges {
  display: grid;
  gap: 8px;
}

.employee-activity h3,
.employee-role-badges h3 {
  margin: 0;
  font-size: 14px;
}

.employee-activity-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 10px;
  background: #fff;
  text-decoration: none;
}

.employee-activity-row span,
.employee-activity-row small {
  color: var(--muted);
}

.employee-role-badges .state-badge {
  margin: 0 6px 6px 0;
}

.employee-role-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

body[data-view="employees"] .topbar {
  display: none;
}

body[data-view="employees"] .workspace {
  padding-top: 28px;
  overflow: hidden;
}

body[data-view="employees"] #employeesView {
  height: 100%;
  min-height: 0;
}

body[data-view="employees"] #employeesView .workband {
  height: 100%;
  min-height: 0;
  margin-top: 0;
}

body[data-view="employees"] #employeesView .workband-head {
  display: none;
}

body[data-view="employees"] #employeesPanel {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.nav-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.employee-sidebar-tree {
  margin: 4px 0 8px 8px;
  padding-left: 12px;
  padding-right: 4px;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 2px;
  max-height: none;
  overflow: visible;
}

.org-node {
  min-height: 28px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) minmax(28px, auto);
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: #4d463e;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.org-node:hover {
  background: var(--soft);
}

.org-node.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 650;
}

.org-node.level-1 { padding-left: 18px; }
.org-node.level-2 { padding-left: 28px; }
.org-node.level-3 { padding-left: 38px; }

.org-caret {
  color: #8a8176;
  display: grid;
  place-items: center;
}

.org-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-count {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
}

.employee-directory {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
}

.employees-summary {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 14;
}

.employees-summary b {
  font-size: 15px;
}

.birthday-inline {
  display: grid;
  grid-template-columns: auto 30px auto 30px;
  align-items: center;
  gap: 10px;
  color: #5f564c;
  font-size: 13px;
  white-space: nowrap;
}

.date-button,
.mini-button {
  height: 30px;
  border: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: #5f564c;
}

.date-button {
  min-width: 86px;
  padding: 0 12px;
  font-weight: 650;
}

.mini-button {
  width: 30px;
}

.employee-filter {
  display: none;
}

.employee-list-shell {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: auto;
  box-shadow: 0 8px 24px rgba(80, 70, 58, 0.05);
}

.identity-requests-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fffaf1;
}

.identity-requests-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
}

.identity-requests-head span {
  min-width: 26px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #eadbc5;
  color: #5b4934;
  font-size: 12px;
  font-weight: 750;
}

.identity-requests-note,
.identity-requests-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.identity-requests-empty {
  min-height: 42px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fffdf9;
}

.identity-request-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(220px, 1.3fr) minmax(220px, 1.2fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.identity-request-person,
.identity-request-select,
.identity-request-roles {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.identity-request-person b,
.identity-request-person span,
.identity-request-person small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-request-person span,
.identity-request-person small,
.identity-request-select span,
.identity-request-roles > span {
  color: var(--muted);
  font-size: 12px;
}

.identity-request-select select {
  min-height: 34px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.identity-request-roles .role-list {
  gap: 8px 12px;
}

.role-check.compact {
  font-size: 12px;
}

.identity-request-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-action.danger {
  color: #8a3d2f;
}

.employee-list-head,
.employee-row-card {
  display: grid;
  grid-template-columns: 2.15fr 1.18fr 1.15fr 1.35fr;
  gap: 14px;
  align-items: center;
  padding: 0 18px;
}

.employee-list-head {
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #fbfaf7;
  position: sticky;
  top: 0;
  z-index: 3;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.employee-row-card {
  min-height: 70px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.employee-row-card:hover {
  background: #fffdf9;
}

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

.employee-person {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.employee-person b {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-avatar {
  width: 44px;
  height: 44px;
  font-size: 12px;
}

.employee-position-cell {
  min-width: 0;
  overflow: hidden;
  color: #3f3932;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-contact {
  display: grid;
  gap: 4px;
  color: #4f4942;
  font-size: 13px;
}

.employee-contact span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-tg-status.status {
  width: fit-content;
  max-width: 100%;
  border: 0;
  border-radius: 999px;
  justify-content: flex-start;
  padding: 5px 9px;
  background: var(--soft);
  color: #5e564c;
  white-space: nowrap;
}

.employee-tg-status.online {
  background: rgba(96, 115, 99, 0.16);
  color: #465b49;
}

.employee-tg-status.recent {
  background: var(--soft);
  color: #5e564c;
}

.employee-panel {
  width: 430px;
  max-height: calc(100vh - 64px);
  border-radius: 10px;
  overflow: hidden;
  background: #fffdfa;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(28, 24, 18, 0.28);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.employee-close {
  top: 10px;
  right: 10px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.86);
}

.employee-photo {
  width: 100%;
  height: 380px;
  flex: 0 0 380px;
  border-radius: 0;
  background: #d7d0c4;
  font-size: 30px;
}

.employee-photo-initials {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
}

.employee-body {
  --employee-title-scrollbar-gutter: 17px;
  padding: 20px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  max-height: calc(100vh - 64px - 380px);
  display: grid;
  gap: 14px;
}

.employee-title {
  display: block;
  width: calc(100% + 40px + var(--employee-title-scrollbar-gutter));
  margin-left: -20px;
  padding: 0 20px;
  box-sizing: border-box;
  text-align: center;
}

.employee-title > div {
  width: 100%;
  max-width: 100%;
  margin: 0;
  display: block;
  text-align: center;
}

.employee-title h2 {
  width: 100%;
  max-width: 100%;
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 650;
  text-align: center;
}

.employee-title p {
  width: 100%;
  max-width: 100%;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.employee-title .state-badge {
  display: none;
}

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

.employee-fields div {
  display: block;
  min-height: 0;
  border-bottom: 0;
}

.employee-fields dt {
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.employee-fields dd {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.telegram-link {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #426b89;
  background: #f8fbfd;
  text-decoration: none;
  font-weight: 650;
  font-size: 13px;
}

.telegram-link.disabled {
  color: var(--muted);
  pointer-events: none;
  opacity: 0.55;
}

.employee-activity {
  display: grid;
  gap: 9px;
}

.employee-activity h3 {
  margin: 0;
  font-size: 13px;
}

.employee-activity-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  color: inherit;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 8px;
  text-decoration: none;
}

.employee-activity-row .chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--active);
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
}

.employee-activity-row .chat-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.employee-activity-row b,
.employee-activity-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.employee-activity-row small,
.employee-activity-row time {
  color: var(--muted);
  font-size: 12px;
}

.employee-role-badges {
  display: grid;
  gap: 9px;
}

.employee-role-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.employee-role-header h3,
.employee-activity h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.25;
}

.employee-role-header .small-action {
  min-height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

.employee-role-badges .role-list {
  gap: 7px;
  min-width: 0;
}

.employee-role-badges .role-check {
  gap: 8px;
  color: #5f564c;
  font-size: 13px;
  font-weight: 400;
}

.employee-role-badges .role-check input {
  width: 15px;
  height: 15px;
}

.employee-invite-box {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.employee-invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.employee-invite-url {
  display: grid;
  gap: 5px;
}

.employee-invite-url span {
  color: var(--text);
  font-weight: 700;
}

.employee-invite-url input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.profile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(33, 28, 22, 0.22);
  display: grid;
  place-items: center;
  padding: 24px;
}

.profile-panel {
  width: min(520px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.profile-panel header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.icon-button.danger {
  width: 28px;
  height: 28px;
  border: 1px solid #ead7d0;
  background: #fff4ef;
  color: #9d3f2d;
  font-size: 18px;
}

.profile-card {
  margin: 18px 20px 14px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.profile-avatar {
  width: 46px;
  height: 46px;
}

.profile-card div:last-child {
  display: grid;
  gap: 4px;
}

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

.profile-fields {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 20px 14px;
}

.profile-fields div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  min-height: 32px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.profile-fields dt {
  color: var(--muted);
  font-size: 12px;
}

.profile-fields dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.profile-actions {
  display: grid;
  gap: 8px;
  padding: 0 20px 18px;
}

.profile-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 650;
}

.profile-actions button:hover:not(:disabled) {
  border-color: rgba(88, 121, 97, 0.42);
}

.profile-actions button:disabled {
  color: #aaa29a;
  cursor: default;
  background: #f5f4f1;
}

.profile-actions .primary-action {
  color: #ffffff;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.profile-message {
  min-height: 20px;
  margin: 0;
  padding: 0 20px 20px;
  color: var(--warn);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    max-height: 190px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 14px 18px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(136px, auto);
    grid-template-areas:
      "brand user"
      "menu menu";
    gap: 10px 12px;
    align-items: center;
    overflow: hidden;
    transition: max-height 0.22s ease, padding 0.22s ease, box-shadow 0.22s ease;
    touch-action: pan-y;
  }

  .brand {
    grid-area: brand;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    transition: opacity 0.12s ease, transform 0.12s ease;
  }

  .brand-mark {
    width: 64px;
    height: 34px;
    flex: 0 0 auto;
  }

  .brand-title {
    font-size: 15px;
    line-height: 1.08;
    min-width: 0;
  }

  .main-menu {
    grid-area: menu;
    display: flex;
    overflow-x: auto;
    padding: 0 0 2px;
    transition: opacity 0.12s ease, transform 0.12s ease;
  }

  .nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .nav-label {
    display: none;
  }

  .current-user {
    grid-area: user;
    width: min(178px, 100%);
    justify-self: end;
    margin-top: 0;
    border: 0;
    border-radius: 10px;
    padding: 5px 6px;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    background: #fbfaf8;
    transition: opacity 0.12s ease, transform 0.12s ease;
  }

  .current-avatar {
    width: 34px;
    height: 34px;
  }

  .current-user-text b {
    font-size: 12px;
  }

  .current-user-text span {
    font-size: 10px;
  }

  .mobile-header-handle {
    position: absolute;
    left: 50%;
    bottom: 2px;
    z-index: 3;
    width: 72px;
    height: 16px;
    border: 0;
    border-radius: 999px;
    display: grid;
    place-items: center;
    padding: 0;
    background: transparent;
    cursor: pointer;
    transform: translateX(-50%);
    touch-action: none;
  }

  .mobile-header-handle::before {
    content: "";
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: #d6d0c7;
    box-shadow: 0 1px 2px rgba(39, 35, 30, 0.08);
  }

  .sidebar.is-collapsed {
    max-height: 22px;
    padding-top: 0;
    padding-bottom: 22px;
    box-shadow: 0 8px 18px rgba(39, 35, 30, 0.08);
  }

  .sidebar.is-collapsed .brand,
  .sidebar.is-collapsed .main-menu,
  .sidebar.is-collapsed .current-user {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
  }

  .sidebar.is-collapsed .mobile-header-handle::before {
    background: #c9c2b8;
  }

  .workspace {
    height: auto;
    overflow: visible;
    padding: 18px 14px 28px;
  }

  body[data-view="used_materials"] .sidebar {
    display: grid;
    max-height: 228px;
  }

  body[data-view="used_materials"] .sidebar.is-collapsed {
    max-height: 22px;
    padding-top: 0;
    padding-bottom: 22px;
  }

  body[data-view="used_materials"] .main-menu {
    overflow: hidden;
  }

  .usedmat-mobile-nav {
    width: 100%;
    min-width: 0;
    display: grid;
    gap: 5px;
  }

  .usedmat-mobile-tabs,
  .usedmat-mobile-categories,
  .usedmat-mobile-sites {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    padding: 0 0 2px;
  }

  .usedmat-mobile-tabs button,
  .usedmat-mobile-categories button {
    flex: 0 0 auto;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 12px;
    background: #fff;
    color: #514b44;
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
  }

  .usedmat-mobile-tabs button {
    font-weight: 650;
  }

  .usedmat-mobile-tabs .usedmat-mobile-back {
    width: 34px;
    padding: 0;
    display: grid;
    place-items: center;
  }

  .usedmat-mobile-back svg {
    width: 17px;
    height: 17px;
  }

  .usedmat-mobile-tabs button.active,
  .usedmat-mobile-categories button.active {
    border-color: #cad6c7;
    background: var(--active);
    color: #2f2b26;
  }

  .usedmat-mobile-sites {
    gap: 14px;
    min-height: 28px;
  }

  .usedmat-mobile-sites label {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #514b44;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
  }

  .usedmat-mobile-sites input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--accent);
  }

  body[data-view="used_materials"] .workspace {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
    padding: 8px 10px 10px;
  }

  body[data-view="used_materials"] .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body[data-view="used_materials"] .sidebar {
    flex: 0 0 auto;
  }

  body[data-view="used_materials"] #usedMaterialsView,
  body[data-view="used_materials"] #usedMaterialsView .workband {
    height: 100%;
    min-height: 0;
  }

  body[data-view="used_materials"] #usedMaterialsView .workband {
    margin: 0;
  }

  body[data-view="used_materials"] #usedMaterialsView .workband-head {
    display: none;
  }

  .usedmat-panel {
    height: 100%;
    min-height: 0;
  }

  .usedmat-shell {
    height: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(190px, var(--usedmat-mobile-list-height, 54%)) 18px minmax(0, 1fr);
    border-radius: 8px;
    overflow: hidden;
  }

  .usedmat-shell.mobile-detail-collapsed {
    grid-template-rows: minmax(0, 1fr) 22px 0;
  }

  .usedmat-shell.left-unpinned.right-pinned,
  .usedmat-shell.left-pinned.right-unpinned,
  .usedmat-shell.left-unpinned.right-unpinned {
    grid-template-columns: minmax(0, 1fr);
  }

  .usedmat-shell.left-unpinned .usedmat-left,
  .usedmat-shell.right-unpinned .usedmat-right {
    position: static;
    width: auto;
    transform: none;
    box-shadow: none;
  }

  .usedmat-edge,
  .usedmat-resizer,
  .usedmat-horizontal-resizer {
    display: none !important;
  }

  .usedmat-left {
    display: none !important;
  }

  .usedmat-center {
    grid-column: 1 !important;
    grid-row: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .usedmat-list-zone {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  .usedmat-list-head {
    align-items: stretch;
    flex-direction: column;
  }

  .usedmat-list-actions {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .usedmat-lots {
    min-height: 0;
    max-height: none;
  }

  .usedmat-mobile-detail-resizer {
    grid-column: 1;
    grid-row: 2;
    z-index: 3;
    width: 100%;
    height: 18px;
    border: 0;
    border-top: 1px solid #ddd3c4;
    border-bottom: 1px solid #ddd3c4;
    display: grid;
    place-items: center;
    padding: 0;
    background: #f2eee7;
    cursor: row-resize;
    touch-action: none;
  }

  .usedmat-mobile-detail-resizer span {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: #c9c2b8;
    box-shadow: 0 1px 2px rgba(39, 35, 30, 0.08);
  }

  .usedmat-shell.mobile-detail-collapsed .usedmat-mobile-detail-resizer {
    height: 22px;
    cursor: pointer;
    box-shadow: 0 -8px 18px rgba(39, 35, 30, 0.08);
  }

  .usedmat-right {
    grid-column: 1 !important;
    grid-row: 3;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    max-height: none;
    overflow: hidden;
    border-top: 0;
  }

  .usedmat-shell.mobile-detail-collapsed .usedmat-right {
    display: none;
  }

  .usedmat-right header [data-usedmat-pin="right"] {
    display: none;
  }

  .usedmat-detail-stack {
    min-height: 0;
    overflow: auto;
  }

  .usedmat-lot {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .usedmat-assistant {
    display: none;
  }

  .usedmat-assistant-box {
    display: none;
  }

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

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

  .topbar-actions {
    justify-content: flex-start;
  }

  .summary-grid,
  .module-grid,
  .placeholder-grid {
    grid-template-columns: 1fr;
  }

  .tg-monitor-grid,
  .tg-activity-row {
    grid-template-columns: 1fr;
  }

  .tg-monitor-stat {
    min-height: 76px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tg-monitor-stat:last-child {
    border-bottom: 0;
  }

  .tg-activity-row {
    align-items: start;
    gap: 6px;
  }

  .tg-activity-row > span:nth-child(2) {
    white-space: normal;
  }

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

  .segmented-control {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

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

  .photobank-meta {
    min-height: 120px;
    padding: 10px;
  }

  body[data-view="photos"] .workspace {
    padding-top: 18px;
    overflow: visible;
  }

  body[data-view="photos"] #photosView,
  body[data-view="photos"] #photosView .workband,
  body[data-view="photos"] #photosPanel {
    height: auto;
  }

  .photo-sidebar-tree {
    display: none;
  }

  .photobank-layout {
    height: auto;
    overflow: visible;
  }

  .photobank-work {
    height: auto;
    overflow: visible;
  }

  .photo-head {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .photo-filters {
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .comment-toggle,
  .date-mode.ghost {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .date-popover {
    position: static;
    width: 100%;
    box-shadow: none;
    grid-column: 1 / -1;
  }

  .photo-feed {
    overflow: visible;
    padding-right: 0;
  }

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

  .comments-mode .photo-card {
    min-height: 250px;
    grid-template-rows: 140px auto;
  }

  .comments-mode .photo-card img,
  .comments-mode .photo-card video,
  .comments-mode .photo-missing {
    height: 140px;
  }

  .comments-mode .photo-card time {
    top: 140px;
  }

  .comments-mode .video-card-progress {
    top: 130px;
  }

  .photo-modal-backdrop {
    padding: 10px;
    place-items: stretch;
  }

  .photo-viewer {
    width: 100%;
    height: calc(100vh - 20px);
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 96px;
  }

  .photo-thumbs-panel {
    order: 2;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    grid-template-rows: 1fr;
    gap: 6px;
    padding: 8px;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .photo-thumbs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    height: auto;
    padding: 4px;
    margin-right: 0;
  }

  .photo-thumbs button {
    width: 70px;
    min-width: 70px;
    height: 70px;
    min-height: 70px;
  }

  .photo-thumbs button.active {
    width: 78px;
    min-width: 78px;
    height: 78px;
    min-height: 78px;
  }

  .photo-details {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
    max-height: 220px;
    overflow: auto;
  }

  .photo-main-time {
    left: 10px;
    bottom: 10px;
  }

  .usedmat-viewer-backdrop,
  .usedmat-media-viewer {
    overscroll-behavior: none;
  }

  .usedmat-media-viewer .photo-large {
    touch-action: none;
    overscroll-behavior: none;
  }

  .usedmat-media-viewer .photo-thumbs {
    touch-action: pan-x;
    overscroll-behavior-x: contain;
  }

  .usedmat-media-viewer .photo-details {
    touch-action: pan-y;
    overscroll-behavior: contain;
  }

  .usedmat-media-viewer .photo-nav {
    top: 50%;
    bottom: auto;
    width: 44px;
    height: 64px;
    margin: -32px 0 0;
  }

  .usedmat-media-viewer .photo-nav.prev {
    left: 8px;
  }

  .usedmat-media-viewer .photo-nav.next {
    left: auto;
    right: 8px;
  }

  body[data-view="employees"] .workspace {
    padding-top: 18px;
    overflow: visible;
  }

  body[data-view="employees"] #employeesView {
    height: auto;
  }

  body[data-view="employees"] #employeesView .workband {
    height: auto;
  }

  body[data-view="employees"] #employeesPanel {
    height: auto;
  }

  .employee-sidebar-tree {
    display: none;
  }

  .employee-directory {
    height: auto;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
  }

  .employees-summary {
    display: none;
  }

  .employee-filter {
    display: block;
    position: sticky;
    top: 0;
    z-index: 12;
    padding: 0;
    border-bottom: 0;
    background: transparent;
  }

  .department-picker {
    width: 100%;
  }

  .department-menu {
    left: 12px;
    width: calc(100vw - 52px);
    max-height: min(420px, calc(100vh - 180px));
  }

  .employee-list-head {
    display: none;
  }

  .identity-requests-panel {
    padding: 10px;
  }

  .identity-request-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .identity-request-actions {
    justify-content: stretch;
  }

  .identity-request-actions .small-action {
    flex: 1;
  }

  .employee-row-card {
    min-height: 82px;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 12px 14px;
  }

  .employee-contact,
  .employee-position-cell {
    padding-left: 52px;
  }

  .employee-tg-status {
    justify-self: start;
    margin-left: 52px;
  }

  .employee-panel {
    width: 100%;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
  }

  .employee-photo {
    width: 100%;
    height: min(320px, 52vh);
    flex-basis: min(320px, 52vh);
  }

  .employee-body {
    max-height: calc(100vh - 32px - min(320px, 52vh));
  }

  .employee-title {
    width: 100%;
    margin-left: 0;
    padding: 0;
  }

  .employee-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 14px;
  }

  .employee-fields div {
    gap: 4px;
  }
}
