.case-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
}
.case-bar #case-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #52687a;
}
.case-bar button {
  padding: 7px 10px;
  font-size: 12px;
  min-height: 36px;
}
.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.entry-actions button {
  font-size: 13px;
  padding: 9px 12px;
  background: #eff5fc;
  border-color: #c7d8e9;
  color: #173c5c;
}
.entry-actions button:first-child {
  background: #193e5f;
  color: white;
}
.workspace-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 18px;
}
.workspace-dialog form {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}
.workspace-dialog label {
  display: grid;
  gap: 5px;
}
.workspace-dialog input,
.workspace-dialog select,
.workspace-dialog textarea {
  width: 100%;
  min-width: 0;
  font: inherit;
  padding: 10px;
  border: 1px solid #cbd6e2;
  border-radius: 8px;
}
.workspace-dialog textarea {
  min-height: 100px;
  resize: vertical;
}
.saved-case {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}
.saved-case button {
  text-align: left;
}
.saved-case small {
  color: #607489;
}
.case-next-actions,
.draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
.case-next-actions button {
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 9px;
}
.workspace-result details {
  font-size: 12px;
  margin-top: 12px;
  color: #607489;
}
.workspace-result details p {
  margin: 8px 0;
}
.draft-preview {
  border-top: 1px solid #d7e0e9;
  max-height: 40dvh;
  overflow: auto;
}
.draft-preview pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
}
.workspace-dialog [role="status"] {
  overflow-wrap: anywhere;
}
@media (max-width: 480px) {
  .case-bar {
    gap: 5px;
  }
  .case-bar #case-title {
    font-size: 12px;
  }
  .case-bar button {
    font-size: 11px;
    padding: 7px;
  }
  .entry-actions {
    gap: 6px;
  }
  .entry-actions button {
    font-size: 12px;
    padding: 8px;
  }
  .workspace-dialog {
    padding: 18px;
  }
  .saved-case {
    grid-template-columns: 1fr;
  }
  .saved-case small {
    padding-left: 10px;
  }
}

/* A single row stays above the chat. Tool dialogs do not consume its height. */
.case-bar.case-tools-ready {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 8px;
}
.case-bar.case-tools-ready > button {
  min-width: 0;
  min-height: 44px;
  white-space: nowrap;
  padding: 8px 10px;
  font-size: 12px;
}
.case-bar.case-tools-ready > button:not(#my-cases):not(#case-tools-open) {
  display: none;
}
.case-tools-trigger {
  background: #eef4fa;
  border-color: #bfcfdf;
  color: #173c5c;
}
.case-tools-dialog {
  box-sizing: border-box;
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #bdcad8;
  border-radius: 16px;
  padding: 16px;
}
.case-tools-dialog::backdrop {
  background: #17344c66;
}
.case-tools-header {
  position: sticky;
  top: -16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 8px 0 12px;
  z-index: 1;
}
.case-tools-header h2 {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  line-height: 1.3;
  margin: 0;
}
.case-tools-header button {
  min-height: 44px;
  padding: 8px 10px;
}
.case-tools-actions {
  display: grid;
  gap: 8px;
}
.case-tools-actions > button {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 11px 12px;
  font-size: 14px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
.case-tools-dialog button:focus-visible,
.case-bar button:focus-visible {
  outline: 3px solid #5688ba;
  outline-offset: 2px;
}
@media (max-width: 360px) {
  .case-bar.case-tools-ready {
    gap: 4px;
  }
  .case-bar.case-tools-ready > button {
    padding-inline: 7px;
  }
}
