#view-exon-works .hero {
  padding-bottom: 12px;
}

#view-exon-works > .panel {
  min-width: 0;
}

.works-muted {
  color: var(--muted, #68746e);
  font-size: 12px;
}

.works-registry-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 10px 0 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.works-registry-toolbar > button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.works-search-field {
  display: flex;
  flex: 1 1 220px;
  align-items: center;
  min-width: 190px;
  max-width: 320px;
  min-height: 40px;
  padding: 0 5px 0 12px;
  border: 1px solid #cfd9d3;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(28 45 36 / 7%);
}

.works-search-field:focus-within {
  border-color: var(--accent, #34785a);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #34785a) 14%, transparent);
}

.works-search-field > span {
  flex: 0 0 auto;
  padding-right: 10px;
  border-right: 1px solid #e0e6e2;
  color: #52645a;
  font-size: 12px;
  font-weight: 700;
}

.works-search-field > input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
}

.works-search-field > input:focus {
  border: 0;
  box-shadow: none;
  outline: 0;
}

#exonWorksStatusText:empty {
  display: none;
}

.works-cell-legend {
  margin: 2px 0 8px;
  padding: 8px 10px;
  border: 1px solid #e0e6e2;
  border-radius: 6px;
  background: #fafcfb;
}

.works-context-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: #58655f;
  font-size: 12px;
}

.works-selection-count {
  margin-left: auto;
  padding: 5px 9px;
  border: 1px solid #d7e0da;
  border-radius: 5px;
  background: #f6f9f7;
  color: #45564d;
  font-weight: 700;
}

.works-registry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 500px;
  border-top: 1px solid #dce3df;
}

.works-registry-layout.chat-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.works-table-area {
  min-width: 0;
}

.works-table-area .exon-works-table-wrap {
  min-height: 420px;
  max-height: 72vh;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.works-registry-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.works-registry-table .works-selection-col {
  width: 44px;
}

.works-registry-table .works-structure-col {
  width: 260px;
}

.works-registry-table .works-name-col {
  width: 300px;
}

.works-registry-table .works-normative-col {
  width: 380px;
}

.works-registry-table .works-data-col {
  width: 180px;
}

.works-registry-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f2f5f3;
  font-size: 12px;
}

.works-registry-table td {
  min-width: 170px;
  font-size: 13px;
}

.works-registry-table .works-selection-column {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
  border-right: 1px solid #d6dfda;
  background: #f7f9f8;
  text-align: center;
}

.works-registry-table th.works-selection-column,
.works-registry-table td.works-selection-column {
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  padding: 0 !important;
}

.works-registry-table th.works-selection-column {
  z-index: 6;
  background: #edf2ef;
}

.works-registry-table .works-structure-column,
.works-registry-table .works-structure-document-cell {
  position: sticky;
  left: 44px;
  width: 260px;
  min-width: 260px;
  max-width: 340px;
  border-right: 1px solid #cfdad4;
  background: #fff;
  box-shadow: 5px 0 9px rgb(22 39 30 / 6%);
}

.works-registry-table .works-structure-column {
  z-index: 5;
  background: #edf2ef;
}

.works-structure-document-cell {
  z-index: 2;
  padding-left: calc(12px + var(--tree-depth, 0) * var(--hierarchy-indent, 22px)) !important;
  color: #253c31;
  font-weight: 700;
  cursor: grab;
  overflow-wrap: anywhere;
}

