#chat-composer,
.attachment-menu,
.workspace-files-view,
.mvp04-chat-document-job,
.rag-sources {
  --file-ink: #193443;
  --file-muted: #526970;
  --file-border: #d8e5e1;
  --file-accent: #086d6f;
  --file-accent-hover: #dff3ed;
}

.workspace-files-view {
  color: var(--file-ink);
  background: #f5f7f6;
  overflow-y: auto;
}

.workspace-files-header,
.workspace-files-content {
  width: min(100%, 75rem);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 48px);
}

.workspace-files-header {
  padding-block: clamp(20px, 4vw, 42px) 8px;
  border: 0;
}

.workspace-files-header h1 {
  margin: 0 0 8px;
  color: #102d40;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.2;
}

.workspace-files-header p,
.workspace-files-toolbar {
  color: var(--file-muted);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.workspace-files-content {
  padding-block: 14px 28px;
}

.workspace-files-toolbar {
  gap: 10px;
  margin-bottom: 12px;
}

.file-hint {
  color: var(--file-muted);
  font-size: 14px;
  line-height: 1.5;
}

.attached-files,
.library-file {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.attached-files:not(:empty) { margin-bottom: 5px; }
.attached-files[inert] { opacity: .6; }
.file-library { overflow: auto; }

.file-chip {
  display: flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  gap: 4px;
  padding: 2px 3px 2px 10px;
  border: 1px solid var(--file-border);
  border-radius: 10px;
  background: #edf6f2;
  color: var(--file-ink);
  font-size: 14px;
}

.file-chip > span {
  min-width: 0;
  max-width: 24rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.file-chip button,
.library-file button,
.workspace-files-toolbar button,
.mvp04-chat-document-job .job-actions button,
.rag-sources button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--file-border);
  border-radius: 8px;
  color: var(--file-accent);
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.file-chip button {
  flex: 0 0 auto;
  min-width: 32px;
  min-height: 32px;
  padding: 2px 7px;
  border-color: transparent;
  background: transparent;
  font-size: 18px;
}

.file-chip button:hover:not(:disabled),
.library-file button:hover:not(:disabled),
.workspace-files-toolbar button:hover:not(:disabled),
.mvp04-chat-document-job .job-actions button:hover:not(:disabled),
.rag-sources button:hover:not(:disabled) {
  color: var(--file-accent);
  background: var(--file-accent-hover);
}

.library-file button.danger-button {
  color: #923741;
}

.library-file button.danger-button:hover:not(:disabled) {
  color: #923741;
  background: #fff0f1;
}

.attachment-menu button:disabled,
.workspace-files-view button:disabled,
.mvp04-chat-document-job button:disabled,
.rag-sources button:disabled {
  color: var(--file-muted);
  background: #edf1ef;
  cursor: not-allowed;
  opacity: 1;
}

.attachment-menu button:focus-visible,
.workspace-files-view button:focus-visible,
.mvp04-chat-document-job :is(a, button):focus-visible,
.rag-sources :is(a, button):focus-visible {
  outline: 2px solid #087f80;
  outline-offset: 2px;
}

#file-library {
  max-height: min(38vh, 18rem);
  margin-top: 8px;
  padding: 4px 12px;
  border: 1px solid var(--file-border);
  border-radius: 10px;
  background: #fff;
  overscroll-behavior: contain;
}

.workspace-files-list {
  max-height: none;
  margin: 0;
  padding: 4px 14px;
  border: 1px solid var(--file-border);
  border-radius: 12px;
  background: #fff;
  overflow: visible;
}

.library-file,
.workspace-files-list .library-file {
  gap: 8px;
  padding: 12px 4px;
  border-bottom: 1px solid #e4eaea;
}

.library-file:last-child {
  border-bottom: 0;
}

.library-filename,
.workspace-files-list .library-filename {
  flex: 1 1 14rem;
  min-width: 0;
  color: var(--file-ink);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.library-file-format {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  min-height: 40px;
  padding: 4px;
  border: 1px solid var(--file-border);
  border-radius: 7px;
  color: var(--file-accent);
  background: #f3f8f4;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.library-file-meta {
  display: block;
  color: var(--file-muted);
  font-size: 14px;
  font-weight: 400;
}

.library-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-files-list > .file-hint {
  margin: 0;
  padding: 18px 4px;
}

.mvp04-chat-document-job,
.rag-sources {
  min-width: 0;
  max-width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--file-border);
  border-radius: 12px;
  color: var(--file-ink);
  background: #f3f8f5;
  overflow-wrap: anywhere;
}

.mvp04-chat-document-job .job-title {
  color: #102d40;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
}

.mvp04-chat-document-job .job-status {
  color: var(--file-muted);
  font-size: 15px;
  line-height: 1.55;
}

.mvp04-chat-document-job .job-actions {
  gap: 8px;
}

.mvp04-chat-document-job .job-actions a,
.rag-source-detail > a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #087f80;
  border-radius: 8px;
  color: #fff;
  background: #087f80;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}

.mvp04-chat-document-job .job-actions a:hover,
.rag-source-detail > a:hover {
  color: #fff;
  background: #086d6f;
}

.rag-sources {
  gap: 8px;
  font-size: 15px;
}

.rag-sources button {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.rag-sources .rag-note,
.rag-source-detail p {
  margin: 0;
  color: var(--file-muted);
  line-height: 1.5;
}

.rag-source-detail {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--file-border);
  border-radius: 9px;
  background: #fff;
}

.rag-source-detail pre {
  margin: 8px 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rag-source-detail > a {
  margin-top: 10px;
}

@media (max-width: 760px) {
    .file-chip button,
  .library-file button,
  .workspace-files-toolbar button,
  .mvp04-chat-document-job .job-actions :is(a, button),
  .rag-sources button,
  .rag-source-detail > a {
    min-height: 44px;
  }

  .file-chip button {
    min-width: 44px;
  }

  .workspace-files-list {
    display: grid;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .workspace-files-list .library-file,
  .workspace-files-list .library-file:last-child {
    align-items: center;
    padding: 12px;
    border: 1px solid var(--file-border);
    border-radius: 10px;
    background: #fff;
  }

  .library-filename,
  .workspace-files-list .library-filename,
  .library-file-actions {
    flex-basis: 100%;
  }

  .library-file-format + .library-filename {
    flex-basis: calc(100% - 5rem);
  }
}

#luna-material-dialog { width: min(42rem, calc(100vw - 2rem)); max-height: 90dvh; overflow: auto; }
.material-files fieldset { margin: .75rem 0; border: 1px solid #c4d5d0; border-radius: .65rem; min-width: 0; }
.material-files legend { padding-inline: .4rem; overflow-wrap: anywhere; }
.material-files legend label { display: inline-flex; flex-direction: row-reverse; align-items: center; gap: .5rem; }
.material-fields:not([hidden]) { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); }
.material-fields label { display: grid; gap: .25rem; }
.material-fields input, .material-fields select { width: 100%; min-width: 0; box-sizing: border-box; }
#luna-material-dialog .model-actions { flex-wrap: wrap; }
.material-review { overflow-wrap: anywhere; }

.material-review .material-suggestion { margin: 0 .35rem .4rem 0; text-align: start; overflow-wrap: anywhere; }

#luna-draft[hidden],#luna-draft button[hidden]{display:none}
#luna-draft-files{display:flex;flex-wrap:wrap;gap:.45rem}
.luna-draft-file{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:.15rem .55rem;max-width:100%;padding:.45rem .7rem;border:1px solid #cdded9;border-radius:.7rem;background:#f4f8f7;overflow-wrap:anywhere}
.luna-draft-file small{grid-column:1;color:#395760}
.luna-draft-file .is-error{color:#913e38}
.luna-draft-file button{grid-column:2;grid-row:1/3;align-self:center;color:inherit;background:transparent;border:0;cursor:pointer;font-size:1.2rem}
#luna-draft>.toolbar-button{margin:.35rem .3rem .2rem 0}

.output-card-actions {display:flex;flex-wrap:wrap;gap:.5rem;margin-block:.6rem;}
.luna-result-link {display:table;margin-top:.6rem;padding:.5rem .85rem;border:1px solid currentColor;border-radius:.5rem;font-weight:600;}

.haiku-comparison{max-width:100%;overflow-x:auto;margin:.65rem 0}.haiku-comparison table{border-collapse:collapse;font-size:.93em}.haiku-comparison th,.haiku-comparison td{padding:.55rem;text-align:left;vertical-align:top;border:1px solid #cad7d5;white-space:pre-wrap}.haiku-comparison th{background:#edf6f4}

.haiku-evidence { margin-block: .75rem; border-inline-start: 2px solid var(--file-border); padding-inline-start: .8rem; overflow-wrap: anywhere; }
.haiku-evidence ol { padding-inline-start: 1.4rem; margin-block: .3rem .5rem; }
.haiku-evidence li { margin-block: .25rem; }
.haiku-evidence summary { cursor: pointer; width: fit-content; }
.haiku-evidence p { margin-block: .3rem; }

#haiku-comparison-order:not([hidden]) {display:flex;align-items:center;flex-wrap:wrap;gap:.4rem .85rem;margin:.5rem 0;color:#284c55}
#haiku-comparison-order span {overflow-wrap:anywhere}

.message-attachments { display:flex; flex-wrap:wrap; gap:.35rem; margin:.45rem 0 0; padding:0; list-style:none; }
.message-attachments li { min-width:0; max-width:100%; overflow-wrap:anywhere; padding:.2rem .55rem; border:1px solid var(--line); border-radius:.6rem; color:var(--navy); background:#f4faf8; font-size:.875rem; }
.chat-published-image { display:block; height:auto; max-width:100%; max-height:65vh; object-fit:contain; margin:.65rem 0; border-radius:.5rem; }
.chat-header { flex-wrap:wrap; }
.chat-header h1 { flex:1 1 12rem; }
#chat-export-status:empty { display:none; }
#chat-export-status:not(:empty) { order:5; width:100%; font-size:.9rem; color:var(--muted); overflow-wrap:anywhere; }
@media (max-width:620px) {
  .chat-header { gap:.3rem .55rem; }
  .chat-header h1 { flex-basis:100%; }
  .chat-header .settings-trigger { min-width:0; max-width:100%; white-space:normal; }
}
