:root {
  color-scheme: light;
  --bg: #d9e4da;
  --bg-deep: #cedbcf;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --rail: rgba(243, 247, 243, 0.88);
  --border: rgba(17, 44, 30, 0.1);
  --text: #10241a;
  --muted: #66756a;
  --muted-strong: #405045;
  --accent: #157347;
  --accent-strong: #0d5d38;
  --accent-soft: #dff3e6;
  --accent-ghost: rgba(21, 115, 71, 0.12);
  --alert-bg: rgba(255, 247, 214, 0.9);
  --alert-border: rgba(177, 129, 24, 0.28);
  --incoming: #ffffff;
  --outgoing: #dcf8c6;
  --shadow: 0 24px 60px rgba(15, 42, 26, 0.14);
  --shadow-soft: 0 10px 28px rgba(15, 42, 26, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
.is-hidden { display: none !important; }
body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(21, 115, 71, 0.12), transparent 28%),
    radial-gradient(circle at 85% 20%, rgba(209, 140, 34, 0.08), transparent 24%),
    linear-gradient(180deg, #e4ece4 0%, #dbe6dc 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(135deg, rgba(255,255,255,0.24) 25%, transparent 25%),
    linear-gradient(225deg, rgba(255,255,255,0.18) 25%, transparent 25%);
  background-size: 30px 30px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.4), transparent 85%);
}

.app-shell {
  height: 100dvh;
  padding: 16px;
  display: grid;
  grid-template-columns: 76px 390px minmax(0, 1fr) 340px;
  gap: 16px;
  overflow: hidden;
  align-items: stretch;
}

.utility-rail,
.sidebar,
.conversation-panel,
.details-panel {
  min-height: 0;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.utility-rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 12px;
  background: var(--rail);
}

.rail-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-btn,
.filter-chip,
.ghost-btn,
.icon-btn,
.send-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.rail-btn {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  background: rgba(255,255,255,0.84);
  border-color: var(--border);
  box-shadow: var(--shadow-soft);
}

.rail-btn.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-color: rgba(0,0,0,0.04);
}

.rail-icon {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.rail-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #1c9c5d;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.95);
  box-shadow: 0 6px 16px rgba(15, 42, 26, 0.18);
}

.rail-badge.is-hidden {
  display: none;
}

.rail-btn.is-busy::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 2px solid rgba(21, 115, 71, 0.18);
  border-top-color: var(--accent);
  animation: rail-spin 0.9s linear infinite;
  pointer-events: none;
}

@keyframes rail-spin {
  to { transform: rotate(360deg); }
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.brand-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(21, 115, 71, 0.1);
  border: 1px solid rgba(21, 115, 71, 0.12);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 700;
}

.brand-pill.muted {
  background: rgba(255,255,255,0.78);
  border-color: var(--border);
  color: var(--muted-strong);
}

.brand-user-picker {
  display: grid;
  gap: 4px;
  width: 170px;
}

.brand-user-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.brand-user-picker select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.82);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1dbf73, #11744a);
  box-shadow: 0 12px 28px rgba(17, 116, 74, 0.24);
}

.brand-mark span {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid rgba(255,255,255,0.92);
  position: relative;
}

.brand-mark span::before,
.brand-mark span::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,0.92);
  border-radius: 999px;
}

.brand-mark span::before { width: 10px; height: 2px; left: 2px; top: 4px; }
.brand-mark span::after { width: 6px; height: 2px; left: 2px; top: 9px; }

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.global-alert {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--alert-border);
  background: var(--alert-bg);
  color: #715308;
  font-size: 0.88rem;
  line-height: 1.45;
}

.global-alert.is-hidden { display: none; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: var(--shadow-soft);
}

.search-box-action {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: var(--muted-strong);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.search-box-action.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(21, 115, 71, 0.18);
}

.search-box input,
.composer textarea {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.search-icon {
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  background: var(--muted);
  right: -6px;
  bottom: -2px;
  transform: rotate(45deg);
  border-radius: 999px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.82);
  color: var(--muted-strong);
  border-color: var(--border);
  font-size: 0.84rem;
  line-height: 1;
  box-shadow: none;
}

.filter-chip-more {
  min-width: 34px;
  padding-inline: 10px;
  font-weight: 800;
}

.filter-chip-product:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.filter-chip.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(21, 115, 71, 0.2);
  box-shadow: 0 8px 18px rgba(21, 115, 71, 0.12);
}

.filter-chip:hover,
.ghost-btn:hover,
.icon-btn:hover,
.send-btn:hover,
.rail-btn:hover { transform: translateY(-1px); }

.stats-grid { display: none; }

.section-head,
.details-head,
.conversation-topbar,
.conversation-meta,
.message-meta,
.thread-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-head {
  color: var(--muted-strong);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.ghost-btn {
  padding: 8px 12px;
  background: rgba(255,255,255,0.8);
  border-color: var(--border);
  color: var(--text);
}

.thread-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.thread-selection-toolbar {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  margin: 8px 0 10px;
  border-radius: 16px;
  border: 1px solid rgba(21, 115, 71, 0.12);
  background: rgba(235, 247, 239, 0.82);
}

.thread-selection-toolbar.is-hidden {
  display: none;
}

.thread-selection-summary {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.thread-selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thread-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.7);
  cursor: pointer;
}

.thread-item:hover {
  background: rgba(255,255,255,0.88);
  border-color: var(--border);
}

.thread-item.is-selected {
  border-color: rgba(21, 115, 71, 0.24);
  box-shadow: 0 8px 18px rgba(21, 115, 71, 0.08);
}

.thread-item.is-active {
  background: linear-gradient(180deg, rgba(226, 246, 233, 0.96), rgba(245, 252, 247, 0.94));
  border-color: rgba(21, 115, 71, 0.18);
  box-shadow: 0 10px 24px rgba(21, 115, 71, 0.1);
}

.thread-avatar,
.avatar {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: linear-gradient(135deg, #d9e9df, #b8d0bf);
  color: #14452d;
  display: grid;
  place-items: center;
  font-weight: 800;
  overflow: hidden;
}

.avatar-claim-indicator {
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: #df4545;
  border: 2px solid rgba(255,255,255,0.96);
  box-shadow: 0 6px 16px rgba(150, 29, 29, 0.26);
}

.thread-avatar.is-image,
.avatar.is-image {
  background: rgba(255,255,255,0.88);
}

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

.thread-body { min-width: 0; flex: 1; }
.thread-line { gap: 10px; }

.thread-state-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.thread-selection-chip,
.thread-task-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.thread-selection-chip {
  background: rgba(21, 115, 71, 0.12);
  color: var(--accent-strong);
}

.thread-task-chip {
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--border);
  color: var(--muted-strong);
}

.thread-task-chip[data-tone="running"] {
  background: rgba(21, 115, 71, 0.12);
  border-color: rgba(21, 115, 71, 0.18);
  color: var(--accent-strong);
}

.thread-task-chip[data-tone="queued"] {
  background: rgba(217, 161, 36, 0.12);
  border-color: rgba(217, 161, 36, 0.2);
  color: #8f6500;
}

.thread-name-wrap {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.thread-name {
  font-size: 0.96rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-pin {
  display: none;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(21, 115, 71, 0.1);
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 700;
}

.thread-item.is-pinned .thread-pin {
  display: inline-flex;
}

.thread-time { font-size: 0.75rem; color: var(--muted); flex: 0 0 auto; }

.thread-preview,
.thread-channel,
.thread-order {
  color: var(--muted);
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-preview { padding-right: 8px; }
.thread-foot { margin-top: 6px; }

.thread-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.thread-labels.is-hidden {
  display: none;
}

.hermes-task-summary {
  color: var(--accent-strong);
  font-weight: 700;
}

.thread-mini-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(21, 115, 71, 0.08);
  border: 1px solid rgba(21, 115, 71, 0.12);
  color: var(--accent-strong);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.thread-channel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-strong);
  font-weight: 700;
}

.thread-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.conversation-panel,
.details-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.conversation-panel {
  overflow: hidden;
}

.conversation-topbar {
  padding: 16px 18px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.68);
}

