.app[hidden] { display: none !important; }
.app-header .tabs { margin-right: auto; }
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.auth-gate[hidden] { display: none; }
.auth-card {
  width: min(380px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px 22px;
}
.auth-card h1 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
}
.auth-card .auth-lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}
.auth-card label {
  display: block;
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
}
.auth-card input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-sizing: border-box;
}
.auth-card button[type=submit] {
  width: 100%;
  margin-top: 8px;
}
.auth-user-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}
.auth-user-bar[hidden] { display: none; }

.chat-work {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 24px;
  max-width: 920px;
  margin: 0 auto;
  min-height: calc(100vh - 56px);
  box-sizing: border-box;
}
.chat-prompt-wrap,
.chat-result-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.chat-revise-notes {
  margin: 0 0 8px;
  padding: 10px 12px 10px 14px;
  border: 1px solid #d5e0ee;
  border-left: 3px solid #3b6ea5;
  border-radius: 8px;
  background: #f3f6fb;
  color: #334155;
}
.chat-revise-notes[hidden] {
  display: none;
}
.chat-revise-notes-label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #3b6ea5;
}
.chat-revise-notes-list {
  margin: 0;
  padding: 0 0 0 1.15em;
  font-size: 0.9rem;
  line-height: 1.45;
}
.chat-revise-notes-list li {
  margin: 0 0 5px;
}
.chat-revise-notes-list li:last-child {
  margin-bottom: 0;
}
#chatPrompt {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-sizing: border-box;
}
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.chat-attach-name {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#chatResult {
  min-height: 280px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  line-height: 1.5;
  white-space: normal;
  overflow: auto;
}
#chatResult strong,
#chatResult .glance-sec-title {
  font-weight: 700;
}
#chatResult .glance-sec-block {
  display: block;
  margin: 0;
  padding: 0;
  border: none;
}
#chatResult .glance-sec-title {
  display: block;
  font-weight: 700;
  margin: 0;
  padding: 0;
  line-height: 1.45;
}
#chatResult .glance-sec-body {
  display: block;
  margin: 0;
  padding: 0 0 0 1.15em;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
#chatResult strong.glance-imaging-title {
  font-weight: 400;
}
#chatResult u.glance-sub-title {
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
  color: inherit;
}
#chatResult:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}
.chat-comment-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
#chatDoctorNote {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-sizing: border-box;
}
.chat-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.chat-save-mark {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}
.chat-save-mark[hidden] { display: none; }
.chat-save-ask {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 4px 0 0;
}
.chat-save-ask[hidden] { display: none; }
.chat-save-ask p {
  margin: 0;
  flex: 1 1 100%;
  font-size: 0.88rem;
  color: var(--muted);
}
#panel-refguide {
  padding: 0 4px 24px;
}
.rg-admin-bar {
  display: none;
  gap: 8px;
  align-items: center;
  margin: 0 16px 8px;
}
body.is-admin .rg-admin-bar { display: flex; }
#rgAdminJson {
  width: 100%;
  min-height: 220px;
  font-family: var(--mono);
  font-size: 0.78rem;
  box-sizing: border-box;
}
