:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --panel: #ffffff;
  --panel-2: #fbfaf7;
  --ink: #1e2423;
  --muted: #66736f;
  --line: #dbe2dd;
  --soft-line: #edf1ed;
  --teal: #0f766e;
  --teal-2: #0b5f59;
  --amber: #b45309;
  --red: #b91c1c;
  --blue: #2563eb;
  --violet: #4f46e5;
  --green-soft: #e8f6f1;
  --amber-soft: #fff4d7;
  --red-soft: #fdeceb;
  --blue-soft: #eaf1ff;
  --violet-soft: #eeedff;
  --focus: 0 0 0 3px rgba(15, 118, 110, 0.16);
  --shadow: 0 18px 50px rgba(31, 41, 35, 0.10), 0 2px 8px rgba(31, 41, 35, 0.06);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.is-auth-loading .app-shell,
.is-login-mode .app-shell {
  display: none;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 10px;
  background: #1f2a27;
  color: #eff7f3;
  min-height: 0;
  overflow: hidden;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e8f3ed;
  color: #123b34;
  font-weight: 800;
  margin-bottom: 8px;
}

.rail-btn,
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: currentColor;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.rail-btn:hover,
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.10);
}

.rail-btn:active,
.icon-btn:active,
.primary-action:active,
.send-btn:active,
.tool-btn:active,
.conversation-item:active {
  transform: scale(0.97);
}

button:disabled:active {
  transform: none;
}

.rail-btn.is-active {
  background: #f7f4ea;
  color: #123b34;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 14px 14px 12px;
  min-width: 0;
}

.workspace.is-data-mode {
  grid-template-rows: auto minmax(0, 1fr);
}

.workspace.is-data-mode .metrics,
.workspace.is-data-mode .cockpit {
  display: none;
}