.conversation-meta {
  gap: 12px;
  justify-content: flex-start;
  min-width: 0;
  flex: 1;
}

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

.conversation-meta h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.conversation-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.conversation-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.conversation-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.thread-order-window-indicator {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.96);
  box-shadow: 0 6px 16px rgba(15, 42, 26, 0.16);
}

.thread-order-window-indicator.is-unknown {
  background: #a6b4aa;
}

.thread-order-window-indicator.is-warning {
  background: #d9a124;
}

.thread-order-window-indicator.is-safe {
  background: #1c9c5d;
}

.thread-order-window-indicator.is-claim {
  background: #df4545;
}

.favorite-labels-wrap {
  position: relative;
}

.favorite-labels-toggle {
  min-width: 44px;
  padding-inline: 12px;
}

.favorite-labels-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  max-width: 320px;
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.97);
  box-shadow: 0 24px 50px rgba(15, 42, 26, 0.18);
  z-index: 30;
}

.favorite-label-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.favorite-label-item:hover,
.favorite-label-item.is-active {
  background: rgba(21, 115, 71, 0.08);
}

.icon-btn,
.send-btn {
  padding: 10px 14px;
  background: var(--panel-solid);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.composer-btn { min-width: 48px; }

.composer-btn.is-recording {
  background: rgba(223, 69, 69, 0.12);
  border-color: rgba(223, 69, 69, 0.24);
  color: #a72626;
}

.messages-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,0.48), transparent 14%),
    radial-gradient(circle at 90% 80%, rgba(255,255,255,0.34), transparent 14%),
    linear-gradient(180deg, rgba(250,252,250,0.85), rgba(245,249,245,0.72));
  position: relative;
}

.messages-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(17,93,56,0.15) 8%, transparent 9%),
    radial-gradient(circle, rgba(17,93,56,0.11) 8%, transparent 9%);
  background-size: 44px 44px;
  background-position: 0 0, 22px 22px;
}

.messages-wrap > * { position: relative; z-index: 1; }

.empty-state {
  margin: auto;
  max-width: 420px;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.empty-state h2 {
  margin: 14px 0 8px;
  color: var(--text);
  font-size: 1.2rem;
}

.empty-illustration {
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 28px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), transparent 22%),
    linear-gradient(135deg, rgba(21,115,71,0.85), rgba(17,93,60,0.88));
  position: relative;
  box-shadow: 0 16px 36px rgba(21,115,71,0.22);
}

.empty-illustration::before,
.empty-illustration::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
}

.empty-illustration::before { width: 30px; height: 18px; left: 18px; top: 24px; }
.empty-illustration::after { width: 18px; height: 12px; left: 28px; top: 45px; }

.day-divider {
  align-self: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(0,0,0,0.05);
  color: var(--muted);
  font-size: 0.76rem;
  box-shadow: var(--shadow-soft);
}

.message {
  display: flex;
  max-width: 100%;
}

.message.is-incoming { justify-content: flex-start; }
.message.is-outgoing { justify-content: flex-end; }
.message.is-system { justify-content: center; }

.message-bubble {
  max-width: min(72ch, 78%);
  padding: 12px 14px 11px;
  border-radius: 18px;
  position: relative;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(0,0,0,0.04);
}

.message.is-incoming .message-bubble {
  background: var(--incoming);
  border-top-left-radius: 8px;
}

.message.is-outgoing .message-bubble {
  background: var(--outgoing);
  border-top-right-radius: 8px;
}

.message.is-system .message-bubble {
  max-width: min(520px, 92%);
  background: rgba(181, 51, 47, 0.14);
  border-color: rgba(181, 51, 47, 0.3);
  color: #6d241f;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  box-shadow: 0 14px 30px rgba(120, 33, 28, 0.1);
}

.message.is-system .message-meta {
  justify-content: center;
}

.message.is-system .message-name,
.message.is-system .message-time {
  color: #8a302a;
}

.message.is-system .message-content {
  text-align: center;
}

.message.is-system.is-neutral-system .message-bubble {
  background: #eef0ef;
  border-color: #d6dbd8;
  color: #33413a;
  box-shadow: 0 12px 28px rgba(31, 41, 55, 0.08);
}

.message.is-system.is-neutral-system .message-name,
.message.is-system.is-neutral-system .message-time {
  color: #516058;
}

.message-meta {
  gap: 10px;
  justify-content: flex-start;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.message-name {
  color: var(--accent-strong);
  font-weight: 700;
}

.message-content {
  display: grid;
  gap: 10px;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 0.94rem;
}

.message-quoted {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border-left: 4px solid rgba(21, 115, 71, 0.42);
  background: rgba(16, 36, 26, 0.06);
}

.message-quoted.is-hidden {
  display: none;
}

.message-quoted-name {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.message-quoted-text {
  color: var(--muted-strong);
  font-size: 0.82rem;
  line-height: 1.4;
}

.message-text {
  white-space: pre-wrap;
}

.message-flags {
  display: grid;
  gap: 6px;
}

.message-deleted {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(177, 129, 24, 0.12);
  color: #8c5b16;
  font-size: 0.8rem;
  font-weight: 700;
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted-strong);
}

.reaction-chip-emoji {
  font-size: 0.92rem;
}

.message-reply-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(16, 36, 26, 0.08);
  color: var(--muted-strong);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  transition: opacity 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.message-react-btn {
  position: absolute;
  top: 10px;
  right: 92px;
  opacity: 0;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(16, 36, 26, 0.08);
  color: var(--muted-strong);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  transition: opacity 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.message-bubble:hover .message-reply-btn,
.message-bubble:hover .message-react-btn,
.message-react-btn:focus-visible,
.message-reply-btn:focus-visible {
  opacity: 1;
}

.message-reply-btn:hover,
.message-react-btn:hover {
  transform: translateY(-1px);
  background: rgba(21, 115, 71, 0.14);
}

.message-media {
  display: grid;
  gap: 8px;
}

.message-media.is-audio {
  width: min(360px, 100%);
  min-width: 300px;
}

.message-media.is-clickable {
  cursor: zoom-in;
}

.message-media-frame {
  width: min(280px, 100%);
  aspect-ratio: 4 / 3;
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(12, 29, 18, 0.08);
  box-shadow: 0 12px 28px rgba(15, 42, 26, 0.12);
}

.message-image,
.message-video {
  display: block;
  width: 100%;
  height: 100%;
  background: rgba(10, 29, 18, 0.06);
  object-fit: cover;
}

.message-video {
  pointer-events: none;
}

.message-video-icon {
  position: absolute;
  inset: auto auto 12px 12px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(12, 29, 18, 0.66);
  box-shadow: 0 8px 22px rgba(0,0,0,0.24);
}

.message-video-icon::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 12px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 13px solid rgba(255,255,255,0.94);
}

.message-audio {
  display: block;
  width: 100%;
  min-width: 0;
}

.message-audio-shell {
  position: relative;
  width: 100%;
  border-radius: 18px;
  padding: 8px 44px 8px 8px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(17, 93, 56, 0.08);
  box-shadow: 0 10px 24px rgba(15, 42, 26, 0.08);
}

.message-audio-speed-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(17, 93, 56, 0.12);
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: var(--accent-strong);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.message-audio-speed-menu {
  position: absolute;
  right: 10px;
  top: 44px;
  z-index: 2;
  display: none;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(17, 93, 56, 0.12);
  box-shadow: 0 14px 28px rgba(15, 42, 26, 0.14);
}

.message-audio-shell.is-speed-open .message-audio-speed-menu {
  display: grid;
}

.message-audio-speed-option {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted-strong);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.message-audio-speed-option:hover,
.message-audio-speed-option.is-active {
  background: rgba(17, 93, 56, 0.1);
  color: var(--accent-strong);
}

@media (max-width: 720px) {
  .message-media.is-audio {
    min-width: 0;
    width: 100%;
  }
}

.message-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(21,115,71,0.16);
  background: rgba(255,255,255,0.76);
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 700;
}

