.files-action {
  position: relative;
}

.files-modal-card {
  width: min(980px, calc(100vw - 28px));
  max-height: min(88vh, 900px);
  overflow: auto;
}

.file-storage-warning {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #f2c66d;
  border-radius: 12px;
  background: #fff9e8;
  color: #6a4a00;
  font-weight: 700;
}

.file-admin-panel,
.file-list-panel {
  padding: 18px;
  border: 1px solid var(--line, #d9e3ea);
  border-radius: 16px;
  background: #fff;
}

.file-admin-panel {
  margin-bottom: 18px;
}

.file-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.file-panel-heading h3 {
  margin: 0 0 4px;
  font-size: 1.08rem;
}

.file-panel-heading p {
  margin: 0;
  color: var(--muted, #637381);
  font-size: .92rem;
}

.file-send-form {
  display: grid;
  grid-template-columns: minmax(160px, .7fr) minmax(220px, 1.3fr);
  gap: 9px 14px;
  align-items: center;
}

.file-send-form label {
  font-weight: 800;
}

.file-send-form select,
.file-send-form input[type="file"],
.file-send-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd8e1;
  border-radius: 10px;
  background: #fff;
  color: #173346;
  font: inherit;
  padding: 10px 12px;
}

.file-send-form textarea {
  resize: vertical;
  min-height: 66px;
}

.file-send-form small,
.file-send-actions {
  grid-column: 2;
}

.file-send-form small {
  color: var(--muted, #637381);
}

.file-send-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.file-send-status {
  min-height: 1.4em;
  color: var(--muted, #637381);
  font-weight: 700;
}

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

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid #dbe5eb;
  border-radius: 14px;
  padding: 13px 14px;
  background: #fbfdfe;
}

.file-item.is-unread {
  border-color: #9bcfb2;
  background: #f5fcf7;
}

.file-item-main {
  min-width: 0;
}

.file-item-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}

.file-item-title {
  margin: 0;
  color: #173346;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.file-new-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e1f4e7;
  color: #16643b;
  font-size: .76rem;
  font-weight: 900;
}

.file-item-meta,
.file-item-note {
  margin: 0;
  color: var(--muted, #637381);
  font-size: .87rem;
  line-height: 1.55;
}

.file-item-note {
  margin-top: 4px;
  color: #355267;
}

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

.file-download-button,
.file-delete-button {
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.file-download-button {
  background: #16784a;
  color: #fff;
}

.file-delete-button {
  background: #fff0f0;
  color: #a12a2a;
  border: 1px solid #efcaca;
}

.file-download-button:disabled,
.file-delete-button:disabled,
#fileSendBtn:disabled {
  opacity: .55;
  cursor: wait;
}

@media (max-width: 720px) {
  .file-send-form {
    grid-template-columns: 1fr;
  }

  .file-send-form small,
  .file-send-actions {
    grid-column: 1;
  }

  .file-item {
    grid-template-columns: 1fr;
  }

  .file-item-actions {
    justify-content: flex-start;
  }

  .file-panel-heading {
    align-items: flex-start;
  }
}

@media print {
  #filesModal,
  #filesBtn {
    display: none !important;
  }
}
