html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111827;
  color: #e5e7eb;
  overflow: hidden;                 /* page itself never scrolls */
}

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.pane {
  flex: 1;
  min-width: 0;
  min-height: 0;                    /* important so children can scroll */
  display: flex;
  flex-direction: column;
  overflow: hidden;                 /* each pane manages its own scroll */
}

.pane.left {
  border-right: 1px solid #374151;
  background: #000;
  width: 75vw;
  flex: none;
}

.pane.right {
  background: #111827;
  flex: 1 1 auto;
  min-width: 200px;
}

.header {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  background: #030712;
  border-bottom: 1px solid #374151;
  display: flex;
  flex-direction: column;
  gap: 8px;

  position: sticky;                 /* stays visible */
  top: 0;
  z-index: 10;
}

.header-title-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
}

.header-title-btn:hover {
  color: #e5e7eb;
  text-decoration: underline;
}

.header-title-btn:active {
  transform: translateY(1px);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header span.sub {
  font-size: 12px;
  font-weight: normal;
  color: #9ca3af;
}

.header-models {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header-model-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  border-radius: 6px;
  text-decoration: none;
}

.header-logo img {
  display: block;
  height: 22px;
  width: auto;
  max-width: 140px;
  opacity: 0.9;
}

.header-logo:hover img,
.header-logo:focus-visible img {
  opacity: 1;
}

.header-label {
  font-size: 12px;
  font-weight: normal;
  color: #9ca3af;
}

.header-select {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
}


/* Small pill button in header */
.header-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.section {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #0b1220;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.section-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.section-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  width: 100%;
  margin: 0;
}

.section-row.center {
  display: flex;
  justify-content: center;
}

.section-row-screenshot {
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  align-items: center;
}

.field-group-wide {
  grid-column: 1 / 2;
}

.field-help {
  margin: 0;
  font-size: 12px;
  color: #9ca3af;
}

.section-row-instance {
  grid-template-columns: minmax(0, 6fr) minmax(0, 1fr) minmax(0, 3fr);
  align-items: end;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12px;
  color: transparent;
  line-height: 1;
}

.section-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;
  white-space: nowrap;
}

.header-btn,
.section-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
}

.section-btn:hover {
  background: #1f2937;
  border-color: #4b5563;
}

.section-divider {
  height: 1px;
  background: #374151;
  opacity: 0.8;
  margin: 0 14px;
}

.section label {
  font-size: 12px;
  color: #9ca3af;
}

.section select,
.section input {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
}

.header-btn:hover {
  background: #1f2937;
  border-color: #4b5563;
}

.header-btn:active {
  transform: translateY(1px);
}



/* LEFT PANE – iframe fills remaining height */
.pane.left iframe {
  border: none;
  width: 100%;
  flex: 1 1 auto;
  height: 100%;
}

/* REMOVE the global iframe rule, we now target only left pane iframe */
/* (your old global iframe rule is no longer needed) */

/* RIGHT PANE – chat */
.chat-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;                    /* allows .messages to scroll */
  /* height: 100%;  <-- remove this */
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;                 /* only this scrolls */
  padding: 12px 14px;
  background: #020617;
}

.msg {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  max-width: 95%;
  line-height: 1.4;
  font-size: 14px;
  white-space: pre-wrap;
}

.msg.user {
  background: #1d4ed8;
  align-self: flex-end;
}

.msg.assistant {
  background: #111827;
  border: 1px solid #1f2937;
  align-self: flex-start;
}

.msg.system {
  background: #0f172a;
  color: #9ca3af;
  font-size: 12px;
  align-self: center;
}

/* --- Markdown znotraj assistant sporočil --- */
.msg.assistant p {
  margin: 0 0 6px 0;
}

.msg.assistant ul,
.msg.assistant ol {
  margin: 4px 0 6px 18px;
  padding-left: 18px;
}

.msg.assistant li {
  margin-bottom: 2px;
}

.msg.assistant code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  background: #020617;
  padding: 2px 4px;
  border-radius: 4px;
}

