:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18312d;
  background: #eef4f1;
}

* { box-sizing: border-box; }
[hidden], .sr-only { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 8% 5%, rgba(45, 139, 116, 0.16), transparent 30rem), #eef4f1;
}

button, input, textarea, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px clamp(20px, 5vw, 64px);
  background: rgba(247, 250, 248, 0.94);
  border-bottom: 1px solid #d8e3df;
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 10px; color: #18312d; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 32px; color: #fff; background: #0b5c4f; border-radius: 9px; font-size: .84rem; letter-spacing: .04em; }
.local-badge { padding: 6px 10px; color: #075648; background: #dff1eb; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 70px; }
.workspace { display: grid; gap: 22px; }
.panel { padding: clamp(24px, 4vw, 40px); background: rgba(255, 255, 255, .97); border: 1px solid #d7e2de; border-radius: 22px; box-shadow: 0 18px 55px rgba(31, 66, 58, .08); }
.auth-panel { width: min(520px, 100%); margin: 6vh auto 0; }
.hero-panel { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; }
.eyebrow { margin: 0 0 10px; color: #0b6b5a; font-size: .76rem; font-weight: 800; letter-spacing: .12em; }
h1, h2 { margin: 0; color: #162d29; letter-spacing: -.035em; }
h1 { font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.02; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
.lead { max-width: 720px; margin: 14px 0 0; color: #586e69; font-size: 1.05rem; line-height: 1.55; }
.muted { color: #71837e; font-size: .82rem; }
.user-box { min-width: 235px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px; border: 1px solid #dbe5e1; border-radius: 16px; }
.user-box strong { display: block; margin-top: 4px; }
.role-label { display: block; margin-top: 4px; color: #0b6b5a; font-size: .74rem; font-weight: 850; text-transform: uppercase; }
.user-actions { display: flex; gap: 8px; }

.form-stack { display: grid; gap: 17px; margin-top: 28px; }
.form-stack label, .form-inline label { display: grid; gap: 7px; color: #415b55; font-weight: 700; }
input, textarea, select { width: 100%; min-height: 48px; padding: 10px 13px; color: #17302b; background: #fff; border: 1px solid #cbd9d4; border-radius: 11px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: #0b6b5a; box-shadow: 0 0 0 3px rgba(11, 107, 90, .12); }
.form-message { min-height: 20px; margin: 8px 0 0; color: #a43b3b; font-size: .9rem; }
button { appearance: none; min-height: 46px; padding: 11px 17px; color: #fff; background: #0b5c4f; border: 0; border-radius: 11px; font-weight: 800; cursor: pointer; }
button:hover { background: #084a40; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible { outline: 3px solid #91c9bb; outline-offset: 3px; }
button.secondary { color: #164c43; background: #e6f0ed; }
button.secondary:hover { background: #d7e8e2; }

.chat-panel { padding-bottom: 30px; }
.chat-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.chat-feed { min-height: 300px; max-height: 68vh; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding: 8px 6px 24px; scroll-behavior: smooth; }
.message { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; align-items: start; max-width: 94%; }
.user-message { align-self: flex-end; grid-template-columns: minmax(0, 1fr); max-width: 80%; }
.message-label { display: grid; place-items: center; width: 38px; height: 38px; color: #fff; background: #0b5c4f; border-radius: 50%; font-size: .72rem; font-weight: 900; }
.message-body { min-width: 0; padding: 14px 17px; background: #f1f7f4; border: 1px solid #dbe6e2; border-radius: 5px 17px 17px 17px; line-height: 1.55; }
.user-message .message-body { color: #fff; background: #0b5c4f; border-color: #0b5c4f; border-radius: 17px 17px 5px 17px; }
.message-body p { margin: 0; white-space: pre-wrap; }
.message-body p + p { margin-top: 10px; }
.message-body h3 { margin: 14px 0 8px; font-size: 1rem; }
.message-body ul { margin: 8px 0 0; padding-left: 20px; }
.message-body details { margin-top: 13px; padding-top: 11px; border-top: 1px solid #d2e0db; }
.message-body summary { color: #165c50; font-weight: 800; cursor: pointer; }
.message.loading .message-body { color: #667a74; }
.user-photo-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.user-photo-row img { width: 94px; height: 70px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .32); }

.candidate-list { display: grid; gap: 10px; margin-top: 13px; }
.candidate-card { padding: 14px; background: #fff; border: 1px solid #d7e3df; border-radius: 13px; }
.candidate-card.best { border-color: #6bad99; box-shadow: 0 0 0 2px rgba(34, 126, 103, .09); }
.candidate-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.candidate-top strong { overflow-wrap: anywhere; }
.candidate-rank { flex: 0 0 auto; color: #075648; font-size: .76rem; font-weight: 900; }
.candidate-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.candidate-meta span { padding: 4px 7px; color: #385750; background: #edf4f1; border-radius: 7px; font-size: .8rem; }
.candidate-article { margin-top: 8px !important; color: #586e69; font-size: .86rem; }
.nomenclature-list { display: grid; gap: 5px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #e0e8e5; }
.nomenclature-list p { color: #3d5b54; font-size: .8rem; overflow-wrap: anywhere; }
.grounded-answer { margin-bottom: 12px !important; }
.stock-note { margin-top: 12px !important; padding: 10px 12px; color: #6b5116; background: #fff7df; border-radius: 10px; font-size: .86rem; }
.parameter-line { margin-top: 10px !important; color: #536c66; font-size: .87rem; }
.status-line { color: #075648; font-weight: 850; }

.composer { position: relative; margin-top: 4px; padding: 13px; background: #fff; border: 1px solid #bdcec8; border-radius: 20px; box-shadow: 0 10px 30px rgba(31, 66, 58, .1); }
.composer:focus-within { border-color: #0b6b5a; box-shadow: 0 0 0 3px rgba(11, 107, 90, .1), 0 10px 30px rgba(31, 66, 58, .1); }
.composer.dragging { border-color: #0b6b5a; background: #f1f8f5; }
.composer textarea { min-height: 56px; max-height: 190px; padding: 8px 6px; border: 0; border-radius: 0; resize: none; line-height: 1.5; box-shadow: none; }
.composer textarea:focus { border: 0; box-shadow: none; }
.composer-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.composer-left { display: flex; gap: 8px; }
.icon-button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 11px; color: #164c43; background: #e6f0ed; border-radius: 999px; }
.icon-button:hover { background: #d7e8e2; }
.icon-button.listening { color: #fff; background: #a43b3b; }
.send-button { min-height: 42px; padding: 9px 18px; border-radius: 999px; }
.attachment-strip { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 8px; }
.attachment { position: relative; width: 105px; }
.attachment img { display: block; width: 105px; height: 78px; object-fit: cover; border: 1px solid #d4e0dc; border-radius: 12px; }
.attachment button { position: absolute; top: -7px; right: -7px; display: grid; place-items: center; width: 25px; min-height: 25px; height: 25px; padding: 0; color: #fff; background: #364d48; border: 2px solid #fff; border-radius: 50%; }
.attachment span { display: block; margin-top: 4px; overflow: hidden; color: #60746f; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.composer-message { min-height: 0; margin: 7px 5px 0; color: #a43b3b; font-size: .86rem; }
.composer-message:empty { display: none; }
.privacy-note { margin: 8px 5px 0; color: #72847f; font-size: .75rem; line-height: 1.4; }

.monitor-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
.monitor-stat { padding: 13px; background: #f1f7f4; border: 1px solid #d8e5e0; border-radius: 12px; }
.monitor-stat span { display: block; color: #667b75; font-size: .75rem; }
.monitor-stat strong { display: block; margin-top: 4px; font-size: 1.35rem; }
.monitor-grid { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.4fr); gap: 18px; }
.monitor-grid h3 { margin: 0 0 10px; }
.monitor-list { display: grid; gap: 8px; }
.monitor-row { padding: 11px 12px; background: #f8faf9; border: 1px solid #dbe5e1; border-radius: 11px; }
.monitor-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.monitor-row p { margin: 6px 0 0; color: #5f746e; font-size: .8rem; line-height: 1.4; overflow-wrap: anywhere; }
.presence-badge, .processing-badge { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; font-size: .69rem; font-weight: 850; }
.presence-online, .processing-running { color: #075648; background: #dff1eb; }
.presence-recent, .processing-queued { color: #76560a; background: #fff2c9; }
.presence-offline, .presence-disabled, .processing-completed { color: #526660; background: #e8eeec; }
.processing-failed, .processing-timed_out { color: #8f2e2e; background: #f9dddd; }

.registry-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.registry-lead { margin-bottom: 22px; font-size: .94rem; }
.admin-registry-tools { margin: 18px 0 24px; padding: 16px; background: #f1f7f4; border: 1px solid #d8e5e0; border-radius: 14px; }
.create-user-form { display: grid; grid-template-columns: auto 1fr 1fr 150px auto; gap: 10px; align-items: center; }
.export-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.button-link { display: inline-flex; align-items: center; min-height: 42px; padding: 9px 14px; color: #fff; background: #0b5c4f; border-radius: 10px; font-size: .86rem; font-weight: 800; text-decoration: none; }
.secondary-link { color: #164c43; background: #dceae5; }
.registry-list { display: grid; gap: 14px; }
.registry-card { padding: 16px; border: 1px solid #d7e3df; border-radius: 15px; background: #fff; }
.registry-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.registry-meta { color: #6a7f79; font-size: .78rem; }
.verdict-badge { padding: 4px 8px; color: #385750; background: #edf4f1; border-radius: 999px; font-size: .74rem; font-weight: 850; }
.registry-block { margin-top: 10px; padding: 10px 12px; background: #f4f8f6; border-radius: 10px; white-space: pre-wrap; }
.registry-block strong { display: block; margin-bottom: 4px; font-size: .78rem; color: #58706a; }
.registry-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.registry-images img { width: 150px; height: 105px; object-fit: cover; border: 1px solid #d3dfdb; border-radius: 10px; }
.review-form { display: grid; grid-template-columns: 180px 1fr; gap: 10px; margin-top: 12px; }
.review-form textarea { min-height: 78px; resize: vertical; }
.review-form .correct-answer { grid-column: 1 / -1; }
.review-form button { justify-self: start; }

.account-panel { padding-top: 24px; padding-bottom: 24px; }
.account-panel summary { color: #164c43; font-weight: 800; cursor: pointer; }
.form-inline { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: end; margin-top: 20px; }

@media (max-width: 820px) {
  .hero-panel { grid-template-columns: 1fr; }
  .user-box { min-width: 0; }
  .form-inline { grid-template-columns: 1fr; }
  .create-user-form { grid-template-columns: 1fr; }
  .review-form { grid-template-columns: 1fr; }
  .review-form .correct-answer { grid-column: auto; }
  .monitor-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monitor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 18px, 1120px); padding-top: 18px; }
  .panel { padding: 21px; border-radius: 17px; }
  .hero-panel .lead { display: none; }
  .user-box { padding: 12px; }
  .user-actions { flex-direction: column; }
  .chat-feed { min-height: 260px; max-height: 62vh; }
  .message { max-width: 100%; }
  .user-message { max-width: 90%; }
  .message-label { width: 32px; height: 32px; }
  .message { grid-template-columns: 32px minmax(0, 1fr); gap: 8px; }
  .control-text { display: none; }
  .icon-button { width: 40px; justify-content: center; padding: 8px; }
  .privacy-note { font-size: .7rem; }
}

.transcript-preview {white-space:pre-wrap;overflow-wrap:anywhere;max-height:28rem;overflow:auto;font:inherit;}
.transcript-item {padding:1rem 0;border-bottom:1px solid #ddd;}
.transcript-item progress {width:100%;}

.shell {width:min(1440px,calc(100% - 32px));padding-top:18px;}
.hero-panel {padding:16px 22px;gap:16px;}
.hero-panel h1 {font-size:1.35rem;}
.hero-panel .lead,.hero-panel .eyebrow {display:none;}
.user-box {padding:8px 12px;}
.chat-layout {display:grid;grid-template-columns:260px minmax(0,1fr);gap:16px;align-items:start;}
.chat-sidebar {padding:18px 12px;position:sticky;top:84px;}
.sidebar-heading {display:flex;align-items:center;justify-content:space-between;padding:0 6px 16px;gap:8px;}
.sidebar-heading h2 {font-size:1.2rem;}
#new-chat {width:100%;margin-bottom:12px;}
.saved-chat-row {display:flex;align-items:center;gap:3px;margin:5px 0;}
.saved-chat {text-align:left;min-width:0;flex:1;color:#18312d;background:transparent;font-weight:500;padding:12px 10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.saved-chat:hover {background:#edf4f1;}
.saved-chat[aria-current=true] {background:#dceee6;color:#084a40;}
.remove-chat {padding:8px;min-width:36px;background:transparent !important;}
.chat-panel {min-width:0;padding:22px;}
.chat-heading {gap:12px;flex-wrap:wrap;align-items:center;}
.chat-heading>div {flex:1;min-width:0;}
#chat-title {font-size:1.2rem;overflow-wrap:anywhere;}
#chat-back {display:none;}
.chat-actions {position:relative;}
.chat-actions summary {cursor:pointer;padding:12px;}
.chat-actions>div {position:absolute;right:0;top:100%;display:grid;gap:6px;padding:12px;background:white;border:1px solid #d7e2de;border-radius:12px;z-index:15;min-width:210px;box-shadow:0 8px 24px #18312d20;}
.chat-feed {max-height:60dvh;min-height:230px;}
.user-photo-row img {cursor:zoom-in;}
@media (min-width:701px) and (max-width:1000px) {
 .chat-layout {grid-template-columns:220px minmax(0,1fr);gap:10px;}
 .chat-panel {padding:16px;}.chat-sidebar {padding:14px 8px;}
}
@media (max-width:700px) {
 .shell {width:calc(100% - 16px);padding-top:8px;}
 .workspace {gap:10px;}.topbar {min-height:48px;padding:8px 12px;}
 .hero-panel {display:block;padding:10px 12px;border-radius:14px;}
 .hero-panel>div:first-child {display:none;}
 .user-box {min-width:0;padding:0;border:0;gap:8px;flex-wrap:wrap;}
 .user-box .muted,.role-label {display:none;}
 .user-actions {flex-wrap:wrap;gap:4px;}
 .user-actions button {padding:8px;min-height:40px;}
 .chat-layout {display:block;}
 .chat-sidebar {position:static;display:none;padding:16px;}
 .chat-layout.list-open .chat-sidebar {display:block;}
 .chat-layout.list-open .chat-panel {display:none;}
 .chat-panel {padding:12px;border-radius:14px;}
 #chat-back {display:block;padding:8px;}
 .chat-heading {gap:6px;margin-bottom:10px;}
 .chat-heading .eyebrow {display:none;}
 .chat-heading>div {flex-basis:140px;}
  .chat-actions summary {padding:8px;}
  .chat-actions>div {left:0;right:auto;}
  .composer .control-text {display:inline;font-size:.8rem;}
  .composer textarea {font-size:16px;}
 .chat-feed {max-height:52dvh;min-height:180px;padding:6px 0 14px;gap:12px;}
 .message,.user-message {max-width:100%;}
 .message {grid-template-columns:26px minmax(0,1fr);gap:6px;}
 .user-message {grid-template-columns:minmax(0,1fr);}
 .message-label {width:26px;height:26px;font-size:.6rem;}
 .message-body {padding:10px;}
 .composer {padding:10px;}
 .privacy-note {font-size:.75rem;}
 .saved-chat {min-height:50px;}
 .remove-chat {min-height:44px;min-width:44px;}
}


/* MIG-D-116: the label and the color convey the same priority meaning. */
.blue-position { color: #064c9f; background: #e5f0ff; font-weight: 700; border-radius: 4px; overflow-wrap: anywhere; }
.blue-label { display: block; color: #064c9f; font-weight: 700; }
.registry-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.blue-filter[aria-pressed="true"] { background: #064c9f; color: white; border-color: #064c9f; }
.registry-blue-card { border-left: 4px solid #1467c5; }
.blue-observations { background: #f1f6ff; border-radius: 10px; padding: 12px; margin: 10px 0; overflow-wrap: anywhere; }
.blue-observations p { margin: 6px 0; }
.next-variant { margin: 12px 0; }
@media (max-width: 700px) { .registry-heading { align-items: flex-start; flex-wrap: wrap; gap: 12px; } }