.works-registry-table tr.selected .works-selection-column,
.works-registry-table tr.selected .works-structure-document-cell {
  background: color-mix(in srgb, var(--accent, #34785a) 10%, #fff);
}

.works-registry-table td[data-column="Наименование работы"] {
  min-width: 300px;
}

.works-registry-table .works-folder-row td {
  padding: 0;
  background: #edf4f0;
  border-bottom: 1px solid #d8e5dd;
}

.works-registry-table .works-folder-row .works-selection-column {
  background: #e4eee8;
}

.works-registry-table .works-folder-row.active-folder td {
  background: #dceee3;
}

.works-registry-table .works-folder-row.folder-drop-target td {
  background: #cfebda;
  box-shadow: inset 0 0 0 2px var(--accent, #34785a);
}

.works-folder-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  width: min(760px, 85vw);
  min-height: 44px;
  padding: 4px 12px 4px calc(8px + var(--tree-depth, 0) * var(--hierarchy-indent, 22px));
}

.works-folder-title {
  min-width: 0;
  padding: 6px;
  border: 0;
  background: none;
  color: #264b39;
  font-weight: 700;
  text-align: left;
  overflow-wrap: anywhere;
}

.works-tree-toggle {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #b9d0c3;
  border-radius: 6px;
  background: #f8fbf9;
  color: #34785a;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.works-tree-toggle.no-children {
  visibility: hidden;
}

.works-folder-action {
  min-height: 30px;
  padding: 4px 7px;
  border: 0;
  background: transparent;
  color: #5c6c63;
  font-size: 11px;
}

.works-folder-action:hover {
  background: #fff;
  color: #245f43;
}

.works-toolbar-popover {
  position: fixed;
  inset: auto;
  width: min(330px, calc(100vw - 24px));
  max-height: min(500px, calc(100vh - 24px));
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid #d7e0da;
  border-radius: 7px;
  background: white;
  color: var(--text);
  box-shadow: 0 12px 34px rgb(23 43 31 / 18%);
}

.works-columns-popover label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 6px 0;
  font-size: 12px;
}

.works-actions-popover:popover-open {
  display: grid;
  gap: 4px;
}

.works-actions-popover button {
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  padding: 7px 10px;
  border-color: transparent;
  font-size: 12px;
  text-align: left;
  white-space: normal;
}

.works-actions-popover button:hover {
  border-color: #d4dfd8;
  background: #f4f8f5;
}

.works-actions-popover .danger-button {
  margin-top: 5px;
  border-top-color: #edcaca;
}

.works-assistant {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 500px;
  max-height: 72vh;
  border-left: 1px solid #dce3df;
  background: #f9fbfa;
}

.works-assistant[hidden] {
  display: none;
}

.works-assistant-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e1e7e3;
}

.works-assistant-heading strong {
  font-size: 14px;
}

.works-assistant-heading span {
  display: block;
  margin-top: 3px;
  color: #758078;
  font-size: 12px;
}

.works-chat-messages {
  flex: 1;
  min-height: 120px;
  padding: 16px;
  overflow-y: auto;
}

.works-chat-empty {
  margin-top: 64px;
  color: #78837c;
  font-size: 14px;
  text-align: center;
}

.works-chat-message {
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.works-chat-message strong {
  color: #61796b;
  font-size: 11px;
}

.works-chat-message.user {
  padding-left: 10px;
  border-left: 2px solid #9bbab0;
}

.works-chat-proposal {
  max-height: 280px;
  padding: 12px 16px;
  overflow: auto;
  border-top: 1px solid #dce3df;
  background: #f0f6f2;
  font-size: 12px;
}

.works-chat-proposal ul {
  padding-left: 18px;
}

.works-chat-proposal li {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.works-chat-proposal button {
  margin: 4px 5px 0 0;
}

.works-chat-status {
  padding: 0 16px;
  color: #94631b;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.works-chat-form {
  display: grid;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e1e7e3;
}

.works-chat-form textarea {
  min-width: 0;
  max-height: 180px;
  resize: vertical;
  background: white;
  font-size: 13px;
}

.works-chat-form button {
  justify-self: end;
}

.works-folder-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid #dce3df;
  border-radius: 8px;
}

.works-folder-dialog::backdrop {
  background: #18241f66;
}

.works-folder-dialog .field {
  margin: 16px 0;
}

@media (max-width: 1100px) {
  .works-registry-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .works-assistant {
    min-height: 420px;
    max-height: 560px;
    border-top: 1px solid #dce3df;
    border-left: 0;
  }
}

@media (max-width: 600px) {
  .works-search-field {
    flex-basis: 260px;
  }

  .works-context-bar {
    align-items: flex-start;
    padding: 8px 0;
  }

  .works-selection-count {
    margin-left: 0;
  }

  .works-folder-bar {
    width: 90vw;
  }
}