.message-file:hover {
  text-decoration: underline;
}

.composer {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.74);
  position: relative;
}

.quick-reply-picker {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(100% + 10px);
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.98);
  box-shadow: var(--shadow);
  z-index: 24;
}

.quick-reply-picker.is-hidden {
  display: none;
}

.quick-reply-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted-strong);
}

.quick-reply-list {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.quick-reply-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(245, 250, 246, 0.95);
  padding: 10px 12px;
  cursor: pointer;
}

.quick-reply-item:hover,
.quick-reply-item.is-active {
  border-color: rgba(21, 115, 71, 0.22);
  background: rgba(223, 243, 230, 0.95);
}

.quick-reply-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quick-reply-shortcut {
  font-weight: 800;
  color: var(--accent-strong);
}

.quick-reply-title {
  font-size: 0.8rem;
  color: var(--muted);
}

.quick-reply-preview {
  margin-top: 6px;
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.quick-reply-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.quick-reply-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(16, 36, 26, 0.06);
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 700;
}

.composer-banner {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.86);
  box-shadow: var(--shadow-soft);
}

.composer-banner.is-hidden {
  display: none;
}

.composer-banner-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.composer-banner-title {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.composer-banner-text {
  font-size: 0.86rem;
  color: var(--muted-strong);
  line-height: 1.4;
  word-break: break-word;
}

.composer-banner-close {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: rgba(16, 36, 26, 0.08);
  color: var(--muted-strong);
  font: inherit;
  cursor: pointer;
}

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

.composer-banner-tool {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(36, 121, 83, 0.14);
  color: var(--accent-strong);
  font: inherit;
  font-size: 0;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.composer-banner-tool::before {
  content: '';
  width: 14px;
  height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 17.25V21h3.75l11-11.03l-3.75-3.75zm14.71-9.04c.39-.39.39-1.02 0-1.41L15.2 4.29a.996.996 0 0 0-1.41 0l-1.96 1.96l3.75 3.75z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 17.25V21h3.75l11-11.03l-3.75-3.75zm14.71-9.04c.39-.39.39-1.02 0-1.41L15.2 4.29a.996.996 0 0 0-1.41 0l-1.96 1.96l3.75 3.75z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.composer textarea {
  flex: 1 1 240px;
  resize: none;
  min-height: 48px;
  max-height: 140px;
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.send-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  border-color: rgba(0,0,0,0.04);
  padding-inline: 18px;
}

.send-btn.is-busy {
  opacity: 0.72;
}

.details-panel {
  gap: 14px;
  padding: 16px;
  overflow: auto;
  scroll-behavior: smooth;
}

.details-head-btn {
  padding: 7px 11px;
  font-size: 0.82rem;
}

.section-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.linker-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.linker-card.is-collapsed .linker-body {
  display: none;
}

.linker-body {
  display: grid;
  gap: 14px;
}

.linker-status {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.linker-status.is-error {
  color: #8d4e14;
}

.linker-search {
  padding: 10px 14px;
}

.linker-actions-row,
.toggle-inline,
.linker-inline-actions,
.linker-card-actions,
.linker-summary-meta,
.linker-candidate-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.linker-actions-row {
  justify-content: space-between;
  flex-wrap: wrap;
}

.toggle-inline {
  flex-wrap: wrap;
  color: var(--muted-strong);
  font-size: 0.84rem;
  font-weight: 600;
}

.toggle-inline input {
  accent-color: var(--accent);
}

.linker-inline-actions {
  flex-wrap: wrap;
}

.linker-section {
  display: grid;
  gap: 10px;
}

.linker-section-head {
  margin-top: 0;
}

.linker-stack,
.linker-list {
  display: grid;
  gap: 10px;
}

.linker-list {
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.linker-current-card,
.linker-candidate-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(247,250,247,0.82));
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.linker-current-title,
.linker-candidate-title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.35;
}

.linker-current-subtitle,
.linker-candidate-subtitle,
.linker-current-address,
.linker-candidate-address,
.linker-current-items,
.linker-candidate-items {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.linker-summary-meta,
.linker-candidate-meta {
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.84);
  border: 1px solid var(--border);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 700;
}

.linker-card-actions {
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 12px;
}

.linker-link {
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.linker-link:hover {
  text-decoration: underline;
}

.linker-candidate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.linker-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(181, 121, 26, 0.14);
  color: #8c5b16;
  font-size: 0.76rem;
  font-weight: 800;
}

.linker-bind-btn {
  padding-inline: 16px;
}

.is-highlighted {
  animation: pulse-card 1.1s ease;
}

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
}

.media-lightbox.is-hidden {
  display: none;
}

.media-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 11, 0.82);
  backdrop-filter: blur(10px);
}

.media-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 1080px);
  max-height: min(92vh, 920px);
  display: grid;
  gap: 12px;
}

.media-lightbox-content {
  display: grid;
  place-items: center;
  min-height: 220px;
  max-height: calc(92vh - 72px);
  overflow: auto;
  border-radius: 24px;
  background: rgba(10, 18, 12, 0.92);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 64px rgba(0,0,0,0.34);
  padding: 22px;
}

.media-lightbox-content img,
.media-lightbox-content video {
  max-width: 100%;
  max-height: calc(92vh - 140px);
  border-radius: 18px;
  display: block;
}

.media-lightbox-content video {
  background: #000;
}

.media-lightbox-caption {
  color: rgba(255,255,255,0.88);
  font-size: 0.92rem;
  text-align: center;
}

.media-lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.image-editor-dialog {
  width: min(94vw, 1180px);
  max-height: min(94vh, 980px);
  gap: 16px;
}

.image-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  color: rgba(255,255,255,0.92);
}

.image-editor-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.image-editor-head p {
  margin: 4px 0 0;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
}

.image-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(8, 16, 11, 0.82);
  border: 1px solid rgba(255,255,255,0.08);
}

.image-editor-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.image-editor-toolbar .ghost-btn.is-active {
  border-color: rgba(108, 180, 147, 0.52);
  background: rgba(108, 180, 147, 0.16);
  color: #fff;
}

.image-editor-colors {
  gap: 8px;
}

.image-editor-color {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--editor-color);
  cursor: pointer;
}

.image-editor-color.is-active {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.92);
}

.image-editor-size-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.82);
  font-size: 0.9rem;
}

.image-editor-size-control input {
  width: 160px;
}

.image-editor-stage-wrap {
  display: grid;
  gap: 10px;
}

.image-editor-loading {
  color: rgba(255,255,255,0.78);
  font-size: 0.92rem;
  text-align: center;
}

.image-editor-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
  max-height: calc(92vh - 240px);
  overflow: auto;
  border-radius: 24px;
  background: rgba(10, 18, 12, 0.92);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 64px rgba(0,0,0,0.34);
  padding: 22px;
}

.image-editor-base,
.image-editor-overlay {
  max-width: 100%;
  max-height: calc(92vh - 300px);
  border-radius: 18px;
  display: block;
}

.image-editor-stage img,
.image-editor-stage canvas {
  grid-area: 1 / 1;
}

.image-editor-overlay {
  touch-action: none;
  cursor: crosshair;
}

.image-editor-overlay[data-mode="erase"] {
  cursor: cell;
}

.image-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@keyframes pulse-card {
  0% {
    box-shadow: 0 0 0 0 rgba(21, 115, 71, 0);
    transform: translateY(0);
  }
  30% {
    box-shadow: 0 0 0 8px rgba(21, 115, 71, 0.12);
    transform: translateY(-2px);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(21, 115, 71, 0);
    transform: translateY(0);
  }
}

