:root {
  --bg-1:    #060e2d;
  --bg-2:    #0d1b4a;
  --ink:     #e2e8f8;
  --muted:   #7b8ab4;
  --panel:   rgba(11, 21, 60, 0.88);
  --line:    rgba(255, 255, 255, 0.08);
  --accent:  #7c5cfc;
  --accent-2:#22d3ee;
  --ok:      #22c55e;
  --bad:     #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "IBM Plex Sans", "Manrope", sans-serif;
  color: var(--ink);
  background: var(--bg-1);
  /* radial purple glow top-left, like Figma design */
  background-image:
    radial-gradient(ellipse 70% 60% at 0% 0%, rgba(98, 60, 234, 0.35) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(14, 40, 120, 0.4) 0%, transparent 70%);
}

/* scanline texture removed — replaced by subtle purple glow */
.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(124, 92, 252, 0.5) 4px
  );
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(6, 14, 45, 0.92);
  backdrop-filter: blur(12px);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 8px rgba(124, 92, 252, 0.7);
}

.brand-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.brand-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-nav-picker {
  display: none;
}

.workspace-switcher {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
}

.workspace-switcher-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
}

.workspace-switcher-actions input { margin: 0; }

.nav-link {
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 140ms ease;
}

.nav-link.active {
  background: rgba(124, 92, 252, 0.18);
  border-color: rgba(124, 92, 252, 0.35);
  color: #fff;
  box-shadow: 0 0 14px rgba(124, 92, 252, 0.15);
}

.nav-link:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  transform: translateX(2px);
}

.nav-link:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-foot {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
}

.content { padding: 22px; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 26px;
  color: #fff;
}

.actions { display: flex; gap: 8px; }

.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 120ms ease;
}

.btn-primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #5a3dd8);
  box-shadow: 0 2px 14px rgba(124, 92, 252, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(124, 92, 252, 0.5);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.view { display: none; animation: rise 220ms ease; }
.view.active { display: block; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.card h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}

label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--muted);
}

input {
  margin-top: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}

input::placeholder { color: var(--muted); }

select {
  margin-top: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
}

select option { background: var(--bg-2); color: var(--ink); }

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.flag-label { display: flex; align-items: center; gap: 8px; }
.flag-label input { width: auto; margin: 0; }

.steps { margin: 0; padding-left: 18px; }
.steps li { margin-bottom: 7px; }
.step-ok  { color: var(--ok); }
.step-bad { color: var(--bad); }

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

.scan-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 10px;
}

.status-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.status-chip.ok {
  color: var(--ok);
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
}

.status-chip.warn {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.1);
}

.status-chip.bad {
  color: var(--bad);
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.1);
}

.table-empty { color: var(--muted); font-style: italic; }
.table-error { color: #fca5a5; font-style: normal; }
.table-retry-btn { margin-left: 8px; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

.sparkline {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
  transition: border-color 150ms;
}

.metric-card:hover { border-color: rgba(124, 92, 252, 0.3); }

.metrics-grid-compact { margin-bottom: 16px; }

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

.card-header-inline .hint { margin-top: 6px; }

.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  margin: 8px 0 0;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}

table { width: 100%; border-collapse: collapse; }

.table-scroll-shell {
  overflow: auto;
  max-height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
}

.table-scroll-shell-tall {
  max-height: 720px;
}

.table-scroll-shell thead th {
  position: sticky;
  top: 0;
  background: rgba(8, 16, 49, 0.98);
  z-index: 1;
}

th {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  padding: 11px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-align: left;
  font-size: 14px;
  color: var(--ink);
}

tr:hover td { background: rgba(124, 92, 252, 0.05); }

.status-line {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.auth-panel {
  margin-bottom: 14px;
  border: 1px solid rgba(248, 113, 113, 0.25);
  background: rgba(248, 113, 113, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
}

.auth-panel h2 { margin: 0 0 6px; color: var(--bad); font-size: 16px; }
.auth-panel p  { margin: 0; font-size: 14px; }

.error-boundary {
  margin-bottom: 14px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
}

.error-boundary h2 { margin: 0 0 6px; color: var(--bad); font-size: 16px; }
.error-boundary p  { margin: 0 0 8px; }

.error-boundary-details {
  margin: 0 0 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  max-height: 160px;
  overflow: auto;
  font-size: 12px;
  color: var(--muted);
}

.error-boundary-actions { display: flex; gap: 8px; }

.hidden { display: none !important; }

.blockers-list { margin: 0; padding-left: 18px; }
.blockers-list li { margin-bottom: 8px; }
.muted { color: var(--muted); }

.deploy-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr repeat(5, auto);
  gap: 8px;
}

.deploy-actions input { margin: 0; }

.deploy-details {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 13px;
  white-space: pre-wrap;
  color: var(--ink);
}

.deploy-warning {
  margin: 0 0 10px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: #fbbf24;
}

.deploy-warning-bad {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
  color: var(--bad);
}

.deploy-warning-info {
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.08);
  color: var(--accent-2);
}

.deploy-action-hints {
  margin: 0 0 12px;
  padding-left: 18px;
}

.deploy-action-hints li {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.deploy-details-grid {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 6px 10px;
}

.deploy-details-grid dt { color: var(--muted); font-size: 12px; }
.deploy-details-grid dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }

.policy-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 2fr 100px auto;
  gap: 8px;
}

