:root {
  --bg: #f2f5f2;
  --surface: #ffffff;
  --surface-muted: #f6f8f6;
  --text: #202521;
  --muted: #66736b;
  --line: rgba(32, 37, 33, 0.12);
  --accent: #2f6a4f;
  --accent-strong: #25543f;
  --success: #2f6a4f;
  --warning: #a46a13;
  --danger: #b34332;
  --shadow: 0 12px 28px rgba(29, 45, 35, 0.1);
  --shadow-soft: 0 6px 16px rgba(29, 45, 35, 0.07);
  --radius-xl: 10px;
  --radius-lg: 8px;
  --radius-md: 8px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --space-1: 4px;
  --space-2: 6px;
  --space-3: 8px;
  --space-4: 10px;
  --space-5: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: var(--fs-sm);
  background:
    linear-gradient(180deg, #f8faf8 0%, var(--bg) 100%);
}

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

button {
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-lg);
  padding: 7px 11px;
  min-height: 32px;
  font-weight: 600;
  font-size: var(--fs-sm);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px rgba(47, 106, 79, 0.16);
}

button.secondary,
button.warn.secondary {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.warn {
  background: var(--warning);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  box-shadow: none;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 7px 9px;
  min-height: 34px;
  font-size: var(--fs-sm);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.console-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 280px;
  gap: 10px;
  width: min(100vw - 16px, 1880px);
  margin: 8px auto 0;
  padding-bottom: 10px;
  align-items: start;
}

.demo-notice {
  width: min(100vw - 16px, 1880px);
  margin: 8px auto 0;
  padding: 9px 12px;
  border: 1px solid rgba(164, 106, 19, 0.25);
  border-radius: var(--radius-lg);
  background: rgba(255, 248, 232, 0.96);
  color: #75510d;
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.primary-nav,
.activity-rail {
  min-height: calc(100vh - 78px);
}

.primary-nav {
  position: sticky;
  top: 8px;
  align-self: start;
  display: grid;
  gap: 10px;
  padding: 14px 12px;
  background: #2f5f48;
  border-radius: var(--radius-xl);
  color: #eef6ef;
  box-shadow: var(--shadow);
}

.brand-eyebrow,
.workspace-kicker,
.page-eyebrow {
  margin: 0 0 8px;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 245, 230, 0.7);
}

.primary-nav h1,
.page-hero h3,
.workspace-title-group h2 {
  margin: 0;
  letter-spacing: 0;
}

.primary-nav h1 {
  font-size: 24px;
  line-height: 1;
}

.brand-copy,
.workspace-description,
.panel-head p,
.page-hero p,
.panel-tip,
.summary-note p,
.placeholder-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.brand-copy {
  color: rgba(238, 246, 239, 0.72);
  margin-top: 8px;
  font-size: var(--fs-xs);
}

.primary-nav-list {
  display: grid;
  gap: 6px;
}

.primary-nav-button {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: rgba(238, 246, 239, 0.78);
  border: 1px solid rgba(238, 246, 239, 0.13);
  box-shadow: none;
  text-align: left;
  padding: 8px 10px;
  font-size: var(--fs-sm);
}

.primary-nav-button.active {
  background: rgba(238, 246, 239, 0.13);
  color: #ffffff;
  border-color: rgba(238, 246, 239, 0.26);
}

.nav-summary {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(238, 246, 239, 0.13);
  border-radius: var(--radius-lg);
  background: rgba(238, 246, 239, 0.07);
}

.summary-row,
.metric-line,
.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-row span,
.metric-line span,
.rail-tag {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.nav-summary .summary-row span {
  color: rgba(238, 246, 239, 0.74);
}

.mode-badge,
.state-pill,
.rail-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.mode-badge.is-dry-run,
.state-pill.is-warning {
  background: rgba(164, 106, 19, 0.16);
  border-color: rgba(164, 106, 19, 0.28);
  color: #8a6112;
}

.state-pill.is-dirty {
  background: rgba(164, 106, 19, 0.12);
  border-color: rgba(164, 106, 19, 0.24);
  color: #8a5b10;
}

.workspace-shell {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.workspace-topbar,
.runtime-cards,
.page-hero,
.panel-card,
.rail-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.workspace-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 36px;
  padding: 3px 8px;
  gap: 8px;
  align-items: center;
}

.workspace-topbar .workspace-title-group {
  display: none;
}

.workspace-title-group {
  display: grid;
  gap: 8px;
}

.workspace-title-group h2 {
  font-size: var(--fs-xl);
  line-height: 1.05;
}

.workspace-description {
  max-width: 760px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.topbar-actions button,
.topbar-toggle {
  min-height: 30px;
  padding: 4px 8px;
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.workspace-topbar .switch {
  width: 36px;
  height: 20px;
}

.workspace-topbar .switch-slider::before {
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
}

.workspace-topbar .switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}

.compact-runtime-strip {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.compact-runtime-strip span {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  min-height: 24px;
  border: 1px solid rgba(32, 37, 33, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
}

.compact-runtime-strip .runtime-chip.is-ok {
  color: #1f5d43;
  border-color: rgba(47, 106, 79, 0.22);
  background: rgba(47, 106, 79, 0.1);
}

.compact-runtime-strip .runtime-chip.is-warning {
  color: #8a5b10;
  border-color: rgba(164, 106, 19, 0.24);
  background: rgba(164, 106, 19, 0.12);
}

.compact-runtime-strip .runtime-chip.is-danger {
  color: #9f3426;
  border-color: rgba(179, 67, 50, 0.24);
  background: rgba(179, 67, 50, 0.12);
}

.topbar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(32, 37, 33, 0.16);
}

.switch-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: rgba(47, 106, 79, 0.82);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.runtime-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  align-items: start;
}

.runtime-cards.is-compact {
  padding: 6px;
}

.runtime-card {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(32, 37, 33, 0.08);
  border-radius: var(--radius-lg);
}

.runtime-card span {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.runtime-card strong {
  font-size: var(--fs-sm);
}

.runtime-hint {
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: rgba(164, 106, 19, 0.14);
  border: 1px solid rgba(164, 106, 19, 0.24);
  color: #83590e;
}

.hidden {
  display: none !important;
}

.activation-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(242, 245, 242, 0.92);
}

.activation-panel {
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.activation-head {
  display: grid;
  gap: 6px;
}

.activation-head h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

.activation-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.activation-form {
  display: grid;
  gap: 12px;
}

.activation-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.activation-meta div {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.activation-meta span {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.activation-meta strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.workspace-main {
  display: grid;
  align-content: start;
}

.workspace-page {
  display: none;
  gap: 10px;
  align-content: start;
}

.workspace-page.active {
  display: grid;
}

.page-hero {
  display: none;
}

.page-hero h3 {
  font-size: var(--fs-xl);
  margin-bottom: 6px;
}

.page-hero p {
  max-width: 760px;
}

.page-meta {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

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

.subnav-button {
  background: rgba(255, 255, 255, 0.74);
  color: rgba(32, 37, 33, 0.88);
  border: 1px solid var(--line);
  box-shadow: none;
  padding: 7px 10px;
}

.subnav-button.active {
  background: rgba(47, 106, 79, 0.11);
  color: var(--accent);
  border-color: rgba(47, 106, 79, 0.22);
}

.subview {
  display: none;
}

.subview.active {
  display: grid;
  gap: 10px;
  align-content: start;
}

.nested-subview {
  display: none;
  gap: 12px;
  align-content: start;
}

.nested-subview.active {
  display: grid;
}

.detail-stack {
  display: grid;
  gap: 10px;
}

.page-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  align-items: start;
  min-width: 0;
}

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

.diagnostics-grid .log-split {
  grid-template-columns: 1fr;
}

.panel-card,
.rail-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  align-content: start;
  min-width: 0;
}

.activity-rail .rail-card:first-child {
  display: none;
}

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

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

.panel-head h4,
.rail-head h3 {
  margin: 0 0 4px;
  font-size: var(--fs-md);
  letter-spacing: 0;
}

.stack-form,
.list-stack,
.metric-stack,
.log-split,
.plain-list,
.form-grid {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field {
  display: grid;
  grid-template-columns: minmax(116px, 172px) minmax(0, 1fr);
  gap: 6px 10px;
  align-items: start;
  min-width: 0;
}

.field span {
  display: inline-flex;
  margin: 0;
  min-height: 30px;
  align-items: center;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.field > input,
.field > select,
.field > textarea,
.field > .readonly-field {
  width: 100%;
}

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

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

.field-inline {
  grid-template-columns: minmax(116px, 172px) minmax(0, 1fr);
}

.readonly-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.readonly-field input {
  width: 100%;
}

.panel-tip,
.summary-note,
.placeholder-card {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
}

.summary-note strong,
.placeholder-card strong {
  display: block;
  margin-bottom: 6px;
}

.compact {
  gap: 8px;
}

.field-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.55;
}

.list-stack {
  min-height: 80px;
}

#contactsTable,
#groupsTable,
#recentGroupsTable {
  min-height: 10rem;
  max-height: max(22rem, calc(100vh - 18rem));
  overflow-y: auto;
  padding-right: 6px;
}

#sendTargetPickerTable {
  max-height: 32rem;
  overflow-y: auto;
  padding-right: 6px;
}

#messageTaskTargetPickerTable {
  max-height: 32rem;
  overflow-y: auto;
  padding-right: 6px;
}

#selectedSendTargetsTable {
  max-height: 12rem;
  overflow-y: auto;
  padding-right: 6px;
}

#messageTaskSelectedTargetsTable {
  max-height: 12rem;
  overflow-y: auto;
  padding-right: 6px;
}

#sendHistoryTable,
#conversationMessagesTable,
#conversationTasksTable,
#addFriendJobsTable,
#acceptJobsTable,
#momentPublishHistoryTable,
#momentLikeHistoryTable,
#messageAutomationTasksTable,
#momentPublishTasksTable,
#momentLikeTasksTable,
#friendRequestsTable {
  max-height: max(24rem, calc(100vh - 24rem));
  overflow-y: auto;
  padding-right: 6px;
}

