.files-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.files-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.files-modal {
  width: min(920px, 96vw);
  max-height: min(88vh, 900px);
  background: linear-gradient(165deg, #111b21 0%, #0d1519 100%);
  border: 1px solid rgba(0, 168, 132, 0.22);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(167, 139, 250, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.22s ease;
}

.files-modal-backdrop.open .files-modal {
  transform: scale(1) translateY(0);
}

.files-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem 0.85rem;
  border-bottom: 1px solid #2a3942;
}

.files-modal-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #e9edef;
  margin: 0;
}

.files-modal-head p {
  font-size: 0.78rem;
  color: #8696a0;
  margin: 0.25rem 0 0;
}

.files-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #2a3942;
  background: #1f2c34;
  color: #e9edef;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.files-modal-close:hover {
  border-color: #00a884;
  color: #00a884;
}

.files-modal-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.65rem 1.35rem 0;
  border-bottom: 1px solid #2a3942;
  overflow-x: auto;
}

.files-tab {
  padding: 0.5rem 0.85rem;
  border: none;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: #8696a0;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.files-tab:hover {
  color: #e9edef;
  background: rgba(255, 255, 255, 0.03);
}

.files-tab.active {
  color: #00a884;
  border-bottom-color: #00a884;
  background: rgba(0, 168, 132, 0.08);
}

.files-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem 1.35rem 1.25rem;
  min-height: 280px;
}

.files-modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 1.35rem 1.15rem;
  border-top: 1px solid #2a3942;
  background: rgba(0, 0, 0, 0.2);
}

.files-btn {
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid #2a3942;
  background: #1f2c34;
  color: #e9edef;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.files-btn:hover {
  border-color: #00a884;
  color: #00a884;
}

.files-btn-primary {
  background: linear-gradient(135deg, #00a884, #008069);
  border-color: transparent;
  color: #fff;
}

.files-btn-primary:hover {
  filter: brightness(1.08);
  color: #fff;
}

.files-btn-purple {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border-color: transparent;
  color: #fff;
}

.files-btn-purple:hover {
  filter: brightness(1.08);
  color: #fff;
}

.files-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.files-card {
  position: relative;
  background: #1f2c34;
  border: 1px solid #2a3942;
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.files-card:hover {
  border-color: rgba(0, 168, 132, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.files-card.selected {
  border-color: #00a884;
  box-shadow: 0 0 0 1px rgba(0, 168, 132, 0.35);
}

.files-card-check {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  width: 18px;
  height: 18px;
  accent-color: #00a884;
}

.files-card-preview {
  aspect-ratio: 1;
  background: #0b141a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.files-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.files-card-preview .files-ico {
  font-size: 2rem;
  opacity: 0.7;
}

.files-card-meta {
  padding: 0.55rem 0.65rem 0.65rem;
}

.files-card-meta .name {
  font-size: 0.72rem;
  font-weight: 600;
  color: #e9edef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.files-card-meta .sub {
  font-size: 0.65rem;
  color: #8696a0;
  margin-top: 0.15rem;
}

.files-card-meta select {
  width: 100%;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  padding: 0.3rem;
  border-radius: 6px;
  border: 1px solid #2a3942;
  background: #111b21;
  color: #e9edef;
}

.files-dropzone {
  border: 2px dashed rgba(0, 168, 132, 0.35);
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: rgba(0, 168, 132, 0.04);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.files-dropzone.dragover {
  border-color: #a78bfa;
  background: rgba(167, 139, 250, 0.08);
}

.files-dropzone .dz-ico {
  font-size: 2.5rem;
  margin-bottom: 0.65rem;
}

.files-dropzone p {
  color: #8696a0;
  font-size: 0.85rem;
  margin: 0.25rem 0;
}

.files-upload-form {
  margin-top: 1rem;
  display: grid;
  gap: 0.65rem;
}

.files-upload-form label {
  font-size: 0.75rem;
  color: #8696a0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.files-upload-form select {
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid #2a3942;
  background: #1f2c34;
  color: #e9edef;
}

.files-progress {
  height: 6px;
  background: #2a3942;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.75rem;
  display: none;
}

.files-progress.show {
  display: block;
}

.files-progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00a884, #a78bfa);
  transition: width 0.2s;
}

.files-service-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.files-service-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: #1f2c34;
  border: 1px solid #2a3942;
  border-radius: 12px;
}

.files-service-item .thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #0b141a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.files-service-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.files-service-item .info {
  flex: 1;
  min-width: 0;
}

.files-service-item .info strong {
  display: block;
  font-size: 0.82rem;
  color: #e9edef;
}

.files-service-item .info small {
  color: #8696a0;
  font-size: 0.68rem;
}

.files-service-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.files-service-actions button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #2a3942;
  background: transparent;
  color: #8696a0;
  cursor: pointer;
  font-size: 0.85rem;
}

.files-service-actions button:hover {
  border-color: #00a884;
  color: #00a884;
}

.files-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #8696a0;
  font-size: 0.85rem;
}

.files-ai-result {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(124, 58, 237, 0.1);
  display: none;
}

.files-ai-result.show {
  display: block;
}

.files-ai-result h4 {
  font-size: 0.85rem;
  color: #c4b5fd;
  margin-bottom: 0.65rem;
}

.files-ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}

.files-ai-grid .item label {
  font-size: 0.65rem;
  color: #8696a0;
  text-transform: uppercase;
}

.files-ai-grid .item span {
  font-size: 0.78rem;
  color: #e9edef;
  display: block;
  margin-top: 0.1rem;
}

.svc-docs-card {
  background: linear-gradient(145deg, rgba(0, 168, 132, 0.1), rgba(124, 58, 237, 0.08));
  border: 1px solid rgba(0, 168, 132, 0.28);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.svc-docs-card .svc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
  min-width: 0;
}

.svc-docs-card .svc-head h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: #e9edef;
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.svc-docs-card .svc-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: #00a884;
  background: rgba(0, 168, 132, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}

.svc-docs-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.svc-docs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  min-width: 0;
}

.svc-docs-row .lbl {
  color: #8696a0;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.svc-docs-row .st {
  font-weight: 600;
  flex-shrink: 0;
}

.svc-docs-row .st.ok {
  color: #4ade80;
}

.svc-docs-row .st.pending {
  color: #fbbf24;
}

.svc-docs-card .btn-manage {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 168, 132, 0.4);
  background: rgba(0, 168, 132, 0.12);
  color: #00a884;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.svc-docs-card .btn-manage:hover {
  background: rgba(0, 168, 132, 0.22);
}

.composer .btn-files-hub {
  color: #a78bfa;
}

.composer .btn-files-hub:hover {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
}
