/* Approved Command Deck layout, shared by browser, installed PWA and Tauri. */
:root {
  --cd-glass: linear-gradient(135deg, #193549ed, #102638d9);
  --cd-glass-button: linear-gradient(135deg, #29445adb, #1a3047b8);
  --cd-highlight: #ffffff25;
  --cd-nav: #122238;
  --cd-soft: #143248;
  --cd-green: #66d8b2;
  --cd-green-bg: #193f3a;
  --cd-amber: #f0bf63;
  --cd-amber-bg: #413624;
  --cd-red: #ff989c;
  --cd-red-bg: #452c37;
  --cd-blue: #8dbdff;
  --cd-blue-bg: #203e61;
  --cd-gray: #a5b6c9;
  --cd-gray-bg: #273b50;
}
:root[data-theme="light"] {
  --bg: #edf1f4;
  --fg: #172b41;
  --fg-muted: #637487;
  --border: #dfe6ec;
  --surface-2: #eef3f7;
  --cd-glass: linear-gradient(135deg, #fffffff0, #ffffffaa 48%, #f6fffdc9);
  --cd-glass-button: linear-gradient(135deg, #ffffffde, #ffffff73);
  --cd-highlight: #ffffffd9;
  --cd-soft: #eaf2f6;
  --cd-green: #148163;
  --cd-green-bg: #e9f5ef;
  --cd-amber: #9b660b;
  --cd-amber-bg: #fff4dc;
  --cd-red: #bf454a;
  --cd-red-bg: #fcecee;
  --cd-blue: #276ab4;
  --cd-blue-bg: #eaf1fd;
  --cd-gray: #637487;
  --cd-gray-bg: #edf1f5;
}
body.command-deck {
  display: block;
  height: auto;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--fg);
}
.command-deck h1,
.command-deck h2,
.command-deck h3,
.command-deck button,
.command-deck input,
.command-deck select {
  font-family: inherit;
}
.command-deck h1 {
  font-size: 29px;
  line-height: 1.2;
  letter-spacing: -1px;
  font-weight: 650;
}
.command-deck h2 {
  font-size: 16px;
  letter-spacing: -0.3px;
  font-weight: 650;
}
.command-deck h3 {
  font-size: 14px;
}
.command-deck button {
  cursor: pointer;
}
.command-deck button:disabled {
  cursor: default;
  opacity: 0.5;
}
.command-deck button:focus-visible,
.command-deck summary:focus-visible,
.command-deck input:focus-visible,
.command-deck select:focus-visible {
  outline: 3px solid #579bf0;
  outline-offset: 3px;
}
.command-deck .hidden {
  display: none !important;
}
.cd-skip {
  position: fixed;
  z-index: 200;
  left: 12px;
  top: -60px;
  background: var(--surface);
  padding: 12px;
  color: var(--fg);
}
.cd-skip:focus {
  top: 12px;
}
.cd-demo-note {
  background: #122238;
  color: #d4e0eb;
  text-align: center;
  padding: 9px;
  font-size: 10px;
  letter-spacing: 1.2px;
}
.command-deck .topbar {
  position: relative;
  min-height: 64px;
  height: auto;
  padding: 10px max(24px, calc((100vw - 1196px) / 2));
  gap: 18px;
  background-color: var(--topbar-bg);
  /* Carbon-fibre header: a 2x2 twill weave of translucent shading (so each
     theme's own --topbar-bg tints it) under a soft diagonal resin sheen. */
  background-image: var(--cd-carbon-sheen), var(--cd-carbon-weave);
  border-bottom: 1px solid var(--border);
}
:root {
  --cd-carbon-sheen: linear-gradient(105deg, transparent 18%, #ffffff0f 42%, #ffffff05 55%, transparent 72%), linear-gradient(#ffffff0a, transparent 55%, #00000033);
  --cd-carbon-weave: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16'><defs><linearGradient id='h' x2='0' y2='1'><stop offset='0' stop-color='%23000' stop-opacity='0.55'/><stop offset='.5' stop-color='%23fff' stop-opacity='0.09'/><stop offset='1' stop-color='%23000' stop-opacity='0.55'/></linearGradient><linearGradient id='v' x2='1' y2='0'><stop offset='0' stop-color='%23000' stop-opacity='0.7'/><stop offset='.5' stop-color='%23fff' stop-opacity='0.03'/><stop offset='1' stop-color='%23000' stop-opacity='0.7'/></linearGradient></defs><rect x='0' y='0' width='4' height='4' fill='url(%23h)'/><rect x='4' y='0' width='4' height='4' fill='url(%23h)'/><rect x='8' y='0' width='4' height='4' fill='url(%23v)'/><rect x='12' y='0' width='4' height='4' fill='url(%23v)'/><rect x='0' y='4' width='4' height='4' fill='url(%23v)'/><rect x='4' y='4' width='4' height='4' fill='url(%23h)'/><rect x='8' y='4' width='4' height='4' fill='url(%23h)'/><rect x='12' y='4' width='4' height='4' fill='url(%23v)'/><rect x='0' y='8' width='4' height='4' fill='url(%23v)'/><rect x='4' y='8' width='4' height='4' fill='url(%23v)'/><rect x='8' y='8' width='4' height='4' fill='url(%23h)'/><rect x='12' y='8' width='4' height='4' fill='url(%23h)'/><rect x='0' y='12' width='4' height='4' fill='url(%23h)'/><rect x='4' y='12' width='4' height='4' fill='url(%23v)'/><rect x='8' y='12' width='4' height='4' fill='url(%23v)'/><rect x='12' y='12' width='4' height='4' fill='url(%23h)'/></svg>");
}
/* Light appearances get a pale, satin weave so dark header text stays legible. */
:root:is([data-theme="light"], [data-theme="tidepool"]) {
  --cd-carbon-sheen: linear-gradient(105deg, transparent 18%, #ffffff8c 42%, #ffffff33 55%, transparent 72%);
  --cd-carbon-weave: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16'><defs><linearGradient id='h' x2='0' y2='1'><stop offset='0' stop-color='%23000' stop-opacity='0.1'/><stop offset='.5' stop-color='%23fff' stop-opacity='0.55'/><stop offset='1' stop-color='%23000' stop-opacity='0.1'/></linearGradient><linearGradient id='v' x2='1' y2='0'><stop offset='0' stop-color='%23000' stop-opacity='0.16'/><stop offset='.5' stop-color='%23fff' stop-opacity='0.3'/><stop offset='1' stop-color='%23000' stop-opacity='0.16'/></linearGradient></defs><rect x='0' y='0' width='4' height='4' fill='url(%23h)'/><rect x='4' y='0' width='4' height='4' fill='url(%23h)'/><rect x='8' y='0' width='4' height='4' fill='url(%23v)'/><rect x='12' y='0' width='4' height='4' fill='url(%23v)'/><rect x='0' y='4' width='4' height='4' fill='url(%23v)'/><rect x='4' y='4' width='4' height='4' fill='url(%23h)'/><rect x='8' y='4' width='4' height='4' fill='url(%23h)'/><rect x='12' y='4' width='4' height='4' fill='url(%23v)'/><rect x='0' y='8' width='4' height='4' fill='url(%23v)'/><rect x='4' y='8' width='4' height='4' fill='url(%23v)'/><rect x='8' y='8' width='4' height='4' fill='url(%23h)'/><rect x='12' y='8' width='4' height='4' fill='url(%23h)'/><rect x='0' y='12' width='4' height='4' fill='url(%23h)'/><rect x='4' y='12' width='4' height='4' fill='url(%23v)'/><rect x='8' y='12' width='4' height='4' fill='url(%23v)'/><rect x='12' y='12' width='4' height='4' fill='url(%23h)'/></svg>");
}
/* Light mode reads as a mid-grey carbon rather than near-white. */
:root[data-theme="light"] .command-deck .topbar {
  background-color: #dde3e8;
}
@media (forced-colors: active) {
  .command-deck .topbar { background-image: none; }
}
.command-deck .brand {
  gap: 12px;
  min-width: 0;
}
.command-deck .brand-mark {
  width: 40px;
  height: 44px;
  object-fit: contain;
}
.command-deck .brand-name {
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 500;
}
.cd-brand-product { font-size: 9px; letter-spacing: 3px; text-transform: uppercase; }
.cd-workspace {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}
.command-deck .cd-workspace .brand-client {
  font-size: 12px;
  color: var(--fg);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.command-deck .cd-workspace .client-switch {
  min-width: 0;
  max-width: 220px;
  text-overflow: ellipsis;
  margin-top: 0;
}
.command-deck .brand-client {
  font-family: inherit;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--fg-muted);
}
.command-deck .topbar-right {
  gap: 12px;
  min-width: 0;
  flex-wrap: nowrap;
}
.command-deck .who {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.command-deck .conn {
  font-size: 10px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.command-deck .conn-ago {
  display: none;
}
.command-deck .icon-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--fg-muted);
  display: inline-grid;
  place-items: center;
}
.cd-bell {
  position: relative;
}
.cd-bell svg {
  width: 19px;
  height: 19px;
}
.cd-bell b {
  position: absolute;
  top: -5px;
  right: -4px;
  background: var(--warn);
  color: var(--bg);
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  font-size: 9px;
}
.command-deck .wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 42px 28px;
  width: 100%;
  min-height: calc(100vh - 230px);
}
.command-deck .app-nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 5px;
  background: #122238;
  border: 1px solid #ffffff0a;
  border-radius: 16px;
  box-shadow: 0 8px 25px #12223830;
  padding: 6px;
  margin: 0;
  max-width: calc(100% - 24px);
  width: max-content;
}
.command-deck .app-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 12px 19px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #b5c7d7;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.command-deck .app-nav-btn.is-active {
  background: #2a3b51;
  color: #fff;
}
.command-deck .app-nav-btn svg {
  height: 18px;
  width: 18px;
}
.command-deck .app-nav-btn b {
  font-size: 9px;
  background: #b9872e;
  color: white;
  padding: 1px 5px;
  border-radius: 4px;
}
.command-deck .foot {
  max-width: 1196px;
  padding: 15px 0 115px;
  margin: auto;
  border: 0;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--fg-muted);
}
.cd-page-head,
.command-deck .view-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}
.cd-page-head p,
.command-deck .view-heading p {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 7px;
  line-height: 1.6;
}
.command-deck .btn-secondary,
.command-deck .btn-primary {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
}
.command-deck .btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
}
.command-deck .btn-primary {
  background: #173a56;
  border: 1px solid #173a56;
  color: #fff;
}
.command-deck .btn-primary:hover {
  background: #235575;
  color: white;
}
.cd-search {
  width: 230px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-size: 12px;
  border-radius: 9px;
}
.cd-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 13px;
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--surface);
}
.cd-status-button {
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 20px;
  text-align: left;
  min-width: 0;
}
.cd-status-button:last-child {
  border: 0;
}
.cd-status-button strong {
  font-size: 12px;
  display: block;
  font-weight: 600;
}
.cd-status-button small {
  font-size: 10px;
  color: var(--fg-muted);
  display: block;
  margin-top: 5px;
  line-height: 1.4;
}
.cd-status-lamp {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid currentColor;
  border-radius: 10px;
  font-size: 16px;
  flex-shrink: 0;
  font-weight: 650;
  background: var(--cd-tone-bg);
}
.cd-status-lamp::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  box-shadow: 0 0 15px currentColor;
  opacity: .12;
  z-index: -1;
}
.cd-status-lamp.cd-reporting {
  color: var(--on-accent-bright);
  background: var(--indigo-bright);
  border-color: var(--indigo-bright);
  box-shadow: 0 0 8px color-mix(in srgb, var(--indigo-bright) 55%, transparent);
}
.cd-status-lamp.cd-reporting::before {
  display: none;
}
.cd-green {
  color: var(--cd-green);
  --cd-tone-bg: var(--cd-green-bg);
}
.cd-amber {
  color: var(--cd-amber);
  --cd-tone-bg: var(--cd-amber-bg);
}
.cd-red {
  color: var(--cd-red);
  --cd-tone-bg: var(--cd-red-bg);
}
.cd-blue {
  color: var(--cd-blue);
  --cd-tone-bg: var(--cd-blue-bg);
}
.cd-gray {
  color: var(--cd-gray);
  --cd-tone-bg: var(--cd-gray-bg);
}
.command-deck .card {
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 15px;
  box-shadow: 0 3px 5px #12223802;
  overflow: hidden;
  margin-bottom: 0;
}
.command-deck .card-head {
  margin-bottom: 0;
  padding: 21px 23px 15px;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.command-deck .card-head > div,
.cd-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cd-head-actions { gap: 16px; }
.cd-head-actions .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.cd-head-actions svg { width: 16px; height: 16px; display: block; }
.cd-module-content { padding: 0 23px 8px; }
.command-deck #queue { display: block; }
.cd-module-content > .record-empty { padding: 18px 0; }
.cd-modules {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
  align-items: start;
}
.cd-count {
  font-size: 11px;
  color: var(--fg-muted);
}
.cd-module-foot {
  margin: 0 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  min-height: 46px;
}
.cd-module-foot small {
  font-size: 10px;
  color: var(--fg-muted);
}
.cd-text-btn {
  border: 0;
  background: none;
  color: var(--indigo);
  font-size: 11px;
  font-weight: 650;
  min-height: 44px;
  white-space: nowrap;
}
.cd-compact-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px 0;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--fg);
  text-align: left;
}
.cd-compact-row:first-child {
  border-top: 0;
}
.cd-compact-row > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.cd-row-end {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-end;
  flex: 0 0 auto;
  max-width: 28%;
  font-size: 10px;
  color: var(--fg-muted);
  text-align: right;
}
.cd-row-end b { font-size: 17px; font-weight: 400; }
.cd-row-end + b { display: none; }
.cd-compact-row strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.cd-compact-row small {
  font-size: 11px;
  color: var(--fg-muted);
  display: block;
  margin-top: 4px;
  line-height: 1.5;
}
.cd-compact-row > b {
  font-size: 20px;
  font-weight: 400;
  color: var(--fg-muted);
}
.cd-row-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: var(--cd-tone-bg, var(--cd-soft));
  flex-shrink: 0;
}
.cd-row-icon svg {
  width: 18px;
  height: 18px;
}
.cd-compact-row:hover {
  background: var(--cd-soft);
}
.command-deck .cd-compact-row.queue-item {
  flex-direction: row;
  padding: 18px 0;
  border-bottom: 0;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  margin: 0;
}
.cd-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--cd-amber) 26%, transparent);
  border-radius: 10px;
  color: var(--cd-amber);
  background: color-mix(in srgb, var(--cd-amber-bg) 60%, var(--surface));
  font-size: 12px;
  line-height: 1.6;
  text-align: left;
  margin-bottom: 10px;
}
.cd-notice svg { width: 20px; height: 20px; flex-shrink: 0; }
.cd-module.cd-compact .cd-compact-row {
  padding-top: 10px;
  padding-bottom: 10px;
}
.cd-module.cd-compact .cd-journey {
  display: none;
}
.command-deck .record-empty {
  font-size: 12px;
  color: var(--fg-muted);
  padding: 22px 23px;
  line-height: 1.7;
}
.command-deck .warn-ink {
  color: var(--warn);
}
/* Undeclared senders silent 30+ days: kept findable, outside the agent count. */
.cd-old-sources {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--fg-muted);
}
.cd-old-sources summary {
  cursor: pointer;
  color: var(--fg);
}
.cd-old-sources p {
  margin: 10px 0 6px;
  line-height: 1.5;
}
.cd-old-sources ul {
  list-style: none;
  display: grid;
  gap: 4px;
}
.cd-old-sources button {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  padding: 6px 0;
  background: none;
  border: 0;
  color: var(--fg);
  font: inherit;
}
.cd-old-sources button small {
  color: var(--fg-muted);
}
.cd-footnote {
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.65;
  margin-top: 18px;
}
.cd-status + .cd-modules {
  margin-top: 0;
}
.cd-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 13px;
}
.cd-section-head span {
  font-size: 12px;
  color: var(--fg-muted);
}
.cd-agent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.cd-agent {
  --edge: 144 163 182;
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid rgb(var(--edge) / 0.72);
  background: var(--cd-glass);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  box-shadow:
    inset 0 0 0 1px var(--cd-highlight),
    inset 0 0 5px rgb(var(--edge) / 0.08),
    0 0 0 1px rgb(var(--edge) / 0.18),
    0 0 4px rgb(var(--edge) / 0.27),
    0 0 8px rgb(var(--edge) / 0.08),
    0 8px 22px #183c4f0b;
}
.cd-agent.automation-active {
  --edge: 27 202 151;
}
.cd-agent.automation-attention {
  --edge: 213 153 61;
}
.cd-agent.automation-paused {
  --edge: 140 155 171;
}
.cd-agent::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    #ffffff13,
    #ffffff00 38%,
    #ffffff09 65%,
    #ffffff00
  );
  pointer-events: none;
}
.cd-agent-main {
  width: 100%;
  min-height: 207px;
  background: none;
  border: 0;
  color: var(--fg);
  position: relative;
  text-align: left;
  padding: 23px 22px 15px;
}
.cd-agent-main:focus-visible {
  outline-offset: -5px;
  border-radius: 13px;
}
.cd-agent-main h2 {
  font-size: 16px;
  margin-bottom: 7px;
}
.cd-agent-main p {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  min-height: 39px;
}
.cd-agent-main small {
  font-size: 10px;
  color: var(--fg-muted);
  display: block;
  margin-top: 7px;
  line-height: 1.5;
}
.cd-agent-symbol {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  background: var(--cd-glass-button);
  border: 1px solid var(--cd-highlight);
  border-radius: 11px;
  margin-bottom: 18px;
  color: var(--fg-muted);
  box-shadow: 0 0 5px rgb(var(--edge) / 0.09);
}
.cd-agent-symbol svg {
  width: 20px;
  height: 20px;
}
.cd-agent-source {
  display: block;
  font-size: 11px;
  margin-top: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}