.details-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.8);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.details-head { gap: 12px; margin-bottom: 12px; }
.details-head h2 { margin: 0; font-size: 0.98rem; letter-spacing: -0.02em; }

.details-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.details-toggle-btn {
  min-width: 36px;
  padding: 7px 10px;
  font-size: 0.84rem;
  font-weight: 800;
}

.details-card-body.is-hidden {
  display: none;
}

.details-card.is-collapsed {
  padding-bottom: 12px;
}

.details-card.is-collapsed .details-head {
  margin-bottom: 0;
}

.details-card.is-collapsed .details-head-actions > :not(.details-toggle-btn) {
  display: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-ghost);
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
}

.status-archived {
  background: rgba(91, 107, 96, 0.14);
  color: #455248;
}

.status-resolved {
  background: rgba(19, 113, 71, 0.14);
  color: #0d5d38;
}

.profile-summary,
.stacked-cards,
.activity-list,
.shipments-stack,
.shipments-history {
  display: grid;
  gap: 10px;
}

.shipment-status {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 0.86rem;
  line-height: 1.45;
}

.shipment-status.is-info {
  background: rgba(255,255,255,0.88);
  color: var(--muted-strong);
}

.shipment-status.is-success {
  background: rgba(223, 243, 230, 0.92);
  color: var(--accent-strong);
  border-color: rgba(21, 115, 71, 0.16);
}

.shipment-status.is-warning {
  background: rgba(255, 247, 214, 0.92);
  color: #715308;
  border-color: rgba(177, 129, 24, 0.24);
}

.shipment-status.is-error {
  background: rgba(255, 235, 236, 0.92);
  color: #8a1f2d;
  border-color: rgba(184, 51, 74, 0.22);
}

.shipment-context-card,
.shipment-history-card {
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(248,250,248,0.8));
  border: 1px solid var(--border);
}

.shipment-context-head,
.shipment-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.shipment-context-head strong,
.shipment-history-head strong {
  font-size: 0.9rem;
}

.shipment-context-head span,
.shipment-context-meta,
.shipment-history-meta,
.shipment-history-status {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.shipment-section {
  display: grid;
  gap: 10px;
}

.shipment-toggle {
  justify-content: flex-start;
}

.shipment-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-field {
  display: grid;
  gap: 6px;
}

.settings-field span {
  font-size: 0.78rem;
  color: var(--muted);
}

.settings-field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.86);
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
}

.shipment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shipment-quote-list {
  display: grid;
  gap: 8px;
}

.shipment-quote-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.86);
  cursor: pointer;
}

.shipment-quote-item.is-selected {
  border-color: rgba(21, 115, 71, 0.22);
  background: rgba(223, 243, 230, 0.85);
}

.shipment-quote-item input {
  margin-top: 3px;
}

.shipment-quote-copy {
  display: grid;
  gap: 4px;
}

.shipment-quote-copy strong {
  font-size: 0.9rem;
}

.shipment-quote-copy span {
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 0;
}

.info-card {
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(248,250,248,0.8));
  border: 1px solid var(--border);
}

.info-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.info-value { font-weight: 700; line-height: 1.4; }

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.labels-stack,
.labels-group {
  display: grid;
  gap: 10px;
}

.labels-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.labels-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  outline: 0;
}

.labels-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  outline: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(21,115,71,0.16);
  color: var(--accent-strong);
  font-size: 0.84rem;
}

.chip-system {
  background: rgba(20, 94, 58, 0.1);
  border-color: rgba(20, 94, 58, 0.18);
}

.chip-custom {
  background: rgba(255,255,255,0.86);
  border-color: var(--border);
  color: var(--muted-strong);
}

.chip-remove {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(16, 36, 26, 0.08);
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0;
}

.chip.muted {
  background: rgba(255,255,255,0.72);
  color: var(--muted-strong);
  border-color: var(--border);
}

.context-menu {
  position: fixed;
  z-index: 80;
  min-width: 220px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 50px rgba(15, 42, 26, 0.18);
}

.context-menu.is-hidden {
  display: none;
}

.context-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.context-menu-item:hover {
  background: rgba(21, 115, 71, 0.08);
}

.context-menu-item.is-selected {
  background: rgba(21, 115, 71, 0.12);
  color: var(--accent-strong);
}

.context-menu-item-danger {
  color: #8d4e14;
}

.context-menu-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 8px;
}

.context-menu-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--muted-strong);
}

.context-menu-back {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.context-menu-section {
  display: grid;
  gap: 4px;
}

.context-menu-section-title {
  padding: 6px 10px 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.context-menu-empty {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.context-menu-indicator {
  color: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.product-picker {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
}

.product-picker.is-hidden {
  display: none;
}

.product-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 11, 0.42);
  backdrop-filter: blur(8px);
}

.product-picker-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 720px);
  max-height: min(88vh, 840px);
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid var(--border);
  background: rgba(248, 252, 249, 0.96);
  box-shadow: 0 30px 70px rgba(15, 42, 26, 0.18);
}

.product-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.product-picker-head h2,
.product-picker-head p {
  margin: 0;
}

.product-picker-head h2 {
  font-size: 1.04rem;
}

.product-picker-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.product-picker-list {
  min-height: 180px;
  max-height: min(58vh, 520px);
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-right: 4px;
}

.product-picker-item {
  display: grid;
  grid-template-columns: auto 52px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.88);
  cursor: pointer;
}

.label-picker-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.88);
  cursor: pointer;
}

.label-picker-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.label-picker-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.label-picker-copy small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.product-picker-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.product-picker-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  overflow: hidden;
}

.product-picker-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.product-picker-copy strong,
.product-picker-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-picker-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.product-picker-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.compact-empty {
  padding: 18px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.activity-item {
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.84);
}

.activity-title { font-weight: 700; font-size: 0.9rem; }
.activity-meta { margin-top: 4px; color: var(--muted); font-size: 0.82rem; }

.settings-modal-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.settings-modal-shell.is-hidden {
  display: none;
}

.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 34, 24, 0.34);
  backdrop-filter: blur(4px);
}

.settings-modal-dialog {
  position: relative;
  width: min(1100px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  border-radius: 26px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.98);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-overlay-shell {
  z-index: 120;
}

.auth-dialog {
  width: min(460px, calc(100vw - 28px));
}

.settings-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.settings-modal-head h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.settings-modal-head p {
  margin: 0;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  min-height: 0;
}

.settings-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(23, 74, 46, 0.09);
  background: linear-gradient(180deg, rgba(248, 252, 248, 0.98), rgba(242, 247, 243, 0.94));
  box-shadow: 0 18px 48px rgba(14, 32, 24, 0.06);
}

.settings-section-head {
  margin: 0;
}

.settings-form {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.settings-form input,
.settings-form select,
.settings-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  font: inherit;
  padding: 11px 12px;
  outline: none;
}

.settings-form textarea {
  resize: vertical;
  min-height: 120px;
}

.settings-inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-inline-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.settings-list {
  min-height: 0;
  overflow: auto;
  max-height: 320px;
  display: grid;
  gap: 10px;
  padding-right: 2px;
}

.settings-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.94);
  min-width: 0;
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.settings-card-title {
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.settings-card-meta {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.hermes-details-summary-card {
  background: rgba(246, 250, 246, 0.96);
}

.hermes-draft-preview {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(21, 115, 71, 0.08);
  color: var(--text);
}

.hermes-correction-form textarea {
  min-height: 88px;
}

.settings-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hermes-modal-dialog {
  width: min(1240px, calc(100vw - 28px));
  min-height: min(760px, calc(100dvh - 28px));
  max-height: calc(100dvh - 28px);
  padding: 24px;
  gap: 20px;
}

.hermes-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  overflow: hidden;
}

.hermes-nav {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 24px;
  border: 1px solid rgba(23, 74, 46, 0.1);
  background: linear-gradient(180deg, rgba(244, 250, 245, 0.98), rgba(238, 245, 240, 0.94));
}

.hermes-nav-btn {
  width: 100%;
  display: grid;
  gap: 4px;
  position: relative;
  padding: 14px 16px;
  text-align: left;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.88);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.hermes-nav-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(21, 115, 71, 0.14);
  box-shadow: 0 10px 24px rgba(15, 34, 24, 0.08);
}