.msg.assistant pre {
  margin: 6px 0;
  padding: 8px;
  background: #020617;
  border-radius: 6px;
  overflow-x: auto;
}

.msg.assistant pre code {
  padding: 0;
  background: transparent;
}

.msg.assistant h1,
.msg.assistant h2,
.msg.assistant h3,
.msg.assistant h4,
.msg.assistant h5,
.msg.assistant h6 {
  margin: 4px 0 6px 0;
  font-weight: 600;
}

.chat-input {
  border-top: 1px solid #374151;
  padding: 10px;
  background: #030712;
  display: flex;
  gap: 8px;
  flex: 0 0 auto;                   /* fixed at bottom */
}

.chat-input input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
  font-size: 14px;
  outline: none;
}

.chat-input input[type="text"]:focus {
  border-color: #60a5fa;
}

.chat-input button {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  background: #22c55e;
  color: #022c22;
  font-weight: 600;
  transition: transform 0.05s ease-out, box-shadow 0.05s ease-out;
  white-space: nowrap;
}

.chat-input button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.chat-input button:disabled {
  opacity: 0.5;
  cursor: default;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  display: inline-block;
  background: #16a34a;
}

.status-offline {
  background: #b91c1c;
}

.splitter {
  width: 6px;
  background: #1f2937;
  cursor: col-resize;
  flex: none;
}

.splitter:hover {
  background: #374151;
}

/* When dragging the splitter, disable pointer events on the iframe
   so it doesn't "eat" mousemove/mouseup events. */
.body-dragging iframe {
  pointer-events: none;
}


/* --- DICOM + PDF toolbars ----------------------------------- */

.dicom-data-container,
.pdf-upload-container {
  flex: 0 0 auto;
  padding: 8px 14px;
  background: #020617;
  border-bottom: 1px solid #1f2937;

  display: flex;
  align-items: center;
  justify-content: flex-start;
}

/* Put them visually closer together, like one combined tools area */
.pdf-upload-container {
  border-top: 1px solid #020617;      /* hide double line between them */
  margin-top: -1px;
}

/* Wrap inner <div> so content hugs left and doesn’t stretch weirdly */
.dicom-data-container > div,
.pdf-upload-container > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons in toolbars: small, pill-shaped, consistent with chat button */
.dicom-data-container button,
.pdf-upload-container button {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dicom-data-container button:hover,
.pdf-upload-container button:hover {
  background: #1f2937;
  border-color: #4b5563;
}

.dicom-data-container button:active,
.pdf-upload-container button:active {
  transform: translateY(1px);
}

/* Optional subtle “label” style if you later add text like “Tools” */
.dicom-data-container::before {
  content: "Current study:";
  font-size: 11px;
  /*text-transform: uppercase;*/
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-right: 12px;
}


/* Optional subtle “label” style if you later add text like “Tools” */
.pdf-upload-container::before {
  content: "Upload previous exams (PDFs):";
  font-size: 11px;
  /*text-transform: uppercase;*/
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-right: 12px;
}


/* === Condensed chat layout ==================================== */

/* Less padding around the whole message area */
.messages {
  padding: 6px 8px;
}

/* Smaller, tighter message bubbles */
.msg {
  margin-bottom: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  max-width: 95%;
  line-height: 1.25;
  font-size: 13px;
}

/* Tighter Markdown formatting inside assistant messages */
.msg.assistant p {
  margin: 0 0 2px 0;
}

.msg.assistant ul,
.msg.assistant ol {
  margin: 2px 0 2px 16px;
  padding-left: 16px;
}

.msg.assistant li {
  margin-bottom: 1px;
}

.msg.assistant pre {
  margin: 2px 0;
  padding: 4px 6px;
}

/* Condensed input area at the bottom */
.chat-input {
  padding: 6px;
  gap: 6px;
}

.chat-input input[type="text"] {
  padding: 6px 8px;
  font-size: 13px;
}

.chat-input button {
  padding: 6px 10px;
  font-size: 13px;
}
