:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-subtle: #f8faf9;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --ink: #11181c;
  --muted: #64717d;
  --line: rgba(17, 24, 28, 0.1);
  --line-strong: rgba(17, 24, 28, 0.16);
  --accent: #0f766e;
  --accent-2: #b4532a;
  --assistant: #ffffff;
  --user: #12384d;
  --user-ink: #f5fafb;
  --shadow: 0 18px 48px rgba(14, 21, 27, 0.1);
  --shadow-soft: 0 10px 28px rgba(14, 21, 27, 0.08);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
}

body.modal-open {
  overflow: hidden;
}

button,
textarea,
select {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
}

.auth-screen {
  min-height: 100dvh;
  overflow: auto;
  overscroll-behavior: contain;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-screen[hidden],
.page-shell[hidden] {
  display: none;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 1.45rem;
}

.auth-card p,
.auth-security-note,
.auth-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
}

.auth-mode-button {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.auth-mode-button.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 20px rgba(21, 111, 99, 0.18);
}

.auth-field {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: var(--accent);
}

.auth-field input {
  width: 100%;
  border: 1px solid rgba(28, 35, 40, 0.12);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--ink);
  font: inherit;
}

.auth-status.error {
  color: #b3261e;
}

.admin-footer {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: rgba(28, 35, 40, 0.45);
  font-size: 0.78rem;
  pointer-events: none;
  z-index: 20;
}

.admin-footer[hidden] {
  display: none;
}

.admin-link-button {
  border: 0;
  background: transparent;
  color: rgba(28, 35, 40, 0.46);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  pointer-events: auto;
}

.admin-link-button:hover,
.admin-link-button:focus-visible {
  color: var(--accent);
}

.admin-link-button:disabled {
  color: rgba(28, 35, 40, 0.24);
  text-decoration: none;
}

.site-compliance-footer {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 8px;
  z-index: 18;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  color: rgba(28, 35, 40, 0.48);
  font-size: 0.76rem;
  pointer-events: none;
}

.site-compliance-footer[hidden] {
  display: none;
}

.site-compliance-footer a {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.site-compliance-footer a:hover,
.site-compliance-footer a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-panel {
  width: min(480px, calc(100vw - 28px));
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 22px;
}

.admin-form {
  display: grid;
  gap: 14px;
}

.page-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
}

