.file-space {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 28px;
  max-width: 1500px;
  width: 100%;
  margin: auto;
}
.file-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.file-heading h1 {
  font-size: 28px;
  margin: 8px 0;
}
.file-heading p,
.file-caption,
.file-rag > p {
  color: var(--text-muted, #94a3b8);
  line-height: 1.7;
}
.file-space button,
.file-space select,
.file-space input {
  border: 1px solid #284052;
  background: #101d2b;
  color: #d7f4fa;
  border-radius: 10px;
  padding: 10px 14px;
}
.file-space button {
  cursor: pointer;
}
.file-space button:hover,
.file-space button.active {
  border-color: #22d3ee;
  background: #163044;
}
.file-space button:disabled {
  opacity: 0.5;
  cursor: default;
}
.file-toolbar,
.file-breadcrumbs,
.file-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.file-breadcrumbs {
  margin: 20px 0;
}
.file-toolbar input {
  flex: 1;
  min-width: 160px;
}
.file-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 20px;
  margin-top: 20px;
}
.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.file-card {
  display: flex;
  text-align: left;
  gap: 14px;
  align-items: center;
  width: 100%;
}
.file-card > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.file-card b {
  display: block;
  overflow-wrap: anywhere;
}
.file-card small {
  display: block;
  color: #91a6b9;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.file-card .badge {
  font-size: 11px;
  max-width: 95px;
  white-space: normal;
}
.file-card.selected {
  border-color: #a78bfa;
  box-shadow: 0 0 16px #8b5cf622;
}
.file-symbol {
  color: #67e8f9;
}
.file-detail,
.file-rag,
.file-citation {
  background: #101927;
  border: 1px solid #24384c;
  border-radius: 16px;
  padding: 22px;
}
.file-detail h2 {
  font-size: 20px;
  overflow-wrap: anywhere;
}
.file-detail p,
.file-detail dd {
  overflow-wrap: anywhere;
  line-height: 1.7;
}
.file-detail dl {
  display: grid;
  grid-template-columns: 75px 1fr;
  gap: 10px;
  font-size: 13px;
}
.file-detail dd {
  margin: 0;
  color: #acbed0;
}
.file-detail dt {
  color: #7f93a8;
}
.file-space a {
  color: #67e8f9;
}
.file-empty {
  padding: 30px;
  line-height: 1.8;
  color: #9aaec2;
}
.file-notice {
  padding: 16px;
  border: 1px solid #b0804555;
  background: #b0804511;
  border-radius: 12px;
  line-height: 1.7;
}
.file-rag {
  margin: 24px 0;
}
.file-citation {
  margin-top: 14px;
}
.file-citation small {
  display: block;
  color: #96a5bb;
  margin-top: 6px;
}
.file-citation p {
  white-space: pre-wrap;
  line-height: 1.8;
}
.file-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px;
  border: 1px solid #28556c;
  border-radius: 12px;
}
.file-upload progress {
  accent-color: #22d3ee;
}
.file-dialog {
  max-width: 560px;
  max-height: 85vh;
  overflow: auto;
  width: calc(100% - 32px);
  background: #111d2e;
  border: 1px solid #7952b8;
  padding: 26px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 80px #0008;
}
.file-operation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.file-space details {
  margin-bottom: 20px;
}
@media (max-width: 700px) {
  .file-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
  .file-toolbar input {
    grid-column: 1/-1;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
  .file-toolbar button {
    white-space: nowrap;
    min-width: 0;
    padding: 10px 7px;
  }
  .file-space {
    padding: 18px 12px;
  }
  .file-columns {
    grid-template-columns: 1fr;
  }
  .file-heading {
    align-items: flex-start;
  }
  .file-heading h1 {
    font-size: 24px;
  }
  .file-card {
    padding: 12px !important;
  }
  .file-card small {
    font-size: 11px;
  }
  .file-detail {
    padding: 18px;
  }
  .file-toolbar button {
    flex: 1;
  }
  .file-dialog {
    padding: 18px;
  }
  .file-operation {
    flex-direction: column;
  }
}
/* Chat attachments use the same authenticated file service. */
.chat-attachments:empty {
  display: none;
}
.chat-attachments {
  font-size: 0.82rem;
  max-height: 190px;
  overflow: auto;
  padding: 0 12px;
  color: #a8b8cc;
}
.chat-attachments p {
  margin: 7px 0;
  overflow-wrap: anywhere;
}
.attachment-chip,
.attachment-card {
  border: 1px solid #284657;
  border-radius: 12px;
  background: #091420;
  padding: 10px;
  overflow-wrap: anywhere;
}
.attachment-chip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0;
  align-items: center;
}
.attachment-chip button {
  padding: 4px 9px;
}
.attachment-check {
  display: flex !important;
  align-items: center;
  gap: 9px;
  margin: 12px 0;
  font-size: 0.86rem;
}
.attachment-check input {
  width: 18px !important;
  height: 18px;
  flex: 0 0 18px;
}
.attachment-folders {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  margin: 12px 0;
}
.chat-attachment-cards {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.message.user:has(.attachment-card) {
  margin-left: 0;
}
@media (max-width: 600px) {
  #messages:has(.attachment-card) {
    width: calc(100% - 24px);
  }
  .message.user:has(.attachment-card) {
    padding: 12px;
  }
  .message.user:has(.attachment-card) .attachment-card {
    padding: 8px;
  }
  .receipt-review-table th,
  .receipt-review-table td {
    padding: 6px;
  }
}
.attachment-card p {
  font-size: 0.8rem;
  color: #9daec4;
}
.attachment-card > a,
.attachment-card > button {
  display: inline-block;
  margin: 4px 12px 4px 0;
}
.receipt-panel {
  padding: 15px 0;
  font-size: 0.86rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.receipt-panel p {
  margin: 8px 0;
}
.receipt-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 15px 0;
}
.receipt-review-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 15px 0;
  font-size: 0.86rem;
}
.receipt-review-table caption {
  text-align: left;
  color: #b2d1dd;
  padding: 8px 0;
}
.receipt-review-table th,
.receipt-review-table td {
  text-align: left;
  border: 1px solid #294657;
  padding: 8px;
  overflow-wrap: anywhere;
}
.receipt-review-table th:first-child {
  width: 34%;
}
.receipt-review-table thead {
  background: #142439;
}
.receipt-review-table td input {
  margin: 0;
  width: 100%;
}
.receipt-panel label {
  display: block;
  color: #afc9d7;
}
.receipt-panel input,
.receipt-panel textarea {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #284657;
  border-radius: 8px;
  background: #06121f;
  color: #e0edf6;
  padding: 9px;
  margin-top: 5px;
  font: inherit;
}
.receipt-panel textarea {
  resize: vertical;
}
.file-receipt-details {
  margin: 16px 0;
}
.files-modal {
  position: fixed;
  inset: 0;
  z-index: 350;
  background: #030914d9;
  display: grid;
  place-items: center;
  padding: 20px;
}
.files-confirm {
  width: min(620px, 100%);
  background: #0b1423;
  border: 1px solid #295164;
  border-radius: 18px;
  padding: 24px;
  box-sizing: border-box;
  max-height: calc(100dvh - 40px);
  overflow: auto;
  overflow-wrap: anywhere;
  color: #d9eaf4;
}
.files-confirm button,
.receipt-panel button,
.attachment-chip button,
.chat-attachments > button,
.attachment-card > button {
  border: 1px solid #284657;
  border-radius: 8px;
  background: #132437;
  color: #d7f4fa;
  padding: 8px 12px;
  cursor: pointer;
}
.files-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 0;
}
.files-error {
  color: #ffb7c3;
}
@media (max-width: 600px) {
  .receipt-fields {
    grid-template-columns: 1fr;
  }
  .attachment-chip {
    align-items: flex-start;
  }
  .files-confirm {
    max-height: calc(100dvh - 24px);
  }
}