.hermes-nav-btn.is-active {
  border-color: rgba(21, 115, 71, 0.22);
  background: linear-gradient(180deg, rgba(223, 243, 230, 0.96), rgba(244, 251, 246, 0.94));
  box-shadow: 0 14px 30px rgba(21, 115, 71, 0.12);
}

.hermes-nav-title {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--text);
}

.hermes-nav-meta {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.hermes-nav-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.92);
}

.hermes-stage {
  min-height: 0;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(23, 74, 46, 0.1);
  background: linear-gradient(180deg, rgba(248, 252, 248, 0.98), rgba(241, 246, 242, 0.95));
  box-shadow: 0 22px 52px rgba(14, 32, 24, 0.08);
  padding: 20px;
  display: flex;
}

.hermes-panel {
  width: 100%;
  min-height: 0;
  display: none;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
  padding-right: 6px;
}

.hermes-panel.is-active {
  display: flex;
}

.hermes-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hermes-panel-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.hermes-panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.hermes-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.hermes-subsection {
  box-shadow: none;
  background: rgba(255,255,255,0.82);
}

.hermes-panel-form {
  gap: 14px;
}

.hermes-settings-shell {
  display: grid;
  gap: 18px;
}

.hermes-settings-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.hermes-settings-section {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(23, 74, 46, 0.1);
  background: rgba(255,255,255,0.88);
  box-shadow: 0 16px 34px rgba(14, 32, 24, 0.05);
}

.hermes-settings-section-head {
  align-items: flex-start;
}

.hermes-settings-section-head > div {
  display: grid;
  gap: 6px;
}

.hermes-section-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.hermes-setting-list {
  display: grid;
  gap: 12px;
}

.hermes-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 74, 46, 0.1);
  background: rgba(252, 254, 252, 0.94);
}

.hermes-setting-row.is-stacked {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.hermes-setting-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.hermes-setting-title {
  min-width: 0;
  font-size: 0.93rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
}

.hermes-setting-help {
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.hermes-setting-control {
  min-width: 220px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.hermes-setting-control.is-wide {
  width: min(100%, 320px);
  min-width: min(100%, 320px);
}

.hermes-setting-control > input,
.hermes-setting-control > select {
  width: 100%;
}

.hermes-switch {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 96px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.hermes-switch input {
  margin: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.hermes-compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hermes-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hermes-field-grid > input,
.hermes-field-grid > select {
  width: 100%;
}

.hermes-channel-toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

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

.hermes-channel-toggle-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 74, 46, 0.1);
  background: rgba(255,255,255,0.9);
}

.hermes-channel-toggle-card input {
  margin: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.hermes-channel-toggle-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.hermes-channel-toggle-copy span {
  font-weight: 700;
  color: var(--text);
}

.hermes-channel-toggle-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.hermes-inline-note {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed rgba(23, 74, 46, 0.14);
  background: rgba(244, 250, 245, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.hermes-item-rules-section {
  gap: 14px;
}

.hermes-rule-composer {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px dashed rgba(23, 74, 46, 0.18);
  background: rgba(247, 251, 247, 0.9);
}

.hermes-rule-composer-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(160px, 0.7fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.hermes-rule-composer-grid > * {
  min-width: 0;
}

.hermes-item-rule-list {
  display: grid;
  gap: 12px;
}

.hermes-item-rule-card {
  display: grid;
  gap: 14px;
}

.hermes-item-rule-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.hermes-item-rule-product {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hermes-item-rule-thumb {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(223, 243, 230, 0.96), rgba(244, 251, 246, 0.94));
  border: 1px solid rgba(21, 115, 71, 0.14);
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 800;
}

.hermes-item-rule-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hermes-item-rule-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.hermes-item-rule-title {
  min-width: 0;
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.hermes-item-rule-id {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.hermes-item-rule-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.hermes-item-rule-field {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.hermes-item-rule-field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hermes-item-rule-field select {
  width: 100%;
}

.hermes-item-rule-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(23, 74, 46, 0.1);
  background: rgba(255,255,255,0.9);
  color: var(--text);
  font-weight: 700;
}

.hermes-item-rule-toggle input {
  margin: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.hermes-item-rule-empty {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px dashed rgba(23, 74, 46, 0.18);
  background: rgba(255,255,255,0.74);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.hermes-panel-list {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.hermes-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.hermes-knowledge-mode-hint {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 74, 46, 0.12);
  background: rgba(230, 247, 237, 0.72);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.5;
}

.hermes-training-card {
  background: rgba(248, 253, 249, 0.95);
}

.hermes-flow-builder-shell {
  gap: 14px;
}

.hermes-flow-builder-actions {
  justify-content: flex-start;
}

.hermes-flow-builder {
  display: grid;
  gap: 14px;
}

.hermes-flow-step-card {
  gap: 12px;
  background: rgba(252, 254, 252, 0.96);
}

.hermes-flow-step-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.hermes-flow-step-block {
  display: grid;
  gap: 10px;
}

.hermes-flow-step-actions {
  justify-content: flex-start;
}

.hermes-flow-arg-list {
  display: grid;
  gap: 10px;
}

.hermes-flow-arg-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(220px, 1.1fr) auto;
  gap: 10px;
  align-items: center;
}

.hermes-flow-empty {
  padding: 14px 16px;
  border: 1px dashed rgba(23, 74, 46, 0.18);
  border-radius: 16px;
  background: rgba(255,255,255,0.72);
  color: var(--muted);
  font-size: 0.84rem;
}

.hermes-inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.hermes-channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 8px;
}

.hermes-toggle-row,
.hermes-toggle-card {
  padding: 12px 14px;
  border: 1px solid rgba(23, 74, 46, 0.1);
  border-radius: 16px;
  background: rgba(255,255,255,0.86);
}

.hermes-toggle-card {
  min-height: 54px;
}

.hermes-thread-actions {
  justify-content: flex-start;
}

.hermes-supervisor-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hermes-supervisor-source {
  display: inline-grid;
  justify-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
}

.hermes-supervisor-source small {
  font-size: 0.72rem;
  font-weight: 700;
}

.hermes-supervisor-thumb {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 0.68rem;
}

.hermes-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid rgba(23, 74, 46, 0.08);
  background: rgba(255,255,255,0.78);
  align-self: flex-start;
}

.hermes-segment-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.hermes-segment-btn.is-active {
  background: rgba(21, 115, 71, 0.14);
  border-color: rgba(21, 115, 71, 0.16);
  color: var(--text);
}

.hermes-knowledge-helper,
.hermes-secondary-outcome {
  white-space: normal;
  overflow-wrap: anywhere;
}

.hermes-label-catalog-card {
  background: rgba(244, 250, 245, 0.88);
}

.hermes-subtabs {
  margin-top: 2px;
}

.hermes-product-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.hermes-product-toolbar input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  font: inherit;
  padding: 12px 14px;
}

.hermes-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.hermes-product-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(23, 74, 46, 0.11);
  background: rgba(255,255,255,0.9);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(14, 32, 24, 0.05);
}

.hermes-product-card:hover {
  border-color: rgba(21, 115, 71, 0.22);
  transform: translateY(-1px);
}

.hermes-product-thumb {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(23, 74, 46, 0.1);
  background: linear-gradient(180deg, rgba(223, 243, 230, 0.96), rgba(244, 251, 246, 0.94));
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 0.78rem;
}

.hermes-product-thumb.is-large {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  flex: 0 0 76px;
}

.hermes-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hermes-product-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.hermes-product-copy strong,
.hermes-product-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hermes-product-copy strong {
  font-size: 0.92rem;
  font-weight: 800;
}

.hermes-product-copy small {
  color: var(--muted);
  font-size: 0.78rem;
}

.hermes-history-card,
.hermes-history-summary {
  background: rgba(255,255,255,0.92);
}

.hermes-child-modal {
  z-index: 96;
}

.hermes-training-dialog,
.hermes-learning-dialog {
  width: min(920px, calc(100vw - 36px));
  max-height: calc(100dvh - 44px);
  padding: 22px;
}

.hermes-learning-dialog {
  width: min(1120px, calc(100vw - 36px));
}

.hermes-training-body,
.hermes-learning-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 16px;
  padding-right: 4px;
}

.hermes-training-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.hermes-training-head > div:nth-child(2) {
  min-width: 0;
}

.hermes-training-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hermes-icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.hermes-training-head h3,
.hermes-training-head p {
  margin: 0;
}

.hermes-training-head h3 {
  font-size: 1.05rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.hermes-training-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.hermes-training-body textarea,
.hermes-learning-body textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.94);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  padding: 14px 16px;
  resize: vertical;
}

.hermes-training-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hermes-learning-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hermes-learning-filter-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hermes-learning-filter-panel {
  gap: 12px;
}

.hermes-learning-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.hermes-learning-filter-search {
  margin: 0;
}

.hermes-learning-label-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.hermes-learning-label-item {
  background: rgba(255,255,255,0.92);
}

.hermes-learning-latest {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.82);
  color: var(--muted);
  font-size: 0.84rem;
}

.hermes-learning-latest input {
  width: 74px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 10px;
  font: inherit;
}

.hermes-learning-group {
  display: grid;
  gap: 10px;
}

.hermes-learning-contact-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.hermes-learning-contact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(23, 74, 46, 0.1);
  background: rgba(255,255,255,0.9);
  cursor: pointer;
}

.hermes-learning-contact input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.hermes-learning-contact span {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.hermes-learning-contact strong {
  overflow-wrap: anywhere;
}

.hermes-learning-contact small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.hermes-learning-contact-tags {
  color: var(--accent-strong);
}

.hermes-learning-proposal {
  display: grid;
  gap: 14px;
}

.hermes-learning-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.hermes-learning-columns label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.hermes-learning-summaries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.hermes-learning-summary-card {
  align-content: start;
}

.hermes-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 6px;
  border-top: 1px solid rgba(23, 74, 46, 0.08);
}

.hermes-modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-inline {
  align-items: flex-start;
}

.toggle-inline span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.is-loading { opacity: 0.76; }

.hermes-absence-block-list,
.hermes-absence-messages {
  display: grid;
  gap: 12px;
}

.hermes-absence-block-card {
  gap: 14px;
}

.hermes-absence-grid,
.hermes-absence-label-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hermes-absence-label-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.hermes-absence-wait-list {
  display: grid;
  gap: 8px;
}

.hermes-absence-wait-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.hermes-absence-grid label,
.hermes-absence-label-grid label,
.hermes-absence-wait-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.hermes-absence-grid .hermes-switch {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-transform: none;
  color: var(--text);
  min-height: 40px;
}

.hermes-absence-grid .hermes-switch input {
  width: 18px;
  min-width: 18px;
}

.hermes-absence-grid input,
.hermes-absence-grid select,
.hermes-absence-label-grid input,
.hermes-absence-label-grid select,
.hermes-absence-wait-row input,
.hermes-absence-message-card textarea {
  min-width: 0;
  width: 100%;
}

.hermes-weekday-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
}

.hermes-mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 12px;
  text-transform: none;
}

