.documents-module {
  min-width: 0;
  padding: 18px;
  color: #263940;
}

.documents-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.documents-search,
.documents-filter {
  min-width: 0;
  min-height: 42px;
  border: 1px solid #d8e4e2;
  border-radius: 10px;
  background: #fff;
}

.documents-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 320px;
  max-width: 480px;
}

.documents-search svg {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #809097;
  stroke-width: 1.8;
}

.documents-search input {
  width: 100%;
  min-height: 40px;
  padding: 0 14px 0 40px;
  border: 0;
  outline: 0;
  background: transparent;
}

.documents-filter {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
}

.documents-filter > span {
  color: #74858c;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.documents-filter select {
  width: 124px;
  min-height: 40px;
  padding: 0 24px 0 0;
  border: 0;
  background-color: transparent;
  font-size: 12px;
}

.documents-status-tabs {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 3px;
  border: 1px solid #d8e4e2;
  border-radius: 10px;
  background: #f7faf9;
}

.documents-status-tabs button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #607279;
  font-size: 11px;
  font-weight: 700;
}

.documents-status-tabs button.active {
  background: #14877d;
  color: #fff;
  box-shadow: 0 2px 7px rgba(20, 135, 125, 0.18);
}

.documents-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid #dce7e5;
  border-radius: 12px;
  background: #fff;
}

.documents-metric {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 15px 18px;
  border-right: 1px solid #e3ebe9;
}

.documents-metric:last-child {
  border-right: 0;
}

.documents-metric > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #eaf6f3;
  color: #13857a;
}

