.mobile-nav { display: none; }
.app-view { height: var(--workbench-viewport-height, 100%); }
.topbar { height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand > span { width: 32px; height: 32px; border-radius: 9px; font-size: .86rem; }
.brand strong { font-size: 1rem; }
.brand small { padding-left: 10px; border-left: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 7px; min-width: 0; }
.weekly-usage-badge { display: inline-flex; align-items: center; gap: 4px; min-height: 31px; padding: 4px 9px; border: 1px solid #dce1ea; border-radius: 9px; color: #586174; background: #f7f8fa; font-size: .75rem; white-space: nowrap; }
.weekly-usage-badge:hover { border-color: #b9c2d4; background: #f1f3f7; }
.weekly-usage-badge strong { color: var(--ink); font-size: .79rem; }
.weekly-usage-badge.available strong { color: #267451; }
.weekly-usage-badge.warning strong { color: #9a6500; }
.weekly-usage-badge.critical strong { color: var(--danger); }
.weekly-usage-badge.loading, .weekly-usage-badge.unavailable { color: #8b93a2; }
.account-badge { margin-right: 3px; color: #555f72; font-size: .82rem; white-space: nowrap; }
.workbench { display: grid; grid-template-columns: 230px minmax(420px, 1fr) minmax(330px, 39%); height: calc(100% - var(--topbar-height)); }
.agent-rail, .chat-pane, .workspace-pane { min-width: 0; min-height: 0; background: var(--surface); }
.agent-rail { border-right: 1px solid var(--line); }
.rail-heading, .workspace-pane > header { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 17px; border-bottom: 1px solid var(--line); }
.rail-heading > span { color: #8a92a3; font-size: .68rem; font-weight: 800; letter-spacing: .13em; }
.agent-list { height: calc(100% - 58px); overflow-y: auto; padding: 10px; }
.agent-item { width: 100%; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; margin-bottom: 5px; padding: 9px; border: 1px solid transparent; border-radius: 12px; color: var(--ink); background: transparent; text-align: left; }
.agent-item:hover { background: #f7f8fa; }
.agent-item.active { border-color: #dfe3ff; background: var(--brand-soft); }
.agent-avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: white; background: var(--agent-color, #6074dc); font-size: .75rem; font-weight: 800; }
.agent-copy { min-width: 0; }
.agent-copy strong, .agent-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-copy strong { font-size: .9rem; }
.agent-copy small { margin-top: 2px; color: var(--muted); font-size: .73rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #aeb4c0; }
.status-dot.working { background: #37ad77; box-shadow: 0 0 0 4px #dcf5e9; }

.chat-pane { position: relative; }

@media (max-width: 1180px) {
  .workbench { grid-template-columns: 205px minmax(390px, 1fr) minmax(300px, 35%); }
  .topbar-actions .btn { font-size: .72rem; }
  .brand small, .account-badge { display: none; }
}

@media (max-width: 820px) {
  body { overflow: hidden; }
  .topbar { padding: 0 10px; }
  .topbar-actions .btn:not([data-action="logout"]) { display: none !important; }
  .mobile-nav { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: white; }
  .mobile-nav button { border: 0; color: var(--muted); background: white; }
  .mobile-nav button.active { color: var(--brand); font-weight: 700; }
  .workbench { grid-template-columns: 72px 1fr; height: calc(100% - var(--topbar-height) - var(--mobile-nav-height) - env(safe-area-inset-bottom)); }
  .agent-rail { grid-column: 1; }
  .rail-heading { padding: 0; justify-content: center; }
  .rail-heading > span { display: none; }
  .agent-list { padding: 7px; }
  .agent-item { display: block; padding: 7px; }
  .agent-avatar { margin: 0 auto; }
  .agent-copy, .status-dot { display: none; }
  .chat-pane, .workspace-pane { grid-column: 2; grid-row: 1; }
  .workspace-pane { display: none; border-left: 0; }
  .workbench.workspace-active .chat-pane { display: none; }
  .workbench.workspace-active .workspace-pane { display: block; }
  .conversation-header { align-items: flex-start; flex-wrap: wrap; }
  .conversation-header > div:first-child { min-width: 0; overflow-wrap: anywhere; }
  .conversation-tools { flex-wrap: wrap; justify-content: flex-end; width: 100%; }
  .conversation-more { display: block; }
  .conversation-tools .form-select { width: 160px; }
  .conversation-tools > [data-action="edit-agent"], .conversation-tools > [data-action="open-system-events"] { display: none !important; }
  .message-bubble { max-width: 95%; }
  .manager-layout { grid-template-columns: 1fr; }
  .manager-nav { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .manager-nav button { min-width: 150px; }
}

@media (max-width: 520px) {
  .action-review-mode { align-items: stretch; flex-direction: column; }
  .action-review-mode .form-select { width: 100%; min-width: 0; }
  .auth-card { padding: 25px 20px; }
  .brand small, .brand strong { display: none; }
  .weekly-usage-badge { padding: 4px 7px; font-size: .68rem; }
  .weekly-usage-badge strong { font-size: .72rem; }
  .workbench { grid-template-columns: 58px 1fr; }
  .conversation-header { min-height: 96px; padding: 8px 10px; }
  .conversation-tools { gap: 4px; }
  .conversation-tools .form-select { width: 130px; }
  .message-list { padding: 12px 9px; }
  .composer { padding: 8px; }
  .draft-list { padding: 0 8px; }
  .workspace-content { padding: 9px; }
}
