:root {
  --bg: #f3f6f5;
  --panel: #ffffff;
  --ink: #17211e;
  --muted: #66736e;
  --line: #dce3e0;
  --accent: #087a66;
  --accent-dark: #075e50;
  --amber: #a76200;
  --red: #b42318;
  --blue: #245f9e;
  --shadow: none;
  --sidebar-rail: 14px;
  --sidebar-open: 264px;
  --sidebar-bg: #10231f;
  --sidebar-surface: #17342d;
  --sidebar-surface-hover: #1d443a;
  --sidebar-border: #2b5046;
  --sidebar-ink: #eff8f5;
  --sidebar-muted: #a7bdb6;
  --sidebar-accent: #55cda8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

body.auth-locked {
  display: grid;
  place-items: center;
}

body.auth-locked .shell {
  display: none;
}

body:not(.auth-locked) .login-screen {
  display: none;
}

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

button {
  border: 1px solid var(--line);
  background: #fffaf0;
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--ink);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 700;
}

button.primary:hover {
  background: var(--accent-dark);
}

button.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

button.icon-button:hover,
button.icon-button:focus-visible {
  border-color: rgba(15, 124, 102, 0.45);
  background: rgba(15, 124, 102, 0.08);
  color: var(--accent-dark);
}

button.icon-button span {
  display: block;
  font-size: 17px;
  line-height: 1;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-rail) minmax(0, 1fr);
}

.sidebar {
  background: #171814;
  color: #f4efe3;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-rail);
  overflow: hidden;
  z-index: 20;
  transition: width 180ms ease, padding 180ms ease, box-shadow 180ms ease;
}

.sidebar:hover,
.sidebar:focus-within,
.sidebar.expanded {
  width: var(--sidebar-open);
  padding: 18px 14px;
  overflow-y: auto;
  box-shadow: 18px 0 46px rgba(17, 18, 15, 0.22);
}

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

.sidebar .brand {
  min-width: 292px;
}

.sidebar:not(:hover):not(:focus-within):not(.expanded) .brand {
  justify-content: center;
  min-width: 20px;
  gap: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #f0c24b;
  color: #11120f;
  font-weight: 900;
}

.sidebar:not(:hover):not(:focus-within):not(.expanded) .brand-mark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 10px;
}

.brand strong,
.brand small {
  display: block;
}

.brand > div,
nav,
.side-controls,
.side-note {
  transition: opacity 160ms ease, transform 160ms ease;
}

.sidebar:not(:hover):not(:focus-within):not(.expanded) .brand > div,
.sidebar:not(:hover):not(:focus-within):not(.expanded) nav,
.sidebar:not(:hover):not(:focus-within):not(.expanded) .side-controls,
.sidebar:not(:hover):not(:focus-within):not(.expanded) .side-note {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
}

.brand small,
.side-note small {
  color: #b7b09f;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 4px;
}

nav a {
  color: #d8d1c4;
  text-decoration: none;
  padding: 10px 10px;
  border-radius: 6px;
  display: block;
  white-space: nowrap;
}

nav a.active,
nav a:hover {
  background: #2a2b25;
  color: #fff;
}

.side-note {
  margin-top: auto;
  border: 1px solid #373832;
  border-radius: 8px;
  padding: 10px;
}

.side-note span,
.side-note strong,
.side-note small {
  display: block;
}

.side-note button {
  width: 100%;
  margin-top: 12px;
  border-color: #45463f;
  background: #22231e;
  color: #f4efe3;
}

.side-controls {
  display: grid;
  gap: 10px;
  min-width: 292px;
}

.side-control {
  border: 1px solid #373832;
  border-radius: 8px;
  background: #1e1f1a;
  overflow: hidden;
}

.side-control summary {
  cursor: pointer;
  list-style: none;
  padding: 10px;
  color: #f4efe3;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.side-control summary::-webkit-details-marker {
  display: none;
}

.side-control summary::after {
  content: "+";
  float: right;
  color: #b7b09f;
}

.side-control[open] summary::after {
  content: "-";
}

.login-screen {
  width: min(480px, calc(100vw - 32px));
}

.login-card {
  display: grid;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

#login-message {
  color: var(--muted);
  align-self: center;
}

main {
  padding: 18px 22px 28px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  font-size: 17px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, var(--inbox-column-width, 520px)) 16px minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
}

.model-panel,
.service-panel,
.inbox-panel,
.case-board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.section-head p {
  color: var(--muted);
  margin-top: 5px;
}