.documents-metric.blue > span { background: #edf5fd; color: #347fc7; }
.documents-metric.purple > span { background: #f4effb; color: #8159bd; }
.documents-metric.orange > span { background: #fff4e9; color: #de7b28; }

.documents-metric svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.documents-metric small,
.documents-metric strong {
  display: block;
}

.documents-metric small {
  color: #73838a;
  font-size: 11px;
  font-weight: 700;
}

.documents-metric strong {
  margin-top: 4px;
  color: #243840;
  font-size: 25px;
  line-height: 1;
}

.documents-metric strong em {
  margin-left: 4px;
  color: #73838a;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.documents-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
  gap: 14px;
  min-height: 540px;
}

.documents-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dce7e5;
  border-radius: 12px;
  background: #fff;
}

.documents-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 14px 16px;
  border-bottom: 1px solid #e3ebe9;
}

.documents-panel-head h2 {
  font-size: 16px;
}

.documents-panel-head p {
  margin-top: 4px;
  color: #788990;
  font-size: 10px;
}

.documents-panel-head > strong {
  color: #137d73;
  font-size: 12px;
  white-space: nowrap;
}

.documents-list {
  max-height: 640px;
  overflow: auto;
}

.documents-file-row {
  display: grid;
  grid-template-columns: 46px minmax(190px, 1.5fr) minmax(110px, 0.72fr) 92px 68px 18px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 74px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid #e7eeed;
  background: #fff;
  color: #34474e;
  text-align: left;
}

.documents-file-row:hover,
.documents-file-row.selected {
  background: #f1f8f6;
}

.documents-file-row.selected {
  box-shadow: inset 3px 0 #14877d;
}

.documents-file-icon {
  position: relative;
  display: grid;
  width: 42px;
  height: 48px;
  place-items: center;
  border-radius: 9px;
  background: #eaf6f3;
  color: #14877d;
}

.documents-file-icon.policy,
.documents-file-icon.notice { background: #fff1ea; color: #d86a32; }
.documents-file-icon.form { background: #edf4fd; color: #347fc7; }
.documents-file-icon.training { background: #f4effb; color: #8159bd; }

.documents-file-icon svg {
  width: 19px;
  height: 19px;
  transform: translateY(-5px);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.documents-file-icon em {
  position: absolute;
  bottom: 4px;
  font-size: 7px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.documents-file-main,
.documents-file-department,
.documents-file-version {
  min-width: 0;
}

.documents-file-main strong,
.documents-file-main small,
.documents-file-department strong,
.documents-file-department small,
.documents-file-version strong,
.documents-file-version small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documents-file-main strong {
  color: #263a42;
  font-size: 12px;
}

.documents-file-main small,
.documents-file-department small,
.documents-file-version small {
  margin-top: 4px;
  color: #849298;
  font-size: 9px;
}

.documents-file-department strong,
.documents-file-version strong {
  color: #53666d;
  font-size: 10px;
}

.documents-file-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eaf7f2;
  color: #18815f;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.documents-file-status.archived {
  background: #f0f2f3;
  color: #748087;
}

.documents-file-arrow {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #8a989d;
  stroke-width: 1.8;
}

.documents-empty,
.documents-detail-empty {
  display: grid;
  min-height: 380px;
  padding: 32px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.documents-empty > span,
.documents-detail-empty > span {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 16px;
  background: #edf7f5;
  color: #16877d;
}

.documents-empty svg,
.documents-detail-empty svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.documents-empty h3,
.documents-detail-empty h3 {
  font-size: 15px;
}

.documents-empty p,
.documents-detail-empty p {
  margin: 7px 0 16px;
  color: #7d8c92;
  font-size: 10px;
}

.documents-detail-content {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 18px;
}

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

.documents-detail-head > div {
  min-width: 0;
}

.documents-detail-category {
  color: #14877d;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.documents-detail-head h2 {
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.35;
}

.documents-detail-head p {
  margin-top: 6px;
  color: #7d8c92;
  font-size: 9px;
  overflow-wrap: anywhere;
}

.documents-download-button {
  width: 100%;
  margin: 18px 0;
  text-decoration: none;
}

.documents-detail-meta {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px 12px;
  margin: 0;
  padding: 15px;
  border-radius: 10px;
  background: #f7faf9;
  font-size: 10px;
}

.documents-detail-meta dt {
  color: #839197;
}

.documents-detail-meta dd {
  margin: 0;
  color: #40545b;
  overflow-wrap: anywhere;
}

.documents-detail-section {
  padding: 16px 0;
  border-bottom: 1px solid #e5eceb;
}

.documents-detail-section h3 {
  margin-bottom: 8px;
  font-size: 12px;
}

.documents-detail-section > p {
  color: #62747b;
  font-size: 10px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.documents-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.documents-tags span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf6f4;
  color: #236d66;
  font-size: 9px;
}

.documents-history {
  display: grid;
  gap: 10px;
}

.documents-history > div {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 8px;
}

.documents-history > div > span {
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: #5da9a1;
}

.documents-history strong,
.documents-history small {
  display: block;
}

.documents-history strong { color: #53666d; font-size: 9px; }
.documents-history small { margin-top: 3px; color: #8a979c; font-size: 8px; }

.documents-detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: auto;
  padding-top: 18px;
}

.documents-detail-actions .btn.danger {
  border-color: #efcbc7;
  color: #b95850;
}

.documents-editor-dialog {
  width: min(820px, calc(100vw - 30px));
  max-height: min(92vh, 880px);
}

.documents-editor-dialog > form {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.documents-dialog-scroll {
  min-height: 0;
  overflow: auto;
  padding: 22px 24px 28px;
}

.documents-upload-section {
  margin-bottom: 18px;
}

.documents-upload-box {
  position: relative;
  display: grid;
  min-height: 112px;
  padding: 18px;
  place-items: center;
  align-content: center;
  border: 1px dashed #9cc8c3;
  border-radius: 12px;
  background: #f8fbfa;
  color: #147a71;
  cursor: pointer;
}

.documents-upload-box.has-file {
  min-height: 64px;
  grid-template-columns: 20px auto;
  gap: 8px;
}

.documents-upload-box svg {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.documents-upload-box.has-file svg { width: 18px; height: 18px; margin: 0; }
.documents-upload-box strong { font-size: 13px; }
.documents-upload-box > span { margin-top: 6px; color: #7b8d92; font-size: 9px; text-align: center; }
.documents-upload-box.has-file > span { display: none; }

.documents-upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 1px;
  min-height: 1px;
  overflow: hidden;
  opacity: 0;
}

.documents-upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  padding: 10px 12px;
  border: 1px solid #dce7e5;
  border-radius: 10px;
  background: #fff;
}

.documents-preview-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 9px;
  background: #eaf6f3;
  color: #147a71;
  font-size: 8px;
  font-weight: 800;
}

.documents-upload-preview div { min-width: 0; }
.documents-upload-preview strong,
.documents-upload-preview span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.documents-upload-preview strong { color: #3e5158; font-size: 11px; }
.documents-upload-preview span { margin-top: 4px; color: #839197; font-size: 9px; }

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

.documents-form-grid + .documents-form-grid {
  margin-top: 14px;
}

.documents-span-2 {
  grid-column: span 2;
}

.documents-visibility-panel {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #dce7e5;
  border-radius: 10px;
  background: #fbfcfc;
}

.documents-visibility-panel > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.documents-visibility-panel strong { font-size: 11px; }
.documents-visibility-panel > div:first-child span { color: #147a71; font-size: 10px; font-weight: 700; }

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

.documents-department-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 9px;
  border: 1px solid #dce7e5;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.documents-department-option:has(input:checked) {
  border-color: #74b8b0;
  background: #edf7f5;
  color: #126f67;
}

.documents-department-option input {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  min-width: 17px;
  min-height: 17px;
  margin: 0;
  padding: 0;
  accent-color: #14877d;
}

.documents-department-option span {
  min-width: 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.documents-editor-dialog .dialog-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 12px 18px;
  border-top: 1px solid #e1e9e8;
  background: #f8fbfa;
}

.documents-editor-dialog .dialog-actions .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 104px;
}

.documents-editor-dialog .dialog-actions .btn.primary {
  min-width: 148px;
}

@media (max-width: 1120px) {
  .documents-file-row {
    grid-template-columns: 46px minmax(170px, 1.4fr) minmax(100px, 0.7fr) 82px 18px;
  }

  .documents-file-status { display: none; }
}

@media (max-width: 980px) {
  .documents-toolbar { flex-wrap: wrap; }
  .documents-search { max-width: none; }
  .documents-status-tabs { margin-left: 0; }
  .documents-workspace { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .documents-detail-panel { min-height: 420px; }
  .documents-list { max-height: none; }
}

@media (max-width: 760px) {
  .documents-module { padding: 12px; }
  .documents-search { flex-basis: 100%; }
  .documents-filter { flex: 1; }
  .documents-filter select { width: 100%; }
  .documents-status-tabs { width: 100%; }
  .documents-status-tabs button { flex: 1; }
  .documents-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .documents-metric:nth-child(2) { border-right: 0; }
  .documents-metric:nth-child(-n + 2) { border-bottom: 1px solid #e3ebe9; }
  .documents-file-row { grid-template-columns: 46px minmax(0, 1fr) 82px 18px; }
  .documents-file-department { display: none; }
  .documents-department-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .documents-metric { min-height: 82px; padding: 12px; grid-template-columns: 36px minmax(0, 1fr); gap: 9px; }
  .documents-metric > span { width: 36px; height: 36px; }
  .documents-metric strong { font-size: 21px; }
  .documents-file-row { grid-template-columns: 42px minmax(0, 1fr) 16px; min-height: 68px; padding: 9px 11px; }
  .documents-file-version { display: none; }
  .documents-file-icon { width: 38px; height: 44px; }
  .documents-panel-head { padding: 12px 14px; }
  .documents-detail-content { padding: 15px; }
  .documents-editor-dialog { width: 100%; max-width: none; max-height: 100dvh; margin: 0; border-radius: 0; }
  .documents-editor-dialog > form { width: 100%; min-width: 0; height: 100dvh; max-height: 100dvh; }
  .documents-editor-dialog .dialog-head { padding: 12px 14px; }
  .documents-editor-dialog .dialog-head .eyebrow,
  .documents-editor-dialog .dialog-context { display: none; }
  .documents-dialog-scroll { padding: 14px; }
  .documents-form-grid { grid-template-columns: minmax(0, 1fr); }
  .documents-span-2 { grid-column: auto; }
  .documents-department-picker { grid-template-columns: minmax(0, 1fr); }
  .documents-editor-dialog .dialog-actions {
    display: grid;
    grid-template-columns: minmax(96px, 0.72fr) minmax(148px, 1.28fr);
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  }
  .documents-editor-dialog .dialog-actions .btn { width: 100%; min-width: 0; }
}
