/* Agents share the workspace header, typography, and color tokens. */

.page { max-width: 1400px; margin: 0 auto; padding: 44px 48px 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 40px; }
.page-heading h1 { margin: 0 0 10px; font-size: 38px; font-weight: 650; line-height: 1.15; letter-spacing: -1.3px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.skill-link { display: inline-flex; align-items: center; flex-shrink: 0; min-height: 40px; color: var(--accent); font-size: 13px; font-weight: 600; }
.skill-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.columns { display: grid; grid-template-columns: minmax(340px, .8fr) minmax(0, 1.25fr); align-items: start; gap: 32px; }
.agents-section, .skill-section { min-width: 0; }
.skill-only { max-width: 1040px; }
.skill-only .columns { grid-template-columns: minmax(0, 1fr); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; margin-bottom: 18px; }
.section-heading h2 { margin: 0 0 5px; font-size: 18px; line-height: 1.3; font-weight: 650; letter-spacing: -.35px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px; margin-left: 5px; border-radius: 6px; background: #e7ecf4; color: var(--muted); font-size: 12px; font-weight: 600; vertical-align: 1px; }
.button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; line-height: 1.4; font-weight: 600; text-align: center; text-decoration: none; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover:not(:disabled) { background: #1846ba; }
.button.secondary { border-color: #c7d2e4; background: var(--surface); color: var(--ink); }
.button.secondary:hover:not(:disabled) { border-color: #9db0cd; background: #f6f8fc; }
.button.small { min-height: 40px; padding: 9px 13px; }

.agent-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.agent-list:empty { display: none; }
.agent-card { padding: 20px; border-bottom: 1px solid var(--line); }
.agent-card:last-child { border-bottom: 0; }
.agent-top { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; background: #e8eefb; color: #385591; font-size: 12px; font-weight: 650; }
.avatar.tone-1 { background: #e9edf4; color: #4c617d; }
.avatar.tone-2 { background: #eee9f8; color: #6c568d; }
.avatar.tone-3 { background: #f6e9e5; color: #895b4f; }
.avatar.tone-4 { background: #e4f0ef; color: #356d69; }
.agent-identity { min-width: 0; }
.agent-identity h3 { margin: 0; font-size: 14px; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.agent-identity p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.connection-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; white-space: nowrap; }
.connection-state::before { content: ''; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: #8a96aa; }
.connection-state.connected { color: #23694e; }
.connection-state.connected::before { background: #358464; }
.agent-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 0 48px; }
.agent-skill { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.agent-skill strong { color: var(--ink); font-weight: 550; }
.agent-bottom .text-button { flex-shrink: 0; min-height: 40px; padding: 8px 0; font-size: 12px; white-space: nowrap; }
.empty-agents { padding: 32px 26px; border: 1px dashed #bdc9dd; border-radius: 12px; background: var(--surface); }
.empty-agents h3 { margin: 0 0 9px; font-size: 17px; font-weight: 600; letter-spacing: -.3px; }
.empty-agents p { max-width: 34ch; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.new-agent-form { padding: 20px; margin-bottom: 16px; border: 1px solid #cbd8f5; border-radius: 12px; background: var(--wash); }
.new-agent-form label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 600; }
.inline-form { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.inline-form input { width: 100%; min-width: 0; min-height: 42px; padding: 10px 12px; border: 1px solid #b8c6df; border-radius: 8px; background: var(--surface); font-size: 14px; }
.inline-form input::placeholder { color: var(--muted); }
.new-agent-form > .text-button { min-height: 40px; font-size: 12px; }

.skill-card { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.version-pill { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 10px; border: 1px solid #cbd8f5; border-radius: 6px; background: var(--wash); color: #244faf; font-size: 12px; font-weight: 600; white-space: nowrap; }
.version-pill:empty { display: none; }
.skill-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-height: 18px; margin-bottom: 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.skill-meta #draft-state { color: #835b1c; }
.skill-editor { display: block; width: 100%; min-height: 440px; padding: 20px; resize: vertical; border: 1px solid #c5d0e2; border-radius: 8px; background: #fcfdff; color: #263650; font-size: 14px; line-height: 1.8; tab-size: 2; }
.skill-editor:focus { border-color: var(--accent); }
.skill-editor[readonly] { background: #f7f9fc; }
.editor-meta { display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.editor-meta #editor-size { flex-shrink: 0; white-space: nowrap; }
.skill-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.skill-actions .button { min-height: 44px; }
.save-result { margin: 18px 0 0; color: #23694e; font-size: 13px; line-height: 1.7; }
.delivery-note { margin-top: 18px; padding: 0 2px; color: var(--muted); }
.delivery-note p { max-width: 76ch; margin: 0; font-size: 12px; line-height: 1.7; }
.ack-summary { margin: 10px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border: 1px solid #e5d4b1; border-radius: 8px; background: #fff8e9; color: #78531e; font-size: 13px; line-height: 1.6; }
.banner .text-button { flex-shrink: 0; min-height: 40px; color: #78531e; font-size: 12px; }
.error-banner { margin-bottom: 24px; }
.conflict-banner { align-items: flex-start; margin-bottom: 16px; }
.error-text { margin: 12px 0 0; color: #a33f3f; font-size: 12px; line-height: 1.7; }
.invitation { padding: 20px; margin-top: 20px; border: 1px solid #c6d5f6; border-radius: 12px; background: var(--wash); }
.invitation-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.invitation-label { color: #3154a0; font-size: 12px; font-weight: 600; }
.invitation-heading .text-button { min-height: 40px; font-size: 12px; }
.invitation h3 { margin: 12px 0 9px; font-size: 19px; font-weight: 650; line-height: 1.4; letter-spacing: -.35px; overflow-wrap: anywhere; }
.invitation > p { margin: 9px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.invitation textarea { display: block; width: 100%; height: 210px; padding: 14px; resize: vertical; overflow-wrap: anywhere; border: 1px solid #bacbef; border-radius: 8px; background: var(--surface); color: #32476d; font-size: 12px; line-height: 1.8; }
.invitation .fine { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.invitation .error-text { color: #a33f3f; }
.invitation-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.invitation-actions .button { white-space: normal; text-align: left; }

.center-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100dvh - 72px); padding: 48px 24px; text-align: center; }
.center-state h1 { max-width: 18ch; margin: 0 0 14px; font-size: 38px; font-weight: 650; letter-spacing: -1.3px; line-height: 1.15; }
.center-state p { max-width: 40ch; margin: 0 0 26px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.center-state > .text-button { margin-top: 12px; min-height: 40px; }
.loading-dot { width: 9px; height: 9px; margin-bottom: 20px; border-radius: 50%; background: var(--accent); animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .loading-dot { animation: none; } }
@media (max-width: 1120px) {
  .page { padding: 36px 28px 56px; }
  .columns { grid-template-columns: minmax(310px, .8fr) minmax(0, 1.2fr); gap: 24px; }
  .agent-card { padding: 18px 16px; }
  .agent-top { grid-template-columns: 36px minmax(0, 1fr); row-gap: 7px; }
  .connection-state { grid-column: 2; }
  .agent-bottom { align-items: flex-start; flex-direction: column; gap: 3px; margin-top: 10px; }
  .skill-card { padding: 20px; }
  .skill-actions .button { flex: 1 1 auto; }
}
@media (max-width: 880px) {
  .page { padding: 32px 24px 48px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 28px; }
  .columns { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .agent-top { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .connection-state { grid-column: auto; }
  .agent-bottom { flex-direction: row; align-items: center; }
  .agent-card { padding: 18px 20px; }
  .skill-editor { min-height: 440px; }
}
@media (max-width: 520px) {
  .page { padding: 28px 18px 40px; }
  .page-heading h1 { font-size: 32px; letter-spacing: -1px; }
  .page-heading p { font-size: 14px; }
  .section-heading { gap: 12px; }
  .section-heading h2 { font-size: 17px; }
  .section-heading p { font-size: 12px; }
  .agent-card { padding: 18px 16px; }
  .agent-top { grid-template-columns: 36px minmax(0, 1fr); }
  .connection-state { grid-column: 2; }
  .agent-bottom { align-items: flex-start; flex-direction: column; gap: 3px; }
  .skill-card { padding: 16px; }
  .skill-editor { padding: 15px; }
  .editor-meta { flex-wrap: wrap; gap: 4px 12px; }
  .skill-actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .skill-actions .button { width: 100%; }
  .banner { align-items: flex-start; flex-direction: column; gap: 0; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form .button { align-self: flex-start; }
  .invitation { padding: 18px 16px; }
  .center-state h1 { font-size: 32px; }
}

@media (max-width: 640px) { .center-state { min-height: calc(100dvh - 66px); } }