.knowledge-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.knowledge-actions {
  display: grid;
  grid-template-columns: 1.1fr auto 90px 1.4fr 2fr 110px 110px auto auto auto;
  gap: 8px;
  margin-bottom: 10px;
}

.knowledge-actions input  { margin: 0; }
.knowledge-actions select { margin: 0; }

.ai-page-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.ai-page-grid-overview {
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
}

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

.ai-grid-span-full {
  grid-column: 1 / -1;
}

.settings-grid-compact {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px 16px;
}

.next-actions-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.next-actions-list {
  display: grid;
  gap: 10px;
}

.next-action-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.knowledge-results { margin: 0 0 10px; padding-left: 18px; }
.knowledge-results li { margin-bottom: 7px; }

.ai-playground-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

[data-ai-page].hidden {
  display: none !important;
}

[data-ai-composer-mode].composer-mode-hidden {
  display: none !important;
}

[data-playground-pane].playground-pane-hidden {
  display: none !important;
}

.task-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 32, 0.58);
  backdrop-filter: blur(3px);
  z-index: 40;
}

.task-drawer {
  position: fixed;
  top: 18px;
  right: 18px;
  width: min(580px, calc(100vw - 36px));
  height: calc(100vh - 36px);
  padding: 22px 18px 28px;
  overflow-y: auto;
  background: rgba(10, 17, 57, 0.98);
  border-left: 1px solid var(--line);
  border-radius: 20px 0 0 20px;
  box-shadow: -18px 0 50px rgba(0, 0, 0, 0.45);
  z-index: 41;
}

.task-drawer.hidden,
.task-drawer-backdrop.hidden {
  display: none !important;
}

.task-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.task-drawer-title-block {
  min-width: 0;
}

.task-drawer-header h2 {
  margin: 2px 0 0;
  font-size: 1.18rem;
  line-height: 1.25;
}

.task-drawer-header-copy {
  margin: 8px 0 0;
  max-width: 44ch;
}