.section-head.compact {
  align-items: center;
  padding: 16px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.section-head.compact.inbox-toolbar-head {
  padding: 8px 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(15, 124, 102, 0.32);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(15, 124, 102, 0.08);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.ai-settings-form {
  display: grid;
  gap: 0;
}

.routing-selector {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 0;
}

.routing-selector > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.routing-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.routing-options button {
  background: white;
  font-weight: 800;
}

.routing-options button.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.model-profiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px;
}

.profile-row {
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
}

.profile-row.selected {
  border-color: var(--accent);
  background: #eef7f3;
}

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

.profile-row strong {
  color: var(--ink);
  font-size: 13px;
  min-height: 20px;
}

.profile-row span {
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.profile-row small {
  color: var(--muted);
  line-height: 1.35;
  margin-top: 4px;
}

.profile-row label {
  margin-top: 10px;
  text-transform: none;
  font-weight: 700;
}

.profile-row input,
.profile-row select {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.channel-box {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.channel-box b {
  display: block;
  color: var(--accent-dark);
  font-size: 12px;
  margin-bottom: 6px;
}

.fallback-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fallback-toggle input {
  min-height: auto;
  width: auto;
}

.model-actions {
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
}

#ai-settings-message {
  color: var(--muted);
}

.service-message-bar {
  min-height: 50px;
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

#service-control-message {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.sidebar .model-panel,
.sidebar .service-panel,
.sidebar .whitelist-panel,
.sidebar .local-charge-panel,
.sidebar .exw-settings-panel,
.sidebar .trucking-settings-panel,
.sidebar .email-action-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.sidebar .routing-selector {
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0 10px 10px;
}

.sidebar .routing-selector > span {
  color: #b7b09f;
}

.sidebar .routing-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.sidebar .routing-options button {
  min-height: 32px;
  padding: 6px 8px;
  background: #24251f;
  border-color: #41423a;
  color: #f4efe3;
  font-size: 12px;
}

.sidebar .routing-options button.selected {
  border-color: #4dc5a9;
  background: var(--accent);
  color: #fff;
}

.sidebar .model-profiles {
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 0 10px 10px;
}

.sidebar .profile-row {
  padding: 8px;
  background: #20211c;
  border-color: #3a3b34;
}

.sidebar .profile-row.selected {
  background: rgba(15, 124, 102, 0.22);
  border-color: #4dc5a9;
}

.sidebar .profile-row strong,
.sidebar .profile-row span {
  color: #f4efe3;
  min-height: 0;
}

.sidebar .profile-row small {
  display: none;
}

.sidebar .profile-row label {
  margin-top: 6px;
  color: #b7b09f;
  font-size: 10px;
}

.sidebar .profile-row input,
.sidebar .profile-row select {
  min-height: 30px;
  padding: 6px 7px;
  background: #fffdf8;
  font-size: 11px;
}

.sidebar .channel-grid {
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}

.sidebar .channel-box {
  border-color: #34352f;
  background: rgba(255, 255, 255, 0.04);
  padding: 7px;
}

.sidebar .channel-box b {
  color: #4dc5a9;
  font-size: 11px;
}

.sidebar .fallback-toggle {
  color: #f4efe3;
  font-size: 11px;
}

.sidebar .model-actions {
  padding: 8px 10px 10px;
  border-top-color: #373832;
}

.sidebar .model-actions button {
  min-height: 32px;
  padding: 6px 10px;
}

.sidebar #ai-settings-message,
.sidebar #service-control-message,
.sidebar #whitelist-message,
.sidebar #local-charge-message,
.sidebar #exw-settings-message,
.sidebar #trucking-settings-message,
.sidebar #email-action-message {
  color: #b7b09f;
  font-size: 12px;
}

.compact-settings-form {
  display: grid;
  gap: 10px;
  padding: 0 10px 10px;
}

.compact-settings-form label {
  display: grid;
  gap: 5px;
  color: #b7b09f;
  font-size: 11px;
}

.compact-settings-form input,
.compact-settings-form textarea,
.compact-settings-form select {
  width: 100%;
  padding: 8px;
  resize: vertical;
  border: 1px solid #41423a;
  border-radius: 6px;
  color: var(--ink);
  background: #fffdf8;
  font: inherit;
}

.trucking-mode-selector {
  display: grid;
  gap: 6px;
  color: #b7b09f;
  font-size: 11px;
}

.trucking-mode-selector .email-action-options button {
  background: #24251f;
  border-color: #41423a;
  color: #f4efe3;
}

.trucking-mode-selector .email-action-options button.selected {
  border-color: #4dc5a9;
  background: var(--accent);
}

.trucking-gateway-state {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid #3a3b34;
  border-radius: 6px;
  background: #20211c;
}

.trucking-gateway-state strong,
.trucking-gateway-state small {
  overflow-wrap: anywhere;
}

.trucking-gateway-state strong.online {
  color: #4dc5a9;
}

.trucking-gateway-state strong.offline {
  color: #e4bd70;
}

.trucking-gateway-state small,
.trucking-schedule {
  color: #b7b09f;
  font-size: 10px;
  line-height: 1.45;
}

.email-action-specialists {
  display: grid;
  gap: 10px;
  padding: 0 10px 10px;
}

.email-action-specialist {
  display: grid;
  gap: 6px;
}

.email-action-specialist > strong {
  color: #f4efe3;
  font-size: 11px;
}

.email-action-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.email-action-options button {
  min-height: 36px;
  padding: 7px 8px;
  border-color: #41423a;
  background: #24251f;
  color: #f4efe3;
  font-size: 12px;
  font-weight: 800;
}

.email-action-options button.selected {
  border-color: #4dc5a9;
  background: var(--accent);
  color: #fff;
}

.email-action-options button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.email-action-note {
  margin: 0;
  padding: 0 10px 10px;
  color: #b7b09f;
  font-size: 11px;
  line-height: 1.4;
}

.side-service-actions {
  display: grid;
  gap: 6px;
  padding: 0 10px 10px;
}

.side-service-actions button {
  min-height: 32px;
  padding: 6px 10px;
  border-color: #41423a;
  background: #24251f;
  color: #f4efe3;
}

.sidebar .service-list {
  border-top: 1px solid #373832;
}

.sidebar .service-row {
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  border-top-color: #373832;
}

.sidebar .service-main {
  gap: 6px;
}

.sidebar .service-title {
  align-items: start;
  gap: 8px;
}

.sidebar .service-title strong {
  color: #f4efe3;
  font-size: 12px;
}

.sidebar .service-title small,
.sidebar .service-facts {
  display: none;
}

.sidebar .service-actions {
  justify-content: end;
  gap: 6px;
}

.sidebar .service-actions button {
  min-height: 30px;
  padding: 5px 8px;
  border-color: #41423a;
  background: #24251f;
  color: #f4efe3;
  font-size: 12px;
}

.sidebar .muted-text {
  color: #b7b09f;
  font-size: 12px;
}

.whitelist-status {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
  border-top: 1px solid #373832;
}

.whitelist-state {
  border: 1px solid #3a3b34;
  border-radius: 8px;
  background: #20211c;
  padding: 9px;
}

.whitelist-state.active {
  border-color: #4dc5a9;
  background: rgba(15, 124, 102, 0.22);
}

.whitelist-state.open {
  border-color: #8b7138;
  background: rgba(181, 107, 8, 0.13);
}

.whitelist-state strong,
.whitelist-state small {
  display: block;
}

.whitelist-state strong {
  color: #f4efe3;
  font-size: 12px;
}

.whitelist-state small,
.whitelist-sync-time {
  color: #b7b09f;
  font-size: 11px;
  line-height: 1.35;
}

.whitelist-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.whitelist-facts span {
  min-width: 0;
  border: 1px solid #3a3b34;
  border-radius: 6px;
  background: #20211c;
  padding: 7px;
}

.whitelist-facts small,
.whitelist-facts em {
  display: block;
  font-style: normal;
}

.whitelist-facts small {
  color: #8d887a;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.whitelist-facts em {
  color: #f4efe3;
  font-size: 12px;
  font-weight: 900;
  margin-top: 2px;
}

.inbox-tools {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  width: 100%;
  gap: 6px;
  color: var(--muted);
}

.inbox-date-filter {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 250, 240, 0.84);
}

.inbox-date-filter button,
.inbox-date-filter input {
  min-height: 28px;
  border-radius: 5px;
  font-size: 12px;
}

.inbox-date-filter button {
  padding: 5px 8px;
  background: transparent;
  border-color: transparent;
}

.inbox-date-filter button.selected {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.inbox-date-filter input {
  width: 118px;
  padding: 5px 8px;
  background: white;
}

.inbox-tools .compact-refresh {
  margin-left: 2px;
}

.auto-refresh-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.auto-refresh-control input {
  width: auto;
  accent-color: var(--accent);
}

.route-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 241, 230, 0.52);
}

.route-filters button {
  background: white;
  font-weight: 800;
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.route-filters button.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.service-list {
  display: grid;
}

.service-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.service-row:first-child {
  border-top: 0;
}

.service-main {
  display: grid;
  gap: 12px;
}

.service-title {
  display: flex;
  align-items: center;
  gap: 11px;
}

.service-title strong,
.service-title small {
  display: block;
}

.service-title small {
  color: var(--muted);
  margin-top: 3px;
}

.state-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(106, 102, 95, 0.11);
  flex: 0 0 auto;
}

.state-dot.running {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 124, 102, 0.14);
}

.state-dot.stopped {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(180, 59, 53, 0.12);
}

.state-dot.planned {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(181, 107, 8, 0.12);
}

.service-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 8px;
}

.service-facts span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  padding: 8px 10px;
  min-width: 0;
}

.service-facts small,
.service-facts em {
  display: block;
  font-style: normal;
}

.service-facts small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
}

.service-facts em {
  color: var(--ink);
  font-weight: 800;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.state-chip.running {
  color: var(--accent-dark);
}

.state-chip.stopped {
  color: var(--red);
}

.state-chip.planned {
  color: var(--amber);
}

.service-error {
  color: var(--red);
  font-size: 13px;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 124, 102, 0.13);
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.45;
  text-transform: none;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.case-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: calc(100vh - 46px);
  max-height: calc(100vh - 46px);
  min-width: 0;
}

.workspace > .inbox-panel,
.workspace > .case-board {
  min-height: calc(100vh - 46px);
  max-height: calc(100vh - 46px);
}

.workspace > .inbox-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 8px 0 0 8px;
}

.workspace > .case-board {
  border-radius: 0 8px 8px 0;
}

.inbox-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.inbox-load-state {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.inbox-load-state button {
  min-height: 30px;
  padding: 6px 12px;
  font-size: 12px;
}

.workspace-splitter {
  position: relative;
  width: 16px;
  min-width: 16px;
  cursor: col-resize;
  border: 0;
  background: transparent;
  touch-action: none;
}

.workspace-splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7px;
  width: 2px;
  border-radius: 999px;
  background: rgba(74, 68, 57, 0.18);
}

