.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.select-control { display: block; min-width: 0; }
.select-trigger,
.settings-trigger,
.toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid #d6e5df;
  border-radius: 9px;
  background: #f5f9f7;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}
.select-trigger { width: 100%; justify-content: space-between; text-align: left; }
.sidebar-workspace .select-trigger { min-height: 42px; font-size: 15px; }
.select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-trigger::after {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin: -3px 2px 0 1px;
  border: solid var(--teal);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.select-trigger[aria-expanded="true"],
.attachment-trigger[aria-expanded="true"] { border-color: #a8cbbf; background: #e9f4ee; }
.settings-trigger { flex: 0 0 auto; }

.pomor-popup {
  position: fixed;
  z-index: 40;
  padding: 5px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #d6e5df;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 14px 34px #102d4024, 0 3px 8px #102d400c;
}
.select-menu:focus { outline: none; }
.select-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-items: center;
  gap: 2px 8px;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.select-option[aria-selected="true"] { background: #eaf5ef; color: #075f61; font-weight: 700; }
.select-option[aria-selected="true"]::after { content: "✓"; grid-column: 2; grid-row: 1; color: var(--teal); }
.select-option:hover:not([aria-disabled="true"]) { background: #f0f7f3; }
.select-option.is-active { box-shadow: inset 0 0 0 1px #a9cec1; background: #f0f7f3; }
.select-option[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }
.select-option-note { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-weight: 500; }

.pomor-dialog {
  width: min(470px, calc(100% - 28px));
  max-width: none;
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: auto;
  border: 1px solid #d6e5df;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 22px 70px #102d4033;
}
.pomor-dialog::backdrop { background: #102d4060; }
.dialog-heading,
.dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-heading { padding: 17px 20px; background: #f3f8f5; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; color: var(--navy); font-size: 20px; line-height: 1.25; }
.dialog-heading p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.dialog-close { flex: 0 0 auto; width: 36px; height: 36px; padding: 0; font-size: 21px; line-height: 1; }
.dialog-body { padding: 18px 20px; }
.dialog-footer { justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); }
.dialog-footer button { min-height: 40px; padding-inline: 14px; }
.dialog-status { min-width: 0; margin-right: auto; color: #086d6f; font-size: 14px; overflow-wrap: anywhere; }
.dialog-status.is-error, .dialog-error { color: #923741; }
.primary-action { border-color: var(--teal); background: var(--teal); color: #fff; font-weight: 650; }
.primary-action:hover:not(:disabled) { background: #066a6b; }
.name-field, .settings-field { display: grid; gap: 7px; }
.name-field label, .settings-fields label { font-size: 14px; font-weight: 650; }
#name-dialog-input {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid #bfd6cd;
  border-radius: 9px;
  background: #f8fbf9;
  color: var(--ink);
}
#name-dialog-input[aria-invalid="true"] { border-color: #a74a53; }
.dialog-error { margin: 0; font-size: 14px; line-height: 1.45; }
.dialog-error:empty { display: none; }
.settings-fields { display: grid; gap: 16px; }
.settings-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.temperature-field { padding: 11px 12px 8px; border: 1px solid var(--line); border-radius: 10px; background: #f5f9f7; }
.temperature-heading, .range-labels { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#qwen-temperature-value { min-width: 39px; padding: 3px 7px; border-radius: 6px; background: #e0efe8; color: #075f61; text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; }
#qwen-temperature {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 24px;
  margin: 7px 0 0;
  background: linear-gradient(to right, var(--teal) var(--range-progress, 35%), #cddfd7 var(--range-progress, 35%)) center / 100% 5px no-repeat;
  cursor: pointer;
}
#qwen-temperature::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--teal);
  border-radius: 50%;
  background: #fff;
}
#qwen-temperature::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid var(--teal); border-radius: 50%; background: #fff; }
#qwen-temperature:disabled { opacity: .58; cursor: not-allowed; }
.range-labels { color: var(--muted); font-size: 12px; }

.composer-wrap {
  flex: 0 0 auto;
  min-width: 0;
  max-height: 56dvh;
  overflow: auto;
  padding: 8px max(16px, calc((100% - var(--composer-width)) / 2)) max(14px, env(safe-area-inset-bottom));
}
.composer-card { min-width: 0; padding: 9px 11px 10px; border: 1px solid #d0e0d7; border-radius: 15px; background: #fff; box-shadow: 0 5px 20px #1439260a; }
.composer-card:has(#message-input:focus) { border-color: #a9cfc1; }
.message-form { display: grid; gap: 7px; min-width: 0; }
#message-input {
  width: 100%;
  min-height: 54px;
  max-height: min(22dvh, 170px);
  padding: 5px 4px;
  field-sizing: content;
  resize: none;
  overflow: auto;
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  line-height: 1.45;
}
#message-input::placeholder { color: #5b7279; }
.composer-toolbar { display: flex; align-items: center; gap: 7px; min-width: 0; }
.composer-mode { flex: 0 1 185px; min-width: 0; }
.toolbar-button { white-space: nowrap; }
.toolbar-symbol { font-size: 18px; line-height: 1; }
.attachment-control[inert] { opacity: .55; }
#send-button { margin-left: auto; flex: 0 0 auto; border-color: var(--teal); background: var(--teal); color: #fff; }
#send-button:hover:not(:disabled) { background: #066a6b; }
.composer-status { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.composer-status:empty { display: none; }
.composer-status.is-error { color: #923741; }
#file-status[data-state="success"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.composer-context {
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f9f7;
  font-size: 14px;
}
.composer-context p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.composer-context p:first-child { margin-top: 0; }
.composer-context p:empty { display: none; }
#rag-base-list { display: flex; flex-wrap: wrap; gap: 6px 12px; }
#rag-base-list label { display: flex; align-items: center; gap: 5px; overflow-wrap: anywhere; }

.attachment-menu { display: grid; gap: 5px; padding: 8px; }
.attachment-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 5px; }
#file-count { color: var(--muted); font-size: 13px; }
.attachment-action { min-height: 38px; padding: 8px 10px; text-align: left; color: var(--ink); font-size: 14px; }
.attachment-action[aria-expanded="true"] { background: #eaf5ef; border-color: #bbd7cc; }

@media (max-width: 760px) {
  .select-trigger, .toolbar-button, .settings-trigger, .select-option,
  .attachment-action, .dialog-close, .dialog-footer button { min-height: 44px; }
  .dialog-close { width: 44px; }
  .composer-wrap { padding-inline: 10px; max-height: 60dvh; }
  .composer-card { padding: 7px 9px 8px; }
  #message-input { font-size: 16px; }
}
@media (max-width: 490px) {
  .toolbar-button .toolbar-label { display: none; }
  .toolbar-button { width: 44px; padding-inline: 0; }
  .dialog-heading, .dialog-body, .dialog-footer { padding-inline: 14px; }
  .settings-options { grid-template-columns: minmax(0, 1fr); }
}
@media (forced-colors: active) {
  #qwen-temperature { -webkit-appearance: auto; appearance: auto; background: none; }
  .select-option.is-active { outline: 1px solid Highlight; }
}

.model-control { display: flex; align-items: center; gap: .4rem; }
.model-control > label, .generation-receipt { color: #405d68; font-size: .82rem; }
.generation-receipt { display: block; margin-top: .4rem; }
.generation-details { color: #405d68; font-size: .82rem; overflow-wrap: anywhere; }
.generation-details summary { cursor: pointer; }
.model-actions { flex-wrap: wrap; }
#usage-details { max-height: 65vh; overflow: auto; }
#usage-details p { margin: .45rem 0 1rem; }
@media (max-width: 700px) {
  .composer-toolbar { flex-wrap: wrap; }
  .model-control > label { position: absolute; clip-path: inset(50%); }
  .model-control .select-trigger { max-width: min(57vw, 12rem); }
}