.topbar,
.panel-head,
.thread-head,
.top-actions,
.thread-actions,
.search-row,
.composer-row,
.conv-meta,
.tag-row,
.channel-tabs,
.tool-grid {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
  text-wrap: balance;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p,
.panel-head p,
.thread-head p,
.metric small,
.conversation-item small,
.conversation-submeta,
.tool-btn small,
.product-row span,
.timeline time {
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  gap: 10px;
}

.thread-actions {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  transition: background-color 150ms ease, transform 150ms ease;
}

.primary-action:hover {
  background: var(--teal-2);
}

.workspace > .topbar .icon-btn {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 8px;
}

.metric {
  min-height: 58px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(31, 41, 35, 0.03);
}

.metric span,
.metric small {
  display: block;
}

.metric strong {
  display: block;
  margin: 2px 0 0;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.cockpit {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(420px, 1fr) minmax(280px, 340px);
  gap: 14px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.queue-panel,
.thread-panel,
.context-panel {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.queue-panel,
.thread-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.thread-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.panel-head,
.thread-head {
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--soft-line);
}

.panel-head select {
  width: 150px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
}

.search-row {
  gap: 8px;
  height: 42px;
  margin: 12px 14px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
}

.search-row input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.channel-tabs {
  gap: 6px;
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--soft-line);
  overflow-x: auto;
  scrollbar-width: thin;
}

.channel-tabs button {
  flex: 0 0 auto;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  color: var(--muted);
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.channel-tabs button.is-active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.conversation-list,
.messages,
.context-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.conversation-list {
  padding: 8px;
}

.conversation-item {
  display: grid;
  width: 100%;
  min-height: 102px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 10px;
  color: var(--ink);
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.conversation-item:hover {
  background: var(--panel-2);
}

.conversation-item.is-selected {
  background: #eff8f5;
  border-color: #9bd6cb;
}

.conversation-item.is-locked {
  background: #fff8f6;
}

.conversation-shell {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.conversation-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.contact-avatar {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d8e6df;
  border-radius: 50%;
  background: #e8f3ed;
  color: #123b34;
  font-weight: 800;
  line-height: 1;
  flex: 0 0 auto;
}

.contact-avatar.is-sm {
  width: 34px;
  height: 34px;
  font-size: 12px;
}

.contact-avatar.is-lg {
  width: 48px;
  height: 48px;
  font-size: 16px;
}

.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.conversation-topline,
.conversation-title,
.conversation-submeta,
.thread-kicker,
.section-title {
  display: flex;
  align-items: center;
}

.conversation-topline,
.conversation-title,
.conversation-submeta,
.section-title {
  justify-content: space-between;
  gap: 8px;
}

.conversation-title {
  min-width: 0;
}

.conversation-title strong,
.tool-btn strong,
.product-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.conversation-topline time,
.conversation-submeta {
  font-variant-numeric: tabular-nums;
}

.conversation-submeta {
  flex-wrap: wrap;
  line-height: 1.2;
}

.conv-channel,
.channel-badge {
  width: max-content;
  border-radius: 999px;
  background: #eaf4f2;
  color: var(--teal-2);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
}

.thread-kicker {
  gap: 6px;
  flex-wrap: wrap;
}

.status-pill,
.muted-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  width: max-content;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.is-open {
  background: var(--green-soft);
  color: var(--teal-2);
}

.status-pill.is-pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.is-order {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-pill.is-locked,
.status-pill.is-blocked {
  background: var(--red-soft);
  color: var(--red);
}

.muted-pill {
  background: #f3f5f2;
  color: var(--muted);
}

.conv-meta {
  min-height: 22px;
  gap: 5px;
  flex-wrap: wrap;
}

.tag-chip,
.lock-pill,
.order-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 7px;
  background: #f1f5f2;
  color: #3f4f49;
  font-size: 11px;
  font-weight: 700;
}

.lock-pill {
  color: var(--red);
  background: var(--red-soft);
}

.order-pill {
  color: var(--blue);
  background: var(--blue-soft);
}

.lock-pill svg,
.order-pill svg {
  width: 13px;
  height: 13px;
}

.tag-chip.is-bloqueado {
  color: var(--red);
  background: var(--red-soft);
}

.tag-chip.is-stone {
  color: var(--violet);
  background: var(--violet-soft);
}

.tag-chip.is-orcamento {
  color: var(--amber);
  background: var(--amber-soft);
}

.thread-head h2 {
  margin-top: 6px;
  font-size: 20px;
  text-wrap: balance;
}

.thread-title {
  min-width: 0;
}

.thread-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.thread-identity > div {
  min-width: 0;
}

.thread-title p {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.thread-head .icon-btn {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.thread-head .icon-btn.is-danger {
  color: var(--red);
  border-color: #f0b8b8;
  background: #fff6f5;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    repeating-linear-gradient(135deg, #f6f7f5 0 12px, #f1f3ef 12px 24px);
}

.policy-banner,
.empty-thread,
.mini-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.policy-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 680px;
  padding: 10px 12px;
  color: var(--teal-2);
  border-color: #bde0d9;
  background: #f1fbf8;
}

.policy-banner.is-blocked {
  color: var(--red);
  border-color: #f1b9b6;
  background: #fff8f6;
}

.policy-banner strong,
.policy-banner span {
  display: block;
}

.policy-banner strong {
  font-size: 12px;
}

.policy-banner span,
.empty-thread,
.mini-empty {
  color: var(--muted);
  font-size: 12px;
}

.message {
  max-width: min(72%, 620px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 41, 35, 0.05);
}

.message.is-agent,
.message.is-rafaela {
  align-self: flex-end;
  border-color: #c7e8dd;
  background: #dcf8c6;
}

.message.is-rafaela {
  border-color: #bfded3;
  background: #e9fdd7;
}

.message span,
.message time {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.message p {
  margin: 5px 0;
  line-height: 1.45;
  text-wrap: pretty;
}

.message time {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.empty-thread,
.mini-empty {
  padding: 12px;
}

.composer {
  border-top: 1px solid var(--soft-line);
  padding: 10px 12px;
  background: #f0f2f0;
}

.composer-state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.composer-state.is-blocked {
  color: var(--red);
}

.composer-row {
  gap: 10px;
  margin-top: 8px;
}

.composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 108px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

.composer textarea:focus {
  border-color: #80cfc3;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.send-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  transition: background-color 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.composer-icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.composer-icon-btn:hover {
  border-color: #9bd6cb;
  color: var(--teal-2);
  background: #eff8f5;
}

.composer-icon-btn.is-recording {
  border-color: #f0b8b8;
  color: var(--red);
  background: #fff6f5;
}

.send-btn:disabled,
.composer-icon-btn:disabled,
.composer textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.context-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.context-section {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.section-title {
  margin-bottom: 10px;
}

.context-section h2 {
  margin-bottom: 10px;
}

.section-title h2 {
  margin-bottom: 0;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 7px;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.compact-dl {
  gap: 6px;
  margin-bottom: 10px;
}

.compact-dl div {
  padding-bottom: 6px;
}

.tag-row {
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.order-alert {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #cbdcff;
  border-radius: 8px;
  background: #f3f7ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  border-top: 1px solid var(--soft-line);
  padding-top: 9px;
  margin-top: 9px;
}

.order-row:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.order-row strong,
.order-row span,
.order-row small,
.order-row b {
  display: block;
}

.order-row span,
.order-row small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.order-row b {
  color: var(--blue);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.order-row small {
  grid-column: 1 / -1;
}

.row-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.order-link,
.mini-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--teal-2);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.mini-link {
  color: var(--ink);
}

.order-alert span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tool-grid {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 7px 10px;
  font-weight: 700;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.tool-btn > svg {
  flex: 0 0 18px;
}

.tool-btn span,
.tool-btn strong,
.tool-btn small {
  display: block;
}

.tool-btn span {
  min-width: 0;
  text-align: left;
}

.tool-btn small {
  margin-top: 2px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.tool-btn:hover {
  border-color: #9bd6cb;
  background: #eff8f5;
}

.tool-btn.is-disabled,
.tool-btn:disabled {
  color: var(--muted);
  border-color: var(--soft-line);
  background: #f7f8f6;
  opacity: 0.72;
}

.product-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border-top: 1px solid var(--soft-line);
  padding-top: 10px;
  margin-top: 10px;
}

.product-row:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.product-row img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.10);
}

.product-row strong,
.product-row span {
  display: block;
}

.product-row div {
  min-width: 0;
}

.product-row strong {
  overflow-wrap: anywhere;
}

.timeline {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.timeline li {
  padding-left: 4px;
}

.timeline li.is-denied::marker {
  color: var(--red);
}

.timeline li.is-denied span {
  color: var(--red);
}

.timeline span,
.timeline time {
  display: block;
}

.data-view {
  min-height: 0;
  overflow: hidden;
}

.data-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.data-panel {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
}

.data-panel.is-wide {
  height: 100%;
}

.data-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.data-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.data-list,
.order-table,
.reason-list {
  display: grid;
  gap: 8px;
}

.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  width: 100%;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  text-align: left;
}

.data-row.is-selected {
  border-color: #9bd6cb;
  background: #eff8f5;
}

.data-row span,
.data-row strong,
.data-row small {
  display: block;
  min-width: 0;
}

.data-row strong {
  overflow-wrap: anywhere;
}

.data-row small,
.order-owner {
  color: var(--muted);
  font-size: 12px;
}

.data-row b {
  min-width: 42px;
  color: var(--teal-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-dl {
  margin-bottom: 12px;
}

.order-table-row {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 10px;
}

.order-table-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.reason-list span {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  background: #f1f5f2;
  color: #3f4f49;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 220px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid #9bd6cb;
  border-radius: 8px;
  background: #102b27;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease;
  z-index: 10;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  background:
    linear-gradient(rgba(246, 247, 245, 0.88), rgba(246, 247, 245, 0.88)),
    repeating-linear-gradient(135deg, #e8eeeb 0 14px, #f4f6f3 14px 28px);
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(390px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.login-card h1 {
  font-size: 22px;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-card input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
}

.login-card .primary-action {
  justify-content: center;
  width: 100%;
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.fatal {
  margin: 24px;
  padding: 16px;
  border-radius: 8px;
  background: #fee2e2;
  color: #7f1d1d;
  white-space: pre-wrap;
}

@media (max-width: 1180px) {
  .cockpit {
    grid-template-columns: minmax(270px, 330px) minmax(420px, 1fr);
  }

  .context-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 260px;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 5;
    flex-direction: row;
    justify-content: center;
    min-height: 58px;
    padding: 8px;
  }

  .brand-mark {
    margin: 0 auto 0 0;
  }

  .workspace {
    padding: 12px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cockpit,
  .context-panel,
  .data-layout {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .thread-head {
    align-items: flex-start;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .panel-head select {
    width: 100%;
  }

  .queue-panel,
  .thread-panel {
    min-height: 420px;
  }

  .message {
    max-width: 92%;
  }
}

@media (max-width: 540px) {
  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .thread-head {
    flex-direction: column;
  }

  .thread-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .composer-row {
    align-items: stretch;
  }

  .send-btn {
    width: 44px;
    flex-basis: 44px;
  }

  .message {
    max-width: 100%;
  }

  .order-alert {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .order-alert strong {
    grid-column: 2;
  }
}