.workspace-splitter::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 10px;
  height: 76px;
  transform: translateY(-50%);
  border: 1px solid rgba(15, 124, 102, 0.28);
  border-radius: 999px;
  background:
    linear-gradient(180deg, transparent 0 30%, rgba(15, 124, 102, 0.45) 30% 34%, transparent 34% 48%, rgba(15, 124, 102, 0.45) 48% 52%, transparent 52% 66%, rgba(15, 124, 102, 0.45) 66% 70%, transparent 70% 100%),
    rgba(255, 250, 240, 0.92);
  box-shadow: 0 2px 7px rgba(35, 31, 25, 0.08);
}

.workspace-splitter:hover::before,
.workspace-splitter:focus-visible::before,
body.is-split-resizing .workspace-splitter::before {
  background: rgba(15, 124, 102, 0.55);
}

.workspace-splitter:focus-visible {
  outline: 2px solid rgba(15, 124, 102, 0.32);
  outline-offset: 2px;
}

body.is-split-resizing {
  cursor: col-resize;
  user-select: none;
}

.inbox-row {
  position: relative;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.inbox-row:hover,
.inbox-row:focus-visible {
  background: rgba(15, 124, 102, 0.045);
}

.inbox-row.selected {
  background: rgba(15, 124, 102, 0.075);
  box-shadow: inset 4px 0 0 var(--accent);
}

.inbox-row.archived {
  background: rgba(88, 84, 78, 0.035);
  box-shadow: inset 3px 0 0 #948c81;
}

.inbox-row.archived.selected {
  background: rgba(88, 84, 78, 0.08);
  box-shadow: inset 4px 0 0 #625d56;
}

.inbox-row.system-paused {
  background: rgba(179, 65, 55, 0.04);
  box-shadow: inset 3px 0 0 #b34137;
}

.inbox-row.system-paused.selected {
  background: rgba(179, 65, 55, 0.085);
  box-shadow: inset 4px 0 0 #8e2e26;
}

.inbox-row:focus-visible {
  outline: 2px solid rgba(15, 124, 102, 0.35);
  outline-offset: -2px;
}

.inbox-main strong,
.inbox-main p,
.inbox-main small {
  display: block;
}

.inbox-summary {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 6px;
}

.inbox-tags {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  vertical-align: baseline;
}

.inbox-main small,
.muted-text {
  color: var(--muted);
}

.archived-case-meta {
  margin-top: 3px;
}

.system-paused-case-meta {
  margin-top: 5px;
  color: #8e2e26 !important;
  font-weight: 700;
}

.inbox-received {
  display: inline-flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.no-case-label {
  color: var(--muted);
  font-weight: 700;
}

.open-case-link {
  padding: 5px 9px;
  min-height: 28px;
}

.case-thread-count {
  color: var(--muted);
  font-weight: 600;
}

.muted-row {
  color: var(--muted);
}

.case-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

.tag {
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 700;
}

.tag.low {
  border-color: rgba(15, 124, 102, 0.3);
  color: var(--accent-dark);
  background: rgba(15, 124, 102, 0.08);
}

.tag.medium {
  border-color: rgba(181, 107, 8, 0.35);
  color: var(--amber);
  background: rgba(181, 107, 8, 0.08);
}

.tag.high {
  border-color: rgba(180, 59, 53, 0.35);
  color: var(--red);
  background: rgba(180, 59, 53, 0.08);
}

.case-detail {
  padding: 18px;
  overflow: auto;
  min-width: 0;
}

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

.empty strong {
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.agents-workspace {
  min-height: calc(100vh - 46px);
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.agent-directory {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #f7f3eb;
  overflow: auto;
}

.agent-directory-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.agent-directory-head strong,
.agent-directory-head small {
  display: block;
}

.agent-directory-head small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

.agent-list {
  display: grid;
}

.agent-list-item {
  min-height: 78px;
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.agent-list-item:hover,
.agent-list-item.selected {
  border-color: var(--line);
  background: rgba(15, 124, 102, 0.08);
  box-shadow: inset 4px 0 0 var(--accent);
}

.agent-list-item small {
  color: var(--muted);
}

.agent-editor {
  min-width: 0;
  min-height: 0;
}

.agent-prompt-form {
  height: calc(100vh - 46px);
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.agent-editor-head,
.agent-editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.agent-editor-head h1 {
  margin: 4px 0 0;
  font-size: 22px;
}

.agent-live-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.agent-live-state.connected {
  color: var(--accent-dark);
}

.agent-prompt-form textarea {
  min-height: 0;
  height: 100%;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 22px;
  background: #fffefb;
  font-size: 14px;
  line-height: 1.65;
}

.agent-prompt-form textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(15, 124, 102, 0.28);
}

.agent-editor-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.case-detail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.case-detail-head small,
.case-detail-head h2,
.case-detail-head p {
  display: block;
  margin: 0;
}

.case-detail-head small {
  color: var(--accent-dark);
  font-weight: 900;
  text-transform: uppercase;
}

.case-detail-head h2 {
  margin-top: 3px;
  font-size: 24px;
}

.case-detail-head p {
  margin-top: 4px;
  color: var(--muted);
}

.closed-case-summary {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.closed-case-summary strong {
  color: var(--ink);
}

.closed-case-summary button {
  justify-self: start;
  margin-top: 6px;
}

.auto-closed-case-summary {
  border-color: rgba(184, 124, 24, 0.35);
}

.case-flow-panel,
.agent-decision-panel,
.email-delivery-panel,
.draft-state-line,
.inbox-outcome-line {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.email-delivery-panel {
  padding: 14px;
  background: #fffefb;
}

.email-delivery-panel.sent {
  border-color: rgba(15, 124, 102, 0.45);
}

.email-delivery-panel.attention {
  border-color: rgba(183, 71, 55, 0.5);
}

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

.email-delivery-head div,
.email-delivery-facts span,
.email-delivery-finding {
  display: grid;
  gap: 3px;
}

.email-delivery-head span,
.email-delivery-facts small,
.email-delivery-finding span {
  color: var(--muted);
  font-size: 12px;
}

.email-delivery-head code {
  color: var(--accent-dark);
  font-size: 11px;
}

.email-delivery-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.email-delivery-facts span {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fffaf2;
}

.email-delivery-error {
  margin: 12px 0 0;
  color: var(--red);
  overflow-wrap: anywhere;
}

.email-delivery-findings {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.email-delivery-findings summary {
  cursor: pointer;
  font-weight: 800;
}

.email-delivery-finding {
  margin-top: 8px;
  padding: 8px;
  border-left: 3px solid var(--amber);
  background: #fffaf2;
}

.case-flow-panel {
  padding: 14px;
  overflow-x: auto;
}

.case-flow-track {
  min-width: 760px;
  display: flex;
  align-items: center;
}

.flow-node {
  min-width: 88px;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.flow-node span {
  width: 14px;
  height: 14px;
  border: 2px solid #bcb4a8;
  border-radius: 50%;
  background: var(--panel);
}

.flow-node.completed span,
.flow-node.has-event.completed span {
  border-color: var(--accent);
  background: var(--accent);
}

.flow-node.waiting span {
  border-color: var(--amber);
  background: #fff2d8;
}

.flow-node.failed span {
  border-color: var(--red);
  background: #fde5e2;
}

.flow-node.system-paused span {
  border-color: var(--red);
  background: #fde5e2;
}

.flow-node.has-event {
  color: var(--ink);
}

.flow-node.has-event:hover {
  color: var(--accent-dark);
}

.flow-link {
  flex: 1 1 28px;
  min-width: 18px;
  height: 1px;
  background: var(--line);
}

.case-flow-branch {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.flow-node.branch {
  min-width: 118px;
  grid-template-columns: auto 1fr;
  justify-items: start;
  text-align: left;
}

.flow-event-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.flow-event-detail pre {
  max-height: 220px;
  margin: 8px 0 0;
  overflow: auto;
  color: var(--ink);
  white-space: pre-wrap;
}

.human-decision-actions {
  margin-top: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(15, 124, 102, 0.045);
}

.agent-instruction-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(15, 124, 102, 0.32);
  border-radius: 8px;
  background: #f7fcfa;
}

.append-reply-panel {
  margin-top: 0;
  margin-bottom: 14px;
  border-width: 2px;
}

.agent-instruction-head,
.agent-instruction-actions,
.agent-instruction-history-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-instruction-head > div {
  display: grid;
  gap: 3px;
}

.agent-instruction-head span,
.agent-instruction-actions span,
.agent-instruction-history small {
  color: var(--muted);
  font-size: 12px;
}

.agent-instruction-head code {
  max-width: 44%;
  color: var(--accent-dark);
  font-size: 11px;
  text-align: right;
  white-space: normal;
}

.agent-instruction-panel textarea {
  width: 100%;
  min-height: 88px;
  max-height: 260px;
  padding: 9px 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  line-height: 1.45;
}

.agent-instruction-panel textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 124, 102, 0.12);
}

.agent-instruction-cc {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.agent-instruction-cc input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.agent-instruction-cc input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 124, 102, 0.12);
}

.agent-instruction-history {
  margin-top: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.agent-instruction-history summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.agent-instruction-history-item {
  display: grid;
  gap: 5px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.agent-instruction-history-item:last-child {
  border-bottom: 0;
}

.agent-instruction-history-item p {
  margin: 0;
  white-space: pre-wrap;
}

.agent-instruction-history-item code {
  color: var(--accent-dark);
  font-size: 10px;
}

.agent-instruction-error {
  color: #8e2e26 !important;
  overflow-wrap: anywhere;
}

.exw-input-panel {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(15, 124, 102, 0.28);
  border-radius: 7px;
  background: rgba(15, 124, 102, 0.045);
}

.trucking-inquiry-panel {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(29, 103, 151, 0.28);
  border-radius: 7px;
  background: #f5f9fc;
}

.trucking-inquiry-panel.attention {
  border-color: rgba(184, 124, 24, 0.5);
  background: #fff9ec;
}

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

.trucking-inquiry-head > div {
  display: grid;
  gap: 3px;
}

.trucking-inquiry-head span,
.trucking-conversation summary,
.trucking-timeout-actions span {
  color: var(--muted);
  font-size: 12px;
}

.trucking-inquiry-head code {
  color: #1d6797;
  font-size: 11px;
  text-align: right;
  white-space: normal;
}

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

.trucking-inquiry-facts > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.trucking-inquiry-facts small,
.trucking-inquiry-facts strong {
  display: block;
  overflow-wrap: anywhere;
}

.trucking-inquiry-facts small {
  color: var(--muted);
  font-size: 10px;
}

.trucking-inquiry-facts strong {
  margin-top: 3px;
  font-size: 12px;
}

.trucking-inquiry-error {
  margin: 0;
  color: #8e2e26;
  font-size: 12px;
}

.trucking-timeout-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(184, 124, 24, 0.28);
}

.trucking-conversation summary {
  cursor: pointer;
  font-weight: 800;
}

.trucking-message-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.trucking-message {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid #8d968f;
  border-radius: 5px;
  background: #fff;
}

.trucking-message.outbound {
  border-left-color: #1d6797;
  background: #f5f9fc;
}

.trucking-message.inbound {
  border-left-color: var(--accent);
  background: #f4faf7;
}

.trucking-message header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.trucking-message header span {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.trucking-message p {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.5;
}

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

.exw-input-head > div {
  display: grid;
  gap: 3px;
}

.exw-input-head span,
.exw-input-panel small,
.exw-input-panel details {
  color: var(--muted);
  font-size: 12px;
}

.exw-input-head code {
  color: var(--accent);
  font-size: 11px;
}

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

.exw-input-facts > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.exw-input-facts small,
.exw-input-facts strong {
  display: block;
  overflow-wrap: anywhere;
}

.exw-input-warning {
  margin: 0;
  color: #8b5a15;
  font-size: 12px;
}

.exw-input-form,
.exw-port-grid {
  display: grid;
  gap: 10px;
}

.exw-port-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.exw-port-input {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.exw-port-input legend {
  padding: 0 5px;
  font-weight: 800;
}

.exw-input-form label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}

.exw-input-form input,
.exw-input-form textarea {
  width: 100%;
  padding: 8px 9px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--panel);
  font: inherit;
}

.exw-surcharge-input {
  max-width: 360px;
}

.system-paused-panel {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(179, 65, 55, 0.32);
  border-radius: 8px;
  background: #fff8f6;
}

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

.system-paused-head > div {
  display: grid;
  gap: 4px;
}

.system-paused-head span,
.system-paused-message {
  color: var(--muted);
  font-size: 12px;
}

.system-paused-head code {
  max-width: 44%;
  overflow-wrap: anywhere;
  color: #8e2e26;
  font-size: 11px;
}

.system-paused-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.system-paused-facts > div {
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid rgba(179, 65, 55, 0.18);
}

.system-paused-facts small,
.system-paused-facts strong {
  display: block;
  overflow-wrap: anywhere;
}

.system-paused-facts small {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.system-paused-facts strong {
  margin-top: 3px;
  font-size: 12px;
}

.system-paused-error {
  margin: 12px 0 0;
  color: #8e2e26;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.system-paused-turns {
  margin-top: 12px;
  font-size: 12px;
}

.system-paused-turns summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.system-paused-turn {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(179, 65, 55, 0.14);
}

.system-paused-turn span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.system-paused-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.system-paused-actions button.danger {
  color: #8e2e26;
  border-color: rgba(179, 65, 55, 0.35);
  background: #fff;
}

.system-paused-message {
  display: block;
  margin-top: 8px;
}

.human-decision-actions > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.human-decision-actions span {
  color: var(--muted);
  font-size: 12px;
}

.human-decision-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.human-decision-buttons button {
  min-height: 38px;
  padding: 7px 9px;
  font-size: 12px;
  white-space: normal;
}

.human-decision-buttons button.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel);
}

.human-decision-buttons button.danger {
  color: #8e2e26;
  border-color: rgba(179, 65, 55, 0.35);
  background: #fff6f4;
}

@media (max-width: 980px) {
  .human-decision-actions > div:first-child {
    align-items: start;
    flex-direction: column;
  }

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

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

  .system-paused-turn {
    flex-direction: column;
    gap: 3px;
  }
}

.agent-decision-panel {
  padding: 14px;
}

.agent-decision-panel .decision-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.agent-decision-panel h3,
.agent-decision-panel p {
  margin: 0;
}

.agent-decision-panel h3 {
  font-size: 16px;
}

.agent-decision-panel .decision-head p {
  margin-top: 5px;
  color: var(--muted);
}

.route-target-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 124, 102, 0.28);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--accent-dark);
  background: rgba(15, 124, 102, 0.07);
  font-size: 10px;
  font-weight: 900;
}

.agent-note {
  margin-top: 10px !important;
  color: var(--muted);
  line-height: 1.5;
}

.cargo-evidence-panel {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.cargo-evidence-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.cargo-evidence-summary span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fffaf2;
}

.cargo-evidence-summary small,
.cargo-evidence-summary strong {
  display: block;
}

.cargo-evidence-summary small {
  color: var(--muted);
}

.cargo-evidence-summary strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.cargo-package-table-wrap {
  margin-top: 8px;
  overflow-x: auto;
}

.cargo-package-table {
  min-width: 720px;
  margin-top: 0;
}

.draft-state-line,
.inbox-outcome-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
}

.draft-state-line span,
.inbox-outcome-line span {
  color: var(--muted);
}

.detail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-head h2 {
  font-size: 22px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffaf2;
}

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

.metric small {
  color: var(--muted);
}

.metric strong {
  margin-top: 5px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.panel-title {
  margin: 20px 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--muted);
}

.raw-preview {
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  max-height: 260px;
  overflow: auto;
  background: #171814;
  color: #f4efe3;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.original-message-panel {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.sent-message-panel {
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid rgba(15, 124, 102, 0.34);
  border-radius: 8px;
  background: #fff;
}

.mail-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbf7ee;
}

.mail-preview-head.sent {
  background: #eef8f4;
}

.mail-preview-head div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mail-preview-head strong {
  font-size: 13px;
}

.mail-preview-head span,
.mail-preview-head code {
  color: var(--muted);
  font-size: 11px;
}

.mail-preview-head code {
  flex: 0 0 auto;
  color: var(--accent-dark);
}

.sent-message-addresses {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.sent-message-addresses span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px 14px;
  background: #fff;
}

.sent-message-addresses small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.sent-message-addresses strong {
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
}

.email-image-load-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 0;
  color: var(--muted);
  font-size: 12px;
}