.conversation-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.conversation-filter-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.conversation-filter-group.is-time {
  grid-column: span 2;
}

.compact-field {
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
}

.compact-field span {
  min-height: 28px;
}

.conversation-task-list {
  display: grid;
  gap: 8px;
  min-height: 100px;
  overflow-y: auto;
  padding-right: 6px;
}

.conversation-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 8px 12px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(32, 37, 33, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
}

.conversation-task-main,
.conversation-task-side,
.conversation-task-preview,
.conversation-task-detail,
.conversation-detail-section,
.conversation-timeline-item {
  min-width: 0;
}

.conversation-task-main {
  display: grid;
  gap: 8px;
}

.conversation-task-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.conversation-task-title strong {
  min-width: 0;
  max-width: 360px;
  overflow-wrap: anywhere;
}

.conversation-task-title .state-pill {
  min-height: 24px;
  padding: 3px 8px;
  font-size: var(--fs-xs);
  box-shadow: none;
}

.conversation-task-preview {
  display: grid;
  gap: 4px;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.conversation-task-side {
  display: grid;
  gap: 4px;
  justify-items: end;
  color: var(--muted);
  font-size: var(--fs-xs);
  text-align: right;
}

.conversation-task-side .mini-action {
  margin-top: 2px;
}

.conversation-task-replied {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.conversation-empty {
  padding: 14px;
  border: 1px dashed rgba(32, 37, 33, 0.16);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

.conversation-empty.compact {
  padding: 9px 10px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 25, 22, 0.38);
}

.modal-panel {
  width: min(1120px, 100%);
  max-height: min(88vh, 920px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

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

.modal-head h3 {
  margin: 0;
  font-size: var(--fs-lg);
  overflow-wrap: anywhere;
}

.conversation-task-detail {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

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

.conversation-detail-meta div {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid rgba(32, 37, 33, 0.1);
  border-radius: var(--radius-md);
  background: rgba(246, 248, 246, 0.9);
  min-width: 0;
}

.conversation-detail-meta span,
.conversation-timeline-meta span {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.conversation-detail-meta strong {
  overflow-wrap: anywhere;
}

.conversation-detail-section {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(32, 37, 33, 0.1);
}

.conversation-detail-section h4 {
  margin: 0;
  font-size: var(--fs-sm);
}

.conversation-timeline-item {
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid rgba(32, 37, 33, 0.09);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.conversation-timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.conversation-timeline-meta strong {
  overflow-wrap: anywhere;
}

.conversation-timeline-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.conversation-media-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.conversation-media-thumb {
  display: grid;
  gap: 4px;
  margin: 0;
  width: min(100%, 360px);
  max-width: 100%;
  cursor: zoom-in;
}

.conversation-media-thumb img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid rgba(32, 37, 33, 0.12);
  background: var(--surface-muted);
}

.conversation-media-thumb.is-expanded {
  width: min(100%, 760px);
  cursor: zoom-out;
}

.conversation-media-thumb.is-expanded img {
  max-height: 70vh;
}

.conversation-media-thumb figcaption,
.conversation-media-chip {
  color: var(--muted);
  font-size: var(--fs-xs);
  overflow-wrap: anywhere;
}

.conversation-media-chip {
  display: inline-flex;
  align-items: center;
  max-width: 240px;
  padding: 4px 8px;
  border: 1px solid rgba(32, 37, 33, 0.1);
  border-radius: 999px;
  background: rgba(246, 248, 246, 0.92);
}

.history-lines {
  display: grid;
  gap: 0;
  min-height: 80px;
  max-height: 420px;
  overflow: auto;
  min-width: 0;
  max-width: 100%;
  padding: 4px 0;
  border: 1px solid rgba(32, 37, 33, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
}

.history-line {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(32, 37, 33, 0.06);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.history-line:last-child {
  border-bottom: 0;
}

.history-line.is-highlight {
  background: rgba(47, 106, 79, 0.08);
}

.history-line.is-warning {
  background: rgba(164, 106, 19, 0.12);
}

.history-line.is-danger {
  background: rgba(179, 67, 50, 0.12);
}

.history-line.is-empty {
  grid-template-columns: 1fr;
}

.history-time {
  color: var(--muted);
  white-space: nowrap;
}

.history-text {
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.history-alert-tag {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: middle;
}

.history-line.is-warning .history-alert-tag {
  background: rgba(164, 106, 19, 0.18);
  color: #8a6112;
}

.history-line.is-danger .history-alert-tag {
  background: rgba(179, 67, 50, 0.18);
  color: #9c3b2d;
}

.list-item {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid rgba(32, 37, 33, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.list-item.is-highlight {
  border-color: rgba(47, 106, 79, 0.3);
  box-shadow: 0 0 0 1px rgba(47, 106, 79, 0.14);
}

.list-item-head,
.list-item-actions,
.list-item-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.list-item-title {
  font-weight: 700;
  word-break: break-all;
}

.list-item-meta {
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.list-item-shell {
  display: grid;
  gap: 8px;
}

.list-item-shell.is-highlight .list-item {
  border-color: rgba(47, 106, 79, 0.3);
  box-shadow: 0 0 0 1px rgba(47, 106, 79, 0.14);
}

.compact-list-item {
  gap: 6px;
}

.compact-item-top,
.compact-item-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
}

.compact-item-title {
  font-weight: 700;
  line-height: 1.35;
  word-break: break-all;
}

.compact-item-facts,
.compact-item-note {
  display: flex;
  gap: 6px 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.compact-item-note {
  min-width: 0;
}

.compact-item-note,
.compact-item-note span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-item-bottom .list-item-actions {
  justify-content: flex-end;
}

.mini-action {
  padding: 6px 9px;
  font-size: var(--fs-xs);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.mini-action.ghost {
  background: transparent;
}

.mini-subnav {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-subnav-button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: rgba(32, 37, 33, 0.8);
  font-weight: 600;
  cursor: pointer;
}

.mini-subnav-button.active {
  color: var(--text);
  border-color: rgba(47, 106, 79, 0.22);
  background: rgba(47, 106, 79, 0.08);
}

.selection-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
}

.selection-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(32, 37, 33, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.selection-chip strong {
  font-size: var(--fs-sm);
}

.selection-chip-kind {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(47, 106, 79, 0.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.result-card {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(47, 106, 79, 0.2);
  background: rgba(47, 106, 79, 0.08);
}

.result-card.is-warning {
  border-color: rgba(164, 106, 19, 0.24);
  background: rgba(164, 106, 19, 0.1);
}

.result-card.is-error {
  border-color: rgba(179, 67, 50, 0.24);
  background: rgba(179, 67, 50, 0.1);
}

.result-card h5 {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
}

.result-card p,
.result-card ul {
  margin: 0;
}

.result-card ul {
  padding-left: 18px;
}

.top-gap {
  margin-top: 10px;
}

.code,
pre {
  font-family: "Cascadia Code", Consolas, monospace;
}

.activity-rail {
  position: sticky;
  top: 8px;
  align-self: start;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.rail-card pre {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: var(--fs-xs);
  line-height: 1.55;
}

.rail-console-log {
  margin: 0;
  height: min(58vh, 520px);
  min-height: 320px;
  max-height: 620px;
  overflow: auto;
  padding: 7px 8px;
  border: 1px solid rgba(32, 37, 33, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-pane {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.log-pane pre,
#processConsoleLog,
#processServerErrorLog {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.rail-log-line {
  display: block;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(32, 37, 33, 0.06);
}

.rail-log-line:last-child {
  border-bottom: 0;
}

.rail-log-line.is-warning {
  background: rgba(164, 106, 19, 0.12);
}

.rail-log-line.is-danger {
  background: rgba(179, 67, 50, 0.12);
}

.rail-console-log .history-alert-tag {
  vertical-align: baseline;
}

.plain-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.doc-list .list-item-title a {
  color: inherit;
  text-decoration: none;
}

.doc-list .list-item-title a:hover {
  text-decoration: underline;
}

.status-bar {
  position: static;
  width: min(100vw - 16px, 1880px);
  margin: 0 auto 8px;
  padding: 6px 10px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.toast-viewport {
  position: fixed;
  right: 18px;
  bottom: 82px;
  z-index: 50;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  color: #fff;
  background: rgba(32, 37, 33, 0.92);
  box-shadow: var(--shadow-soft);
}

.toast.is-success {
  background: rgba(47, 106, 79, 0.94);
}

.toast.is-warning {
  background: rgba(164, 106, 19, 0.96);
}

.toast.is-error {
  background: rgba(179, 67, 50, 0.96);
}

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

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

  .primary-nav,
  .activity-rail {
    position: static;
    min-height: auto;
  }

  .workspace-shell {
    order: 2;
  }

  .primary-nav {
    order: 1;
  }

  .activity-rail {
    order: 3;
  }

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

@media (max-width: 640px) {
  .console-shell,
  .demo-notice,
  .status-bar {
    width: min(100vw - 14px, 1820px);
  }

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

  .primary-nav {
    position: static;
    min-height: auto;
    padding: 16px;
    gap: 12px;
    order: 1;
  }

  .workspace-shell {
    order: 2;
  }

  .activity-rail {
    display: grid;
    position: static;
    min-height: auto;
    order: 3;
  }

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

  .primary-nav-button {
    padding: 9px 10px;
  }

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

  .panel-head,
  .topbar-actions {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .page-grid,
  .form-grid,
  .conversation-filter-grid,
  .conversation-filter-group,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .conversation-filter-group.is-time {
    grid-column: auto;
  }

  .conversation-task-row {
    grid-template-columns: 1fr;
  }

  .conversation-task-side {
    justify-items: start;
    text-align: left;
  }

  .conversation-detail-meta {
    grid-template-columns: 1fr;
  }

  .modal-layer {
    padding: 8px;
    align-items: stretch;
  }

  .modal-panel {
    max-height: calc(100vh - 16px);
  }

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

  .activation-meta {
    grid-template-columns: 1fr;
  }

  .field,
  .field-inline,
  .compact-field {
    grid-template-columns: 1fr;
  }

  .field span {
    min-height: auto;
  }

  .compact-item-top,
  .compact-item-bottom {
    grid-template-columns: 1fr;
  }

  .history-line {
    grid-template-columns: 1fr;
  }

  .toast-viewport {
    left: 10px;
    right: 10px;
  }

  .toast {
    max-width: none;
  }
}