.hermes-absence-message-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.hermes-absence-media-pill {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  background: rgba(209, 250, 229, 0.72);
  color: var(--ink);
}

.hermes-absence-media-pill span {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.hermes-absence-media-pill small {
  color: var(--muted);
}

.hermes-switch.compact {
  min-width: 0;
}

.hermes-max-alert-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(185, 28, 28, 0.32);
  border-radius: 10px;
  background: #fff7f7;
  box-shadow: 0 22px 60px rgba(127, 29, 29, 0.24);
  color: #7f1d1d;
}

.hermes-max-alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hermes-max-alert-head strong {
  font-size: 15px;
}

.hermes-max-alert-head span {
  color: #991b1b;
  font-size: 12px;
  font-weight: 800;
}

.hermes-max-alert-list {
  display: grid;
  gap: 8px;
}

.hermes-max-alert-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(185, 28, 28, 0.2);
  border-radius: 8px;
  background: #ffffff;
  color: #7f1d1d;
  text-align: left;
}

.hermes-max-alert-item span {
  font-weight: 900;
}

.hermes-max-alert-item small,
.hermes-max-alert-item em {
  color: #991b1b;
  font-size: 12px;
  font-style: normal;
  overflow-wrap: anywhere;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

@media (max-width: 1600px) {
  .app-shell { grid-template-columns: 76px 360px minmax(0, 1fr) 320px; }
}

@media (max-width: 1360px) {
  .app-shell { grid-template-columns: 76px 340px minmax(0, 1fr); }
  .details-panel { display: none; }
}

@media (max-width: 1280px) {
  .hermes-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .hermes-inline-grid,
  .hermes-field-grid {
    grid-template-columns: 1fr;
  }
  .hermes-flow-step-grid,
  .hermes-flow-arg-row {
    grid-template-columns: 1fr;
  }
  .hermes-channel-grid {
    grid-template-columns: 1fr 1fr;
  }
  .hermes-config-grid,
  .hermes-settings-columns,
  .hermes-compact-grid,
  .hermes-rule-composer-grid,
  .hermes-item-rule-grid,
  .hermes-absence-grid,
  .hermes-absence-label-grid,
  .hermes-absence-wait-row {
    grid-template-columns: 1fr;
  }
  .hermes-setting-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .hermes-setting-control,
  .hermes-setting-control.is-wide {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }
  .hermes-channel-toggle-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  body { overflow: auto; }
  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-areas:
      "rail"
      "list"
      "chat"
      "details";
  }
  .utility-rail {
    grid-area: rail;
    flex-direction: row;
    align-items: center;
  }
  .rail-group { flex-direction: row; }
  .rail-group-bottom { margin-left: auto; }
  .sidebar { grid-area: list; }
  .conversation-panel { grid-area: chat; }
  .details-panel {
    display: flex;
    grid-area: details;
  }
}