.sidebar,
.chat-panel,
.composer-card,
.settings-card,
.brand-card {
  backdrop-filter: blur(14px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.brand-card,
.settings-card,
.chat-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
}

.brand-card h1 {
  margin: 0;
  font-size: 1.3rem;
}

.brand-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #163f3b;
  color: white;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.ghost-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.skill-action:hover:not(:disabled),
.plaza-nav-btn:hover:not(:disabled) {
  border-color: rgba(15, 118, 110, 0.28);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.ghost-button.subtle {
  opacity: 0.85;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.conversation-item {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.46);
  border-radius: 14px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.conversation-item:hover,
.conversation-item.active {
  transform: translateY(-1px);
  border-color: rgba(21, 111, 99, 0.22);
  background: rgba(255, 255, 255, 0.88);
}

.conversation-name {
  font-weight: 600;
}

.conversation-time {
  color: var(--muted);
  font-size: 0.85rem;
}

.settings-card {
  margin-top: auto;
  padding: 16px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(46dvh, 520px);
  overflow: auto;
  overscroll-behavior: contain;
}

.field-label {
  font-size: 0.88rem;
  color: var(--muted);
}

.system-prompt-panel {
  border: 1px solid rgba(21, 111, 99, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  padding: 10px;
}

.system-prompt-panel summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 8px;
}

.settings-card textarea,
.settings-card select,
.composer-card textarea {
  width: 100%;
  border: 1px solid rgba(28, 35, 40, 0.1);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
  resize: vertical;
}

.status-line {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.4;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 28, 0.52);
  backdrop-filter: blur(14px);
  overflow: hidden;
  overscroll-behavior: none;
}

.modal-backdrop[hidden] {
  display: none;
}

.model-config-panel,
.capability-panel {
  width: min(760px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}

.capability-panel {
  width: min(1040px, 100%);
}

.local-permission-panel {
  width: min(860px, 100%);
}

.model-config-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.model-config-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.model-config-current {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.model-config-form {
  padding: 20px 24px 24px;
  overflow: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
}

.local-permission-body {
  display: grid;
  gap: 16px;
  padding: 20px 24px 24px;
  overflow: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
}

.permission-safety-note,
.permission-deny-list {
  border: 1px solid rgba(21, 111, 99, 0.16);
  border-radius: 14px;
  background: rgba(21, 111, 99, 0.07);
  color: #155f55;
  padding: 13px 14px;
  line-height: 1.6;
}

.permission-safety-note strong {
  display: block;
  margin-bottom: 5px;
}

.permission-safety-note p {
  margin: 0;
}

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

.browser-mode-panel {
  border: 1px solid rgba(28, 35, 40, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.browser-mode-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.browser-mode-head span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  text-align: right;
}

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

.browser-mode-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  border: 1px solid rgba(28, 35, 40, 0.1);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.browser-mode-option.warning {
  border-color: rgba(216, 95, 57, 0.2);
  background: rgba(216, 95, 57, 0.05);
}

.browser-mode-option input,
.private-browser-consent input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.browser-mode-option strong,
.browser-mode-option small {
  display: block;
}

.browser-mode-option small,
.private-browser-consent span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.private-browser-consent {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
  border-top: 1px solid rgba(28, 35, 40, 0.08);
  padding-top: 10px;
}

.permission-path-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

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

.permission-preset-btn {
  min-height: 38px;
  border: 1px solid rgba(21, 111, 99, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--accent);
  cursor: pointer;
  padding: 8px 10px;
  font-weight: 800;
  line-height: 1.25;
}

.permission-preset-btn.danger {
  border-color: rgba(216, 95, 57, 0.22);
  background: rgba(216, 95, 57, 0.07);
  color: #8a3e25;
}

.permission-path-toolbar .ghost-button {
  padding: 8px 12px;
}

.permission-path-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.permission-path-chip,
.permission-path-empty {
  border: 1px solid rgba(21, 111, 99, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 8px 12px;
  font-size: 0.88rem;
}

.permission-path-chip {
  cursor: pointer;
}

.permission-path-chip:hover {
  border-color: rgba(216, 95, 57, 0.28);
  background: rgba(216, 95, 57, 0.06);
}

.permission-path-empty {
  color: var(--muted);
}

.permission-path-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.permission-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  border: 1px solid rgba(28, 35, 40, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  padding: 13px;
}

.permission-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.permission-option strong,
.permission-option small {
  display: block;
}

.permission-option small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.permission-option.danger {
  border-color: rgba(216, 95, 57, 0.18);
  background: rgba(216, 95, 57, 0.06);
}

.local-permission-body textarea {
  width: 100%;
  border: 1px solid rgba(28, 35, 40, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 10px 12px;
  resize: vertical;
}

.permission-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.permission-switches label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(21, 111, 99, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  padding: 9px 12px;
  color: var(--ink);
}

.permission-switches input {
  accent-color: var(--accent);
}

.permission-deny-list {
  border-color: rgba(216, 95, 57, 0.18);
  background: rgba(216, 95, 57, 0.07);
  color: #7c432e;
  font-size: 0.88rem;
}

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

.config-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

.config-field.wide {
  grid-column: 1 / -1;
}

.config-field input,
.config-field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(28, 35, 40, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 10px 12px;
}

.config-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.config-actions > .ghost-button,
.config-actions > .send-button {
  min-height: 40px;
}

.config-verification-panel {
  margin-top: 16px;
  border: 1px solid rgba(28, 35, 40, 0.1);
  border-radius: 12px;
  background: rgba(248, 250, 249, 0.92);
  padding: 14px;
}

.config-verification-head {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.config-verification-head strong {
  font-size: 0.92rem;
  color: var(--ink);
}

.config-verification-head span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

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

.config-verification-card {
  border: 1px solid rgba(28, 35, 40, 0.1);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.config-verification-card strong {
  font-size: 0.8rem;
  color: var(--muted);
}

.config-verification-card span {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.config-verification-card small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.config-verification-card.ok {
  border-color: rgba(21, 111, 99, 0.22);
  background: rgba(21, 111, 99, 0.06);
}

.config-verification-card.warn {
  border-color: rgba(180, 130, 60, 0.22);
  background: rgba(180, 130, 60, 0.08);
}

.config-verification-card.error {
  border-color: rgba(181, 70, 43, 0.22);
  background: rgba(181, 70, 43, 0.08);
}

.fallback-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.fallback-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid rgba(21, 111, 99, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  padding: 8px 11px;
  font-size: 0.86rem;
}

.fallback-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.locked-model-note {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(21, 111, 99, 0.14);
  border-radius: 12px;
  background: rgba(21, 111, 99, 0.07);
  color: var(--accent);
  font-size: 0.88rem;
  line-height: 1.5;
}

.config-status {
  min-height: 22px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  word-break: break-word;
}

.config-status.success {
  color: var(--accent);
}

.config-status.error {
  color: #b5462b;
}

.admin-control-panel {
  width: min(680px, calc(100vw - 28px));
}

.admin-controls {
  display: grid;
  gap: 14px;
}

.admin-update-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-update-summary > div {
  min-width: 0;
  border: 1px solid rgba(21, 111, 99, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  padding: 12px;
}

.admin-update-summary strong,
.admin-update-summary span {
  display: block;
}

.admin-update-summary strong {
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-update-summary span {
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.capability-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 24px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  flex: 0 0 auto;
  overscroll-behavior-x: contain;
}

.capability-tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 8px 12px;
  white-space: nowrap;
  font-weight: 700;
}

.capability-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.capability-content {
  padding: 20px 24px 24px;
  overflow: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
}

.conversation-list,
.settings-card,
.message-list,
.model-config-form,
.local-permission-body,
.capability-content,
.capability-tabs {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 113, 125, 0.45) transparent;
}

.capability-view {
  display: none;
}

.capability-view.active {
  display: block;
}

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

.capability-toolbar h3 {
  margin: 0;
  font-size: 1.05rem;
}

.capability-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.market-search,
.range-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 240px;
  color: var(--muted);
  font-size: 0.82rem;
}

.market-search input {
  min-height: 40px;
  border: 1px solid rgba(28, 35, 40, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  padding: 9px 11px;
}

.template-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) auto auto minmax(150px, 1fr) minmax(150px, 1fr) auto;
  gap: 12px;
  align-items: end;
  width: min(100%, 980px);
}

.template-search,
.range-control {
  min-width: 0;
}

.filter-toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(21, 111, 99, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--accent);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.filter-toggle input {
  accent-color: var(--accent);
}

.range-control span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.range-control strong {
  color: var(--accent);
}

.range-control input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.skill-grid,
.template-grid,
.permission-grid,
.health-grid,
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

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

.plaza-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.plaza-nav-btn {
  border: 1px solid rgba(21, 111, 99, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  cursor: pointer;
  padding: 8px 12px;
  font-weight: 800;
}

.plaza-nav-btn.active {
  background: rgba(21, 111, 99, 0.12);
  color: var(--accent);
  border-color: rgba(21, 111, 99, 0.24);
}

.plaza-status {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.mcp-note {
  margin: -4px 0 14px;
  border: 1px solid rgba(216, 95, 57, 0.16);
  border-radius: 16px;
  background: rgba(216, 95, 57, 0.07);
  color: #7c432e;
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.55;
}

.mcp-note.connected {
  border-color: rgba(21, 111, 99, 0.2);
  background: rgba(21, 111, 99, 0.08);
  color: #155f55;
}

.skill-card,
.template-card,
.project-card,
.permission-card,
.health-card,
.capability-empty {
  border: 1px solid rgba(28, 35, 40, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.capability-empty {
  grid-column: 1 / -1;
  color: var(--muted);
}

.skill-card.enabled {
  border-color: rgba(21, 111, 99, 0.28);
  background: rgba(21, 111, 99, 0.06);
}

.mcp-card {
  background: linear-gradient(180deg, rgba(21, 111, 99, 0.035), rgba(255, 255, 255, 0.66));
}

.skill-card-head,
.template-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.skill-kicker,
.template-source,
.template-difficulty,
.health-meta {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.skill-card h4,
.template-card h4,
.permission-card h4,
.health-card h4 {
  margin: 3px 0 0;
  font-size: 0.98rem;
}

.skill-card p,
.template-card p,
.health-card p {
  margin: 10px 0 0;
  color: #3f4a52;
  line-height: 1.55;
  font-size: 0.88rem;
}

.skill-action {
  border: 1px solid rgba(21, 111, 99, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent);
  cursor: pointer;
  flex: 0 0 auto;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.skill-action:disabled {
  opacity: 0.72;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.skill-tags span,
.skill-tags .tag-button,
.template-badge {
  border: 0;
  border-radius: 10px;
  background: rgba(21, 111, 99, 0.09);
  color: var(--accent);
  padding: 5px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.25;
}

.skill-tags .tag-button {
  cursor: pointer;
  font-family: inherit;
}

.skill-tags .tag-button:hover {
  filter: brightness(0.96);
  text-decoration: underline;
}

.skill-tags .mcp-required-tag {
  border: 1px solid rgba(216, 95, 57, 0.2);
  background: rgba(216, 95, 57, 0.09);
  color: #8a3e25;
}

.skill-tags .mcp-ready-tag {
  border: 1px solid rgba(21, 111, 99, 0.22);
  background: rgba(21, 111, 99, 0.11);
  color: var(--accent);
}

.skill-tags .mcp-not-ready-tag {
  border: 1px solid rgba(180, 130, 60, 0.22);
  background: rgba(180, 130, 60, 0.1);
  color: #8a5b16;
}

.install-required-mcps-btn {
  margin-top: 10px;
}

.permission-details {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.permission-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.permission-details ul,
.permission-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.65;
}

.template-card {
  display: flex;
  flex-direction: column;
}

.project-card {
  display: grid;
  gap: 14px;
}

.project-card.enabled {
  border-color: rgba(21, 111, 99, 0.28);
  background: linear-gradient(180deg, rgba(21, 111, 99, 0.075), rgba(255, 255, 255, 0.72));
}

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

.project-head h4 {
  margin: 3px 0 0;
  font-size: 1.18rem;
}

.project-section {
  border-top: 1px solid rgba(28, 35, 40, 0.08);
  padding-top: 12px;
}

.project-section h5 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.9rem;
}

.project-section ol,
.project-section ul {
  margin: 0;
  padding-left: 20px;
  color: #3f4a52;
  line-height: 1.65;
  font-size: 0.88rem;
}

.project-helper {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

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

.route-family-card {
  border: 1px solid rgba(21, 111, 99, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.route-family-card strong {
  color: var(--accent);
  font-size: 0.9rem;
}

.route-family-card span,
.route-family-card p,
.route-family-card div,
.route-family-card em {
  margin: 0;
  color: #3f4a52;
  line-height: 1.45;
  font-size: 0.82rem;
}

.route-family-card em {
  color: var(--muted);
  font-style: normal;
}

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

.project2-import-input {
  min-width: 0;
  border: 1px solid rgba(28, 35, 40, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  padding: 9px;
  color: var(--muted);
}

.project2-import-status {
  margin-top: 10px;
  word-break: break-word;
}

.project-status {
  border: 1px solid rgba(216, 95, 57, 0.16);
  border-radius: 14px;
  background: rgba(216, 95, 57, 0.07);
  color: #7c432e;
  padding: 10px 12px;
  font-size: 0.84rem;
  line-height: 1.5;
}

.project-status.ready {
  border-color: rgba(21, 111, 99, 0.22);
  background: rgba(21, 111, 99, 0.08);
  color: #155f55;
}

.mcp-readiness-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.mcp-readiness-item {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid rgba(28, 35, 40, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 9px 10px;
  color: var(--text);
  cursor: pointer;
}

.mcp-readiness-item strong {
  font-size: 0.82rem;
}

.mcp-readiness-item span {
  font-size: 0.76rem;
  color: var(--muted);
}

.mcp-readiness-item.ready {
  border-color: rgba(21, 111, 99, 0.24);
  background: rgba(21, 111, 99, 0.08);
}

.mcp-readiness-item.blocked {
  border-color: rgba(216, 95, 57, 0.2);
  background: rgba(216, 95, 57, 0.07);
}

.template-card.new-post {
  border-color: rgba(216, 95, 57, 0.26);
  background: linear-gradient(180deg, rgba(216, 95, 57, 0.06), rgba(255, 255, 255, 0.66));
}

.template-industry {
  width: fit-content;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(28, 35, 40, 0.06);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 0.76rem;
  font-weight: 800;
}

.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}

.template-card .send-button {
  align-self: flex-start;
}

.template-source {
  margin-top: 10px;
}

.template-difficulty {
  flex: 0 0 auto;
  text-align: right;
}

.health-card {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 12px;
}

.health-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--muted);
}

.health-card.ok .health-dot {
  background: var(--accent);
}

.health-card.error .health-dot {
  background: #b5462b;
}

.health-card.pending .health-dot {
  background: #d49b2a;
}

.job-ledger-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

.job-card {
  border: 1px solid rgba(28, 35, 40, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.job-card.running {
  border-color: rgba(21, 111, 99, 0.28);
}

.job-card.failed {
  border-color: rgba(181, 70, 43, 0.3);
}

.job-card-head,
.job-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.job-card h4 {
  margin: 3px 0 0;
  font-size: 0.98rem;
  word-break: break-all;
}

.job-kicker,
.job-meta-row,
.job-safety-note,
.job-timeline em {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.job-meta-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 10px;
}

.job-meta-row span {
  border-radius: 999px;
  background: rgba(28, 35, 40, 0.055);
  padding: 5px 8px;
}

.job-ready {
  color: var(--accent);
  background: rgba(21, 111, 99, 0.08) !important;
}

.job-missing {
  color: #b5462b;
  background: rgba(181, 70, 43, 0.08) !important;
}

.risk-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(21, 111, 99, 0.08);
  color: var(--accent);
}

.risk-badge.medium {
  background: rgba(212, 155, 42, 0.12);
  color: #966713;
}

.risk-badge.high {
  background: rgba(181, 70, 43, 0.12);
  color: #b5462b;
}

.job-details,
.agent-trace-panel {
  margin-top: 12px;
  border: 1px solid rgba(28, 35, 40, 0.08);
  border-radius: 14px;
  background: rgba(250, 247, 240, 0.72);
  overflow: hidden;
}

.job-details summary,
.agent-trace-panel summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.88rem;
}

.job-timeline {
  margin: 0;
  padding: 0 12px 12px 32px;
  color: #334048;
  line-height: 1.6;
  font-size: 0.86rem;
}

.job-safety-note,
.agent-trace-body {
  border-top: 1px solid rgba(28, 35, 40, 0.07);
  padding: 10px 12px 12px;
}

.agent-tool-traces {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.agent-tool-traces span {
  border-radius: 999px;
  background: rgba(21, 111, 99, 0.08);
  color: var(--accent);
  padding: 5px 8px;
  font-size: 0.78rem;
}

.chat-panel {
  border-radius: 20px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: calc(100dvh - 36px);
  min-height: 0;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.chat-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.chat-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.header-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(21, 111, 99, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.message-list {
  padding: 24px;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  scroll-behavior: smooth;
}

.empty-state {
  margin: auto;
  max-width: 520px;
  text-align: center;
  padding: 36px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed rgba(21, 111, 99, 0.18);
}

.empty-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.empty-copy {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.message-card {
  max-width: min(820px, 88%);
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--assistant);
  box-shadow: 0 8px 20px rgba(14, 21, 27, 0.05);
  animation: message-in 170ms ease-out;
}

.message-card.user {
  align-self: flex-end;
  background: var(--user);
  color: var(--user-ink);
  border-color: transparent;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.message-card.user .message-meta {
  color: rgba(245, 250, 251, 0.72);
}

.copy-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.message-body {
  line-height: 1.7;
  word-break: break-word;
}

.message-body code {
  font-family: "IBM Plex Mono", "Cascadia Mono", monospace;
  font-size: 0.92em;
  background: rgba(21, 111, 99, 0.1);
  padding: 2px 6px;
  border-radius: 6px;
}

.message-body pre {
  overflow: auto;
  margin: 12px 0 0;
  padding: 14px;
  border-radius: 12px;
  background: #16252f;
  color: #eef6f7;
}

.message-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.reasoning-panel {
  margin-top: 12px;
  border: 1px solid rgba(21, 111, 99, 0.14);
  border-radius: 12px;
  background: rgba(21, 111, 99, 0.055);
  overflow: hidden;
}

.reasoning-summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  user-select: none;
}

.reasoning-body {
  padding: 0 12px 12px;
  color: #334048;
  line-height: 1.6;
  font-size: 0.92rem;
  word-break: break-word;
}

.reasoning-note {
  border-top: 1px solid rgba(21, 111, 99, 0.12);
  padding: 9px 12px 10px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.usage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.usage-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(28, 35, 40, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #4d5962;
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.failure-diagnostic-panel {
  margin-top: 12px;
  border: 1px solid rgba(179, 38, 30, 0.14);
  border-radius: 12px;
  background: rgba(179, 38, 30, 0.04);
  padding: 12px;
  display: grid;
  gap: 10px;
}

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

.failure-diagnostic-kicker {
  color: #a63f2f;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
}

.failure-diagnostic-head h4 {
  margin: 4px 0 0;
  font-size: 0.98rem;
}

.failure-diagnostic-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.failure-diagnostic-badges span,
.job-diagnostic {
  border-radius: 999px;
  font-size: 0.76rem;
}

.failure-diagnostic-badges span {
  border: 1px solid rgba(166, 63, 47, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: #8f3427;
  padding: 4px 8px;
}

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

.failure-diagnostic-grid strong,
.failure-diagnostic-summary strong {
  display: block;
  font-size: 0.8rem;
  color: #8f3427;
  margin-bottom: 4px;
}

.failure-diagnostic-grid p,
.failure-diagnostic-summary p {
  margin: 0;
  color: #4e403d;
  line-height: 1.55;
  font-size: 0.86rem;
}

.job-diagnostic {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(179, 38, 30, 0.14);
  background: rgba(179, 38, 30, 0.05);
  padding: 10px 12px;
  color: #7f3428;
}

.job-diagnostic strong {
  font-size: 0.82rem;
}

.job-diagnostic span {
  line-height: 1.5;
}

.attachment-only-copy {
  color: var(--muted);
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.attachment-list.pending {
  margin-top: 0;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(21, 111, 99, 0.14);
  background: rgba(255, 255, 255, 0.76);
}

.message-card.user .attachment-chip {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.12);
}

.attachment-thumb,
.attachment-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex: 0 0 42px;
}

.attachment-thumb {
  object-fit: cover;
}

.attachment-badge {
  display: grid;
  place-items: center;
  background: rgba(21, 111, 99, 0.12);
  color: var(--accent);
  font-weight: 700;
}

.message-card.user .attachment-badge {
  background: rgba(255, 255, 255, 0.14);
  color: var(--user-ink);
}

.attachment-meta {
  min-width: 0;
}

.attachment-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.message-card.user .attachment-note {
  color: rgba(245, 250, 251, 0.72);
}

.attachment-remove {
  border: 0;
  background: transparent;
  color: var(--accent-2);
  cursor: pointer;
  padding: 0 0 0 4px;
}

.composer-card {
  margin: 0 18px 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 18px 50px rgba(26, 23, 19, 0.12);
  flex: 0 0 auto;
}

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

.attach-button {
  flex: 0 0 auto;
}

.attach-button:disabled {
  opacity: 0.6;
}

.composer-attachments {
  margin-bottom: 8px;
}

.composer-card textarea {
  min-height: 44px;
  border: 1px solid transparent;
  background: transparent;
  resize: none;
  max-height: 220px;
  outline: none;
  padding: 10px 2px 12px;
}

.composer-card textarea:focus {
  border-color: rgba(15, 118, 110, 0.18);
  border-radius: var(--radius-md);
  padding-left: 10px;
  padding-right: 10px;
  background: #fbfbfa;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-hint {
  color: var(--muted);
  font-size: 0.84rem;
}

.send-button {
  border: 0;
  background: #0f766e;
  color: white;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.send-button:hover:not(:disabled) {
  background: #0b625b;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.18);
}

.send-button:disabled {
  opacity: 1;
  background: #d7ddd9;
  border-color: #d7ddd9;
  color: #7b8580;
  cursor: not-allowed;
}

.live-job-panel {
  display: grid;
  gap: 12px;
}

.live-job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.live-job-kicker {
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.live-job-head h4 {
  margin: 3px 0 4px;
  font-size: 1rem;
  color: #1f2a31;
}

.live-job-head p {
  margin: 0;
  color: #4d5962;
  line-height: 1.55;
}

.live-orb {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(21, 111, 99, 0.28);
  animation: live-orb-pulse 1.45s infinite ease-out;
}

.live-job-meter,
.live-job-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.live-job-meter span {
  position: relative;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(28, 35, 40, 0.06);
  color: var(--muted);
  font-size: 0.78rem;
}

.live-job-meter span.done {
  background: rgba(21, 111, 99, 0.1);
  color: var(--accent);
}

.live-job-meter span.current {
  background: var(--accent);
  color: white;
}

.live-job-facts span {
  padding: 5px 9px;
  border-radius: 10px;
  border: 1px solid rgba(28, 35, 40, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: #4d5962;
  font-size: 0.78rem;
}

.live-job-insight {
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(21, 111, 99, 0.06);
  color: #334048;
  line-height: 1.55;
  font-size: 0.88rem;
}

.live-job-insight.warn {
  background: rgba(183, 107, 22, 0.1);
  color: #7a4d16;
}

.live-job-details {
  border: 1px solid rgba(21, 111, 99, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  overflow: hidden;
}

.live-job-details summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

.live-job-details .job-timeline {
  padding: 0 14px 12px 32px;
}

.live-cancel-btn {
  justify-self: start;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.pending-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 24px;
}

.pending-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  animation: pulse 1.2s infinite ease-in-out;
}

.pending-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.pending-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@keyframes live-orb-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(21, 111, 99, 0.28);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(21, 111, 99, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(21, 111, 99, 0);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 920px) {
  .page-shell {
    grid-template-columns: 1fr;
    overflow: auto;
    height: 100dvh;
    overscroll-behavior: contain;
  }

  .chat-panel {
    height: min(78dvh, 860px);
    min-height: 620px;
  }

  .message-card {
    max-width: 100%;
  }

  .composer-tools,
  .composer-footer,
  .config-actions,
  .capability-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .config-grid,
  .permission-form-grid,
  .browser-mode-grid,
  .config-verification-grid,
  .skill-grid,
  .template-grid,
  .permission-grid,
  .health-grid,
  .project-grid,
  .route-family-grid,
  .project-import-toolbar {
    grid-template-columns: 1fr;
  }

  .market-search {
    min-width: 0;
  }

  .browser-mode-head {
    display: grid;
    align-items: start;
  }

  .browser-mode-head span {
    text-align: left;
  }

  .template-controls {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .permission-preset-grid {
    grid-template-columns: 1fr;
  }
}

/* Professional UI pass: tokenized, work-focused control console. */
:root {
  --bg: #f3f4f2;
  --surface: #ffffff;
  --surface-subtle: #f7f8f6;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --ink: #161a18;
  --text: #161a18;
  --muted: #66706a;
  --line: rgba(22, 26, 24, 0.1);
  --line-strong: rgba(22, 26, 24, 0.18);
  --accent: #0f766e;
  --accent-2: #9f4d2f;
  --assistant: #ffffff;
  --user: #173d3a;
  --user-ink: #f7fbfa;
  --shadow: 0 8px 22px rgba(22, 26, 24, 0.08);
  --shadow-soft: 0 4px 12px rgba(22, 26, 24, 0.06);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --control-height: 40px;
  font-family: "IBM Plex Sans", "Aptos", "Microsoft YaHei UI", sans-serif;
}

html,
body {
  background: var(--bg);
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.35);
  outline-offset: 2px;
}

.auth-card,
.admin-panel,
.brand-card,
.settings-card,
.chat-panel,
.composer-card,
.model-config-panel,
.capability-panel,
.skill-card,
.template-card,
.project-card,
.permission-card,
.health-card,
.capability-empty,
.job-card,
.empty-state {
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: none;
}

.sidebar,
.chat-panel,
.composer-card,
.settings-card,
.brand-card {
  backdrop-filter: none;
}

.auth-card {
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.auth-mode-switch,
.auth-field input,
.settings-card textarea,
.settings-card select,
.composer-card textarea,
.config-field input,
.config-field select,
.market-search input,
.project2-import-input {
  border-radius: var(--radius-md);
  background: var(--surface);
  border-color: var(--line-strong);
}

.page-shell {
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  background: var(--bg);
}

.sidebar {
  gap: 12px;
  padding: 14px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand-card {
  padding: 12px;
  box-shadow: none;
}

.brand-card h1 {
  font-size: 1.05rem;
}

.brand-card p {
  font-size: 0.82rem;
  line-height: 1.35;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  letter-spacing: 0;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#model-config-btn,
#capability-center-btn,
#local-permission-btn,
#admin-mode-btn {
  display: none;
}

.conversation-list {
  gap: 6px;
  min-height: 140px;
}

.conversation-item {
  border-radius: var(--radius-md);
  background: transparent;
  padding: 10px;
  transition: background 140ms ease, border-color 140ms ease;
}

.conversation-item:hover,
.conversation-item.active {
  transform: none;
  box-shadow: none;
  border-color: var(--line-strong);
  background: var(--surface-subtle);
}

.settings-card {
  padding: 12px;
  gap: 9px;
  max-height: min(48dvh, 520px);
  box-shadow: none;
}

.system-prompt-panel {
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border-color: var(--line);
}

.system-prompt-panel summary {
  color: var(--ink);
  font-weight: 700;
}

.chat-panel {
  height: 100dvh;
  border: 0;
  border-radius: 0;
  border-left: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  box-shadow: none;
  background: var(--surface);
}

.chat-header {
  padding: 14px 18px 12px;
  min-height: 64px;
  background: var(--surface);
}

.chat-title {
  font-size: 1.05rem;
  font-weight: 750;
}

.chat-subtitle {
  font-size: 0.84rem;
}

.header-pill {
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
}

.workflow-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfa;
}

.workflow-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  min-width: 0;
}

.workflow-action {
  min-width: 0;
  min-height: 54px;
  display: grid;
  gap: 3px;
  align-content: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 8px 10px;
  transition: background 140ms ease, border-color 140ms ease;
}

.workflow-action:hover:not(:disabled),
.workflow-action:focus-visible {
  border-color: rgba(15, 118, 110, 0.35);
  background: #f7fbfa;
}

.workflow-action.primary {
  border-color: rgba(15, 118, 110, 0.35);
}

.workflow-action.active,
.workflow-action.admin.active {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.35);
}

.workflow-action span {
  font-weight: 750;
  font-size: 0.9rem;
}

.workflow-action small {
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-update {
  min-width: 310px;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.workflow-update-status {
  min-height: 54px;
  display: grid;
  gap: 3px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 8px 10px;
}

.workflow-update-status span {
  color: var(--muted);
  font-size: 0.76rem;
}

.workflow-update-status strong {
  min-width: 0;
  color: var(--ink);
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-update .ghost-button,
.workflow-update .send-button {
  min-height: 40px;
  align-self: center;
  white-space: nowrap;
}

.message-list {
  padding: 18px;
  background: var(--surface-subtle);
}

.empty-state {
  max-width: 520px;
  padding: 28px;
  text-align: left;
  border-style: solid;
  background: var(--surface);
}

.empty-title {
  font-size: 1.16rem;
}

.message-card {
  border-radius: var(--radius-lg);
  box-shadow: none;
}

.message-card.user {
  background: var(--user);
}

.composer-card {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 18px 14px;
  box-shadow: none;
}

.composer-tools {
  margin-bottom: 8px;
}

.ghost-button,
.send-button,
.icon-button,
.skill-action,
.plaza-nav-btn,
.permission-preset-btn {
  border-radius: var(--radius-md);
  min-height: var(--control-height);
  box-shadow: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

.ghost-button,
.icon-button,
.skill-action,
.plaza-nav-btn,
.permission-preset-btn {
  background: var(--surface);
  border-color: var(--line-strong);
}

.ghost-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.skill-action:hover:not(:disabled),
.plaza-nav-btn:hover:not(:disabled),
.permission-preset-btn:hover:not(:disabled) {
  border-color: rgba(15, 118, 110, 0.32);
  background: var(--surface-subtle);
  box-shadow: none;
}

.send-button {
  background: var(--accent);
  border: 1px solid var(--accent);
}

.send-button:hover:not(:disabled) {
  background: #0c625c;
  box-shadow: none;
}

.ghost-button.subtle {
  opacity: 1;
  color: var(--muted);
}

.modal-backdrop {
  padding: 18px;
  background: rgba(22, 26, 24, 0.46);
  backdrop-filter: blur(4px);
}

.model-config-panel,
.capability-panel {
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.model-config-header {
  padding: 18px 20px 14px;
}

.model-config-form,
.local-permission-body,
.capability-content {
  padding: 18px 20px 20px;
}

.capability-tabs {
  padding: 10px 20px 0;
}

.capability-tab {
  font-weight: 650;
}

.capability-toolbar {
  align-items: center;
}

.capability-toolbar p {
  max-width: 680px;
}

.skill-grid,
.permission-grid,
.health-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

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

.permission-safety-note,
.permission-deny-list,
.mcp-note,
.project-status,
.locked-model-note,
.live-job-insight,
.live-job-details,
.job-details,
.agent-trace-panel {
  border-radius: var(--radius-md);
}

.permission-option,
.browser-mode-panel,
.browser-mode-option,
.permission-switches label,
.permission-path-chip,
.permission-path-empty,
.fallback-option,
.admin-update-summary > div,
.route-family-card,
.mcp-readiness-item,
.usage-pill,
.attachment-chip,
.live-job-meter span,
.live-job-facts span,
.job-meta-row span,
.risk-badge,
.template-industry,
.skill-tags span,
.skill-tags .tag-button,
.template-badge {
  border-radius: var(--radius-sm);
}

.permission-switches label,
.job-meta-row span,
.risk-badge,
.template-industry {
  border-radius: var(--radius-sm);
}

.mcp-card,
.project-card.enabled,
.template-card.new-post {
  background: var(--surface);
}

.health-dot,
.live-orb,
.pending-dots span {
  border-radius: 50%;
}

@media (max-width: 1180px) {
  .workflow-bar {
    grid-template-columns: 1fr;
  }

  .workflow-update {
    min-width: 0;
  }
}

@media (max-width: 920px) {
  .page-shell {
    grid-template-columns: 1fr;
    height: 100dvh;
    overflow: hidden;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 0;
  }

  .sidebar {
    max-height: 32dvh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .conversation-list {
    min-height: 0;
    max-height: 96px;
  }

  .settings-card {
    display: none;
  }

  .chat-panel {
    height: auto;
    min-height: 0;
  }

  .chat-header,
  .workflow-bar,
  .message-list,
  .composer-card {
    padding-left: 12px;
    padding-right: 12px;
  }

  .workflow-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding-bottom: 0;
  }

  .workflow-action {
    min-height: 56px;
  }

  .workflow-update {
    grid-template-columns: 1fr;
  }

  .workflow-update .ghost-button,
  .workflow-update .send-button {
    width: 100%;
  }

  .message-list {
    padding-top: 12px;
  }

  .composer-tools,
  .composer-footer,
  .config-actions,
  .capability-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