.email-image-load-state button {
  min-height: 28px;
  padding: 4px 9px;
}

.original-message-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.original-message-head h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
}

.original-message-head strong,
.original-message-head small {
  display: block;
}

.original-message-head small {
  color: var(--muted);
  margin-top: 4px;
}

.attachment-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbf7ee;
}

.attachment-summary {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.attachment-chip {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffaf2;
  min-width: 0;
}

.attachment-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.attachment-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.original-email-body {
  margin: 14px;
  max-height: 360px;
  background: #202019;
}

.email-preview-frame {
  display: block;
  width: calc(100% - 28px);
  height: 520px;
  margin: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.email-text-preview {
  white-space: pre-wrap;
  width: calc(100% - 28px);
  min-height: 260px;
  max-height: 520px;
  margin: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.65;
}

.agent-reply-preview {
  min-height: 120px;
  max-height: 620px;
}

.attachment-panel {
  border-top: 1px solid var(--line);
  background: #fbfaf6;
}

.attachment-panel > header,
.attachment-preview > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attachment-panel > header {
  padding: 9px 14px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.attachment-panel > header span {
  flex: 0 0 auto;
}

.attachment-rows {
  border-top: 1px solid var(--line);
}

.attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.attachment-row:last-child {
  border-bottom: 0;
}

.attachment-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment-name strong,
.attachment-name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-name strong {
  font-size: 12px;
}

.attachment-name small {
  color: var(--muted);
  font-size: 10px;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.attachment-actions button,
.attachment-preview > header button {
  min-width: 48px;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
}

.attachment-preview {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: #f6f4ed;
}

.attachment-preview > header {
  margin-bottom: 8px;
}

.attachment-preview > header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.attachment-preview-content {
  min-height: 80px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.attachment-preview-content pre {
  max-height: 420px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.55 "Cascadia Mono", Consolas, monospace;
}

.attachment-image-preview {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 620px;
  margin: 0 auto;
  object-fit: contain;
}

.attachment-pdf-preview {
  display: block;
  width: 100%;
  height: 620px;
  border: 0;
  background: #fff;
}

.attachment-preview-error {
  margin: 0;
  padding: 14px;
  color: var(--red);
  overflow-wrap: anywhere;
}

.understanding-checklist {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 7px 10px 9px;
}

.check-card {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 5px 8px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.check-card small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.1;
  font-weight: 800;
}

.check-card strong {
  font-size: 13px;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.check-card.ok {
  border-color: rgba(16, 128, 96, 0.36);
  background: #f1fbf5;
}

.check-card.warn {
  border-color: rgba(199, 135, 33, 0.42);
  background: #fff8e8;
}

.check-card.stop {
  border-color: rgba(176, 73, 73, 0.42);
  background: #fff4f0;
}

.rate-evidence-panel {
  border-top: 1px solid var(--line);
  padding: 9px 10px 10px;
}

.rate-evidence-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.rate-evidence-head strong {
  font-size: 11px;
  text-transform: uppercase;
}

.rate-evidence-head span,
.rate-search-dates,
.rate-search-summary,
.rate-evidence-row p {
  color: var(--muted);
  font-size: 11px;
}

.rate-search-dates {
  margin: 5px 0 0;
}

.rate-search-summary {
  margin: 5px 0 7px;
  line-height: 1.45;
}

.rate-evidence-list {
  border-top: 1px solid var(--line);
}

.rate-evidence-row {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.rate-evidence-reference {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.rate-evidence-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 700;
}

.rate-evidence-row p {
  margin: 5px 0 0;
  line-height: 1.4;
}

.rate-audit-panel {
  margin: 10px 0;
  border: 1px solid rgba(15, 124, 102, 0.32);
  border-radius: 8px;
  padding: 12px;
  background: #f2fbf7;
}

.rate-audit-panel.warning {
  border-color: rgba(199, 135, 33, 0.52);
  background: #fff8e8;
}

.rate-audit-panel.danger {
  border-color: rgba(179, 65, 55, 0.52);
  background: #fff5f3;
}

.rate-audit-head,
.rate-audit-difference-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.rate-audit-head strong,
.rate-audit-head span,
.rate-audit-head small {
  display: block;
}

.rate-audit-head span {
  margin-top: 3px;
  font-weight: 800;
}

.rate-audit-head small,
.rate-audit-difference-head span,
.rate-audit-difference p,
.rate-audit-error {
  color: var(--muted);
  font-size: 11px;
}

.rate-audit-differences {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.rate-audit-difference {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.rate-audit-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 6px;
}

.rate-audit-values > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.rate-audit-values small,
.rate-audit-values code {
  display: block;
}

.rate-audit-values small {
  color: var(--muted);
}

.rate-audit-values code {
  margin-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}

@media (max-width: 760px) {
  .rate-audit-head,
  .rate-audit-difference-head {
    flex-direction: column;
  }

  .rate-audit-values {
    grid-template-columns: 1fr;
  }
}

.rate-resolution-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid rgba(199, 135, 33, 0.48);
  border-radius: 8px;
  background: #fff8e8;
}

.rate-resolution-panel p,
.rate-resolution-message {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.rate-resolution-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.rate-resolution-actions button {
  min-height: 30px;
  padding: 5px 9px;
}

.rate-resolution-message {
  grid-column: 1 / -1;
}

.compact-empty {
  min-height: 120px;
}

@media (max-width: 1100px) {
  .agents-workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .workspace-splitter {
    display: none;
  }

  .workspace > .inbox-panel,
  .workspace > .case-board {
    min-height: auto;
    max-height: none;
    border-radius: 8px;
  }

  .inbox-list {
    max-height: var(--inbox-list-height, 52vh);
    min-height: 300px;
  }

  .routing-selector,
  .routing-options,
  .model-profiles,
  .service-facts,
  .email-delivery-facts,
  .understanding-checklist,
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .section-head.compact {
    align-items: start;
  }

  .inbox-tools {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

.exw-calculation-audit {
  margin-top: 14px;
  border: 1px solid #b8d8cf;
  background: #f7fbf9;
}

.exw-calculation-head,
.exw-calculation-option header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.exw-calculation-head {
  padding: 12px 14px;
  border-bottom: 1px solid #cfe3dd;
}

.exw-calculation-head div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.exw-calculation-head span,
.exw-calculation-head small,
.exw-calculation-option small {
  color: var(--muted);
}

.exw-formula {
  display: block;
  padding: 10px 14px;
  overflow-x: auto;
  border-bottom: 1px solid #dceae6;
  background: #eef7f4;
}

.exw-calculation-options {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.exw-calculation-option {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.exw-calculation-option header span {
  flex: 1;
}

.exw-calculation-option header b {
  color: var(--accent);
}

.exw-calculation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}

.exw-calculation-grid span {
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12px;
}

.exw-calculation-grid strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
}

@media (max-width: 760px) {
  .sent-message-addresses {
    grid-template-columns: 1fr;
  }

  .attachment-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .attachment-actions {
    justify-content: flex-start;
  }

  .attachment-pdf-preview {
    height: 480px;
  }

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

  .rate-resolution-panel {
    grid-template-columns: 1fr;
  }

  .rate-resolution-actions {
    justify-content: flex-start;
  }

  .agent-instruction-head,
  .agent-instruction-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-instruction-head code {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .exw-calculation-head,
  .exw-calculation-option header {
    align-items: flex-start;
    flex-direction: column;
  }

  .exw-calculation-grid {
    grid-template-columns: 1fr;
  }

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

  .sidebar,
  .sidebar:hover,
  .sidebar:focus-within,
  .sidebar.expanded {
    position: static;
    width: auto;
    height: auto;
    padding: 16px;
    box-shadow: none;
  }

  .sidebar:not(:hover):not(:focus-within):not(.expanded) .brand {
    justify-content: start;
    min-width: 0;
    gap: 12px;
  }

  .sidebar:not(:hover):not(:focus-within):not(.expanded) .brand > div,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) nav,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) .side-controls,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) .side-note {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  main {
    padding: 18px;
  }

  .agents-workspace {
    min-height: auto;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .agent-directory {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .agent-prompt-form {
    height: auto;
    min-height: 680px;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .routing-selector,
  .routing-options,
  .model-profiles,
  .service-row,
  .service-facts,
  .email-delivery-facts,
  .understanding-checklist,
  .detail-grid {
    grid-template-columns: 1fr;
  }


  .cargo-evidence-summary {
    grid-template-columns: 1fr;
  }

  .service-actions {
    justify-content: start;
    flex-wrap: wrap;
  }
}

/* Quote OS v0.20 workbench */

button {
  border-radius: 5px;
  background: #fff;
}

code,
.queue-case-id,
.case-workspace-head code,
.case-qtn {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}

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

.shell {
  min-height: 100vh;
  grid-template-columns: var(--sidebar-rail) minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  width: var(--sidebar-rail);
  height: 100vh;
  padding: 0;
  overflow: hidden;
  gap: 14px;
  color: var(--sidebar-ink);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: none;
  transition: width 170ms ease, padding 170ms ease, box-shadow 170ms ease;
}

.sidebar:hover,
.sidebar.expanded {
  width: var(--sidebar-open);
  padding: 16px 14px 14px;
  overflow-y: auto;
  box-shadow: 18px 0 42px rgba(8, 34, 28, 0.24);
}

.sidebar-edge-cue {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--sidebar-accent);
  pointer-events: none;
  transition: opacity 120ms ease;
}

.sidebar-edge-cue > span {
  margin-left: -1px;
  font-size: 16px;
  line-height: 1;
}

.sidebar:hover .sidebar-edge-cue,
.sidebar.expanded .sidebar-edge-cue {
  opacity: 0;
}

.sidebar > .brand,
.sidebar > .app-navigation,
.sidebar > .sidebar-quick-action,
.sidebar > .side-note {
  width: calc(var(--sidebar-open) - 28px);
  flex: 0 0 auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-8px);
  transition: opacity 120ms ease, transform 150ms ease, visibility 0s linear 170ms;
}

.sidebar:hover > .brand,
.sidebar:hover > .app-navigation,
.sidebar:hover > .sidebar-quick-action,
.sidebar:hover > .side-note,
.sidebar.expanded > .brand,
.sidebar.expanded > .app-navigation,
.sidebar.expanded > .sidebar-quick-action,
.sidebar.expanded > .side-note {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition-delay: 35ms;
}

.sidebar .brand {
  min-width: 0;
  justify-content: flex-start;
  gap: 10px;
  color: var(--sidebar-ink);
  text-decoration: none;
}

.sidebar .brand > div {
  display: block;
  min-width: 0;
}

.sidebar .brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  font-size: 16px;
}

.sidebar .brand small {
  color: var(--sidebar-muted);
}

.app-navigation {
  display: grid;
  gap: 6px;
  width: 100%;
}

.app-navigation a {
  position: relative;
  min-height: 42px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  color: #c5d4cf;
  text-align: left;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.app-navigation a:hover,
.app-navigation a.active {
  color: var(--sidebar-ink);
  background: var(--sidebar-surface-hover);
}

.app-navigation a.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--sidebar-accent);
}

.nav-glyph {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--sidebar-accent);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.sidebar-quick-action {
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-sync-whitelist {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-color: var(--sidebar-border);
  color: var(--sidebar-ink);
  background: var(--sidebar-surface);
  text-align: left;
}

.sidebar-sync-whitelist:hover,
.sidebar-sync-whitelist:focus-visible {
  border-color: var(--sidebar-accent);
  background: var(--sidebar-surface-hover);
}

.sidebar-sync-whitelist:disabled {
  cursor: wait;
  opacity: 0.78;
}

.sidebar-sync-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--sidebar-accent);
  font-size: 20px;
  line-height: 1;
}

.sidebar-sync-whitelist[data-sync-state="syncing"] .sidebar-sync-icon {
  animation: sidebar-sync-spin 900ms linear infinite;
}

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

.sidebar-sync-copy,
.sidebar-sync-copy strong,
.sidebar-sync-copy small {
  min-width: 0;
  display: block;
}

.sidebar-sync-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.sidebar-sync-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--sidebar-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.sidebar-sync-whitelist[data-sync-state="synced"] .sidebar-sync-copy small {
  color: #9fd4bd;
}

.sidebar-sync-whitelist[data-sync-state="failed"] .sidebar-sync-copy small {
  color: #efb4ae;
}

.sidebar-sync-metric {
  min-width: 48px;
  align-self: stretch;
  display: grid;
  align-content: center;
  justify-items: end;
  padding-left: 8px;
  border-left: 1px solid var(--sidebar-border);
  font-variant-numeric: tabular-nums;
}

.sidebar-sync-metric small,
.sidebar-sync-metric strong {
  display: block;
  line-height: 1.1;
}

.sidebar-sync-metric small {
  color: var(--sidebar-muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar-sync-metric strong {
  margin-top: 4px;
  color: var(--sidebar-accent);
  font-size: 15px;
  font-weight: 800;
}

.side-note {
  width: 100%;
  margin-top: auto;
  padding: 0;
  border: 0;
}

.side-note .nav-logout {
  width: 100%;
  min-height: 48px;
  display: grid;
  place-items: center;
  gap: 2px;
  margin: 0;
  padding: 5px 2px;
  border-color: transparent;
  color: var(--sidebar-muted);
  background: transparent;
  font-size: 10px;
}

.side-note .nav-logout:hover,
.side-note .nav-logout:focus-visible {
  border-color: var(--sidebar-border);
  color: var(--sidebar-ink);
  background: var(--sidebar-surface);
}

.nav-logout > span:first-child {
  font-size: 16px;
}

.app-main {
  min-width: 0;
  padding: 0;
}

button.sidebar-mobile-toggle,
button.sidebar-backdrop {
  display: none;
}

.current-state-signal {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #8a9691;
}

.tone-replied .current-state-signal {
  background: var(--accent);
}

.tone-needs-joe .current-state-signal,
.tone-waiting .current-state-signal {
  background: var(--amber);
}

.tone-error .current-state-signal {
  background: var(--red);
}

.tone-processing .current-state-signal {
  background: var(--blue);
}

.workspace {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, var(--inbox-column-width, 430px)) 10px minmax(0, 1fr);
  gap: 0;
  padding: 0;
}

.model-panel,
.service-panel,
.inbox-panel,
.case-board,
.agents-workspace {
  border-color: var(--line);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.workspace > .inbox-panel,
.workspace > .case-board,
.case-board {
  min-height: 0;
  max-height: none;
  height: 100%;
  border-top: 0;
  border-bottom: 0;
  border-radius: 0;
}

.workspace > .inbox-panel {
  border-left: 0;
}

.workspace > .case-board {
  border-right: 0;
}

.queue-head {
  display: grid;
  gap: 10px;
  padding: 15px 14px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.queue-title-row,
.queue-time-tools,
.queue-secondary-filters,
.settings-block-head,
.page-heading,
.agent-save-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.queue-title-row h1 {
  font-size: 20px;
  line-height: 1.15;
}

.queue-title-row small {
  display: block;
  max-width: 320px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.queue-search {
  position: relative;
  display: block;
  text-transform: none;
}

.queue-search > span {
  position: absolute;
  left: 10px;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
}

.queue-search input {
  height: 38px;
  padding: 8px 34px 8px 32px;
  border-radius: 5px;
  background: #f8faf9;
  font-size: 13px;
}

.search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  transform: translateY(-50%);
  border-color: transparent;
  color: var(--muted);
  background: transparent;
  font-size: 18px;
}

.route-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
}

.route-filters button {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 6px 8px;
  border-color: transparent;
  background: #f4f7f6;
  color: var(--muted);
  font-size: 10px;
  text-align: left;
}

.route-filters button span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-filters button strong {
  min-width: 20px;
  text-align: right;
  font-size: 12px;
}

.route-filters button:hover {
  border-color: #c8d3cf;
}

.route-filters button.selected {
  border-color: #9fc9bd;
  color: var(--accent-dark);
  background: #e8f4f0;
}

.queue-secondary-filters {
  align-items: stretch;
}

.segmented-filter {
  min-width: 0;
  display: flex;
  flex: 1;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f6f8f7;
}

.segmented-filter button {
  min-width: 0;
  flex: 1;
  min-height: 28px;
  padding: 4px 7px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.segmented-filter button.selected {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
  box-shadow: 0 1px 2px rgba(26, 43, 37, 0.05);
}

.queue-time-tools {
  align-items: center;
  flex-wrap: wrap;
}

.inbox-date-filter {
  padding: 2px;
  border-radius: 5px;
  background: #f6f8f7;
}

.inbox-date-filter button,
.inbox-date-filter input {
  min-height: 26px;
  font-size: 10px;
}

.inbox-date-filter button.selected {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.inbox-date-filter input {
  width: 108px;
  padding: 4px 6px;
}

.auto-refresh-control {
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  text-transform: none;
}

#last-refresh-at {
  color: var(--muted);
  font-size: 9px;
}

.inbox-list {
  background: #fff;
  scrollbar-gutter: stable;
}

.inbox-row {
  min-height: 112px;
  padding: 11px 13px 11px 15px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 3px 0 0 transparent;
}

.inbox-row:hover,
.inbox-row:focus-visible {
  background: #f7faf9;
}

.inbox-row.selected {
  background: #edf6f3;
  box-shadow: inset 3px 0 0 var(--accent);
}

.inbox-row.tone-needs-joe {
  box-shadow: inset 3px 0 0 #d88b16;
}

.inbox-row.tone-error,
.inbox-row.system-paused {
  background: #fffafa;
  box-shadow: inset 3px 0 0 var(--red);
}

.inbox-row.tone-waiting {
  box-shadow: inset 3px 0 0 #d7a348;
}

.inbox-row.archived {
  background: #fafbfa;
  box-shadow: inset 3px 0 0 #9aa49f;
}

.queue-row-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
}

.queue-case-id {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
}

.open-case-link {
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.case-thread-count {
  flex: 0 0 auto;
  font-family: "Avenir Next", Avenir, sans-serif;
  font-size: 9px;
}

.queue-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #fff;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.queue-status.needs-joe,
.queue-status.waiting {
  border-color: #e8c58c;
  color: #81500b;
  background: #fff8eb;
}

.queue-status.error {
  border-color: #efb4ae;
  color: #8f1d14;
  background: #fff4f2;
}

.queue-status.processing {
  border-color: #b8cee7;
  color: #1e568f;
  background: #f2f7fc;
}

.queue-status.replied {
  border-color: #a8d2c5;
  color: var(--accent-dark);
  background: #edf8f4;
}

.queue-row-top time {
  min-width: 64px;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.queue-subject {
  margin-top: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.25;
}

.queue-customer {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

.queue-facts {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 7px;
  color: #43504b;
  font-size: 10px;
}

.queue-facts span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-facts span + span::before {
  content: "·";
  padding: 0 5px;
  color: #9aa49f;
}

.queue-owner {
  margin-top: 3px;
  font-size: 9px;
}

.archived-case-meta,
.auto-closed-case-meta,
.system-paused-case-meta {
  display: none !important;
}

.inbox-load-state {
  min-height: 38px;
  background: #fff;
  font-size: 10px;
}

.workspace-splitter {
  display: block;
  width: 10px;
  min-width: 10px;
  background: var(--bg);
}

.workspace-splitter::before {
  left: 4px;
  width: 1px;
  background: #cdd6d2;
}

.workspace-splitter::after {
  left: 1px;
  width: 8px;
  height: 54px;
  border-radius: 4px;
  background: #fff;
  box-shadow: none;
}

.case-board,
.case-detail {
  min-width: 0;
  min-height: 0;
}

.case-detail {
  height: 100%;
  padding: 0;
  background: #fff;
  scrollbar-gutter: stable;
}

.case-workspace-chrome {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.case-workspace-head {
  padding: 16px 18px 12px;
  border-left: 3px solid transparent;
}

.case-workspace-head.tone-needs-joe,
.case-workspace-head.tone-waiting {
  border-left-color: var(--amber);
}

.case-workspace-head.tone-error {
  border-left-color: var(--red);
}

.case-workspace-head.tone-processing {
  border-left-color: var(--blue);
}

.case-workspace-head.tone-replied {
  border-left-color: var(--accent);
}

.case-identity-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.case-identity-line code {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.case-qtn {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

.case-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
}

.case-title-row > div {
  min-width: 0;
}

.case-title-row h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  line-height: 1.25;
}

.case-title-row p {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.case-title-row > button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 10px;
}

.case-fact-strip {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) repeat(3, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #edf0ef;
}

.case-fact-strip span,
.case-fact-strip small,
.case-fact-strip strong {
  min-width: 0;
  display: block;
}

.case-fact-strip small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.case-fact-strip strong {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.case-tabs {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  background: #fff;
}

.case-tabs button {
  position: relative;
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.case-tabs button.selected {
  color: var(--ink);
}

.case-tabs button.selected::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.case-tab-panel {
  min-width: 0;
  padding: 14px 18px 28px;
}

.action-conversation {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.action-conversation > header {
  margin-bottom: 12px;
}

.action-conversation > header small,
.action-conversation > header h3 {
  display: block;
}

.action-conversation > header small {
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.action-conversation > header h3 {
  margin-top: 2px;
  font-size: 14px;
}

.action-conversation > :last-child {
  margin-bottom: 0;
}

.case-workspace-chrome + .agent-instruction-panel {
  margin: 14px 18px 0;
}

.current-state-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
}

.current-state-signal {
  margin-top: 5px;
}

.current-state-bar small,
.current-state-bar strong,
.current-state-bar p {
  display: block;
}

.current-state-bar small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.current-state-bar strong {
  margin-top: 2px;
  font-size: 15px;
}

.current-state-bar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.current-state-owner {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.case-tab-panel > :first-child {
  margin-top: 0;
}

.case-flow-panel,
.agent-decision-panel,
.email-delivery-panel,
.draft-state-line,
.inbox-outcome-line,
.original-message-panel,
.sent-message-panel,
.attachment-panel,
.cargo-evidence-panel,
.rate-resolution-panel,
.rate-consistency-panel,
.exw-calculation-panel {
  border-color: var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
}

.email-delivery-facts span,
.email-delivery-finding,
.service-facts span,
.exw-calculation-grid span,
.profile-row,
.channel-box {
  background: #f8faf9;
}

.workspace-empty {
  min-height: 100%;
}

.empty-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-dark);
  background: #f5f9f7;
  font-weight: 800;
}

.page-heading {
  min-height: 78px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.page-heading small {
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 800;
}

.page-heading h1 {
  margin-top: 3px;
  font-size: 24px;
}

.settings-workspace,
.system-workspace {
  height: 100vh;
  overflow: auto;
  background: #fff;
}

.settings-band {
  padding: 22px 24px 26px;
  border-bottom: 1px solid var(--line);
}

.settings-band > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.settings-band > header > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.settings-band > header small {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.settings-band > header h2 {
  font-size: 17px;
}

.settings-band > header > span {
  color: var(--muted);
  font-size: 11px;
}

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

.settings-columns-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-block {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.settings-block-wide {
  max-width: 1120px;
}

.settings-block > h3,
.settings-block-head h3 {
  margin: 0 0 14px;
  font-size: 14px;
}

.settings-block-head h3 {
  margin: 0;
}

.settings-block-head {
  margin-bottom: 12px;
}

.settings-block-head button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 10px;
}

.settings-block .model-actions {
  padding: 12px 0 0;
}

.settings-block .email-action-specialists {
  display: grid;
  gap: 10px;
}

.settings-block .email-action-specialist > strong,
.settings-block .trucking-mode-selector {
  color: var(--ink);
}

.settings-block .email-action-options button,
.settings-block .trucking-mode-selector .email-action-options button {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.settings-block .email-action-options button.selected,
.settings-block .trucking-mode-selector .email-action-options button.selected {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.settings-block .trucking-gateway-state {
  border-color: var(--line);
  background: #f8faf9;
}

.settings-block .trucking-gateway-state strong.online {
  color: var(--accent-dark);
}

.settings-block .trucking-gateway-state strong.offline {
  color: var(--amber);
}

.settings-block .trucking-gateway-state small,
.settings-block .trucking-schedule {
  color: var(--muted);
}

.settings-block .email-action-specialist {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.settings-block .compact-settings-form {
  padding: 0;
}

.settings-block .routing-selector {
  grid-template-columns: 100px minmax(0, 1fr);
  padding: 0;
}

.settings-block .routing-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-block .model-profiles {
  grid-template-columns: minmax(0, 1fr);
  padding: 14px 0 0;
}

.settings-block .profile-row {
  background: #f8faf9;
}

.exw-defaults-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) minmax(320px, 1fr);
  gap: 14px;
}

.exw-defaults-form .form-actions {
  grid-column: 1 / -1;
}

.system-service-panel {
  margin: 20px 24px 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.agents-workspace {
  height: 100vh;
  min-height: 0;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  border: 0;
}

.agent-directory {
  background: #f7f9f8;
}

.agent-prompt-form {
  height: 100vh;
  min-height: 0;
}

.agent-prompt-form textarea {
  background: #fff;
}

.agent-save-actions {
  justify-content: flex-end;
}

#agent-dirty-state {
  color: var(--muted);
  font-size: 10px;
}

#agent-dirty-state.dirty {
  color: var(--amber);
  font-weight: 800;
}

.login-card {
  background: #fff;
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: minmax(360px, var(--inbox-column-width, 390px)) 8px minmax(0, 1fr);
  }

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

@media (max-width: 1020px) {
  :root {
    --sidebar-rail: 14px;
  }

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

  .settings-columns,
  .settings-columns-three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --sidebar-rail: 0px;
  }

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

  .sidebar,
  .sidebar:hover,
  .sidebar:focus-within,
  .sidebar.expanded {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    height: 62px;
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar .brand,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) .brand {
    flex: 0 0 38px;
  }

  .sidebar .brand-mark,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) .brand-mark {
    width: 34px;
    height: 34px;
  }

  .app-navigation {
    min-width: 0;
    flex: 1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
  }

  .app-navigation a {
    min-height: 48px;
    padding: 3px 2px;
    font-size: 8px;
  }

  .app-navigation a.active::before {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: -6px;
    width: auto;
    height: 2px;
  }

  .nav-glyph {
    width: 18px;
    height: 18px;
    font-size: 14px;
  }

  .side-note {
    display: none;
  }

  .workspace {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace > .inbox-panel,
  .workspace > .case-board,
  .case-board {
    height: auto;
    min-height: 58vh;
    max-height: 72vh;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-splitter {
    display: none;
  }

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

  .queue-secondary-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .case-title-row,
  .settings-band > header,
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .case-title-row h2,
  .case-title-row p {
    white-space: normal;
    overflow-wrap: anywhere;
  }

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

  .case-tabs {
    overflow-x: auto;
  }

  .case-tabs button {
    flex: 0 0 auto;
  }

  .case-tab-panel {
    padding: 12px 12px 24px;
  }

  .current-state-bar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .current-state-owner {
    grid-column: 2;
  }

  .settings-workspace,
  .system-workspace,
  .agents-workspace {
    height: auto;
    min-height: calc(100vh - 114px);
  }

  .settings-band,
  .page-heading {
    padding: 18px 14px;
  }

  .exw-defaults-form,
  .channel-grid,
  .service-facts,
  .email-delivery-facts {
    grid-template-columns: 1fr;
  }

  .agents-workspace {
    grid-template-columns: 1fr;
  }

  .agent-prompt-form {
    height: 72vh;
    min-height: 620px;
  }
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .sidebar:hover,
  .sidebar:focus-within,
  .sidebar.expanded {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(86vw, 300px);
    height: 100vh;
    height: 100dvh;
    padding: 16px 14px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    border-bottom: 0;
    box-shadow: 18px 0 42px rgba(17, 18, 15, 0.28);
    transform: translateX(-102%);
    transition: transform 170ms ease;
  }

  .sidebar.expanded {
    transform: translateX(0);
  }

  .sidebar-edge-cue {
    display: none;
  }

  .sidebar > .brand,
  .sidebar > .app-navigation,
  .sidebar > .sidebar-quick-action,
  .sidebar > .side-note {
    width: 100%;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .sidebar .brand,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) .brand {
    min-width: 0;
    justify-content: flex-start;
    gap: 10px;
    padding-right: 42px;
  }

  .sidebar .brand > div,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) .brand > div,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) nav,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) .side-note {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .sidebar .brand-mark,
  .sidebar:not(:hover):not(:focus-within):not(.expanded) .brand-mark {
    width: 36px;
    height: 36px;
  }

  .app-navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .app-navigation a {
    min-height: 42px;
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 7px 9px;
    text-align: left;
    font-size: 12px;
  }

  .app-navigation a.active::before {
    left: -14px;
    right: auto;
    top: 8px;
    bottom: 8px;
    width: 3px;
    height: auto;
  }

  .side-note {
    display: block;
  }

  button.sidebar-mobile-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 80;
    display: inline-grid;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    border-color: var(--sidebar-border);
    border-radius: 6px;
    color: #fff;
    background: var(--sidebar-bg);
    box-shadow: 0 3px 12px rgba(8, 34, 28, 0.18);
    transition: left 170ms ease, background 120ms ease;
  }

  button.sidebar-mobile-toggle:hover,
  button.sidebar-mobile-toggle:focus-visible {
    border-color: var(--sidebar-accent);
    color: #fff;
    background: var(--sidebar-surface-hover);
  }

  body.sidebar-open .sidebar-mobile-toggle {
    left: calc(min(86vw, 300px) - 48px);
    box-shadow: none;
  }

  button.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(17, 18, 15, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 170ms ease;
  }

  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .queue-title-row,
  .agent-directory-head,
  .page-heading {
    padding-left: 44px;
  }

  .settings-workspace,
  .system-workspace,
  .agents-workspace {
    min-height: 100vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-mobile-toggle,
  .sidebar-backdrop {
    transition: none;
  }
}
