/* Widget Perkins — ver DESIGN.md, secao Components */
.perkins-fab, .perkins-window, .perkins-window * {
    box-sizing: border-box;
    font-family: 'Alegreya Sans', -apple-system, sans-serif;
  }

  .perkins-fab {
    position: fixed; bottom: 24px; right: 24px;
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--sage); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: var(--z-modal-backdrop);
    box-shadow: var(--sh-overlay);
    transition: background var(--t-micro) var(--ease);
  }
  .perkins-fab:hover { background: var(--sage-deep); }
  .perkins-fab:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 4px; }
  .perkins-fab svg {
    width: 24px; height: 24px;
    stroke: var(--surface-base); fill: none; stroke-width: 1.5;
    stroke-linecap: round; stroke-linejoin: round;
  }

  .perkins-window {
    position: fixed; bottom: 24px; right: 24px;
    width: 400px; max-width: calc(100vw - 32px);
    height: 600px; max-height: calc(100vh - 48px);
    background: var(--surface-base);
    border: none; border-radius: var(--r-lg);
    z-index: var(--z-modal);
    display: none; flex-direction: column; overflow: hidden;
    box-shadow: var(--sh-overlay);
    color: var(--ink);
  }
  .perkins-window.open { display: flex; animation: perkins-slide-up var(--t-comp) var(--ease); }
  @keyframes perkins-slide-up {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }

  @media (max-width: 640px) {
    .perkins-window {
      bottom: 0; right: 0;
      width: 100vw; max-width: 100vw;
      height: 100dvh; max-height: 100dvh;
      border-radius: 0;
    }
    .perkins-fab { bottom: 16px; right: 16px; }
  }

  .perkins-header {
    padding: 16px 20px;
    display: flex; align-items: center; gap: 12px;
    background: var(--surface-raised);
  }
  .perkins-header-avatar {
    width: 36px; height: 36px; flex-shrink: 0;
    border-radius: 50%; background: var(--sage); position: relative;
  }
  .perkins-header-avatar::after {
    content: ''; position: absolute; inset: 10px 7px 10px 12px;
    background: var(--surface-raised); border-radius: 50%;
  }
  .perkins-header-info { flex: 1; min-width: 0; }
  .perkins-header-name {
    font-family: 'Alegreya', Georgia, serif;
    font-size: 18px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2;
  }
  .perkins-header-status {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px; color: var(--ink-muted);
    letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px;
  }
  .perkins-close {
    background: none; border: none; cursor: pointer;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    color: var(--ink-muted);
    border-radius: var(--r-pill);
    transition: color var(--t-micro) var(--ease), background var(--t-micro) var(--ease);
  }
  .perkins-close:hover { color: var(--ink); background: var(--surface-sunken); }
  .perkins-close:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 2px; }
  .perkins-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

  .perkins-messages { flex: 1; overflow-y: auto; padding: 20px; }
  .perkins-messages::-webkit-scrollbar { width: 6px; }
  .perkins-messages::-webkit-scrollbar-track { background: transparent; }
  .perkins-messages::-webkit-scrollbar-thumb { background: var(--surface-sunken); border-radius: var(--r-pill); }

  .perkins-msg { margin-bottom: 14px; animation: perkins-fade-in 200ms var(--ease); }
  @keyframes perkins-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
  }
  .perkins-msg-bubble {
    display: inline-block; max-width: 85%;
    padding: 12px 16px; border-radius: var(--r-md);
    font-size: 15px; line-height: 1.55;
    word-wrap: break-word; white-space: pre-wrap;
  }
  .perkins-msg.user { text-align: right; }
  .perkins-msg.user .perkins-msg-bubble {
    background: var(--sage); color: var(--surface-base);
    border-bottom-right-radius: 4px; text-align: left;
  }
  .perkins-msg.assistant .perkins-msg-bubble {
    background: var(--surface-raised); color: var(--ink);
    border-bottom-left-radius: 4px;
  }
  .perkins-msg-cta {
    display: inline-flex; align-items: center; min-height: 44px;
    margin-top: 10px; padding: 10px 20px;
    background: var(--sage); color: var(--surface-base);
    text-decoration: none; border-radius: var(--r-pill);
    font-size: 14px; font-weight: 500;
    transition: background var(--t-micro) var(--ease);
  }
  .perkins-msg-cta:hover { background: var(--sage-deep); }
  .perkins-msg-cta:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 3px; }

  .perkins-typing {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 14px 16px; background: var(--surface-raised);
    border-radius: var(--r-md); border-bottom-left-radius: 4px;
  }
  .perkins-typing span {
    width: 6px; height: 6px; background: var(--ink-muted); border-radius: 50%;
    animation: perkins-dot 1.4s infinite ease-in-out;
  }
  .perkins-typing span:nth-child(2) { animation-delay: 0.16s; }
  .perkins-typing span:nth-child(3) { animation-delay: 0.32s; }
  @keyframes perkins-dot {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
  }

  .perkins-form {
    padding: 16px 20px; display: flex; gap: 8px; align-items: flex-end;
    background: var(--surface-raised);
  }
  .perkins-textarea {
    flex: 1; background: var(--surface-base); border: none;
    border-radius: var(--r-sm); padding: 11px 14px;
    color: var(--ink);
    font-family: 'Alegreya Sans', sans-serif; font-size: 15px; line-height: 1.5;
    resize: none; min-height: 44px; max-height: 120px; outline: none;
  }
  .perkins-textarea:focus { outline: 2px solid var(--sage); outline-offset: 2px; }
  .perkins-textarea::placeholder { color: var(--ink-muted); }
  .perkins-textarea:disabled { opacity: 0.6; }

  .perkins-send {
    width: 44px; height: 44px; background: var(--sage); border: none;
    border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: background var(--t-micro) var(--ease), opacity var(--t-micro) var(--ease);
  }
  .perkins-send:hover:not(:disabled) { background: var(--sage-deep); }
  .perkins-send:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 3px; }
  .perkins-send:disabled { opacity: 0.45; cursor: not-allowed; }
  .perkins-send svg {
    width: 16px; height: 16px; stroke: var(--surface-base); fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  }

  .perkins-footer { padding: 8px 20px 14px; text-align: center; background: var(--surface-raised); }
  .perkins-footer-text {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px; color: var(--ink-muted); letter-spacing: 0.05em;
  }

  @media (prefers-reduced-motion: reduce) {
    .perkins-window.open { animation: none; }
    .perkins-msg { animation: none; }
    .perkins-typing span { animation: none; opacity: 0.7; }
  }