@media (max-width: 760px) {
  .app-shell { padding: 10px; gap: 10px; }
  .utility-rail,
  .sidebar,
  .conversation-panel,
  .details-panel { border-radius: 22px; }
  .brand-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .brand-tools {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .brand-user-picker {
    width: 100%;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .hermes-shell {
    grid-template-columns: 1fr;
  }
  .hermes-nav {
    flex-direction: row;
    overflow: auto;
    padding: 10px;
  }
  .hermes-nav-btn {
    min-width: 220px;
  }
  .hermes-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .hermes-modal-footer-actions {
    justify-content: stretch;
  }
  .hermes-modal-footer-actions > * {
    flex: 1 1 auto;
  }
  .hermes-config-grid,
  .hermes-inline-grid,
  .hermes-channel-grid,
  .hermes-settings-columns,
  .hermes-compact-grid,
  .hermes-field-grid,
  .hermes-rule-composer-grid,
  .hermes-item-rule-grid,
  .hermes-absence-grid,
  .hermes-absence-label-grid,
  .hermes-absence-wait-row,
  .hermes-channel-toggle-grid {
    grid-template-columns: 1fr;
  }
  .hermes-item-rule-head,
  .hermes-item-rule-product {
    align-items: flex-start;
    flex-direction: column;
  }
  .hermes-product-toolbar,
  .hermes-learning-columns {
    grid-template-columns: 1fr;
  }
  .hermes-learning-contact-list {
    grid-template-columns: 1fr;
  }
  .conversation-topbar,
  .composer { flex-direction: column; align-items: stretch; }
  .conversation-actions { width: 100%; justify-content: space-between; }
  .message-bubble { max-width: 92%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .linker-actions-row,
  .linker-card-actions,
  .linker-candidate-head { flex-direction: column; align-items: stretch; }
}

.mobile-back-btn,
.mobile-details-topbar,
.mobile-contact-hero {
  display: none;
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f7f8f4;
  }

  body::before {
    display: none;
  }

  .app-shell {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    display: block;
    overflow: hidden;
    background: #f7f8f4;
  }

  .utility-rail,
  .sidebar,
  .conversation-panel,
  .details-panel {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .sidebar,
  .conversation-panel,
  .details-panel,
  .utility-rail {
    display: none;
  }

  body.mobile-view-list .sidebar,
  body.mobile-view-chat .conversation-panel,
  body.mobile-view-details .details-panel {
    display: flex;
  }

  body.mobile-view-list .utility-rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: 100vw;
    height: calc(66px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    overflow-x: auto;
    border-top: 1px solid rgba(17, 44, 30, 0.1);
    background: rgba(252, 253, 250, 0.96);
  }

  .rail-group,
  .rail-group-bottom {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin: 0;
  }

  .rail-group-bottom {
    margin-left: 8px;
  }

  .rail-btn {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    background: transparent;
    box-shadow: none;
    border-color: transparent;
  }

  .rail-btn.is-active {
    background: #0b6d3b;
  }

  .sidebar {
    height: calc(100dvh - 66px - env(safe-area-inset-bottom));
    padding: calc(14px + env(safe-area-inset-top)) 14px 10px;
    gap: 10px;
    overflow: hidden;
    background: #ffffff;
  }

  .brand-row {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    box-shadow: 0 10px 24px rgba(17, 116, 74, 0.16);
  }

  .brand-copy {
    flex: 1 1 160px;
  }

  .brand-title-row {
    gap: 6px;
  }

  .brand-title {
    font-size: 1.28rem;
    letter-spacing: 0;
  }

  .brand-subtitle {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-pill {
    min-height: 22px;
    padding: 3px 8px;
    font-size: 0.7rem;
  }

  .brand-tools {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
  }

  .brand-user-picker {
    width: 100%;
  }

  .brand-user-picker select {
    min-height: 40px;
    border-radius: 14px;
  }

  .brand-settings-btn {
    min-height: 40px;
    white-space: nowrap;
  }

  .global-alert {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
  }

  .search-box {
    min-height: 48px;
    padding: 10px 14px;
    border-radius: 18px;
    box-shadow: none;
    background: #f4f5f2;
  }

  .search-box input {
    min-width: 0;
    font-size: 0.92rem;
  }

  .filters {
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .filter-chip {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 12px;
    background: #ffffff;
    border-color: rgba(17, 44, 30, 0.12);
    box-shadow: none;
  }

  .filter-chip.is-active {
    background: #dcf8e2;
  }

  .section-head {
    gap: 10px;
    margin-top: 2px;
    font-size: 0.74rem;
    letter-spacing: 0.09em;
  }

  .settings-inline-actions {
    max-width: 70%;
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }

  .settings-inline-actions .ghost-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .thread-selection-toolbar {
    margin: 0;
    border-radius: 14px;
  }

  .thread-list {
    flex: 1;
    min-height: 0;
    margin: 0 -14px;
    padding: 0;
    gap: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .thread-item {
    min-height: 76px;
    padding: 12px 14px;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid rgba(17, 44, 30, 0.08);
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
  }

  .thread-item:hover,
  .thread-item.is-active {
    background: #ffffff;
    border-color: rgba(17, 44, 30, 0.08);
    box-shadow: none;
  }

  .thread-item.is-selected {
    background: #ecf8f0;
  }

  .thread-avatar {
    width: 54px;
    height: 54px;
  }

  .thread-line {
    gap: 8px;
  }

  .thread-name-wrap {
    max-width: 100%;
  }

  .thread-name {
    color: #111812;
    font-size: 1rem;
    font-weight: 800;
  }

  .thread-time {
    font-size: 0.72rem;
  }

  .thread-preview,
  .thread-channel,
  .thread-order {
    font-size: 0.82rem;
  }

  .thread-channel {
    font-weight: 800;
  }

  .thread-foot {
    margin-top: 3px;
  }

  .thread-state-row {
    gap: 5px;
    margin-top: 5px;
  }

  .thread-labels {
    gap: 3px;
    margin-top: 4px;
  }

  .thread-mini-chip {
    max-width: 78px;
    font-size: 0.54rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .thread-badge {
    min-width: 22px;
    height: 22px;
    font-size: 0.72rem;
  }

  .conversation-panel {
    background: #f7f8f4;
    overflow: hidden;
  }

  .conversation-topbar {
    min-height: calc(62px + env(safe-area-inset-top));
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(17, 44, 30, 0.09);
    background: rgba(247, 248, 244, 0.98);
  }

  .mobile-back-btn {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #111812;
    cursor: pointer;
  }

  .mobile-back-btn::before {
    content: "";
    width: 13px;
    height: 13px;
    border-left: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transform: rotate(45deg);
    margin-left: 5px;
  }

  .conversation-meta {
    min-width: 0;
    gap: 9px;
    cursor: pointer;
  }

  .conversation-meta .avatar {
    width: 42px;
    height: 42px;
  }

  .conversation-copy {
    gap: 1px;
  }

  .conversation-meta h1 {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
    letter-spacing: 0;
  }

  .conversation-meta p {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.76rem;
  }

  .conversation-tags,
  .conversation-actions {
    display: none;
  }

  .messages-wrap {
    flex: 1;
    min-height: 0;
    padding: 10px 9px;
    gap: 7px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background:
      radial-gradient(circle at 10% 18%, rgba(17, 93, 56, 0.06), transparent 18%),
      linear-gradient(180deg, #fbfbf7, #f1f2eb);
  }

  .messages-wrap::before {
    opacity: 0.08;
    background-size: 34px 34px;
  }

  .message-bubble {
    max-width: 84%;
    padding: 8px 10px 7px;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(15, 42, 26, 0.08);
  }

  .message.is-incoming .message-bubble {
    border-top-left-radius: 5px;
  }

  .message.is-outgoing .message-bubble {
    border-top-right-radius: 5px;
  }

  .message-content {
    gap: 7px;
    font-size: 0.94rem;
    line-height: 1.42;
  }

  .message-meta {
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.66rem;
  }

  .message-media.is-audio {
    width: min(280px, 100%);
  }

  .message-media-frame {
    width: min(230px, 100%);
    border-radius: 14px;
  }

  .composer {
    min-height: calc(58px + env(safe-area-inset-bottom));
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 6px;
    box-sizing: border-box;
    overflow: hidden;
    border-top: 1px solid rgba(17, 44, 30, 0.09);
    background: #f7f8f4;
  }

  .quick-reply-picker {
    left: 8px;
    right: 8px;
    bottom: calc(100% + 8px);
    border-radius: 16px;
  }

  .composer-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    display: grid;
    place-items: center;
    box-shadow: none;
  }

  #record-btn {
    min-width: 44px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .composer textarea {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    min-height: 40px;
    max-height: 112px;
    border-radius: 20px;
    padding: 10px 12px;
    box-shadow: none;
    background: #ffffff;
  }

  .send-btn {
    flex: 0 0 auto;
    min-width: 56px;
    max-width: 66px;
    height: 40px;
    padding: 0 10px;
    font-size: 0.78rem;
    box-shadow: none;
  }

  .composer-banner {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: calc(100% + 8px);
    width: auto;
    border-radius: 14px;
    padding: 9px 10px;
  }

  .details-panel {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #f2f2f2;
    padding: 0 0 calc(18px + env(safe-area-inset-bottom));
  }

  .mobile-details-topbar {
    position: sticky;
    flex: 0 0 auto;
    top: 0;
    z-index: 4;
    min-height: calc(58px + env(safe-area-inset-top));
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(242, 242, 242, 0.98);
    border-bottom: 1px solid rgba(17, 44, 30, 0.06);
  }

  .mobile-details-topbar .mobile-back-btn {
    position: absolute;
    left: 8px;
    top: calc(8px + env(safe-area-inset-top));
  }

  .mobile-details-topbar strong {
    font-size: 1rem;
  }

  .mobile-contact-hero {
    flex: 0 0 auto;
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 22px 18px 16px;
  }

  .mobile-contact-avatar {
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 999px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #d9e9df, #b8d0bf);
    color: #14452d;
    font-size: 1.4rem;
    font-weight: 800;
    box-shadow: inset 0 0 0 5px rgba(255,255,255,0.78);
  }

  .mobile-contact-hero h2,
  .mobile-contact-hero p {
    margin: 0;
    text-align: center;
  }

  .mobile-contact-hero h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 1.6rem;
    letter-spacing: 0;
  }

  .mobile-contact-hero p {
    color: #6a6f6c;
    font-size: 0.92rem;
  }

  .mobile-contact-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
  }

  .mobile-contact-actions .ghost-btn {
    min-height: 54px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: none;
  }

  .details-card {
    flex: 0 0 auto;
    min-height: 54px;
    margin: 10px 14px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: none;
  }

  .details-card.is-collapsed {
    padding-bottom: 0;
  }

  .details-head {
    min-height: 54px;
    margin: 0;
    padding: 0 14px;
  }

  .details-head h2 {
    font-size: 0.94rem;
    letter-spacing: 0;
  }

  .details-toggle-btn,
  .details-head-btn {
    min-width: 38px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 999px;
    box-shadow: none;
  }

  .details-card-body,
  .linker-body {
    padding: 0 14px 14px;
  }

  .info-card,
  .shipment-context-card,
  .shipment-history-card,
  .linker-current-card,
  .linker-candidate-card,
  .activity-item {
    border-radius: 12px;
    box-shadow: none;
    background: #fbfbfb;
  }

  .settings-modal-dialog,
  .product-picker-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
    margin: 9px auto;
    border-radius: 18px;
  }

  .settings-grid,
  .shipment-form-grid,
  .labels-form {
    grid-template-columns: 1fr;
  }

  .hermes-max-alert-panel {
    left: 10px;
    right: 10px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: auto;
  }

  body.mobile-view-list .sidebar {
    background: #ffffff;
  }

  body.mobile-view-list .brand-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: calc(18px + env(safe-area-inset-top)) 18px 8px;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
  }

  body.mobile-view-list .brand-mark {
    display: none;
  }

  body.mobile-view-list .brand-copy {
    min-width: 0;
    gap: 4px;
  }

  body.mobile-view-list .brand-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  body.mobile-view-list .brand-title {
    font-size: 1.95rem;
    line-height: 1.04;
    font-weight: 850;
    letter-spacing: 0;
    color: #111812;
  }

  body.mobile-view-list #brand-response-time {
    min-height: 26px;
    padding: 4px 9px;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  body.mobile-view-list .brand-subtitle,
  body.mobile-view-list .brand-meta-row,
  body.mobile-view-list .brand-user-label {
    display: none;
  }

  body.mobile-view-list .brand-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
  }

  body.mobile-view-list .brand-user-picker {
    width: 42px;
    height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: #f2f2f2;
    box-shadow: none;
  }

  body.mobile-view-list .brand-user-picker::before {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 999px;
    box-shadow:
      0 -5px 0 -2px #111812,
      -7px 2px 0 -3px #111812,
      7px 2px 0 -3px #111812;
  }

  body.mobile-view-list .brand-user-picker select {
    position: absolute;
    inset: 0;
    width: 42px;
    height: 42px;
    opacity: 0;
  }

  body.mobile-view-list .brand-settings-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #f2f2f2;
    color: transparent;
    font-size: 0;
    box-shadow: none;
  }

  body.mobile-view-list .brand-settings-btn::before {
    content: "...";
    color: #111812;
    font-size: 1.1rem;
    font-weight: 900;
    line-height: 1;
    transform: translateY(-3px);
  }

  body.mobile-view-list .search-box {
    min-height: 38px;
    margin: 8px 16px 10px;
    padding: 0 10px;
    border: 0;
    border-radius: 12px;
    background: #f1f1f1;
    box-shadow: none;
  }

  body.mobile-view-list .search-icon {
    width: 18px;
    height: 18px;
  }

  body.mobile-view-list .search-box input {
    font-size: 0.98rem;
  }

  body.mobile-view-list .search-box-action {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.mobile-view-list .filters {
    padding: 0 16px 4px;
    gap: 8px;
  }

  body.mobile-view-list .filter-chip {
    min-height: 34px;
    padding: 7px 13px;
    border-radius: 999px;
    background: #ffffff;
    font-size: 0.86rem;
  }

  body.mobile-view-list .filter-chip.is-active {
    background: #d8f6dd;
    color: #075e54;
  }

  body.mobile-view-list .section-head {
    margin: 6px 16px 2px;
    letter-spacing: 0;
    text-transform: none;
    color: #656d68;
    font-size: 0.92rem;
  }

  body.mobile-view-list .section-head > span {
    display: none;
  }

  body.mobile-view-list .settings-inline-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
  }

  body.mobile-view-list .settings-inline-actions .ghost-btn {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #ffffff;
    font-size: 0.82rem;
  }

  body.mobile-view-list .thread-list {
    margin: 0;
    padding: 0 0 18px;
    gap: 0;
    background: #ffffff;
  }

  body.mobile-view-list .thread-item {
    min-height: 78px;
    padding: 10px 16px;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid #ecefed;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
  }

  body.mobile-view-list .thread-item.is-active {
    border-color: #ecefed;
    background: #ffffff;
    box-shadow: none;
  }

  body.mobile-view-list .thread-avatar {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    font-size: 0.9rem;
  }

  body.mobile-view-list .thread-body {
    min-width: 0;
    padding-bottom: 0;
  }

  body.mobile-view-list .thread-line {
    gap: 8px;
  }

  body.mobile-view-list .thread-name {
    color: #111812;
    font-size: 1.02rem;
    font-weight: 850;
  }

  body.mobile-view-list .thread-time {
    color: #6a6f6c;
    font-size: 0.78rem;
  }

  body.mobile-view-list .thread-preview {
    color: #656d68;
    font-size: 0.92rem;
  }

  body.mobile-view-list .thread-channel {
    color: #075e54;
    font-size: 0.82rem;
    font-weight: 850;
  }

  body.mobile-view-list .thread-order {
    max-width: 48%;
    color: #656d68;
    font-size: 0.78rem;
  }

  body.mobile-view-list .thread-badge {
    min-width: 22px;
    height: 22px;
    background: #25d366;
    color: #ffffff;
    font-size: 0.72rem;
  }

  body.mobile-view-chat .conversation-topbar {
    min-height: calc(58px + env(safe-area-inset-top));
    padding: calc(7px + env(safe-area-inset-top)) 8px 7px;
    background: #f7f7f7;
  }

  body.mobile-view-chat .conversation-meta .avatar {
    width: 40px;
    height: 40px;
  }

  body.mobile-view-chat .conversation-meta h1 {
    color: #111812;
    font-size: 1rem;
    font-weight: 850;
  }

  body.mobile-view-chat .messages-wrap {
    background:
      radial-gradient(circle, rgba(7, 94, 84, 0.045) 1.2px, transparent 1.6px) 0 0 / 34px 34px,
      #efeae2;
  }

  body.mobile-view-chat .composer {
    background: #f7f7f7;
  }

  body.mobile-view-details .details-panel {
    background: #f2f2f2;
  }
}