.cd-agent-source b {
  font-weight: 600;
  margin-right: 4px;
}
.cd-agent-source em {
  font-style: normal;
  opacity: 0.7;
}
.cd-agent-health {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  margin-top: 8px;
  color: var(--fg-muted);
  line-height: 1.5;
}
.automation-active .cd-agent-health {
  color: var(--signal);
}
.automation-attention .cd-agent-health {
  color: var(--warn);
}
.cd-agent-health i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  box-shadow: 0 0 4px rgb(var(--edge) / 0.4);
}
.cd-agent-info {
  position: absolute;
  z-index: 2;
  right: 12px;
  top: 14px;
  min-width: 50px;
  min-height: 36px;
  font-size: 11px;
  padding: 7px;
  border: 1px solid var(--cd-highlight);
  border-radius: 9px;
  background: var(--cd-glass-button);
  backdrop-filter: blur(12px);
  color: var(--fg-muted);
  box-shadow:
    inset 0 1px 0 var(--cd-highlight),
    0 0 0 1px rgb(var(--edge) / 0.2),
    0 0 4px rgb(var(--edge) / 0.1);
}
.cd-agent-counts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 51px;
  padding: 12px 20px;
  border-top: 1px solid var(--cd-highlight);
  background: #ffffff08;
  position: relative;
  font-size: 10px;
  color: var(--fg-muted);
}
.cd-tag {
  display: inline-block;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 10px;
  color: var(--fg-muted);
  background: var(--surface-2);
  line-height: 1.4;
}
.cd-tag-working {
  color: var(--cd-blue);
  background: var(--cd-blue-bg);
}
.cd-tag-approval,
.cd-tag-attention {
  color: var(--cd-amber);
  background: var(--cd-amber-bg);
}
.cd-tag-authorized {
  color: var(--cd-blue);
  background: var(--cd-blue-bg);
}
.cd-tag-blocked {
  color: var(--cd-red);
  background: var(--cd-red-bg);
}
.cd-tag-delivered,
.cd-tag-completed {
  color: var(--cd-green);
  background: var(--cd-green-bg);
}
.cd-agent-counts > span {
  align-self: center;
}
.cd-comms-summary {
  width: 100%;
  display: flex;
  align-items: center;
  text-align: left;
  padding: 13px 16px;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 20px;
  min-height: 68px;
  color: var(--fg);
}
.cd-comms-icon {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--cd-soft);
  color: var(--fg-muted);
  flex-shrink: 0;
}
.cd-comms-icon svg {
  width: 19px;
  height: 19px;
}
.cd-comms-copy strong {
  font-size: 12px;
  font-weight: 600;
}
.cd-comms-copy strong > span {
  margin-left: 10px;
  font-size: 10px;
  font-weight: 400;
  color: var(--fg-muted);
}
.cd-comms-copy small {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  color: var(--fg-muted);
}
.cd-comms-dots {
  display: flex;
  flex-wrap: wrap;
  max-width: 125px;
  gap: 7px;
  margin-left: auto;
  padding: 8px;
}
.cd-comms-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #96a6b5;
}
.cd-comms-dots i.signal-ok {
  background: #29a785;
}
.cd-comms-dots i.signal-bad {
  background: #ca7551;
}
.cd-comms-dots small {
  font-size: 9px;
}
.cd-comms-open {
  font-size: 11px;
  color: var(--fg-muted);
  white-space: nowrap;
  margin-left: 10px;
}
.cd-work-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) 16px;
  gap: 24px;
  align-items: center;
  width: 100%;
  padding: 22px 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--border);
  color: var(--fg);
  text-align: left;
}
.cd-work-row:first-child {
  border-top: 0;
}
.cd-work-row > span {
  min-width: 0;
}
.cd-work-row strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  display: block;
  overflow-wrap: anywhere;
}
.cd-work-row > span > small {
  display: block;
  font-size: 10px;
  color: var(--fg-muted);
  margin: 5px 0 9px;
}
.command-deck .cd-work-list { padding: 0 24px; }
.cd-mini-work {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 18px 0 22px;
  text-align: left;
  background: none;
  color: var(--fg);
}
.cd-mini-work:last-child { border-bottom: 0; }
.cd-mini-work-head { display: flex; align-items: center; gap: 14px; justify-content: space-between; }
.cd-mini-work-head > span:first-child { min-width: 0; }
.cd-mini-work strong { display: block; font-size: 13px; line-height: 1.5; font-weight: 600; overflow-wrap: anywhere; }
.cd-mini-work small { display: block; margin-top: 4px; font-size: 11px; color: var(--fg-muted); line-height: 1.5; }
.cd-mini-work .cd-tag { flex-shrink: 0; }
.cd-mini-work .cd-journey { margin-top: 18px; }
.cd-module-content .list-row { padding: 18px 0; }
.cd-module-content .list-headline { font-size: 13px; font-weight: 600; }
.cd-module-content .list-detail { font-size: 11px; line-height: 1.5; margin-top: 4px; }
.cd-module-content .list-empty { padding: 20px 0; font-size: 12px; }
.cd-filterbar { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 20px; }
.cd-filterbar button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
  border-radius: 7px;
}
.cd-filterbar button[aria-pressed="true"] { background: #173a56; color: #fff; border-color: #173a56; }
.cd-legend { display: flex; flex-wrap: wrap; gap: 18px; color: var(--fg-muted); font-size: 10px; margin-top: 20px; }
.cd-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cd-legend i { font-style: normal; width: 18px; height: 18px; border: 1px solid currentColor; border-radius: 50%; display: grid; place-items: center; background: var(--cd-tone-bg); }
.cd-journey {
  display: flex;
  position: relative;
  isolation: isolate;
  min-width: 0;
  margin: 10px 0 2px;
  overflow-x: auto;
  padding: 4px 0;
}
.cd-step {
  position: relative;
  flex: 1;
  min-width: 50px;
  padding: 0 3px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 10px;
}
.cd-step i {
  font-style: normal;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  margin: 0 auto 7px;
  background: var(--surface);
  font-size: 10px;
}
.cd-step small {
  font-size: 9px;
  display: block;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.cd-step::before {
  content: "";
  position: absolute;
  height: 2px;
  top: 9px;
  left: calc(-50% + 11px);
  width: calc(100% - 22px);
  background: var(--border);
  z-index: -1;
}
.cd-step:first-child::before {
  display: none;
}
.cd-step-complete {
  color: var(--signal);
}
.cd-step-complete i {
  background: var(--signal);
  color: var(--bg);
  border-color: var(--signal);
}
.cd-step-complete::before {
  background: var(--signal);
}
.cd-step-working {
  color: var(--cd-blue);
}
.cd-step-working i {
  background: var(--cd-blue-bg);
  box-shadow: 0 0 6px #4a9cd45e;
}
.cd-step-waiting {
  color: var(--cd-amber);
}
.cd-step-waiting i { background: var(--cd-amber-bg); box-shadow: 0 0 6px #d7a34355; }
.cd-step-blocked {
  color: var(--cd-red);
}
.cd-step-blocked i { background: var(--cd-red-bg); box-shadow: 0 0 6px #cf4e5755; }
.cd-step-upcoming {
  opacity: 0.7;
}
.cd-detail-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.cd-dialog {
  inset: 0 0 0 auto;
  margin: 0;
  padding: 27px 30px;
  width: min(590px, 100%);
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border: 0;
  background: var(--surface);
  color: var(--fg);
  box-shadow: -15px 0 60px #12223825;
  overflow: auto;
}
.cd-dialog::backdrop {
  background: #10213558;
  backdrop-filter: blur(3px);
}
.cd-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 23px;
}
.cd-dialog-head h2 {
  font-size: 23px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.cd-dialog-head .icon-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cd-dialog-head .icon-btn:hover {
  background: var(--cd-glass-button);
  color: var(--fg);
}
.cd-dialog-head .icon-btn:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}
.cd-dialog .detail-grid {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 17px;
}
.cd-dialog .detail-facts {
  display: block;
  font-size: 12px;
  margin: 0 0 20px;
}
.cd-dialog .detail-facts > div {
  display: grid;
  grid-template-columns: 125px minmax(0, 1fr);
  gap: 15px;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 15px 0;
  border-radius: 0;
  background: none;
}
.cd-dialog .detail-facts span { font-size: 12px; }
.cd-dialog .detail-facts strong { font-weight: 500; margin: 0; line-height: 1.6; }
.cd-dialog .detail-grid .cd-disclosure { margin: 0; }
.cd-output { padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.cd-decision-section { margin: 24px 0; }
.cd-dialog .cd-decision-section .decision-row { padding: 16px 0; }
.cd-dialog .detail-facts strong {
  overflow-wrap: anywhere;
}
.cd-dialog .card {
  flex-shrink: 0;
}
.cd-panel-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 20px;
}
.cd-evidence-note {
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.7;
  margin: 20px 0;
}
.cd-panel-section {
  padding-top: 22px;
  margin-top: 22px;
  border-top: 1px solid var(--border);
}
.cd-panel-section h3 {
  margin-bottom: 12px;
}
.cd-panel-section p {
  font-size: 13px;
  line-height: 1.8;
}
.cd-panel-section small {
  display: block;
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin: 12px 0;
}
.cd-report-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cd-panel-section .btn-secondary {
  margin-top: 10px;
}
.cd-disclosure {
  margin-top: 20px;
  padding: 18px 23px;
}
.cd-disclosure > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  min-height: 28px;
}
.cd-disclosure > summary span {
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 400;
  margin-left: 8px;
}
.cd-disclosure .cd-footnote {
  margin: 4px 0 16px;
}
.cd-disclosure .feed-row {
  padding: 16px 0;
}
.cd-layout-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.cd-layout-row > label:first-child {
  flex: 1;
  min-width: 135px;
}
.cd-layout-row button {
  border: 1px solid var(--border);
  color: var(--fg);
  background: var(--surface-2);
  width: 35px;
  height: 35px;
  border-radius: 7px;
}
.cd-layout-row input {
  accent-color: var(--indigo);
  margin-right: 6px;
}
.cd-density {
  font-size: 11px;
  white-space: nowrap;
}
.cd-settings-links {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.cd-settings-links .app-nav-btn {
  color: var(--fg);
  background: var(--surface-2);
}
#cd-layout-options {
  margin-bottom: 25px;
}
.command-deck .stats {
  margin-bottom: 20px;
}
.command-deck .stat-tile > strong {
  display: block;
  font-size: 24px;
  margin-top: 10px;
}
.command-deck .stat-tile > small {
  display: block;
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 8px;
}
.command-deck #connectors-modal {
  z-index: 80;
}
.command-deck #connectors-modal .modal {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(590px, 100%);
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  overflow: auto;
  background: var(--surface);
  padding: 26px;
}
.command-deck .conn-diagram {
  max-height: 55vh;
  overflow: auto;
}
.command-deck .conn-svg {
  min-width: 390px;
}
.command-deck .conn-lede {
  font-size: 12px;
  line-height: 1.7;
}
.command-deck .conn-legend {
  font-size: 10px;
  flex-wrap: wrap;
}
.cd-motion-paused .pulse {
  display: none;
}
.command-deck .queue-card.is-clear {
  padding: 0;
}
.command-deck .queue-item,
.command-deck .decision-row {
  padding: 20px 23px;
}
.command-deck .decision-head strong {
  font-size: 14px;
}
.command-deck .decision-row p,
.command-deck .queue-detail {
  font-size: 13px;
  line-height: 1.8;
}
.command-deck .decision-options button {
  min-height: 42px;
  padding: 10px 13px;
}
.command-deck .decision-options .decision-choice:first-child {
  color: #fff;
  background: #173a56;
  border-color: #173a56;
}
.command-deck .queue-headline {
  font-size: 14px;
  line-height: 1.6;
}
.command-deck .queue-actions {
  flex-wrap: wrap;
}
.command-deck .view-heading .eyebrow {
  display: none;
}
.command-deck .results-layout {
  gap: 20px;
}
.command-deck .brief-lines {
  font-size: 12px;
}
@media (hover: hover) {
  .cd-agent.automation-active:hover {
    box-shadow:
      inset 0 0 0 1px var(--cd-highlight),
      inset 0 0 6px rgb(var(--edge) / 0.12),
      0 0 5px rgb(var(--edge) / 0.3),
      0 0 10px rgb(var(--edge) / 0.1);
  }
  .cd-agent-info:hover {
    filter: brightness(1.04);
  }
}
@media (max-width: 1080px) {
  .cd-agent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .command-deck .topbar {
    padding: 10px 25px;
  }
  .command-deck .wrap {
    padding-left: 25px;
    padding-right: 25px;
  }
  .cd-status-button {
    padding: 16px 13px;
    gap: 9px;
  }
  .cd-status-button small {
    font-size: 9px;
  }
  .command-deck .foot {
    padding-left: 25px;
    padding-right: 25px;
  }
  .command-deck .who {
    display: none;
  }
}
@media (max-width: 700px) {
  .command-deck .topbar {
    padding: 10px 17px;
    min-height: 56px;
    gap: 12px;
    align-items: center;
  }
  .command-deck .brand-mark {
    width: 30px;
    height: 36px;
  }
  .command-deck .brand {
    flex: 0 0 auto;
  }
  .command-deck .brand-name {
    font-size: 9px;
    letter-spacing: 1px;
  }
  .command-deck .brand-client {
    font-size: 10px;
    max-width: 155px;
    white-space: normal;
  }
  .command-deck .cd-workspace .brand-client { display: none; }
  .command-deck .cd-workspace { gap: 7px; }
  .command-deck .cd-workspace .client-switch {
    max-width: 160px;
    min-height: 32px;
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0;
    text-transform: none;
  }
  .cd-brand-product { font-size: 8px; letter-spacing: 2px; }
  .command-deck .client-switch {
    max-width: 150px;
    font-size: 11px;
  }
  .command-deck .topbar-right {
    margin-left: auto;
    gap: 7px;
  }
  .command-deck .topbar .conn {
    position: static;
    font-size: 9px;
    gap: 5px;
    padding: 0;
    background: none;
    border: 0;
  }
  .command-deck .topbar .icon-btn {
    width: 32px;
    height: 32px;
  }
  .command-deck .wrap {
    padding: 23px 17px;
    min-height: calc(100vh - 250px);
  }
  .command-deck h1 {
    font-size: 24px;
  }
  .cd-page-head {
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 20px;
  }
  .cd-page-head p {
    font-size: 11px;
  }
  .cd-page-head .btn-secondary {
    font-size: 10px;
    min-height: 38px;
    padding: 9px 11px;
  }
  #cd-today-date { display: none; }
  .cd-head-actions { gap: 8px; }
  .cd-search {
    width: 100%;
    margin-top: 3px;
  }
  .cd-status {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 18px;
  }
  .cd-status-button {
    padding: 14px 11px;
    gap: 9px;
    min-height: 75px;
    border-bottom: 1px solid var(--border);
  }
  .cd-status-button:nth-child(2) {
    border-right: 0;
  }
  .cd-status-button:nth-child(3) {
    border-bottom: 0;
  }
  .cd-status-button strong {
    font-size: 11px;
  }
  .cd-status-lamp {
    width: 29px;
    height: 29px;
    font-size: 14px;
  }
  .cd-modules {
    grid-template-columns: 1fr;
    gap: 17px;
  }
  .command-deck .card-head {
    margin-bottom: 0;
    padding: 18px 17px 12px;
  }
  .cd-compact-row {
    padding: 15px 0;
    gap: 10px;
  }
  .command-deck .cd-compact-row.queue-item { padding: 15px 0; }
  .cd-module-content { padding: 0 17px 8px; }
  .cd-row-end { font-size: 9px; }
  .command-deck .cd-work-list { padding: 0 17px; }
  .cd-notice { font-size: 11px; }
  .cd-legend { gap: 10px; }
  .cd-compact-row strong {
    font-size: 12px;
  }
  .cd-compact-row small {
    font-size: 10px;
  }
  .cd-module-foot {
    margin: 0 17px;
  }
  .cd-module-foot small {
    font-size: 9px;
  }
  .cd-agent-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .cd-agent-main {
    min-height: 0;
    padding: 18px 17px 15px;
  }
  .cd-agent-main h2 {
    font-size: 15px;
    padding-right: 56px;
    min-height: 20px;
  }
  .cd-agent-main p {
    font-size: 11px;
    min-height: 0;
  }
  .cd-agent-symbol {
    float: left;
    margin: 0 13px 30px 0;
    width: 36px;
    height: 36px;
  }
  .cd-agent-health {
    clear: both;
    font-size: 10px;
    margin-top: 15px;
  }
  .cd-agent-main small {
    font-size: 9px;
  }
  .cd-agent-info {
    font-size: 10px;
    top: 13px;
    right: 11px;
  }
  .cd-agent-counts {
    padding: 11px 17px;
    min-height: 44px;
  }
  .cd-comms-summary {
    display: grid;
    grid-template-columns: 29px minmax(0, 1fr) auto;
    padding: 11px;
    column-gap: 9px;
    row-gap: 7px;
  }
  .cd-comms-icon {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 29px;
  }
  .cd-comms-copy {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .cd-comms-copy strong {
    font-size: 11px;
  }
  .cd-comms-copy strong > span {
    display: block;
    margin: 4px 0 0;
    font-size: 9px;
  }
  .cd-comms-copy small {
    font-size: 9px;
    line-height: 1.5;
  }
  .cd-comms-dots {
    display: grid;
    grid-template-columns: repeat(5, 7px);
    gap: 6px;
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
    margin: 0;
    padding: 0;
    min-width: 0;
    max-width: 100%;
  }
  .cd-comms-dots i {
    width: 7px;
    height: 7px;
  }
  .cd-comms-dots small {
    grid-column: 1 / -1;
    max-width: 100%;
    justify-self: center;
    overflow-wrap: anywhere;
  }
  .cd-comms-open {
    grid-column: 3;
    grid-row: 2;
    margin: 0;
    font-size: 9px;
  }
  .cd-comms-dots:empty {
    display: none;
  }
  .cd-work-row {
    grid-template-columns: 1fr 16px;
    gap: 12px;
    padding: 18px 0;
  }
  .cd-work-row .cd-journey {
    grid-row: 2;
    grid-column: 1/-1;
  }
  .cd-work-row > span:last-child {
    grid-row: 1;
    grid-column: 2;
  }
  .cd-work-row strong {
    font-size: 13px;
  }
  .cd-dialog {
    padding: 21px 20px;
  }
  .cd-dialog-head h2 {
    font-size: 21px;
  }
  .cd-dialog .detail-facts {
    grid-template-columns: 1fr;
  }
  .command-deck .view-heading {
    flex-wrap: wrap;
  }
  .cd-layout-row {
    gap: 7px;
  }
  .cd-density {
    width: 100%;
  }
  .cd-disclosure {
    padding: 17px;
  }
  .command-deck .foot {
    padding: 10px 18px 95px;
    font-size: 9px;
    gap: 14px;
  }
  .command-deck .app-nav {
    bottom: 0;
    left: 0;
    transform: none;
    max-width: none;
    width: 100%;
    border-radius: 0;
    padding: 5px 4px max(9px, env(safe-area-inset-bottom));
    gap: 0;
    justify-content: space-around;
  }
  .command-deck .app-nav-btn {
    position: relative;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    flex: 1;
    min-height: 56px;
    padding: 8px 3px;
    font-size: 9px;
  }
  .command-deck .app-nav-btn b {
    position: absolute;
    right: 12px;
    top: 5px;
    font-size: 8px;
  }
  .command-deck .queue-item,
  .command-deck .decision-row {
    padding: 17px;
  }
  .command-deck .record-empty {
    padding: 18px 17px;
  }
  .command-deck .results-layout {
    grid-template-columns: 1fr;
  }
  .cd-step {
    min-width: 48px;
  }
}
@media (max-width: 480px) {
  /* Keep the selector, feed status and actions together on narrow phones.
     The compact brand mark reserves room only when a selector is present;
     its text stays available to assistive technology. */
  .command-deck .topbar:has(.client-switch:not(.hidden)) .brand-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .command-deck .pulse {
    display: none !important;
  }
  .command-deck *,
  .command-deck *::before {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  .cd-agent {
    border: 1px solid CanvasText;
    background: Canvas;
    box-shadow: none;
  }
  .cd-agent::before {
    display: none;
  }
  .cd-agent-info,
  .cd-status-button {
    border: 1px solid ButtonText;
  }
  .cd-step i {
    border: 1px solid CanvasText;
  }
  .cd-status-lamp {
    color: CanvasText;
  }
  .cd-tag {
    border: 1px solid CanvasText;
  }
}

.command-deck .app-nav-btn {
  text-transform: none;
  letter-spacing: 0;
}
.command-deck .app-nav-btn::after {
  display: none;
}
.command-deck .cd-disclosure {
  padding: 18px 23px;
}
.command-deck .notlinked-card {
  padding: 28px;
}
.command-deck .brand-client {
  letter-spacing: 0.5px;
  text-transform: none;
}
.command-deck .push-banner {
  margin-bottom: 22px;
}
/* Scale the on-demand map inside a phone drawer without sideways page travel. */
.command-deck .conn-svg {
  min-width: 0;
}
.command-deck .topbar {
  padding-top: max(10px, env(safe-area-inset-top));
}
.command-deck .cd-dialog,
.command-deck #connectors-modal .modal {
  padding-bottom: max(26px, env(safe-area-inset-bottom));
}

/* A focused work review is smaller than the technical drawers. Its middle
   scrolls, keeping navigation and the current action within reach. */
html.cd-work-open, html.cd-work-open body { overflow: hidden; }
.command-deck #cd-work-modal {
  inset: 0;
  margin: auto 24px auto auto;
  width: min(560px, calc(100% - 48px));
  height: fit-content;
  max-height: min(760px, calc(100vh - 48px));
  max-height: min(760px, calc(100dvh - 48px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 75px #10213540;
}
#cd-work-modal[open] { display: flex; flex-direction: column; }
.cd-work-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 0 0 auto;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}
.cd-work-head > div { min-width: 0; }
.cd-work-head h2 { margin: 4px 0 0; font-size: 20px; line-height: 1.35; overflow-wrap: anywhere; }
.cd-work-eyebrow { color: var(--fg-muted); font-size: 11px; }
.cd-work-title-copy { display: none; }
.cd-work-back { flex: 0 0 auto; }
.cd-work-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-padding-block: 16px;
  padding: 20px 22px;
  overflow-wrap: anywhere;
}
.cd-work-context { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; color: var(--fg-muted); font-size: 12px; margin-bottom: 18px; }
.cd-work-decision h3, .cd-work-report h3, .cd-work-related h3 { font-size: 13px; margin: 0 0 8px; }
.cd-work-decision p, .cd-work-report p { font-size: 14px; line-height: 1.65; margin: 0; }
.cd-work-decision .cd-work-rationale { margin-top: 10px; color: var(--fg-muted); font-size: 12px; }
.cd-work-decision .cd-work-due { font-size: 12px; margin-top: 10px; }
.cd-work-report { margin-top: 18px; }
.cd-work-report.is-lead { margin-top: 0; }
.cd-work-report-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--fg-muted); font-size: 11px; margin-top: 8px; }
.cd-work-report small { display: block; color: var(--fg-muted); font-size: 11px; margin-top: 8px; }
.cd-work-disclosure { border-top: 1px solid var(--border); margin-top: 16px; }
.cd-work-disclosure > summary { cursor: pointer; padding: 14px 0; min-height: 44px; font-size: 13px; font-weight: 600; }
.cd-work-disclosure > div { padding: 0 0 8px; }
.cd-work-disclosure .cd-work-report:first-child { margin-top: 0; }
.cd-work-disclosure .cd-journey { margin-top: 8px; }
.cd-work-related { margin-top: 18px; }
.cd-work-related-link { display: block; text-align: left; width: 100%; color: var(--fg); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.cd-work-agent-link { margin-top: 12px; }
.cd-work-actions { flex: 0 0 auto; max-height: 40vh; max-height: 40dvh; overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 12px; padding: 16px 22px 20px; border-top: 1px solid var(--border); background: var(--surface); }
#cd-work-modal .cd-text-btn { color: var(--indigo-bright); }
#cd-work-modal .cd-work-actions .decision-row { border: 0; padding: 0; }
#cd-work-modal .cd-work-action-note { margin: 0 0 10px; font-size: 11px; color: var(--fg-muted); line-height: 1.5; }
#cd-work-modal .queue-actions, #cd-work-modal .decision-options { margin: 0; display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
#cd-work-modal button { min-height: 44px; white-space: normal; overflow-wrap: anywhere; }
#cd-work-modal .queue-actions button, #cd-work-modal .decision-options button { flex: 1 1 auto; margin: 0; padding: 11px 14px; }
#cd-work-modal .decision-options .decision-reject { flex: 0 1 auto; }
#cd-work-modal .event-action-error, #cd-work-modal .decision-error { margin: 10px 0 0; font-size: 12px; line-height: 1.5; }
#cd-work-modal .cd-evidence-note { margin: 12px 0; }
#cd-work-modal .decision-options + .cd-work-action-note { margin: 10px 0 0; }
@media (max-width: 700px) {
  .command-deck #cd-work-modal {
    margin: auto 0 0;
    width: 100%;
    max-height: calc(100vh - max(12px, env(safe-area-inset-top)));
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  .cd-work-head { padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); gap: 12px; }
  .cd-work-head h2 { font-size: 18px; }
  .cd-work-scroll { padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); }
  .cd-work-actions { padding: 14px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
}
/* Short landscape screens keep the full title in the scrolling review, so
   long titles cannot push the decision content or controls offscreen. */
@media (max-height: 500px) {
  .command-deck #cd-work-modal {
    width: min(760px, calc(100% - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right))));
    max-height: calc(100vh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
    margin: auto max(12px, env(safe-area-inset-right)) auto auto;
    border: 1px solid var(--border);
    border-radius: 16px;
  }
  .cd-work-head { padding: 10px 16px; }
  .cd-work-head > div { display: none; }
  .cd-work-title-copy { display: block; font-size: 18px; line-height: 1.4; margin: 0 0 14px; }
  .cd-work-scroll { padding: 14px 16px; }
  .cd-work-actions { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
}