.task-drawer-top {
  position: sticky;
  top: -22px;
  margin: -22px -18px 18px;
  padding: 22px 18px 18px;
  background:
    linear-gradient(180deg, rgba(10, 17, 57, 0.99) 0%, rgba(10, 17, 57, 0.97) 88%, rgba(10, 17, 57, 0.88) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 2;
}

.task-drawer-toolbar {
  display: grid;
  gap: 12px;
}

.task-drawer-toolbar-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.task-drawer-toolbar-card-secondary {
  background: rgba(255, 255, 255, 0.025);
}

.task-drawer-toolbar-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.task-drawer-toolbar-card-head .hint {
  margin: 0;
  text-align: right;
}

.task-drawer-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-drawer-toolbar-actions .btn {
  min-height: 40px;
}

.task-drawer-toolbar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.task-drawer-toolbar-grid label {
  min-width: 0;
  margin-bottom: 0;
  display: grid;
  gap: 6px;
}

.task-drawer-statuses {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.task-drawer-status {
  min-height: 18px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

body.drawer-open {
  overflow: hidden;
}

.thread-toolbar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.thread-toolbar-disclosure summary {
  display: none;
}

.thread-toolbar-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.thread-toolbar-card .scan-controls {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}

.thread-toolbar-card label {
  flex: 1 1 140px;
  min-width: 120px;
  margin-bottom: 0;
}

.thread-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.agent-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.agent-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.agent-card-title {
  margin: 0;
  font-size: 17px;
  color: #fff;
}

.agent-card-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.agent-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.agent-card-stat {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
  padding: 10px;
}

.agent-capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.composer-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 10px;
}

.composer-form-grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.composer-disclosure {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
}

.composer-disclosure summary {
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  list-style: none;
}

.composer-disclosure summary::-webkit-details-marker {
  display: none;
}

.composer-disclosure summary::after {
  content: "Ukryj";
  float: right;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.composer-disclosure:not([open]) summary::after {
  content: "Pokaz";
}

.composer-disclosure .composer-form-grid {
  margin-top: 10px;
}

.composer-block {
  margin-top: 10px;
}

.composer-textarea {
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  resize: vertical;
}

.composer-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.composer-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
}

.composer-toggle input {
  width: auto;
  margin: 0;
}

.inline-status {
  margin: 0;
}

.knowledge-context {
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 12px;
  line-height: 1.35;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
}

.metric-sha { font-size: 12px; line-height: 1.3; word-break: break-all; }

.settings-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px 10px;
  margin: 0;
}

.settings-grid dt { color: var(--muted); font-size: 12px; }
.settings-grid dd { margin: 0; overflow-wrap: anywhere; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .brand-sub { display: none; }
  nav { display: none; }
  .mobile-nav-picker { display: block; }
  .mobile-nav-picker label { margin-bottom: 0; }
  .workspace-switcher {
    padding: 8px;
  }
  .workspace-switcher-actions {
    grid-template-columns: 1fr auto auto;
  }
  .sidebar-foot { display: none; }
  .content { padding: 16px; }
  .metrics-grid         { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
  .trend-grid           { grid-template-columns: 1fr; }
  .knowledge-summary-grid { grid-template-columns: 1fr; }
  .knowledge-actions    { grid-template-columns: 1fr; }
  .settings-grid        { grid-template-columns: 1fr; }
  .ai-page-grid-overview,
  .ai-page-grid-inbox,
  .threads-workspace,
  .thread-toolbar-grid { grid-template-columns: 1fr; }
  .thread-toolbar-disclosure {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 12px;
  }
  .thread-toolbar-disclosure summary {
    display: block;
    cursor: pointer;
    color: #fff;
    font-weight: 600;
    list-style: none;
  }
  .thread-toolbar-disclosure summary::-webkit-details-marker {
    display: none;
  }
  .thread-toolbar-disclosure summary::after {
    content: "Ukryj";
    float: right;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
  }
  .thread-toolbar-disclosure:not([open]) summary::after {
    content: "Pokaz";
  }
  .thread-toolbar-disclosure .thread-toolbar-grid {
    margin-top: 10px;
    margin-bottom: 0;
  }
  .ai-page-grid-inbox .card {
    padding: 12px;
  }
  .ai-page-grid-inbox .card h2 {
    margin-bottom: 6px;
    font-size: 17px;
  }
  .ai-page-grid-inbox .card .hint {
    margin-top: 2px;
    margin-bottom: 8px;
  }
  .ai-page-grid-inbox .table-scroll-shell {
    max-height: 260px;
  }
  .ai-page-grid-inbox th {
    padding: 8px 6px;
    font-size: 11px;
  }
  .ai-page-grid-inbox td {
    padding: 9px 6px;
    font-size: 13px;
  }
  .composer-form-grid,
  .composer-form-grid-wide,
  .agent-card-stats { grid-template-columns: 1fr; }
  .composer-disclosure {
    padding: 10px;
  }
  .composer-disclosure summary {
    font-size: 14px;
  }
  .card-header-inline { flex-direction: column; }
  .composer-actions { align-items: stretch; }
  .composer-actions .btn { width: 100%; }
  .thread-toolbar-actions { align-items: stretch; }
  .thread-toolbar-actions .btn { width: 100%; }
  .task-drawer {
    top: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    border-left: 0;
    border-radius: 0;
  }
  .task-drawer-top {
    position: static;
    margin: 0 0 14px;
    padding: 0 0 12px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .task-drawer-toolbar-actions,
  .task-drawer-toolbar-grid {
    grid-template-columns: 1fr;
  }
  .task-drawer-toolbar-card-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .task-drawer-toolbar-card-head .hint {
    text-align: left;
  }
  .task-drawer-toolbar-actions .btn {
    width: 100%;
  }
}

/* AI Playground chat */
.msg-task-details h3 { margin: 0 0 .5rem; font-size: 1.05rem; color: #fff; }
.msg-task-details h4 { margin: 1rem 0 .3rem; font-size: .9rem; color: var(--muted); }
.msg-pre {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  padding: .6rem;
  border-radius: 8px;
  font-size: .8rem;
  overflow-x: auto;
  max-height: 16rem;
  color: var(--ink);
}
.msg-history { list-style: none; padding: 0; margin: 0; }
.msg-history li { padding: .2rem 0; font-size: .85rem; }
.msg-bubble {
  background: rgba(124, 92, 252, 0.1);
  border: 1px solid rgba(124, 92, 252, 0.2);
  padding: .5rem .7rem;
  border-radius: 10px;
  margin-bottom: .4rem;
  font-size: .85rem;
}
.msg-from { font-weight: 600; color: var(--accent); }
.msg-to   { font-weight: 600; color: var(--accent-2); }

.msg-chat-feed {
  margin-top: 10px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.threads-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
  gap: 12px;
  align-items: start;
}

.threads-feed-card,
.threads-chat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  min-height: 100%;
}

.msg-chat-bubble {
  max-width: min(78%, 920px);
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  align-self: flex-start;
}

.msg-chat-bubble.outgoing {
  align-self: flex-end;
  background: rgba(13, 143, 104, 0.16);
  border-color: rgba(13, 143, 104, 0.45);
}

.msg-chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: .74rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.msg-chat-type {
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.msg-chat-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
  font-size: .86rem;
}

/* scrollbar dark */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124,92,252,0.4); }
