@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;600;700;800&display=swap');

@layer tokens, base, layout, components, pages, utilities;

@layer tokens {
  :root {
    --paper: #fafaf5;
    --surface: #ffffff;
    --surface-sunken: #f3f5ec;
    --surface-tint: #f7faef;
    --ink: #292b28;
    --ink-muted: #5f685b;
    --ink-subtle: #6d7468;
    --line: #e2e6da;
    --line-strong: #c9d3bd;
    --primary: #2e382b;
    --primary-hover: #46543e;
    --accent: #405b2a;
    --accent-soft: #e8f0d8;
    --accent-softer: #f2f6e9;
    --highlight: #d9ec93;
    --success: #3f7246;
    --success-soft: #e8f1e9;
    --warning: #8a5a12;
    --warning-soft: #fbf0d9;
    --danger: #984d3d;
    --danger-soft: #fff1ed;
    --info: #3d5968;
    --info-soft: #e1e9ed;
    --text-display: clamp(44px, 5.5vw, 76px);
    --text-h1: 30px;
    --text-h2: 22px;
    --text-h3: 18px;
    --text-body: 16px;
    --text-small: 14px;
    --text-caption: 12px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 999px;
    --shadow-float: 0 8px 24px #26342b14;
    --shadow-dialog: 0 22px 70px #20271a3d;
  }
}

@layer base {
  [dir="auto"] { text-align: match-parent; }
  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Heebo', Arial, sans-serif;
    font-size: var(--text-body);
    line-height: 1.7;
  }

  h1 {
    font-size: var(--text-h1);
    line-height: 1.3;
    font-weight: 700;
    margin: 0;
  }

  h2 {
    font-size: var(--text-h2);
    line-height: 1.35;
    font-weight: 700;
    margin: 0;
  }

  h3 {
    font-size: var(--text-h3);
    line-height: 1.4;
    font-weight: 600;
    margin: 0;
  }

  input[type=checkbox] {
    accent-color: var(--accent);
  }

  input[type=radio] {
    accent-color: var(--accent);
  }

  :is(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }

  input:not([type=checkbox], [type=radio], [type=submit]) {
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 12px;
    font-size: var(--text-body);
  }

  select {
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 12px;
    font-size: var(--text-body);
    font: inherit;
  }

  textarea {
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 12px;
    font-size: var(--text-body);
    font: inherit;
  }

  input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }

  textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }

  select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }

  ::placeholder {
    color: var(--ink-subtle);
    opacity: 1;
  }

  label {
    font-size: var(--text-small);
    font-weight: 500;
  }

  label > :is(input, select, textarea) {
    margin-top: 8px;
  }

  pre {
    max-width: 100%;
    overflow: auto;
  }

  button {
    font: inherit;
  }

  input {
    font: inherit;
  }
}

@layer layout {

  .agent-directory {
    max-width: 1000px;
    margin-inline: auto;
    padding-inline: 32px;
  }

  .profile-page {
    max-width: 1000px;
    margin-inline: auto;
    padding-inline: 32px;
  }

  .blueprint-picker {
    max-width: 1040px;
    margin-inline: auto;
    padding-inline: 32px;
  }

  .workspace {
    --topbar-height: 60px;
    display: grid;
    grid-template-areas: "topbar" "main";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: var(--workspace-height, 100dvh);
    min-height: 0;
    overflow: hidden;
    background: var(--paper);
    font-size: var(--text-body);
  }

  .workspace > turbo-cable-stream-source {
    display: none;
  }

  .app-topbar {
    position: relative;
    grid-area: topbar;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-height);
    padding: 8px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    z-index: 5;
  }

  .app-topbar > .brand {
    font-size: var(--text-h2);
    padding-inline: 4px 8px;
  }

  .app-topbar > .brand .bottle-mark {
    width: 17px;
    height: 22px;
    margin-top: 4px;
    border-width: 2px;
    border-radius: 5px 5px 7px 7px;
  }

  .app-topbar > .brand .bottle-mark::before {
    top: -6px;
    left: 2px;
    width: 9px;
    height: 4px;
    border-width: 2px;
    background: var(--surface);
  }

  .app-topbar > .brand .bottle-mark::after {
    left: 3px;
    right: 3px;
    bottom: 4px;
    height: 6px;
  }

  .topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }

  .topbar-nav a {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--ink-muted);
    font-size: var(--text-small);
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 150ms ease, color 150ms ease;
  }

  .topbar-nav a:hover {
    background: var(--accent-softer);
    color: var(--ink);
  }

  .topbar-nav a.selected {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
  }

  .topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-inline-start: auto;
  }

  .workspace-tabs-row {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    padding-inline-start: 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .workspace-body {
    display: flex;
    flex: 1;
    min-height: 0;
  }

  .workspace-paused > :is(.workspace-header, .mobile-chat-toolbar, .workspace-tabs-row),
  .workspace-paused > .workspace-body > :is(.sidebar, .workspace-content) {
    filter: grayscale(1);
  }

  .workspace-paused > .workspace-body {
    background: var(--surface-sunken);
    color: var(--ink-muted);
  }

  .workspace-pause-notice {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-sunken);
    border-bottom: 1px solid var(--line);
    font-size: var(--text-small);
  }

  .workspace-pause-notice p {
    margin: 4px 0 0;
    color: var(--ink-muted);
  }

  .workspace-pause-notice form {
    flex: 0 0 auto;
  }

  .workspace-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: relative;
    flex: 0 0 320px;
    width: 320px;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 16px;
    border-inline-end: 1px solid var(--line);
    background: var(--surface-sunken);
  }

  .workspace-main {
    grid-area: main;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    margin: 0;
  }

  .workspace-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    padding: 20px 32px;
    min-height: 92px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }

  .workspace-header > div:nth-of-type(2) {
    min-width: 0;
    flex: 1;
  }

  .workspace-header .muted {
    display: block;
    max-width: 480px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--text-small);
  }

  .workspace-agent-name {
    font-size: var(--text-h3);
    line-height: 1.4;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
  }

  .workspace-agent-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-inline-start: auto;
  }

  .sidebar-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--ink);
    border-radius: var(--radius-md);
  }

  .sidebar-toggle:hover {
    background: var(--accent-softer);
  }

  .sidebar-backdrop {
    display: none;
  }

  @media (min-width: 901px) {
    .sidebar {
      transition: margin-inline-start 200ms ease, visibility 0s;
    }

    /* The sidebar slides out past the start edge, then leaves the tab order. */
    .workspace.sidebar-collapsed .sidebar {
      margin-inline-start: -320px;
      visibility: hidden;
      transition: margin-inline-start 200ms ease, visibility 0s 200ms;
    }
  }

  @media (min-width: 901px) and (prefers-reduced-motion: reduce) {
    .sidebar,
    .workspace.sidebar-collapsed .sidebar {
      transition: none;
    }
  }

  .settings-scroll {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .settings-page {
    width: 100%;
    max-width: 1040px;
    margin-inline: auto;
    padding: 32px;
  }

  .bookmark-reader {
    width: 100%;
    max-width: 1040px;
    margin-inline: auto;
    padding: 32px;
  }

  .settings-page > h1 {
    font-size: var(--text-h1);
    margin-block: 8px;
  }

  .bookmark-reader h1 {
    font-size: var(--text-h1);
    margin-block: 8px;
  }

  .settings-page > .section-sub {
    margin-block: 8px 32px;
    font-size: var(--text-body);
    color: var(--ink-muted);
    max-width: 640px;
  }

  .mobile-chat-toolbar {
    display: none;
  }

  .workspace-main-chat {
    --chat-gutter: 32px;
    --chat-column-width: 760px;
    --chat-content-width: min(var(--chat-column-width), calc(100% - var(--chat-gutter) * 2));
    background: var(--paper);
    overflow: hidden;
  }

  .workspace-main-chat .chat-layout {
    display: flex;
    flex: 1;
    height: auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
  }

  .workspace-main-chat .chat-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    max-width: none;
    width: 100%;
    overflow: hidden;
    padding: 0 0 16px;
    background: var(--paper);
  }

  .workspace-main-chat .messages {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    padding: 24px 0 12px;
  }

  .workspace-main-chat .messages > * {
    flex-shrink: 0;
  }

  .workspace-main-chat .messages > :first-child {
    margin-top: auto;
  }

  .workspace-main-chat .message {
    position: relative;
    align-items: flex-start;
    gap: 0;
    width: var(--chat-content-width);
    max-width: var(--chat-column-width);
    margin-inline: auto;
    margin-bottom: 28px;
    display: flex;
  }

  .workspace-main-chat .composer {
    width: var(--chat-content-width);
    margin-inline: auto;
    flex: 0 0 auto;
    padding-top: 8px;
    background: var(--paper);
  }

  .workspace-main-chat .conversation-footer {
    width: var(--chat-content-width);
    margin-inline: auto;
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
  }

  .workspace-main-chat .demo-note {
    width: var(--chat-content-width);
    margin-inline: auto;
    flex: 0 0 auto;
  }

  .workspace-main-chat .conversation-footer .composer-note {
    margin: 0;
  }

  .bookmarks-panel {
    position: fixed;
    inset-block: calc(var(--workspace-top, 0px) + var(--topbar-height, 0px)) 0;
    /* Clear the dialog UA's inset-inline-start, or RTL pins the panel to the right. */
    inset-inline: auto 0;
    width: 300px;
    height: auto;
    max-height: none;
    max-width: none;
    margin: 0;
    padding: 20px 16px;
    border: 0;
    border-inline-start: 1px solid var(--line);
    background: var(--surface-sunken);
    overflow: hidden;
    z-index: 4;
    box-shadow: var(--shadow-float);
  }

  .bookmarks-panel[open] {
    display: flex;
    flex-direction: column;
  }

  .workspace.files-open .workspace-main,
  .workspace.prompts-open .workspace-main {
    padding-inline-end: 300px;
  }

  @media (max-width: 1200px) {
    .workspace-header {
      flex-wrap: wrap;
      padding: 16px 24px;
    }

    .workspace-agent-actions {
      flex-wrap: wrap;
    }
  }

  @media (max-width: 900px) {
    .sidebar {
      display: none;
      position: fixed;
      inset-block: var(--workspace-top, 0px) 0;
      inset-inline-start: 0;
      width: min(320px, 88vw);
      height: var(--workspace-height, 100dvh);
      z-index: 8;
      box-shadow: var(--shadow-dialog);
    }

    .workspace.sidebar-open .sidebar {
      display: flex;
    }

    .workspace {
      --topbar-height: 56px;
    }

    .app-topbar {
      gap: 4px;
      padding: 6px 8px;
    }

    .app-topbar > .brand {
      font-size: var(--text-h3);
    }

    .workspace.sidebar-open .sidebar-backdrop {
      display: block;
      position: fixed;
      inset: 0;
      z-index: 7;
      background: #1d241a66;
    }

    .sidebar-toggle {
      display: inline-flex;
    }

    .workspace-header {
      padding: 12px 16px;
      min-height: 72px;
    }

    .workspace-header > .agent-icon {
      display: grid;
    }

    .workspace-header > div:nth-of-type(2) {
      display: block;
    }

    .workspace-agent-actions {
      width: 100%;
      justify-content: flex-end;
    }

    .workspace-main-chat > .workspace-header {
      display: none;
    }

    .mobile-chat-toolbar {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      min-height: 60px;
      flex: 0 0 auto;
      background: var(--surface);
      border-bottom: 1px solid var(--line);
    }

    .mobile-agent-identity {
      display: flex;
      align-items: center;
      gap: 8px;
      flex: 1;
      min-width: 0;
    }

    .mobile-agent-identity strong {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: var(--text-body);
    }

    .mobile-agent-identity .agent-icon {
      width: 32px;
      height: 32px;
    }

    .workspace:has(.workspace-main-chat) {
      position: fixed;
      top: var(--workspace-top, 0px);
      inset-inline: 0;
    }

    .workspace.files-open .workspace-main,
    .workspace.prompts-open .workspace-main {
      padding-inline-end: 0;
    }
  }

  @media (max-width: 600px) {
    .topbar-nav a {
      padding-inline: 8px;
    }


    .agent-directory {
      padding-inline: 16px;
    }

    .profile-page {
      padding-inline: 16px;
    }

    .blueprint-picker {
      padding-inline: 16px;
    }

    .settings-page {
      padding-inline: 16px;
      padding-block: 24px;
    }

    .bookmark-reader {
      padding-inline: 16px;
    }

    .workspace-main-chat {
      --chat-gutter: 16px;
    }

    .workspace-main-chat .chat-panel {
      padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .workspace-main-chat .conversation-footer {
      flex-wrap: wrap;
    }

    .bookmarks-panel {
      inset-block: auto 0;
      inset-inline: 0;
      width: 100%;
      height: min(72dvh, 600px);
      border: 0;
      border-radius: var(--radius-xl) var(--radius-xl) 0 0;
      padding: 12px 16px;
    }

    .bookmarks-toggle-mobile .bookmarks-toggle-label {
      display: none;
    }
  }
}

@layer components {
  * {
    box-sizing: border-box;
  }

  html {
    scroll-behavior: smooth;
    scroll-padding-top: 25px;
  }

  button {
    font: inherit;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    color: inherit;
  }

  input {
    font: inherit;
  }

  a {
    -webkit-tap-highlight-color: transparent;
    color: inherit;
    text-decoration: none;
  }

  input[type=submit] {
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }

  p {
    margin: 0;
  }

  button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }

  a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }

  [hidden] {
    display: none!important;
  }

  .wrap {
    max-width: 1160px;
    margin: auto;
    padding-inline: 30px;
  }

  .site-header {
    height: 104px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
  }

  .bottle-mark {
    display: inline-block;
    width: 22px;
    height: 29px;
    border: 2.6px solid currentColor;
    border-radius: 6px 6px 9px 9px;
    position: relative;
    transform: rotate(10deg);
    margin-top: 6px;
  }

  .bottle-mark:before {
    content: '';
    position: absolute;
    top: -8px;
    width: 10px;
    height: 6px;
    border: 2.5px solid currentColor;
    border-radius: 3px;
    left: 3px;
    background: var(--paper);
  }

  .bottle-mark:after {
    content: '';
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 5px;
    height: 7px;
    background: currentColor;
    border-radius: 1px 1px 4px 4px;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: var(--text-small);
  }

  .builder {
    max-width: 665px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 17px;
    box-shadow: var(--shadow-float);
    overflow: hidden;
    position: relative;
    z-index: 1;
    scroll-margin-top: 28px;
  }

  .agent-icon .bottle-mark {
    transform: rotate(0deg) scale(.72);
    margin-top: 3px;
  }

  .status-pill i {
    width: 6px;
    height: 6px;
    background: var(--ink-subtle);
    display: inline-block;
    border-radius: 50%;
  }

  .question {
    font-size: var(--text-body);
    font-weight: 500;
    line-height: 1.7;
  }

  .choice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: .2s;
    position: relative;
  }

  .choice:hover {
    border-color: var(--line-strong);
    background: var(--surface-tint);
  }

  .choice:has(input:checked) {
    border-color: var(--line-strong);
    background: var(--surface-tint);
  }

  .choice input {
    position: absolute;
    opacity: 0;
    width: 1px;
  }

  .choice:focus-within {
    outline: 2px solid var(--ink-subtle);
  }

  .choice strong {
    font-size: var(--text-small);
    display: block;
    font-weight: 500;
  }

  .choice small {
    font-size: var(--text-caption);
    color: var(--ink-muted);
    display: block;
    margin-top: 3px;
  }

  .send-circle {
    width: 42px;
    height: 42px;
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    font-size: var(--text-h1);
    color: var(--surface);
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }

  .send-circle:hover {
    background: var(--primary);
  }

  .section-sub {
    font-size: var(--text-small);
    color: var(--ink-muted);
    margin-top: 10px;
    line-height: 1.8;
  }

  footer.wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 25px;
    padding-bottom: 30px;
    border-top: 1px solid var(--line);
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  footer .brand {
    font-size: var(--text-h1);
    color: var(--accent);
  }

  footer .bottle-mark {
    transform: scale(.72) rotate(10deg);
  }

  .auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    flex-direction: column;
    padding: 55px 20px;
    background: var(--paper);
  }

  .auth-card {
    margin-top: 35px;
    width: 100%;
    max-width: 430px;
    padding: 35px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: none;
  }

  .auth-card h1 {
    font-size: var(--text-h1);
    margin-bottom: 8px;
    letter-spacing: -.7px;
  }

  .auth-card form {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  input:not([type=submit],[type=checkbox],[type=radio]) {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    padding: 11px 12px;
    color: var(--ink);
    outline: none;
  }

  label > input {
    display: block;
    margin-top: 7px;
  }

  label > textarea {
    display: block;
    margin-top: 7px;
  }

  label > select {
    display: block;
    margin-top: 7px;
  }

  .check-row {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .check-row input {
    margin: 0;
    accent-color: var(--ink-subtle);
  }

  .user-avatar {
    width: 36px;
    height: 36px;
    background: var(--line);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--ink);
    flex-shrink: 0;
    font-size: var(--text-small);
    font-weight: 700;
  }

  .demo-note {
    background: var(--surface-tint);
    border: 1px solid var(--accent-soft);
    color: var(--danger);
    padding: 8px 12px;
    border-radius: 7px;
    font-size: var(--text-small);
    text-align: center;
    margin: 16px 0 0;
  }

  .message-body {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
  }

  .message-meta strong {
    font-weight: 600;
  }

  .message-processing-details {
    color: var(--ink-muted);
    font-size: var(--text-caption);
    font-variant-numeric: tabular-nums;
    margin-block: -4px 12px;
  }

  .workspace-main-chat .message-processing-details {
    padding-inline-start: 48px;
  }

  .message-content p + p {
    margin-top: 12px;
  }

  .suggestions button:hover {
    background: var(--accent-softer);
  }

  .info-note {
    font-size: var(--text-small);
    padding: 15px;
    background: var(--accent-softer);
    border-radius: 8px;
    color: var(--ink-muted);
    line-height: 1.8;
  }

  .settings-form h3 {
    font-size: var(--text-h3);
    font-weight: 500;
    margin-bottom: 5px;
  }

  .record-list article > div {
    flex: 1;
    min-width: 0;
  }

  .record-list a {
    font-size: var(--text-small);
    color: var(--accent);
    display: inline-block;
    margin: 8px 0 15px;
  }

  .public-chat {
    max-width: 760px;
    margin: auto;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 20px;
  }

  .public-chat.public-chat-framed {
    max-width: none;
  }

  .public-chat > header {
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--line);
    padding: 12px 0 20px;
  }

  .public-chat h1 {
    font-size: var(--text-h2);
  }

  .input-record {
    flex-wrap: wrap;
  }

  .record-list .input-details {
    flex: 1;
    min-width: 240px;
  }

  .record-list .input-status {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
  }

  .input-value-form {
    width: 100%;
    display: flex;
    align-items: end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }

  .input-value-form label {
    flex: 1;
  }

  .input-value-form label > input {
    margin-top: 7px;
  }

  .channel-connection {
    background: var(--paper);
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
    font-size: var(--text-small);
  }

  .channel-connection summary {
    cursor: pointer;
    color: var(--accent);
    font-size: var(--text-small);
  }

  .channel-connection code {
    font-size: var(--text-small);
    color: var(--accent);
  }

  .channel-connection label {
    display: block;
    margin-top: 12px;
  }

  .typing-indicator {
    display: inline-flex;
    direction: ltr;
    align-items: center;
    gap: 4px;
    min-height: 18px;
  }

  .typing-indicator i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ink-subtle);
    animation: bottle-typing 1.1s infinite ease-in-out;
  }

  .typing-indicator i:nth-child(2) {
    animation-delay: .16s;
  }

  .typing-indicator i:nth-child(3) {
    animation-delay: .32s;
  }

  .stream-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-inline-start: 3px;
    vertical-align: -2px;
    background: var(--ink-subtle);
    animation: bottle-cursor .8s infinite;
  }

  @keyframes bottle-typing {
    0% {
      opacity: .3;
      transform: translateY(0);
    }

    60% {
      opacity: .3;
      transform: translateY(0);
    }

    100% {
      opacity: .3;
      transform: translateY(0);
    }

    30% {
      opacity: 1;
      transform: translateY(-3px);
    }
  }

  @keyframes bottle-cursor {
    0% {
      opacity: 1;
    }

    45% {
      opacity: 1;
    }

    46% {
      opacity: 0;
    }

    100% {
      opacity: 0;
    }
  }

  .message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
  }

  .message-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-tint);
    color: var(--accent);
    font-size: var(--text-small);
  }

  .message-file:hover {
    background: var(--accent-soft);
  }

  .message-file span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mcp-suggestions {
    display: grid;
    gap: 10px;
    margin-top: 10px;
  }

  .mcp-suggestion {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-tint);
  }

  .mcp-suggestion strong {
    font-size: var(--text-small);
  }

  .mcp-suggestion p {
    font-size: var(--text-caption);
    line-height: 1.6;
  }

  .mcp-suggestion small {
    color: var(--ink-muted);
  }

  .mcp-suggestion .button_to {
    justify-self: start;
  }

  .conversation-icon {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    flex-shrink: 0;
  }

  .conversation-details {
    display: block;
    min-width: 0;
    flex: 1;
  }

  .privacy-note {
    font-size: var(--text-small);
    line-height: 1.7;
    color: var(--ink-muted);
    background: var(--surface-sunken);
    border-radius: 8px;
    padding: 12px;
  }

  .channel-transcript-note {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink-muted);
    font-size: var(--text-small);
    line-height: 1.7;
    padding: 14px;
    text-align: center;
  }

  .setting-link strong {
    display: block;
    font-size: var(--text-caption);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .settings-form textarea {
    width: 100%;
    box-sizing: border-box;
  }

  .settings-page textarea {
    line-height: 1.8;
    resize: vertical;
  }

  .record-delete {
    margin-top: 20px;
  }

  .capability-card h4 {
    font-size: var(--text-h3);
    margin: 0;
  }

  .capability-card > .button_to {
    margin-top: auto;
  }

  .capability-card-heading h4 {
    flex: 1;
  }

  .capability-card-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: auto;
  }

  .capability-section-heading {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .unified-section-heading h3 {
    font-size: var(--text-h2);
  }

  .tool-selection {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
  }

  .tool-selection legend {
    padding: 0 8px;
    font-size: var(--text-small);
  }

  .tool-selection small {
    color: var(--ink-muted);
  }

  .settings-connection-list {
    margin-block: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
  }

  .settings-connection-list:not(:has(.settings-connection-row)) {
    display: none;
  }

  .settings-connection-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
  }

  .settings-connection-row + .settings-connection-row {
    border-block-start: 1px solid var(--line);
  }

  .settings-connection-row > div {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .settings-connection-row h3,
  .settings-connection-row p {
    margin: 0;
  }

  .settings-connection-row h3 {
    font-size: var(--text-body);
  }

  .settings-connection-row p {
    margin-block-start: 4px;
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .settings-tool-list { min-width: 0; }
  .settings-tool { min-width: 0; }
  .settings-tool-description { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .automation-list {
    display: grid;
    gap: var(--space-3);
  }

  .automation-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }

  .automation-item:hover,
  .automation-item[open] {
    border-color: var(--line-strong);
  }

  .automation-item[open] {
    box-shadow: var(--shadow-float);
  }

  .automation-item > summary {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    list-style: none;
    border-radius: var(--radius-lg);
  }

  .automation-item > summary::-webkit-details-marker,
  .automation-item > summary::after {
    display: none;
  }

  .automation-item > summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .automation-item-text {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: var(--space-1);
  }

  .automation-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--text-body);
  }

  .automation-item-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 2px var(--space-2);
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .automation-item-summary > span + span::before {
    content: "·";
    margin-inline-end: var(--space-2);
    color: var(--ink-subtle);
  }

  .automation-item .badge {
    flex-shrink: 0;
    color: var(--success);
    background: var(--success-soft);
  }

  .automation-item .badge.badge-muted {
    color: var(--ink-muted);
    background: var(--surface-sunken);
  }

  .automation-item-chevron {
    flex-shrink: 0;
    display: inline-grid;
    color: var(--ink-subtle);
    transition: transform 0.15s ease;
  }

  .automation-item[open] .automation-item-chevron {
    transform: rotate(180deg);
  }

  .automation-item-body {
    display: grid;
    gap: var(--space-5);
    padding: var(--space-5);
    border-block-start: 1px solid var(--line);
  }

  .automation-detail {
    display: grid;
    gap: var(--space-3);
    min-width: 0;
  }

  .automation-detail h3 {
    margin: 0;
    font-size: var(--text-small);
    font-weight: 600;
    color: var(--ink-muted);
  }

  .automation-detail-label {
    margin: 0;
    font-size: var(--text-small);
    font-weight: 600;
  }

  .automation-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-3) var(--space-5);
    margin: 0;
    padding: 14px 18px;
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
    font-size: var(--text-small);
  }

  .automation-facts dt {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .automation-facts dd {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
  }

  .automation-detail code {
    direction: ltr;
    unicode-bidi: isolate;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
    overflow-wrap: anywhere;
  }

  .automation-packages {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .automation-packages code {
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    background: var(--surface);
  }

  .automation-note {
    margin: 0;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--info-soft);
    color: var(--info);
    font-size: var(--text-small);
  }

  .automation-note-warning {
    background: var(--warning-soft);
    color: var(--warning);
  }

  .automation-copy-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }

  .automation-copy-row code {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    color: var(--ink-muted);
  }

  .automation-webhook {
    display: grid;
    gap: var(--space-2);
  }

  .automation-detail .automation-prompt {
    padding: var(--space-4) var(--space-5);
    border-inline-start: 3px solid var(--accent);
    border-radius: var(--radius-md);
    background: var(--accent-softer);
    line-height: 1.7;
    overflow-wrap: anywhere;
  }

  .automation-prompt > :first-child {
    margin-top: 0;
  }

  .automation-prompt > :last-child {
    margin-bottom: 0;
  }

  .automation-tool-description {
    margin: 0;
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .automation-arguments-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
  }

  .automation-arguments {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-small);
  }

  .automation-arguments th,
  .automation-arguments td {
    padding: 10px 14px;
    text-align: start;
    vertical-align: top;
    border-block-end: 1px solid var(--line);
  }

  .automation-arguments tr:last-child > * {
    border-block-end: 0;
  }

  .automation-arguments thead th {
    color: var(--ink-muted);
    font-weight: 500;
    background: var(--surface-sunken);
  }

  .automation-arguments tbody th {
    width: 35%;
    font-weight: 500;
  }

  .automation-arguments tbody th small {
    display: block;
    margin-top: 2px;
    color: var(--ink-muted);
    font-weight: 400;
  }

  .automation-arguments pre {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-caption);
  }

  .automation-argument-dynamic {
    color: var(--info);
    font-style: italic;
  }

  .automation-help > summary {
    width: fit-content;
    cursor: pointer;
    color: var(--accent);
    font-size: var(--text-small);
  }

  .automation-help[open] > summary {
    margin-bottom: var(--space-2);
  }

  .automation-settings .settings-form {
    margin: 0;
  }

  .automation-settings > .button_to,
  .automation-actions {
    justify-self: start;
  }

  .automation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .automation-runs {
    margin: 0;
    padding-inline-start: 20px;
    font-size: var(--text-small);
  }

  .code-viewer {
    --code-bg: #1f2420;
    --code-ink: #e4e8dd;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--code-bg);
    color: var(--code-ink);
  }

  .code-viewer-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 8px 12px;
    background: #2a302a;
    border-block-end: 1px solid #3a4238;
  }

  .code-viewer-file {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-caption);
  }

  .code-viewer-file small {
    color: #9aa592;
    font-family: 'Heebo', Arial, sans-serif;
  }

  .code-viewer-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-caption);
  }

  .code-viewer-actions .btn {
    background: #343c33;
    border-color: #48523f;
    color: var(--code-ink);
  }

  .code-viewer-actions .btn:hover {
    background: #3f483d;
  }

  .code-viewer-source {
    margin: 0;
    max-height: 520px;
    overflow: auto;
    padding: 14px 0;
    direction: ltr;
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
    tab-size: 4;
    counter-reset: code-line;
  }

  .code-viewer-source:focus-visible {
    outline: 2px solid var(--highlight);
    outline-offset: -2px;
  }

  .code-viewer-source .code-line {
    counter-increment: code-line;
    padding-inline-end: 16px;
  }

  .code-viewer-source .code-line::before {
    content: counter(code-line);
    display: inline-block;
    width: 3.5em;
    margin-inline-end: 1em;
    padding-inline-end: 0.75em;
    text-align: right;
    color: #6b7566;
    border-inline-end: 1px solid #3a4238;
    user-select: none;
  }

  .tok-keyword { color: #c9a5f2; }
  .tok-definition { color: #8fc9f5; }
  .tok-builtin { color: #7fd8c8; }
  .tok-constant { color: #f2b37a; }
  .tok-string { color: #b8dc8a; }
  .tok-number { color: #f2b37a; }
  .tok-comment { color: #8a9584; font-style: italic; }
  .tok-decorator { color: #f2d77a; }
  .tok-operator { color: #b3bcad; }

  .connector-permissions-heading {
    margin-top: 30px;
  }

  .connector-permissions-table-wrap {
    overflow-x: auto;
    margin-top: 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .connector-permissions-table {
    width: 100%;
    border-collapse: collapse;
    text-align: start;
  }

  .connector-permissions-table th {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    text-align: start;
    white-space: nowrap;
    color: var(--ink-muted);
    font-weight: 500;
  }

  .connector-permissions-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    text-align: start;
    white-space: nowrap;
  }

  .connector-permissions-table tr:last-child td {
    border-bottom: 0;
  }

  .message-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
  }

  .message-content pre {
    direction: ltr;
    text-align: end;
    overflow-x: auto;
    white-space: pre;
    padding: 12px;
    background: var(--surface-sunken);
    border-radius: 6px;
  }

  .message-content code {
    font-family: monospace;
  }

  .message-content ul {
    padding-inline-start: 24px;
  }

  .message-content ol {
    padding-inline-start: 24px;
  }

  .message-content blockquote {
    margin-inline: 0;
    padding-inline-start: 12px;
    border-inline-start: 3px solid var(--line);
  }

  .message-content hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.4em 0;
    opacity: .8;
  }

  .message-content table {
    display: block;
    width: max-content;
    max-width: min(100%, 800px);
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1em 0;
    line-height: 1.6;
  }

  .message-content th {
    padding: 9px 12px;
    border: 1px solid var(--line);
    text-align: start;
    vertical-align: top;
    min-width: 110px;
    background: var(--success-soft);
    font-weight: 600;
  }

  .message-content td {
    padding: 9px 12px;
    border: 1px solid var(--line);
    text-align: start;
    vertical-align: top;
    min-width: 110px;
  }

  .message-content tr:nth-child(even) td {
    background: var(--paper);
  }

  .composer-input-row {
    display: flex;
    align-items: end;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .attach-button {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    display: grid;
    place-items: center;
  }

  .attach-button svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }

  .attach-button:hover {
    background: var(--accent-softer);
  }

  .attach-button:focus-visible {
    background: var(--accent-softer);
  }

  .attachment-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    padding: 2px 2px 8px;
  }

  .attachment-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 112px;
    height: 96px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    overflow: visible;
  }

  .attachment-type {
    align-self: flex-start;
    padding: 5px 7px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--accent);
    font-size: var(--text-caption);
    font-weight: 700;
    line-height: 1;
  }

  .attachment-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
    font-size: var(--text-caption);
    text-align: end;
  }

  .attachment-remove {
    position: absolute;
    top: -8px;
    inset-inline-end: -8px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--ink);
    color: var(--surface);
    font-size: var(--text-h2);
    line-height: 1;
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
  }

  .attachment-tile:hover .attachment-remove {
    opacity: 1;
    pointer-events: auto;
  }

  .attachment-tile:focus-within .attachment-remove {
    opacity: 1;
    pointer-events: auto;
  }

  .message-attachment-tile:hover {
    background: var(--surface-sunken);
    border-color: var(--line-strong);
  }

  .attachment-error {
    width: 100%;
    padding: 4px 6px;
    color: var(--danger);
    font-size: var(--text-caption);
  }

  .fleet-worker-result {
    max-width: 560px;
    margin-top: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-tint);
  }

  .fleet-worker-result > strong {
    display: block;
    margin-bottom: 7px;
    font-size: var(--text-small);
  }

  .human-input-form {
    margin-top: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-tint);
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: end;
    gap: 10px;
  }

  .human-input-form label {
    font-weight: 500;
  }

  .human-input-form input {
    margin-top: 7px;
  }

  .human-input-form small {
    grid-column: 1/-1;
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .credential-dialog {
    width: min(460px,calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-dialog);
  }

  .credential-dialog::backdrop {
    background: var(--ink);
    backdrop-filter: blur(2px);
  }

  .credential-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px 14px;
  }

  .credential-dialog-header > div {
    display: flex;
    align-items: center;
    gap: 11px;
  }

  .credential-dialog-icon {
    display: grid;
    place-items: center;
    width: 37px;
    height: 37px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: var(--text-h2);
  }

  .credential-dialog h3 {
    font-size: var(--text-h3);
  }

  .credential-dialog > p {
    padding: 0 22px 17px;
    color: var(--ink-muted);
    line-height: 1.7;
  }

  .credential-dialog-close {
    border: 0;
    background: none;
    color: var(--ink-muted);
    font-size: var(--text-h1);
    line-height: 1;
  }

  .credential-form {
    display: grid;
    gap: 14px;
    padding: 18px 22px;
    border-block: 1px solid var(--line);
    background: var(--paper);
  }

  .credential-form label {
    font-weight: 500;
  }

  .credential-form input {
    display: block;
    margin-top: 7px;
  }

  .credential-dialog > small {
    display: block;
    padding: 13px 22px;
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .choice-request-card {
    max-width: 560px;
    margin-top: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-tint);
  }

  .choice-request-heading {
    margin: 0 0 11px;
    color: var(--accent);
    font-size: var(--text-caption);
    font-weight: 600;
  }

  .choice-request-options {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .choice-request-option-form {
    margin: 0;
    width: 100%;
  }

  .choice-request-options > :not(:last-child) {
    border-bottom: 1px solid var(--line);
  }

  .choice-request-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 12px 14px;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: var(--text-body);
    font-weight: 500;
    line-height: 1.6;
    text-align: start;
    white-space: normal;
    cursor: pointer;
  }

  .choice-request-option > [dir="auto"],
  .choice-request-custom-form label {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .choice-request-option:hover {
    background: var(--accent-softer);
  }

  .choice-request-other[open] > .choice-request-option {
    background: var(--accent-softer);
  }

  .choice-request-option:focus-visible {
    outline: 3px solid var(--ink-subtle);
    outline-offset: -3px;
  }

  .choice-request-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-size: var(--text-small);
    font-weight: 600;
    direction: ltr;
  }

  .choice-request-icon .icon,
  .choice-request-arrow .icon {
    width: 18px;
    height: 18px;
  }

  .choice-request-arrow {
    display: flex;
    flex: 0 0 auto;
    margin-inline-start: auto;
    color: var(--ink-muted);
    font-size: var(--text-h3);
  }

  .choice-request-other > summary {
    list-style: none;
    color: var(--ink-muted);
  }

  .choice-request-other > summary::after {
    content: none;
  }

  .choice-request-other[open] > summary .choice-request-arrow {
    transform: rotate(180deg);
  }

  .choice-request-other > summary::-webkit-details-marker {
    display: none;
  }

  .choice-request-custom-form {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--line);
    background: var(--paper);
  }

  .choice-request-custom-form label {
    font-size: var(--text-caption);
  }

  .choice-request-custom-form input[type="text"] {
    display: block;
    min-width: 0;
    width: 100%;
    margin-top: 7px;
  }

  .choice-request-custom-form .btn {
    justify-self: start;
  }

  .choice-request-hint {
    margin: 11px 1px 0;
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .service-connection-page {
    max-width: 1040px;
  }

  .service-connection-page h1 {
    font-size: var(--text-h1);
  }

  .service-connection-page .settings-form form {
    display: grid;
    gap: 12px;
  }

  .service-connection-page .settings-form summary {
    cursor: pointer;
    font-weight: 600;
  }

  .service-connection-page .settings-form code {
    overflow-wrap: anywhere;
  }

  .message-status {
    color: var(--ink-muted);
  }

  .message-copy {
    display: inline-grid;
    place-items: center;
    flex: 0 0 30px;
    width: 44px;
    height: 44px;
    margin-inline-start: auto;
    padding: 5px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    min-width: 44px;
  }

  .message-copy svg {
    display: block;
    width: 16px;
    height: 16px;
    flex: none;
  }

  .message-copy:hover {
    background: var(--success-soft);
    color: var(--accent);
  }

  .message-copy:focus-visible {
    background: var(--success-soft);
    color: var(--accent);
  }

  .message-copy:disabled {
    opacity: .35;
    cursor: default;
  }

  .cancel-message-form {
    display: inline-flex;
    margin: 0;
  }

  .cancel-message {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--danger-soft);
    border-radius: 50%;
    background: var(--surface);
    color: var(--danger);
    font-size: var(--text-h2);
    line-height: 1;
  }

  .cancel-message:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
  }

  .fleet-request-status-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    background: var(--accent-soft);
    font-weight: 700;
  }

  .fleet-request-status > div {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 2px 9px;
    min-width: 0;
  }

  .fleet-request-status strong {
    font-size: var(--text-caption);
  }

  .fleet-request-status span {
    font-size: var(--text-caption);
    color: var(--ink-muted);
  }

  .fleet-request-status small {
    grid-column: 1/-1;
    color: var(--ink-muted);
    overflow-wrap: anywhere;
  }

  .fleet-request-status-queued .fleet-request-status-icon {
    animation: fleet-request-pulse 1.2s ease-in-out infinite;
  }

  .fleet-request-status-running .fleet-request-status-icon {
    animation: fleet-request-pulse 1.2s ease-in-out infinite;
  }

  .fleet-request-status-completed .fleet-request-status-icon {
    background: var(--line);
    color: var(--accent);
  }

  .fleet-request-status-failed {
    border-color: var(--danger-soft);
    background: var(--danger-soft);
    color: var(--danger);
  }

  .fleet-request-status-cancelled {
    border-color: var(--danger-soft);
    background: var(--danger-soft);
    color: var(--danger);
  }

  @keyframes fleet-request-pulse {
    50% {
      opacity: .35;
      transform: scale(.85);
    }
  }

  .fleet-request-action {
    max-width: 490px;
    margin-top: -5px;
  }

  .fleet-request-action .image-request-card {
    margin-top: 0;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
  }

  .fleet-request-action-link {
    max-width: 490px;
    margin-top: 8px;
  }

  .stop-reply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--danger);
    border-radius: 8px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: var(--text-body);
    cursor: pointer;
  }

  .stop-reply:hover:not(:disabled) {
    background: var(--danger-soft);
  }

  .stop-reply:disabled {
    border-color: var(--line);
    background: var(--paper);
    color: var(--ink-muted);
    cursor: default;
  }

  .stop-reply:focus-visible {
    outline: 2px solid var(--danger);
    outline-offset: 2px;
  }

  .agent-directory h1 {
    font-size: var(--text-h1);
  }

  .directory-help {
    color: var(--ink-muted);
    margin-top: 10px;
    line-height: 1.7;
  }

  .agent-directory-tabs {
    display: flex;
    gap: 8px;
    margin-top: 28px;
    border-bottom: 1px solid var(--line);
  }

  .agent-directory-tabs a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    color: var(--ink-muted);
    font-weight: 600;
    border-bottom: 2px solid transparent;
  }

  .agent-directory-tabs a.active {
    color: var(--ink);
    border-color: var(--ink-subtle);
  }

  .agent-directory-tabs span {
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 20px;
    background: var(--success-soft);
    font-size: var(--text-caption);
  }

  .agent-selection-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    min-height: 43px;
  }

  .agent-selection-toolbar[hidden] {
    display: none;
  }

  .agent-bulk-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-inline-start: auto;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
  }

  .select-all-agents {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
  }

  .select-all-agents input {
    accent-color: var(--ink-subtle);
  }

  .agent-selection-count {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .delete-selected-agents:disabled {
    cursor: not-allowed;
    opacity: .45;
  }

  .agent-directory-list {
    display: grid;
    gap: 12px;
  }

  .agent-directory-row {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color .15s,background .15s;
  }

  .agent-directory-row.selected {
    border-color: var(--accent);
    background: var(--surface-tint);
  }

  .agent-directory-open {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 20px 22px;
    flex: 1;
    min-width: 0;
  }

  .agent-directory-open:hover {
    background: var(--surface-sunken);
  }

  .agent-directory-open.deleted:hover {
    background: transparent;
  }

  .agent-directory-summary {
    min-width: 180px;
    flex: 1;
  }

  .agent-directory-open h2 {
    font-size: var(--text-h3);
    overflow-wrap: anywhere;
  }

  .agent-directory-info {
    display: grid;
    grid-template-columns: 155px 70px 100px 155px;
    align-items: center;
    gap: 16px;
    margin: 0;
  }

  .agent-directory-info > div {
    text-align: center;
  }

  .agent-directory-info dt {
    color: var(--ink-muted);
    font-size: var(--text-caption);
    margin-top: 4px;
  }

  .agent-directory-info dd {
    font-size: var(--text-body);
    font-weight: 600;
    margin: 0 0 3px;
  }

  .directory-arrow {
    color: var(--accent);
  }

  .agent-directory-row > form {
    padding: 16px;
    border-inline-start: 1px solid var(--line);
  }

  .home-header {
    height: 88px;
  }

  .home-header .login-link {
    font-size: var(--text-small);
    font-weight: 600;
  }

  .visually-hidden {
    position: absolute!important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
  }

  .public-chat .message-form textarea {
    font-size: var(--text-small);
    font-weight: 500;
  }

  .public-chat .message-form textarea::placeholder {
    color: var(--ink-muted);
    opacity: 1;
    font-weight: 500;
  }

  .chat-composer-button svg {
    width: 21px;
    height: 21px;
  }

  .chat-composer-button[data-state="send"] .stop-icon {
    display: none;
  }

  .chat-composer-button[data-state="stop"] .send-icon {
    display: none;
  }

  .public-chat[data-embedded-widget="true"] {
    max-width: none;
    padding: 12px 16px 16px;
    background: var(--surface);
  }

  .public-chat .messages {
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
  }

  .public-chat[data-embedded-widget="true"] .messages {
    padding: 12px 0 20px;
  }

  .public-chat[data-embedded-widget="true"] .message {
    margin-bottom: 18px;
    display: flex;
    gap: 12px;
  }

  .public-chat[data-embedded-widget="true"] .message-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .public-chat[data-embedded-widget="true"] .message-meta strong {
    font-weight: 400;
  }

  .public-chat[data-embedded-widget="true"] .message-meta time {
    font-size: var(--text-caption);
    color: inherit;
  }

  .conversation-group {
    border-top: 1px solid var(--line);
    padding-top: 13px;
  }

  .conversation-group:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .conversation-group-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-inline: 10px;
    color: var(--accent);
  }

  .conversation-group-heading strong {
    font-size: var(--text-small);
    font-weight: 700;
  }

  .conversation-group-count {
    min-width: 20px;
    padding: 2px 5px;
    border-radius: 20px;
    background: var(--success-soft);
    color: var(--accent);
    text-align: center;
    font-size: var(--text-caption);
    line-height: 1.4;
  }

  .conversation-channel-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin: 11px 8px 4px;
    padding: 0 3px 5px;
    border-bottom: 1px solid var(--line);
    border-color: var(--line);
  }

  .conversation-channel-heading strong {
    font-size: var(--text-small);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .conversation-channel-heading small {
    flex-shrink: 0;
    font-size: var(--text-small);
    color: var(--ink-muted);
  }

  .interview-reply-prompt {
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-tint);
  }

  .interview-reply-prompt p {
    margin: 0;
    font-weight: 600;
  }

  .interview-reply-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
  }

  .interview-reply-actions form {
    margin: 0;
  }

  .choice-request-answered {
    margin: 12px 0 0;
    color: var(--accent);
    font-size: var(--text-small);
    font-weight: 600;
  }

  .landing {
    font-size: var(--text-body);
    line-height: 1.75;
  }

  .landing h1 {
    line-height: 1.3;
  }

  .landing h2 {
    line-height: 1.3;
    font-size: clamp(30px,3vw,44px);
    font-weight: 700;
    letter-spacing: -1px;
  }

  .landing h3 {
    line-height: 1.3;
  }

  .landing-kicker {
    display: inline-block;
    color: var(--accent);
    font-size: var(--text-small);
    font-weight: 700;
    margin-bottom: 16px;
  }

  .landing-section-intro {
    max-width: 670px;
    color: var(--ink-muted);
    font-size: var(--text-h3);
    margin-top: 18px;
  }

  .landing-actions {
    display: flex;
    align-items: center;
    gap: 23px;
    margin-top: 32px;
  }

  .landing-text-link {
    font-weight: 600;
    color: var(--accent);
    border-bottom: 1px solid var(--line-strong);
  }

  .preview-avatar {
    width: 46px;
    height: 46px;
    background: var(--accent-soft);
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: var(--accent);
  }

  .preview-avatar .bottle-mark {
    transform: scale(.7);
    margin: 0;
  }

  .landing-steps article > span {
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .landing-steps {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 20px;
    margin-top: 36px;
  }

  .landing-steps article {
    padding: 25px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 16px;
  }

  .landing-steps h3 {
    font-size: var(--text-h2);
    margin: 15px 0 10px;
  }

  .landing-steps p {
    color: var(--ink-muted);
  }

  .landing-contact {
    background: var(--accent-soft);
    border-radius: 24px;
    padding-block: 55px;
    margin-bottom: 75px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 45px;
  }

  .landing-contact h2 {
    font-size: clamp(35px,3.8vw,52px);
  }

  .landing-contact p {
    font-size: var(--text-h3);
    color: var(--ink-muted);
    margin-top: 17px;
  }

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

  .contact-form label {
    display: grid;
    gap: 6px;
    font-size: var(--text-small);
    font-weight: 600;
  }

  .contact-form label > :is(input, textarea) {
    width: 100%;
    margin-top: 0;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--surface);
    padding: 12px 16px;
    font-size: var(--text-body);
    line-height: 1.6;
    transition: border-color .15s, box-shadow .15s;
  }

  .contact-form label > textarea {
    min-height: 120px;
    resize: vertical;
  }

  .contact-form label > textarea[rows="2"] {
    min-height: 76px;
  }

  .contact-form label > :is(input, textarea):focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--highlight);
    outline: none;
  }

  .widget-assistant {
    background: var(--success-soft);
  }

  .widget-user {
    align-self: flex-end;
    background: var(--surface-sunken);
  }

  .landing footer {
    font-size: var(--text-caption);
  }

  .catalog-nav {
    display: flex;
    gap: 30px;
    color: var(--accent);
    font-size: var(--text-small);
  }

  .catalog-nav a:hover {
    color: var(--ink);
  }

  .catalog-hero {
    display: grid;
    grid-template-columns: minmax(0,1.08fr) minmax(340px,.92fr);
    align-items: center;
    gap: 72px;
    padding-block: 58px 92px;
    min-height: 570px;
  }

  .catalog-hero h1 {
    font-size: clamp(48px,5.7vw,78px);
    font-weight: 800;
    letter-spacing: -3px;
    line-height: 1.13;
    max-width: 730px;
  }

  .catalog-hero-copy > p {
    font-size: var(--text-h2);
    color: var(--ink-muted);
    max-width: 660px;
    margin-top: 25px;
  }

  .work-preview {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-float);
    overflow: hidden;
    transform: rotate(-1.5deg);
  }

  .work-preview-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 25px;
    border-bottom: 1px solid var(--success-soft);
  }

  .work-preview-head strong {
    display: block;
    font-size: var(--text-h3);
  }

  .work-preview-head small {
    display: block;
    font-size: var(--text-caption);
    color: var(--ink-muted);
    margin-top: 2px;
  }

  .work-preview-item {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 13px;
    padding: 17px 25px;
    border-bottom: 1px solid var(--success-soft);
  }

  .work-preview-item > span {
    height: 40px;
    width: 40px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 11px;
    font-size: var(--text-h2);
  }

  .work-preview-item strong {
    display: block;
    font-size: var(--text-body);
  }

  .work-preview-item small {
    display: block;
    color: var(--ink-muted);
    font-size: var(--text-caption);
    margin-top: 2px;
  }

  .work-preview-item > b {
    color: var(--accent);
  }

  .work-preview > p {
    background: var(--paper);
    color: var(--ink-muted);
    padding: 15px 25px;
    font-size: var(--text-caption);
  }

  .catalog-section {
    padding-block: 82px;
    border-top: 1px solid var(--line);
    scroll-margin-top: 20px;
  }

  .catalog-section h2 {
    font-size: clamp(32px,3.6vw,48px);
    font-weight: 800;
    letter-spacing: -1.2px;
  }

  .customization-section h2 {
    font-size: clamp(32px,3.6vw,48px);
    font-weight: 800;
    letter-spacing: -1.2px;
  }

  .customization-section {
    background: var(--primary);
    color: var(--surface);
    padding-block: 82px;
  }

  .customization-section .landing-kicker {
    color: var(--surface);
  }

  .customization-section .landing-section-intro {
    color: var(--surface);
  }

  .customization-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 75px;
    align-items: center;
  }

  .personal-onboarding {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 760px;
    background: var(--success-soft);
    border-radius: 16px;
    padding: 20px 24px;
    margin-top: 34px;
  }

  .ynon-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--surface);
    font-size: var(--text-h2);
    font-weight: 700;
  }

  .personal-onboarding strong {
    font-size: var(--text-h3);
  }

  .personal-onboarding p {
    color: var(--ink-muted);
    font-size: var(--text-small);
    margin-top: 4px;
  }

  .catalog-contact {
    scroll-margin-top: 20px;
  }


  .dev-landing .catalog-hero h1 {
    font-size: clamp(40px,4.4vw,62px);
    letter-spacing: -2px;
  }

  .dev-preview {
    transform: rotate(-1deg);
  }

  .dev-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 22px 4px;
  }

  .dev-bubble {
    max-width: 92%;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: var(--text-small);
    line-height: 1.6;
  }

  .dev-bubble small {
    display: block;
    color: var(--ink-muted);
    font-size: var(--text-caption);
    margin-bottom: 2px;
  }

  .dev-bubble-you {
    align-self: flex-start;
    background: var(--surface-sunken);
  }

  .dev-bubble-agent {
    align-self: flex-end;
    background: var(--accent-soft);
  }

  .dev-code {
    margin: 14px 22px 0;
    background: var(--primary);
    color: var(--surface-tint);
    border-radius: 14px;
    overflow: hidden;
  }

  .dev-code figcaption {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--primary-hover);
    color: var(--accent-soft);
    font-size: var(--text-caption);
  }

  .dev-code pre {
    margin: 0;
    padding: 14px;
    overflow-x: auto;
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-caption);
    line-height: 1.6;
  }

  .dev-code-large {
    margin: 0;
    box-shadow: var(--shadow-float);
  }

  .dev-code-large > p {
    padding: 12px 16px;
    border-top: 1px solid var(--primary-hover);
    color: var(--accent-soft);
    font-size: var(--text-caption);
  }

  .dev-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 14px 22px 20px;
  }

  .dev-meta li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--accent);
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    font-size: var(--text-caption);
  }

  .dev-loop {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,2fr) minmax(0,1fr);
    align-items: center;
    gap: 22px;
    margin-top: 38px;
    padding: 28px;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-radius: 24px;
  }

  .dev-loop-column > small {
    display: block;
    margin-bottom: 10px;
    color: var(--ink-muted);
    font-size: var(--text-caption);
    font-weight: 700;
  }

  .dev-loop-column > .dev-chips + small {
    margin-top: 18px;
  }

  .dev-loop-core {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
    align-items: center;
    gap: 14px;
  }

  .dev-loop-node {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 22px 16px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 18px;
  }

  .dev-loop-node > span {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: var(--text-h2);
  }

  .dev-loop-node strong {
    font-size: var(--text-h2);
  }

  .dev-loop-node small {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .dev-loop-node-code {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--surface);
  }

  .dev-loop-node-code small {
    color: var(--accent-soft);
  }

  .dev-loop-arrows {
    display: grid;
    gap: 12px;
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--accent);
    text-align: center;
  }

  .dev-loop-arrows span {
    padding: 6px 10px;
    background: var(--highlight);
    border-radius: var(--radius-pill);
    color: var(--primary);
  }

  .dev-pillars {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 18px;
    margin-top: 22px;
  }

  .dev-snippet {
    margin: 16px 0 0;
    padding: 12px 14px;
    overflow-x: auto;
    text-align: left;
    background: var(--primary);
    color: var(--surface-tint);
    border-radius: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-caption);
    line-height: 1.6;
  }

  .prompt-examples {
    border-top: 0;
  }

  .prompt-examples-list {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 18px;
    list-style: none;
    margin: 42px 0 0;
    padding: 0;
  }

  .prompt-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 22px;
    transition: border-color .15s ease;
  }

  .prompt-card:hover,
  .prompt-card:focus-within {
    border-color: var(--accent);
  }

  .prompt-card:first-child {
    grid-column: span 2;
    background: var(--accent-soft);
    border-color: transparent;
  }

  .prompt-card:first-child .prompt-bubble {
    background: var(--surface);
    font-size: var(--text-h2);
  }

  .prompt-bubble {
    position: relative;
    margin: 0;
    background: var(--surface-sunken);
    border-radius: 16px;
    border-start-start-radius: 4px;
    color: var(--ink);
    font-size: var(--text-body);
    line-height: 1.75;
    overflow-wrap: anywhere;
    padding: 14px 16px;
  }

  .prompt-card .dev-chips {
    margin-top: 0;
  }

  .prompt-try {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    margin-top: auto;
    color: var(--accent);
    font-size: var(--text-small);
    font-weight: 700;
    text-decoration: none;
  }

  .prompt-try:hover {
    text-decoration: underline;
  }

  .prompt-try .icon {
    width: 16px;
    height: 16px;
    transition: transform .15s ease;
  }

  .prompt-try:hover .icon {
    transform: translateX(-3px);
  }

  @media (max-width: 900px) {
    .prompt-examples-list {
      grid-template-columns: repeat(2,minmax(0,1fr));
    }
  }

  .hero-prompts {
    display: none;
  }

  @media (max-width: 600px) {
    .prompt-examples-list {
      display: flex;
      gap: 12px;
      margin: 28px -20px 0;
      padding: 4px 20px 12px;
      overflow-x: auto;
      overscroll-behavior-x: contain;
      scroll-snap-type: x mandatory;
      scroll-padding-inline: 20px;
      scrollbar-width: none;
    }

    .prompt-examples-list::-webkit-scrollbar {
      display: none;
    }

    .prompt-card {
      flex: 0 0 82%;
      scroll-snap-align: start;
    }

    .prompt-card:first-child {
      grid-column: auto;
      background: var(--surface);
      border-color: var(--line);
    }

    .prompt-card:first-child:focus-within {
      border-color: var(--accent);
    }

    .prompt-card:first-child .prompt-bubble {
      background: var(--surface-sunken);
      font-size: var(--text-body);
    }

    /* On phones the prompt carousel moves into the hero, replacing the
       chat/code preview, and the standalone prompts section keeps only its
       bridge line. */
    .hero-prompts {
      display: block;
      min-width: 0;
    }

    .hero-prompts .prompt-examples-list {
      margin-top: 12px;
    }

    .dev-landing .dev-preview,
    .catalog-hero .landing-text-link,
    #prompts > h2,
    #prompts > .landing-section-intro,
    #prompts > .prompt-examples-list {
      display: none;
    }

    #prompts {
      padding-block: 0 48px;
    }

    #prompts .story-bridge {
      margin-top: 0;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .prompt-card,
    .prompt-try .icon {
      transition: none;
    }
  }

  .story-bridge {
    max-width: 780px;
    margin: 48px auto 0;
    padding: 28px 24px;
    border-block: 1px solid var(--line);
    color: var(--primary);
    font-size: var(--text-h2);
    font-weight: 600;
    text-align: center;
    text-wrap: balance;
  }

  .story-learning {
    min-width: 0;
    margin: 0;
    padding-bottom: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
  }

  .story-learning figcaption {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .story-saved-rule {
    margin: 20px 22px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-tint);
    font-size: var(--text-small);
  }

  .story-saved-rule strong {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
  }

  .story-saved-rule p {
    margin-top: 8px;
    color: var(--ink-muted);
  }

  .comparison-tabs {
    display: flex;
    gap: 8px;
    margin-top: 32px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .comparison-tab {
    position: relative;
    flex: none;
    overflow: hidden;
    padding: 11px 20px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink-muted);
    font: inherit;
    font-size: var(--text-body);
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
  }

  .comparison-tab:hover {
    border-color: var(--primary);
    color: var(--ink);
  }

  .comparison-tab.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--surface);
  }

  .comparison-tab-progress {
    position: absolute;
    inset-inline-start: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--highlight);
    transform: scaleX(0);
    transform-origin: right;
  }

  .is-autoplay .comparison-tab.is-active .comparison-tab-progress {
    animation: comparison-progress 8s linear forwards;
  }

  .is-autoplay.is-paused .comparison-tab-progress {
    animation-play-state: paused;
  }

  @keyframes comparison-progress {
    to { transform: scaleX(1); }
  }

  .comparison-panel {
    margin-top: 20px;
    padding: 44px 48px;
    border-radius: 28px;
    background: var(--surface-sunken);
    animation: comparison-fade .35s ease;
  }

  @keyframes comparison-fade {
    from { opacity: 0; transform: translateY(6px); }
  }

  .comparison-headline {
    max-width: 22ch;
    font-size: clamp(28px,3vw,40px);
    font-weight: 800;
    letter-spacing: -.8px;
    line-height: 1.2;
  }

  .comparison-columns {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 16px;
    margin-top: 36px;
  }

  .comparison-side {
    padding: 26px 28px;
    border-radius: var(--radius-xl);
    background: var(--surface);
  }

  .comparison-side h3 {
    font-size: var(--text-small);
    font-weight: 700;
    color: var(--ink-muted);
  }

  .comparison-us {
    background: var(--primary);
    color: var(--surface);
  }

  .comparison-us h3 {
    color: var(--highlight);
  }

  .comparison-side ul {
    display: grid;
    gap: 14px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
  }

  .comparison-side li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: var(--text-h3);
    line-height: 1.55;
  }

  .comparison-side li .icon {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 4px;
  }

  .comparison-them li {
    color: var(--ink-muted);
  }

  .comparison-them li .icon {
    color: var(--danger);
  }

  .comparison-us li .icon {
    color: var(--highlight);
  }

  @media (max-width: 900px) {
    .comparison-columns {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 600px) {
    .comparison-tabs {
      margin-inline: -20px;
      padding-inline: 20px;
    }

    .comparison-panel {
      padding: 28px 20px;
      border-radius: var(--radius-xl);
    }

    .comparison-side {
      padding: 20px;
    }

    .comparison-side li {
      font-size: var(--text-body);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .comparison-panel {
      animation: none;
    }
  }

  .dev-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 18px;
    margin-top: 38px;
  }

  .dev-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px;
  }

  .dev-card-icon {
    flex: none;
    height: 46px;
    width: 46px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 13px;
    font-size: var(--text-h2);
  }

  .dev-card h3 {
    font-size: var(--text-h2);
    margin: 18px 0 8px;
  }

  .dev-card p {
    color: var(--ink-muted);
    font-size: var(--text-small);
    line-height: 1.7;
  }

  .dev-case dl {
    margin: 16px 0;
    padding: 13px 14px;
    background: var(--surface-tint);
    border: 1px solid var(--success-soft);
    border-radius: 12px;
    font-size: var(--text-small);
    line-height: 1.6;
  }

  .dev-case dt {
    color: var(--accent);
    font-size: var(--text-caption);
    font-weight: 700;
  }

  .dev-case dd {
    margin: 2px 0 10px;
  }

  .dev-case dd:last-child {
    margin-bottom: 0;
  }

  .dev-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
  }

  .dev-chips span {
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--accent);
    border-radius: var(--radius-pill);
    padding: 3px 9px;
    font-size: var(--text-caption);
  }

  .dev-flow {
    display: grid;
    gap: 14px;
    margin: 30px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: dev-flow;
  }

  .dev-flow li {
    display: grid;
    grid-template-columns: 34px 1fr;
    column-gap: 14px;
    counter-increment: dev-flow;
  }

  .dev-flow li::before {
    content: counter(dev-flow);
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--highlight);
    color: var(--primary);
    font-weight: 700;
  }

  .dev-flow strong {
    font-size: var(--text-h3);
  }

  .dev-flow span {
    color: var(--accent-soft);
    font-size: var(--text-small);
  }

  .dev-flow-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--primary-hover);
    color: var(--accent-soft);
    font-size: var(--text-small);
  }

  #agent-python .dev-flow span,
  #agent-python .dev-flow-note {
    color: var(--ink-muted);
  }

  #agent-python .dev-flow-note {
    border-color: var(--line);
  }

  .dev-flow-note .icon {
    flex: none;
    margin-top: 5px;
  }

  .dev-projects-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
  }

  .dev-checklist {
    display: grid;
    gap: 10px;
    list-style: none;
    margin: 26px 0 0;
    padding: 0;
  }

  .dev-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .dev-checklist .icon {
    flex: none;
    margin-top: 6px;
    color: var(--accent);
  }

  .dev-projects {
    display: grid;
    gap: 14px;
  }

  .dev-project {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px 20px;
  }

  .dev-project > div:first-child {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .dev-project h3 {
    font-size: var(--text-h3);
  }

  .dev-project small {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .dev-compare-scroll {
    overflow-x: auto;
    margin-top: 34px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
  }

  .dev-compare {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: var(--text-small);
    line-height: 1.6;
  }

  .dev-compare caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .dev-compare th,
  .dev-compare td {
    padding: 14px 16px;
    text-align: start;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
  }

  .dev-compare tbody tr:last-child > * {
    border-bottom: 0;
  }

  .dev-compare thead th {
    background: var(--surface-sunken);
    font-size: var(--text-caption);
    color: var(--ink-muted);
  }

  .dev-compare tbody th {
    font-weight: 700;
  }

  .dev-compare td {
    color: var(--ink-muted);
  }

  .dev-compare th:last-child,
  .dev-compare td:last-child {
    background: var(--accent-soft);
    color: var(--ink);
    font-weight: 600;
  }

  .dev-compare thead th:last-child {
    color: var(--accent);
  }

  .dev-compare-note {
    display: block;
    margin-top: 12px;
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  @media (max-width: 900px) {
    .dev-grid {
      grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .dev-loop {
      grid-template-columns: 1fr;
    }

    .dev-pillars {
      grid-template-columns: 1fr;
    }

    .dev-projects-layout {
      grid-template-columns: 1fr;
      gap: 36px;
    }

    .dev-preview {
      transform: none;
    }
  }

  @media (max-width: 600px) {
    .dev-grid {
      grid-template-columns: 1fr;
      gap: 14px;
      margin-top: 28px;
    }

    .dev-loop {
      padding: 18px;
    }

    .dev-loop-core {
      grid-template-columns: 1fr;
    }

    .dev-loop-arrows b {
      display: inline-block;
      transform: rotate(-90deg);
    }

    .dev-chat {
      padding-inline: 17px;
    }

    .dev-code {
      margin-inline: 17px;
    }

    .dev-code-large {
      margin-inline: 0;
    }

    .dev-meta {
      padding-inline: 17px;
    }
  }

  .default-ai-copy h2 {
    font-size: var(--text-h2);
  }

  .provider-manager-header h2 {
    font-size: var(--text-h2);
  }

  .default-ai-copy p {
    color: var(--ink-muted);
    font-size: var(--text-small);
    line-height: 1.6;
    margin-top: 6px;
  }

  .provider-manager-header p {
    color: var(--ink-muted);
    font-size: var(--text-small);
    line-height: 1.6;
    margin-top: 6px;
  }

  .default-ai-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: start;
    gap: 12px;
  }

  .default-ai-form label {
    display: grid;
    gap: 8px;
    font-size: var(--text-small);
    font-weight: 600;
  }

  .default-ai-form select {
    width: 100%;
    font-size: var(--text-small);
    min-height: 44px;
    font-weight: 400;
    text-align: start;
    margin-top: 0;
  }

  .default-ai-form > .btn {
    margin-top: 29px;
  }

  .provider-manager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 27px 32px;
    border-bottom: 1px solid var(--line);
  }

  .provider-manager-header > div {
    display: flex;
    align-items: baseline;
    gap: 13px;
  }

  .provider-manager-header > div p {
    margin: 0;
  }

  .provider-manager-header > span {
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .provider-row {
    border-bottom: 1px solid var(--line);
  }

  .provider-row:last-child {
    border-bottom: 0;
  }

  .provider-row summary {
    list-style: none;
    display: grid;
    grid-template-columns: minmax(200px,1fr) 130px 140px;
    align-items: center;
    gap: 20px;
    padding: 24px 32px;
    cursor: pointer;
  }

  .provider-row summary::-webkit-details-marker {
    display: none;
  }

  .provider-row summary:hover {
    background: var(--paper);
  }

  .provider-identity {
    display: flex;
    align-items: center;
    gap: 13px;
  }

  .provider-identity strong {
    font-size: var(--text-h3);
  }

  .provider-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--line);
    flex: none;
  }

  .provider-status {
    justify-self: start;
    background: var(--surface-sunken);
    color: var(--ink-muted);
    border-radius: 30px;
    padding: 6px 13px;
    font-size: var(--text-small);
  }

  .provider-row[open] summary {
    background: var(--paper);
  }

  .provider-row[open] .provider-row-action:after {
    content: ' ↑';
    font-size: var(--text-caption);
  }

  .provider-editor {
    padding: 26px 32px 30px;
    border-top: 1px solid var(--success-soft);
    background: var(--surface);
  }

  .provider-editor form {
    display: grid;
    gap: 12px;
  }

  .provider-editor label {
    font-size: var(--text-small);
    font-weight: 600;
  }

  .provider-editor input[type=password] {
    font-size: var(--text-body);
  }

  .provider-editor p {
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .provider-editor-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 4px;
  }

  .provider-editor-actions .check-row {
    font-size: var(--text-small);
    font-weight: 500;
  }

  .provider-editor-actions .check-row input {
    width: auto;
    margin: 0;
  }

  .profile-notes {
    border-top: 1px solid var(--line);
    margin-top: 28px;
    padding-top: 18px;
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .profile-notes p + p {
    margin-top: 7px;
  }

  .chat-panel:has(.human-input-form) .composer {
    display: none;
  }

  .chat-panel:has(.image-request-form) .composer {
    display: none;
  }

  .input-help-form {
    margin-block: 8px 12px;
  }

  .input-help-button {
    border: 0;
    background: none;
    color: var(--primary);
    font: inherit;
    text-align: start;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 0;
  }

  .input-help-button:disabled {
    color: var(--ink-muted);
    cursor: wait;
  }

  .input-request-card {
    margin-block: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-tint);
    max-width: 560px;
  }

  .input-question-form {
    display: grid;
    gap: 8px;
    margin-block: 12px;
  }

  .input-question-form textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    font: inherit;
  }

  .input-question-form small {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .input-deferred {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .input-secure-heading {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
  }

  .input-request-card .human-input-form small {
    font-size: var(--text-caption);
  }

  .capability-options-form {
    display: grid;
    gap: 12px;
    margin-top: 14px;
  }

  .capability-options-form label {
    display: grid;
    gap: 6px;
    font-size: var(--text-small);
  }

  .capability-options-form input {
    width: 100%;
    box-sizing: border-box;
  }

  .capability-options-form select {
    width: 100%;
    box-sizing: border-box;
  }

  .capability-options-form textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 80px;
  }

  .capability-card details > summary {
    cursor: pointer;
    font-weight: 600;
  }

  .blueprint-picker > .muted {
    margin-top: 8px;
    font-size: var(--text-small);
  }

  .blueprint-card h2 {
    margin: 8px 0;
    font-size: var(--text-h2);
  }

  .blueprint-card p {
    line-height: 1.7;
  }

  .blueprint-card li {
    line-height: 1.7;
  }

  .fleet-directory-list {
    gap: 22px;
  }

  .fleet-directory-group {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
  }

  .fleet-directory-group.selected {
    border-color: var(--accent);
    background: var(--surface-tint);
  }

  .fleet-directory-leader-link > div {
    flex: 1;
    min-width: 0;
  }

  .fleet-directory-heading a.fleet-directory-leader-link:hover {
    background: var(--success-soft);
  }

  .fleet-directory-count {
    flex: none;
    border-radius: 30px;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 6px 11px;
    font-size: var(--text-caption);
    font-weight: 600;
  }

  .fleet-collapse-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 0;
    cursor: pointer;
    white-space: nowrap;
  }

  .fleet-collapse-toggle:hover {
    background: var(--line);
  }

  .fleet-collapse-toggle:focus-visible {
    outline: 2px solid var(--ink-muted);
    outline-offset: 2px;
  }

  .fleet-collapse-icon {
    font-size: var(--text-body);
    line-height: 1;
    transition: transform .15s;
  }

  .fleet-directory-group:not(.collapsed) .fleet-collapse-icon {
    transform: rotate(180deg);
  }

  .fleet-directory-agents {
    display: grid;
  }

  .fleet-directory-agents[hidden] {
    display: none;
  }

  .fleet-directory-agents .agent-directory-row {
    border: 0;
    border-radius: 0;
  }

  .fleet-directory-agents .agent-directory-row + .agent-directory-row {
    border-top: 1px solid var(--line);
  }

  .agent-directory-name {
    display: flex;
    align-items: center;
    gap: 9px;
  }

  .agent-directory-name h3 {
    font-size: var(--text-h3);
    overflow-wrap: anywhere;
  }

  .agent-directory-name span {
    border-radius: 20px;
    background: var(--success-soft);
    color: var(--accent);
    padding: 3px 8px;
    font-size: var(--text-caption);
    white-space: nowrap;
  }

  .message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-block: 12px;
  }

  .fleet-image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-block: 12px;
  }

  .message-images img {
    display: block;
    width: min(240px, 100%);
    max-height: 240px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
  }

  .fleet-image-gallery img {
    display: block;
    width: min(240px, 100%);
    max-height: 240px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
  }

  .message-images a {
    align-self: end;
  }

  .fleet-image-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 240px;
  }

  .image-request-card > strong {
    font-size: var(--text-body);
  }

  .image-request-card > p {
    margin-top: 5px;
    color: var(--ink-muted);
    font-size: var(--text-caption);
    line-height: 1.6;
  }

  .image-request-form {
    display: grid;
    gap: 12px;
    margin-top: 14px;
  }

  .image-request-picker {
    font-weight: 600;
  }

  .image-request-form input[type="file"] {
    max-width: 100%;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
  }

  .image-request-form input[type="file"]::file-selector-button {
    margin-inline-end: 10px;
    padding: 9px 13px;
    border: 0;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
  }

  .image-request-decline {
    margin-top: 10px;
  }

  .authority-card-form {
    display: grid;
    gap: 10px;
  }

  .authority-card-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-small);
    flex-wrap: wrap;
  }

  .authority-card-form input[type=number] {
    flex: 1 1 140px;
    min-width: 0;
  }

  .authority-card-form .field-help {
    margin: 0;
    font-size: var(--text-caption);
    color: var(--ink-muted);
  }

  .team-member-notice {
    max-width: 640px;
    margin: 24px auto 12px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-tint);
  }

  .team-member-notice p {
    margin: 0 0 10px;
  }

  .team-member-chat {
    margin: 0 16px 16px;
  }

  .team-member-chat > summary {
    max-width: 640px;
    margin: 0 auto 12px;
    color: var(--ink-muted);
    font-size: var(--text-small);
    cursor: pointer;
    flex-shrink: 0;
  }

  .team-member-chat[open] > summary {
    margin-bottom: 12px;
  }

  .team-member-chat[open] {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  .team-member-chat[open]::details-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .team-member-chat[open] .chat-layout {
    flex: 1;
    min-height: 0;
  }

  .repository-picker {
    display: grid;
    gap: 10px;
  }

  .repository-picker-label {
    display: grid;
    gap: 6px;
    font-size: var(--text-small);
  }

  .repository-picker-label input {
    width: 100%;
  }

  .repository-options {
    max-height: 420px;
    overflow: auto;
  }

  .repository-options .choice-request-option {
    min-height: 48px;
    font-size: var(--text-small);
  }

  .repository-options .choice-request-option[hidden] {
    display: none;
  }

  .meta-ad-preview {
    margin: 16px 0;
    padding: 18px;
    border: 1px solid var(--surface-sunken);
    border-radius: 16px;
    background: var(--paper);
  }

  .meta-ad-preview h3 {
    margin: 0 0 12px;
  }

  .meta-ad-preview p {
    margin: 6px 0;
  }

  .meta-ad-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
    gap: 14px;
    margin: 14px 0;
  }

  .meta-ad-preview-card {
    overflow: hidden;
    border: 1px solid var(--surface-sunken);
    border-radius: 10px;
    background: var(--surface);
    max-width: 420px;
  }

  .meta-ad-preview-card > p {
    padding: 0 12px;
    white-space: pre-line;
  }

  .meta-ad-preview-card > img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
  }

  .meta-ad-preview-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
  }

  .meta-ad-preview-heading span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--info);
    color: var(--surface);
    font-weight: bold;
  }

  .meta-ad-preview-footer {
    display: grid;
    gap: 4px;
    padding: 12px;
    background: var(--surface-sunken);
  }

  .meta-ad-preview-footer span {
    justify-self: start;
    border: 1px solid var(--surface-sunken);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: var(--text-caption);
  }

  .agent-directory-row.paused:not(.selected) {
    background: var(--surface-sunken);
    border-color: var(--line);
  }

  .fleet-directory-group.paused:not(.selected) {
    background: var(--surface-sunken);
    border-color: var(--line);
  }

  .privacy-page {
    max-width: 820px;
    padding-block: 40px 90px;
    font-size: var(--text-body);
    line-height: 1.8;
  }

  .privacy-page h1 {
    font-size: var(--text-h1);
    margin-bottom: 20px;
  }

  .privacy-page h2 {
    font-size: var(--text-h2);
    margin-bottom: 8px;
  }

  .privacy-page section {
    margin-block: 30px;
  }

  .privacy-page p {
    color: var(--ink-muted);
  }

  .privacy-page .landing-text-link {
    display: inline-block;
    margin-top: 28px;
  }

  .agent-directory-row.paused .agent-directory-open:hover {
    background: var(--success-soft);
  }

  .fleet-directory-group.paused .fleet-directory-leader-link:hover {
    background: var(--success-soft);
  }

  .fleet-directory-group.paused .fleet-directory-agents .agent-directory-row {
    background: var(--paper);
  }

  .fleet-directory-group.paused .fleet-directory-count {
    background: var(--line);
    color: var(--accent);
  }

  .agent-directory-row.paused .agent-directory-name h2 {
    color: var(--accent);
  }

  .fleet-directory-group.paused .fleet-directory-heading h2 {
    color: var(--ink);
  }

  .agent-directory-model dd {
    overflow-wrap: anywhere;
  }

  .composer .search-only {
    display: none;
  }

  .composer.searching .search-only {
    display: flex;
  }

  .composer.searching .chat-only {
    display: none;
  }

  .composer.searching .attachment-previews {
    display: none;
  }

  .composer.searching .attachment-error {
    display: none;
  }

  .composer.searching .suggestions {
    display: none;
  }

  .composer.searching .composer-input-row {
    align-items: center;
  }

  .composer.searching textarea {
    white-space: nowrap;
    height: 42px !important;
  }

  .search-icon-button {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    min-width: 44px;
  }

  .search-icon-button:hover {
    background: var(--accent-softer);
  }

  .search-icon-button:focus-visible {
    outline: 2px solid var(--success);
    outline-offset: 2px;
  }

  .search-icon-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
  }

  .search-mode-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
  }

  .search-icon-button.small {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .search-icon-button.small svg {
    width: 16px;
    height: 16px;
  }

  .search-mode-icon {
    flex: none;
    color: var(--accent);
    padding-inline: 8px;
  }

  .search-controls {
    align-items: center;
    gap: 2px;
    flex: none;
  }

  .search-count {
    font-size: var(--text-small);
    color: var(--ink-muted);
    white-space: nowrap;
    padding-inline: 6px;
  }

  mark.conversation-search-hit {
    background: var(--danger-soft);
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
  }

  mark.conversation-search-hit.current {
    background: var(--accent-soft);
  }

  .fleet-status-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
  }

  .fleet-status-list .fleet-request-status {
    max-width: none;
    margin-top: 0;
  }

  .fleet-status-list .fleet-request-status > div {
    flex: 1;
  }

  .fleet-status-list .fleet-request-status > form {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .fleet-status-list:not(:has(.fleet-request-status)) {
    display: none;
  }

  .fleet-request-open {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 1;
  }

  .fleet-request-open:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
  }

  .fleet-request-status:has(.fleet-request-open:hover) {
    border-color: var(--line-strong);
  }

  .fleet-request-status > form {
    position: relative;
    z-index: 2;
  }

  .bookmark-reader header {
    border-bottom: 1px solid var(--line);
    padding-bottom: 20px;
    margin-bottom: 24px;
  }

  .bookmark-actions form {
    margin: 0;
  }

  .bookmark-share input {
    width: 100%;
  }

  .bookmark-content {
    overflow-wrap: anywhere;
  }

  .bookmark-content pre {
    overflow-x: auto;
  }

  .bookmark-content table {
    display: block;
    overflow-x: auto;
  }

  .bookmarks-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--accent);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: var(--text-small);
    cursor: pointer;
    white-space: nowrap;
  }

  .bookmarks-toggle svg {
    width: 20px;
    height: 20px;
  }

  .bookmarks-count {
    min-width: 20px;
    text-align: center;
    font-size: var(--text-caption);
  }

  .bookmarks-toggle.has-files .bookmarks-count {
    border-radius: 20px;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 5px;
  }

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

  .bookmarks-panel-header h2 {
    font-size: var(--text-h3);
  }

  .bookmarks-close {
    background: transparent;
    border: 0;
    font-size: var(--text-h1);
    color: var(--accent);
    cursor: pointer;
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .bookmarks-handle {
    display: none;
  }

  .bookmarked-file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    min-height: 0;
  }

  .bookmarked-file {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
  }

  .bookmarked-file:hover {
    border-color: var(--ink-subtle);
  }

  .bookmarked-file-open {
    display: grid;
    grid-template-columns: 24px minmax(0,1fr);
    gap: 5px;
    flex: 1;
    min-width: 0;
  }

  .bookmarked-file-open > span {
    grid-row: 1/3;
  }

  .bookmarked-file strong {
    font-size: var(--text-small);
    overflow-wrap: anywhere;
  }

  .bookmarked-file small {
    grid-column: 2;
    color: var(--ink-muted);
    font-size: var(--text-caption);
    line-height: 1.6;
  }

  .bookmarked-file-download {
    display: grid;
    place-items: center;
    width: 34px;
    height: 38px;
    border-radius: 6px;
    color: var(--accent);
    font-size: var(--text-h2);
  }

  .bookmarked-file-download:hover {
    background: var(--success-soft);
  }

  .bookmarks-empty {
    color: var(--ink-muted);
    font-size: var(--text-small);
    line-height: 1.8;
    padding: 12px;
  }

  .message-bookmark-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface-sunken);
    color: var(--accent);
    font-size: var(--text-small);
    overflow-wrap: anywhere;
  }

  .message-bookmark-card:hover {
    background: var(--accent-soft);
  }

  .bookmarked-file-icon svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .message-bookmark-card svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .agent-model-name {
    font-size: var(--text-small);
    overflow-wrap: anywhere;
    min-width: 0;
  }

  .brand {
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    direction: ltr;
    font-size: var(--text-h1);
    font-weight: 800;
    letter-spacing: -.8px;
  }

  .icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    vertical-align: middle;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--text-small);
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
  }

  .btn-primary {
    background: var(--primary);
    color: var(--surface);
  }

  .btn-primary:hover {
    background: var(--primary-hover);
  }

  .btn-secondary {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--accent);
  }

  .btn-secondary:hover {
    background: var(--accent-softer);
    border-color: var(--accent);
  }

  .btn-ghost {
    background: transparent;
    color: var(--accent);
  }

  .btn-ghost:hover {
    background: var(--accent-softer);
  }

  .btn-danger {
    background: var(--surface);
    border-color: var(--danger);
    color: var(--danger);
  }

  .btn-danger:hover {
    background: var(--danger-soft);
  }

  .btn-sm {
    min-height: 36px;
    padding: 8px 12px;
  }

  .btn:disabled {
    background: var(--surface-sunken);
    color: var(--ink-subtle);
    border-color: var(--line);
    opacity: 1;
    cursor: default;
  }

  .btn[aria-disabled=true] {
    background: var(--surface-sunken);
    color: var(--ink-subtle);
    border-color: var(--line);
    opacity: 1;
    cursor: default;
  }

  .btn[aria-busy=true] {
    cursor: progress;
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
  }

  .card p {
    color: var(--ink-muted);
    font-size: var(--text-small);
    line-height: 1.6;
  }

  .field-help {
    color: var(--ink-muted);
    font-size: var(--text-small);
    line-height: 1.6;
  }

  .muted {
    color: var(--ink-muted);
    font-size: var(--text-small);
    line-height: 1.6;
  }

  .agent-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent);
  }

  .capability-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent);
  }

  .message-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent);
  }

  .badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--surface-sunken);
  }

  .paused-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--warning);
    background: var(--warning-soft);
  }

  .status-pill {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin: 0;
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--text-caption);
    font-weight: 500;
    background: var(--surface-sunken);
    color: var(--ink-muted);
  }

  .status-pill::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
  }

  .success {
    color: var(--success);
    background: var(--success-soft);
  }

  .provider-status.connected {
    color: var(--success);
    background: var(--success-soft);
  }

  .warning {
    color: var(--warning);
    background: var(--warning-soft);
  }

  .danger {
    color: var(--danger);
    background: var(--danger-soft);
  }

  .provider-status-dot.connected {
    background: var(--success);
  }

  .workspace-tab-slot { display: contents; }

  .tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    padding-block: 6px;
    padding-inline: 32px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    overflow-x: auto;
  }

  .tabs a {
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-muted);
    white-space: nowrap;
    border-radius: var(--radius-pill);
  }

  .tabs .active {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 700;
  }

  .conversation-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
    gap: 6px;
    padding-bottom: 16px;
  }

  .setting-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
    gap: 6px;
    padding-bottom: 16px;
  }

  .conversation-row {
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .conversation-row .conversation-link {
    flex: 1;
    min-width: 0;
  }

  .conversation-delete-form {
    flex-shrink: 0;
    margin: 0;
  }

  .conversation-delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
  }

  .conversation-delete-button:hover,
  .conversation-delete-button:focus-visible {
    background: var(--danger-soft);
    color: var(--danger);
  }

  .conversation-link {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--ink-muted);
    font-size: var(--text-small);
    position: relative;
  }

  .setting-link {
    display: block;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--ink-muted);
    font-size: var(--text-small);
    position: relative;
  }

  .conversation-link:hover {
    background: var(--accent-softer);
  }

  .setting-link:hover {
    background: var(--accent-softer);
  }

  .conversation-link.selected {
    background: var(--accent-soft);
    color: var(--ink);
    font-weight: 600;
  }

  .setting-link.selected {
    background: var(--accent-soft);
    color: var(--ink);
    font-weight: 600;
  }

  .conversation-link.selected::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    inset-block: 8px;
    width: 3px;
    background: var(--accent);
    border-radius: var(--radius-sm);
  }

  .setting-link.selected::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    inset-block: 8px;
    width: 3px;
    background: var(--accent);
    border-radius: var(--radius-sm);
  }

  .sidebar-label {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .conversation-group-description {
    margin-block: 8px;
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .conversation-details small {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .setting-link small {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .conversation-details strong {
    font-size: var(--text-small);
  }

  .empty-state {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin-top: 32px;
    padding: 32px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    color: var(--ink-muted);
    text-align: center;
    font-size: var(--text-body);
  }

  .empty-state .icon {
    width: 32px;
    height: 32px;
    color: var(--accent);
  }

  .empty-state h3 {
    font-size: var(--text-body);
    font-weight: 600;
  }

  .empty-state p {
    font-size: var(--text-small);
  }

  .settings-form {
    display: grid;
    gap: 16px;
    max-width: none;
    width: 100%;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    margin-top: 24px;
  }

  .settings-form form {
    display: grid;
    gap: 16px;
  }

  .settings-form .btn {
    justify-self: end;
  }

  .capability-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-block: 24px;
  }

  .capability-card {
    min-width: 0;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
  }

  .memory-group { margin-block-start: 32px; }
  .memory-group-heading { display: flex; align-items: center; gap: 12px; }
  .memory-group-heading h2 { margin: 0; font-size: var(--text-h3); font-weight: 600; }
  .memory-list { display: grid; gap: 12px; margin-block-start: 12px; }
  .memory-selection-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-height: 44px; margin-block-start: 12px; }
  .memory-select-all { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-muted); }
  .memory-bulk-actions { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
  .memory-bulk-actions[hidden] { display: none; }
  .memory-selection-count { color: var(--ink-muted); font-size: var(--text-small); }
  .memory-select-all input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
  .memory-fact-select { flex: 0 0 auto; width: 18px; height: 18px; margin-block-start: 3px; cursor: pointer; }
  .memory-fact.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

  .memory-fact {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 20px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
  }

  .memory-fact.is-expired { background: var(--surface-sunken); }
  .memory-fact.is-expired .memory-fact-value { color: var(--ink-muted); }
  .memory-fact-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
  .memory-fact-key { flex: 1; margin: 0; min-width: 0; font-size: var(--text-body); font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
  .memory-fact-heading .badge { flex: 0 0 auto; white-space: nowrap; }
  .memory-fact .badge.memory-expired { color: var(--danger); background: var(--danger-soft); }
  .memory-fact-value { margin: 0; color: var(--ink); font-size: var(--text-body); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }

  .memory-fact-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding-block-start: 12px;
    border-block-start: 1px solid var(--line);
  }

  .memory-fact-edit > summary { list-style: none; }
  .memory-fact-edit > summary::-webkit-details-marker { display: none; }
  .memory-fact-edit[open] > summary { background: var(--surface-sunken); }
  .memory-fact-edit > summary::after { width: 6px; height: 6px; margin-inline: 8px 0; translate: 0 -2px; }
  .memory-fact-edit[open] > summary::after { translate: 0 2px; }
  .memory-fact-form { display: grid; gap: 16px; margin-block-start: 16px; }
  .memory-fact-form label { display: grid; }
  .memory-fact-form textarea { resize: vertical; line-height: 1.7; }
  .memory-fact-ttl input { max-width: 160px; }
  .memory-fact-ttl small { margin-block-start: 6px; color: var(--ink-muted); font-size: var(--text-caption); font-weight: 400; }
  .memory-fact-form .btn { justify-self: start; }
  .memory-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-block-start: 16px; color: var(--ink-muted); font-size: var(--text-small); }

  .capability-card-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .capability-card p {
    min-height: 0;
    font-size: var(--text-small);
    color: var(--ink-muted);
    margin-block: 12px;
  }

  .capability-card h3 {
    margin: 0;
    font-size: var(--text-h3);
  }

  .capability-card .settings-form {
    border: 0;
    padding: 0;
  }

  .capability-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    min-height: 44px;
    border: 0;
    border-radius: var(--radius-md);
    color: var(--ink-muted);
    background: transparent;
    font-size: var(--text-small);
  }

  .capability-toggle::before {
    content: '';
    width: 38px;
    height: 22px;
    border-radius: var(--radius-pill);
    background: radial-gradient(circle at 11px 11px, var(--surface) 7px, transparent 8px), var(--line-strong);
    flex: 0 0 auto;
  }

  .capability-toggle[aria-checked=true]::before {
    background: radial-gradient(circle at 27px 11px, var(--surface) 7px, transparent 8px), var(--accent);
  }

  .capability-toggle:disabled {
    color: var(--ink-subtle);
    opacity: 1;
  }

  .capability-card details {
    margin-top: 12px;
  }

  summary.btn {
    display: inline-flex;
    justify-content: start;
    white-space: normal;
  }

  summary.btn::marker {
    display: none;
    content: '';
  }

  summary.btn::-webkit-details-marker {
    display: none;
    content: '';
  }


  .record-list {
    display: grid;
    gap: 12px;
    margin-top: 24px;
  }

  .record-list article {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
  }

  .record-list h3 {
    font-size: var(--text-h3);
    font-weight: 600;
  }

  .record-list p {
    margin-top: 8px;
    color: var(--ink-muted);
    font-size: var(--text-small);
  }

  .record-list a.btn {
    margin: 0;
  }

  .unified-section {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
  }

  .unified-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .unified-section-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 24px;
  }

  .unified-section-heading p {
    color: var(--ink-muted);
    font-size: var(--text-small);
    max-width: 640px;
  }

  .inline-alert {
    padding: 16px;
    margin-block: 16px;
    border-radius: var(--radius-md);
  }

  .flash {
    position: fixed;
    inset-block-start: 76px;
    inset-inline: 16px;
    z-index: 20;
    width: fit-content;
    max-width: min(560px, calc(100% - 32px));
    margin-inline: auto;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: var(--text-small);
    font-weight: 500;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-float);
    background: var(--success-soft);
    color: var(--success);
  }

  .flash.alert {
    background: var(--danger-soft);
    color: var(--danger);
  }

  .form-errors {
    background: var(--danger-soft);
    color: var(--danger);
  }

  .message.user .message-avatar {
    border-radius: 50%;
    background: var(--surface-sunken);
    color: var(--ink);
    font-weight: 700;
  }

  .workspace-main-chat .message-avatar {
    display: grid;
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 36px;
    height: 36px;
  }

  .workspace-main-chat .message-meta {
    min-height: 36px;
    padding-inline-start: 48px;
    margin-block: 0 8px;
    gap: 12px;
    font-size: 15px;
    color: var(--ink);
  }

  .message-meta time {
    font-size: var(--text-caption);
    color: var(--ink-muted);
  }

  .message-content {
    min-width: 0;
    max-width: 100%;
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--ink);
    font-size: var(--text-body);
    line-height: 1.7;
    border-radius: 0;
  }

  .message.user .message-content {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
  }

  .message-content :is(h1, h2, h3, h4, h5, h6) {
    font-size: var(--text-h3);
    margin-block: 24px 8px;
  }

  .message-content > :first-child {
    margin-top: 0;
  }

  .message-content > :last-child {
    margin-bottom: 0;
  }

  .fleet-request {
    background: var(--surface-tint);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-width: 560px;
  }

  .fleet-request-status {
    background: var(--surface-tint);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    margin-top: 12px;
  }

  .input-request {
    background: var(--surface-tint);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-width: 560px;
  }

  .image-request-card {
    background: var(--surface-tint);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-width: 560px;
  }

  .suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .suggestions button {
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    padding: 8px 12px;
    color: var(--accent);
    font-size: var(--text-small);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-align: start;
    white-space: normal;
  }

  .suggestion-text {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .suggestions button .icon {
    flex-shrink: 0;
  }

  .message-form {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    padding: 10px;
    box-shadow: var(--shadow-float);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .message-form textarea {
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    max-height: 200px;
    resize: none;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 8px 10px;
    font: inherit;
    font-size: var(--text-body);
  }

  .chat-composer-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    background: var(--primary);
    color: var(--surface);
    border: 0;
    border-radius: var(--radius-md);
  }

  .chat-composer-button:disabled {
    background: var(--surface-sunken);
    color: var(--ink-subtle);
    opacity: 1;
  }

  .composer-note {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .bookmark-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-block: 16px;
  }

  .bookmark-share {
    display: grid;
    gap: 12px;
    padding: 16px;
    margin-block: 24px;
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
  }

  .embed-code {
    display: grid;
    gap: 12px;
    padding: 16px;
    margin-block: 24px;
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
  }

  .embed-code textarea {
    font-family: monospace;
  }

  .table-scroll {
    overflow-x: auto;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-small);
    text-align: start;
  }

  th {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: start;
    font-weight: 600;
  }

  td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: start;
  }

  .result-list > div {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) 3fr;
    gap: 16px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }

  .result-list dt {
    color: var(--ink-muted);
  }

  .result-list dd {
    min-width: 0;
    margin: 0;
  }

  .result-list .message-content {
    font-size: var(--text-small);
  }

  .stretched-link::after {
    content: '';
    position: absolute;
    inset: 0;
  }

  @media(min-width: 1200px) {

  }

  @media(max-width: 1200px) {

  }

  @media(max-width: 900px) {
    .sidebar form {
      flex: 0 0 auto;
    }

    .conversation-icon {
      width: 25px;
      height: 25px;
    }

    .agent-directory-open {
      gap: 12px;
      flex-wrap: wrap;
    }

    .agent-directory-info {
      width: 100%;
      grid-template-columns: minmax(0,1.5fr) repeat(2,minmax(0,.7fr)) minmax(0,1fr);
    }

    .agent-directory-info > div {
      text-align: start;
    }

    .agent-directory-summary {
      min-width: 0;
    }

    .conversation-group {
      flex: 0 0 auto;
      border-top: 0;
      border-inline-start: 1px solid var(--line);
      padding: 0 12px;
      min-width: 170px;
      max-width: 390px;
    }

    .conversation-group:first-child {
      border-inline-start: 0;
      padding-inline-start: 0;
    }

    .conversation-group-heading {
      padding-inline: 4px;
    }

    .conversation-channel-heading {
      margin: 8px 4px 4px;
    }

    .landing-steps {
      grid-template-columns: 1fr;
    }

    .landing-contact {
      grid-template-columns: 1fr;
    }

    .catalog-nav {
      display: none;
    }

    .catalog-hero {
      gap: 40px;
      grid-template-columns: 1fr;
      min-height: 0;
      padding-block: 42px 70px;
    }

    .customization-layout {
      gap: 42px;
      grid-template-columns: 1fr;
    }

    .work-preview {
      max-width: 560px;
      transform: none;
    }

    .default-ai-form {
      grid-template-columns: 1fr;
    }

    .default-ai-form > .btn {
      margin-top: 0;
    }

    .provider-manager-header {
      align-items: flex-start;
      flex-direction: column;
      padding: 24px;
    }

    .provider-manager-header > div {
      align-items: flex-start;
      flex-direction: column;
      gap: 2px;
    }

    .provider-row summary {
      grid-template-columns: minmax(0,1fr) auto;
      padding: 21px 24px;
    }

    .provider-status {
      grid-column: 1;
    }

    .provider-identity strong {
      font-size: var(--text-body);
    }

    .provider-editor {
      padding: 22px 24px;
    }

    .provider-editor-actions {
      align-items: stretch;
      flex-direction: column;
    }

    .bookmarks-toggle-mobile {
      border: 0;
      padding: 7px;
    }

    .bookmarks-toggle-mobile .bookmarks-toggle-label {
      display: none;
    }

    .bookmarks-toggle-mobile .bookmarks-count {
      font-size: var(--text-caption);
      min-width: 16px;
    }

    .bookmarks-handle {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 28px;
      flex-shrink: 0;
      touch-action: none;
      cursor: grab;
    }

    .bookmarks-handle span {
      width: 38px;
      height: 4px;
      border-radius: 4px;
      background: var(--line-strong);
    }

    .bookmarks-panel-header {
      margin-bottom: 12px;
    }

    .bookmarked-file {
      padding: 14px;
    }

    .bookmarked-file-download {
      width: 40px;
      height: 44px;
    }

    .bookmarks-toggle-mobile:not(.has-files) .bookmarks-count {
      display: none;
    }
  }

  @media (max-width: 900px) {
    .sidebar > form {
      position: sticky;
      inset-inline-start: 0;
      z-index: 1;
      background: var(--surface-sunken);
      align-self: flex-start;
    }

    .conversation-group {
      flex: 0 0 100%;
      min-width: 0;
      max-width: none;
      overflow-y: auto;
    }
  }

  @media(max-width: 600px) {
    .wrap {
      padding-inline: 20px;
    }

    .site-header {
      height: 82px;
      gap: 15px;
    }

    .header-actions {
      gap: 14px;
      font-size: var(--text-small);
    }

    .login-link {
      font-size: var(--text-caption);
    }

    .builder {
      margin-inline: 16px;
      border-radius: 13px;
    }

    .question {
      font-size: var(--text-small);
    }

    .choice {
      padding: 13px 9px;
      gap: 7px;
    }

    .choice strong {
      font-size: var(--text-caption);
    }

    .choice small {
      font-size: var(--text-caption);
    }

    footer.wrap {
      flex-wrap: wrap;
      gap: 20px;
    }

    footer > span:nth-child(2) {
      order: 3;
      width: 100%;
    }

    .input-value-form {
      align-items: stretch;
      flex-direction: column;
    }

    .auth-page {
      padding-top: 35px;
    }

    .auth-card {
      padding: 25px;
    }

    .auth-card h1 {
      font-size: var(--text-h1);
    }

    .agent-selection-toolbar {
      align-items: flex-start;
      flex-direction: column;
    }

    .agent-bulk-actions {
      margin-inline-start: 0;
    }

    .agent-directory-open {
      padding: 16px 10px;
    }

    .directory-arrow {
      display: none;
    }

    .agent-directory-row > form {
      padding: 10px;
    }

    .agent-directory-open h2 {
      font-size: var(--text-body);
    }

    .agent-directory-info {
      gap: 12px;
      grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .agent-directory-info dd {
      font-size: var(--text-small);
    }

    .home-header {
      height: 74px;
    }

    .home-header .login-link {
      font-size: var(--text-caption);
    }

    .landing-actions {
      gap: 14px;
      flex-wrap: wrap;
    }

    .landing-contact {
      margin-inline: 12px;
      padding: 35px 24px;
      gap: 25px;
    }

    .catalog-hero {
      padding-block: 25px 58px;
    }

    .catalog-hero h1 {
      font-size: var(--text-display);
      letter-spacing: -1.8px;
    }

    .catalog-hero-copy > p {
      font-size: var(--text-h3);
    }

    .work-preview-item {
      padding: 15px 17px;
    }

    .work-preview-head {
      padding: 20px 17px;
    }

    .catalog-section {
      padding-block: 58px;
    }

    .customization-section {
      padding-block: 58px;
    }

    .personal-onboarding {
      align-items: flex-start;
      padding: 18px;
    }

    .catalog-contact {
      margin-inline: 12px;
    }

    .input-request-card .human-input-form {
      grid-template-columns: minmax(0,1fr);
    }

    .input-request-card {
      padding: 10px;
    }

    .fleet-collapse-toggle {
      order: 2;
    }

    .agent-directory-name {
      align-items: flex-start;
      flex-direction: column;
      gap: 4px;
    }

    .agent-directory-name h3 {
      font-size: var(--text-body);
    }
  }

  @media (max-width: 600px) {
    .search-controls {
      gap: 0;
    }

    .search-count {
      font-size: var(--text-caption);
      padding-inline: 2px;
    }

    .search-icon-button {
      width: 32px;
      height: 36px;
    }

    .search-icon-button.small {
      width: 26px;
    }

    .composer.searching .composer-input-row {
      gap: 2px;
    }

    .btn-sm {
      min-height: 44px;
    }

    .settings-form {
      padding: 16px;
    }

    .settings-form > .btn:last-child {
      width: 100%;
    }

    .card {
      padding: 16px;
    }

    .capability-card {
      padding: 16px;
    }

    .record-list article {
      padding: 16px;
      flex-wrap: wrap;
      align-items: flex-start;
    }

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

    .tabs {
      padding-inline: 16px;
      gap: 4px;
    }

    .workspace-main-chat .message-avatar {
      width: 24px;
      height: 24px;
    }

    .workspace-main-chat .message-avatar .icon {
      width: 18px;
      height: 18px;
    }

    .workspace-main-chat .message-meta {
      padding-inline-start: 32px;
      min-height: 28px;
      flex-wrap: wrap;
      gap: 8px;
    }

    .workspace-main-chat .message-processing-details {
      padding-inline-start: 32px;
    }

    .result-list > div {
      grid-template-columns: 1fr;
      gap: 8px;
    }

    .member-limits :is(th, td) {
      padding: 8px;
    }

    .member-limits input {
      min-width: 76px;
    }
  }

  @media(prefers-reduced-motion:reduce) {
    .typing-indicator i {
      animation: none;
    }

    .stream-cursor {
      animation: none;
    }
  }

  @media (hover:none) {
    .attachment-remove {
      opacity: 1;
      pointer-events: auto;
    }
  }

  .public-chat .message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
  }
}

@layer pages {
  .auth-links {
    font-size: var(--text-small);
    color: var(--accent);
      display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    text-align: center;
    margin-top: 24px;
}

  .auth-flower {
    color: var(--accent);
  }

  .auth-flower .icon {
    width: 40px;
    height: 40px;
  }

  .fleet-agent-form { max-width: 960px; margin-inline: auto; }
  .fleet-agent-details { display: grid; gap: 20px; margin-block: 24px; padding: 24px; }
  .fleet-agent-details label { display: block; margin-block-end: 8px; font-weight: 600; }
  .fleet-agent-details input, .fleet-agent-details textarea { width: 100%; }
  .fleet-agent-assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; margin-block: 20px; }
  .fleet-agent-assets fieldset { min-width: 0; padding: 20px; }
  .fleet-agent-assets legend { font-weight: 700; padding-inline: 6px; }
  .fleet-asset-option { display: flex; align-items: start; gap: 10px; padding-block: 10px; overflow-wrap: anywhere; cursor: pointer; }
  .fleet-asset-option input { flex: 0 0 auto; width: auto; margin-block-start: 4px; }
  .fleet-agent-submit { display: flex; gap: 12px; margin-block: 24px; }

  .fleet-directory-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    flex-wrap: wrap;
  }

  .fleet-directory-leader-link {
    flex: 1;
    min-width: 200px;
  }

  .fleet-directory-heading p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--ink-muted);
  }

  .agent-directory-open p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--ink-muted);
  }

  .fleet-directory-heading h2 {
    font-size: var(--text-h3);
  }

  .fleet-directory-group.paused {
    background: var(--surface-sunken);
  }

  .agent-select {
    display: grid;
    place-items: center;
    width: 24px;
    height: 44px;
    flex: 0 0 24px;
    cursor: pointer;
  }

  .agent-select input {
    position: static;
    opacity: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
  }

  .fleet-directory-heading:hover .agent-select input {
    opacity: 1;
  }

  .agent-select:focus-within input {
    opacity: 1;
  }

  .agent-directory:has(input[name="agent_ids[]"]:checked) .agent-select input {
    opacity: 1;
  }

  .blueprint-picker > h1 {
    font-size: var(--text-h1);
    font-weight: 700;
  }

  .profile-page h1 {
    font-size: var(--text-h1);
    font-weight: 700;
  }

  .blueprint-section {
    margin-top: 32px;
  }

  .blueprint-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
  }

  .blueprint-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 12px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 24px;
  }

  .blueprint-card form {
    margin-top: auto;
    padding-top: 16px;
  }

  .blueprint-card form .btn {
    width: 100%;
  }

  .blueprint-card .btn-secondary:hover,
  .blueprint-card .btn-secondary:focus-visible {
    background: var(--primary);
    color: var(--surface);
    border-color: var(--primary);
  }

  .blueprint-scratch {
    border-style: dashed;
    margin-top: 32px;
      flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
}

  .blueprint-members {
    padding: 0;
    margin: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .blueprint-members li {
    background: var(--surface-sunken);
    color: var(--ink-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-small);
  }

  .profile-page {
    padding-block: 32px 64px;
  }

  .profile-page > p {
    font-size: var(--text-body);
    color: var(--ink-muted);
  }

  .default-ai-card {
    box-shadow: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 1.5fr);
    align-items: center;
    gap: 24px;
    padding: 24px;
    margin-top: 32px;
    overflow: hidden;
  }

  .provider-manager {
    box-shadow: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    margin-top: 32px;
    overflow: hidden;
  }

  .provider-row-action {
    font-weight: 500;
  }

  .default-ai-form .btn {
    min-height: 44px;
  }

  .fleet-summary p {
    margin-top: 12px;
  }

  .fleet-summary .field-help {
    border-top: 1px solid var(--line);
    padding-top: 16px;
    margin-top: 16px;
  }

  .settings-section-title {
    margin-top: 32px;
    font-size: var(--text-h2);
  }

  .member-limits-form {
    display: grid;
    gap: 24px;
    margin-top: 24px;
  }

  .member-limits-form .btn {
    justify-self: end;
  }

  .usage-stat {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .site-header nav {
    font-size: var(--text-small);
    color: var(--ink-muted);
  }

  @media (max-width: 900px) {
    .blueprint-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .default-ai-card {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  @media (max-width: 600px) {
    .blueprint-grid {
      grid-template-columns: minmax(0, 1fr);
    }

    .fleet-directory-heading {
      gap: 12px;
      padding: 16px;
    }

    .fleet-directory-leader-link {
      min-width: 0;
      flex-basis: calc(100% - 100px);
    }

    .fleet-directory-heading > .btn {
      order: 1;
    }

    .fleet-directory-heading > form {
      order: 1;
    }

    .fleet-directory-count {
      order: 1;
    }

    .agent-select input {
      opacity: 1;
    }

    .default-ai-card {
      padding: 16px;
    }

    .fleet-request-status {
      flex-wrap: wrap;
    }
  }
}

@layer components {
  .page-header {
    margin-bottom: 32px;
  }
  .page-header h1 {
    font-size: var(--text-h1);
    margin-block: 8px;
  }
  .page-header .section-sub {
    font-size: var(--text-body);
    max-width: 640px;
  }
  details > summary {
    list-style: none;
    cursor: pointer;
  }
  details > summary::-webkit-details-marker {
    display: none;
  }
  details > summary::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-bottom: 2px solid currentColor;
    border-inline-end: 2px solid currentColor;
    transform: rotate(-45deg);
    margin-inline: 12px;
    vertical-align: 3px;
    transition: transform 150ms ease;
  }
  details[open] > summary::after {
    transform: rotate(135deg);
    vertical-align: 0;
  }
  .confirm-dialog {
    width: min(430px, calc(100% - 32px));
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-dialog);
    background: var(--surface);
    color: var(--ink);
  }
  .confirm-dialog::backdrop {
    background: rgb(0 0 0 / 35%);
  }
  .confirm-dialog p {
    margin-block: 16px 24px;
  }
  .dialog-actions {
    display: flex;
    justify-content: end;
    gap: 12px;
  }
  .data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: start;
  }
  .data-table th, .data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
  }
  .data-table thead {
    background: var(--surface-sunken);
    font-size: var(--text-small);
  }
  .model-table-card {
    padding: 0;
    overflow: hidden;
  }
  .model-table {
    table-layout: fixed;
  }
  .model-table th, .model-table td {
    vertical-align: top;
  }
  .model-table tr {
    align-items: start;
  }
  .model-table th:first-child {
    width: 22%;
  }
  .model-table th:last-child {
    width: 18%;
  }
  .model-table select {
    width: 100%;
    min-width: 0;
    font-size: var(--text-small);
    margin: 0;
    padding: 8px;
  }
  .model-price-cell { font-size: var(--text-small); }
  .model-price-value { display: inline-block; white-space: nowrap; }
  .model-provider-note, .model-retired-note { display: block; margin-top: 6px; color: var(--warning); font-size: var(--text-caption); }
  .model-save-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin-bottom: 12px; border: 1px solid var(--danger); border-radius: var(--radius-md); background: var(--danger-soft); color: var(--danger); }
  .unified-section-heading.with-action {
    flex-direction: row;
    justify-content: space-between;
    align-items: start;
    gap: 24px;
  }
  .fleet-member-identity {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .provider-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
  }
  .blueprint-scratch > div {
    flex: 1;
    min-width: 180px;
  }
  .blueprint-scratch form {
    margin: 0;
    padding: 0;
  }
  .connection-settings-card {
    max-width: 700px;
  }
  @media (max-width: 600px) {
    .tabs {
    mask-image: linear-gradient(to left, black 92%, transparent);
  }
    .model-table thead {
    display: none;
  }
    .model-table tbody {
    display: grid;
  }
    .model-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 16px;
    gap: 8px;
    border-bottom: 1px solid var(--line);
  }
    .model-table th:first-child, .model-table td:last-child {
    grid-column: 1 / -1;
    width: auto;
  }
    .model-table th, .model-table td {
    padding: 0;
    border: 0;
  }
    .model-table label.visually-hidden, .model-price-label {
    position: static !important;
    width: auto;
    height: auto;
    clip: auto;
    clip-path: none;
    display: block;
    margin-block: 4px;
  }
    .unified-section-heading.with-action {
    flex-direction: column;
    gap: 8px;
  }
    .blueprint-scratch {
    gap: 16px;
  }
  }
  @media (max-width: 359px) {
    .model-table tr {
    grid-template-columns: minmax(0, 1fr);
  }
  }
  @media (prefers-reduced-motion: reduce) {
    details > summary::after {
    transition: none;
  }
  }
}

@layer components {
  .public-chat .messages > .message:first-child {
    margin-top: auto;
  }
  .fleet-actions {
    position: relative;
  }
  .fleet-actions > summary {
    display: none;
  }
  .fleet-actions:not([open]) > .fleet-actions-list {
    display: none;
  }
  .fleet-actions-list {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .fleet-actions > summary::after {
    content: none;
  }
  .guardrails-page .settings-form select {
    width: 100%;
  }
  .broadcasts-page .settings-form > label {
    width: 100%;
    max-width: 640px;
  }
  .broadcasts-page .settings-form select {
    width: 100%;
  }
  @media (max-width: 600px) {
    .fleet-actions > summary {
    display: inline-flex;
  }
    .fleet-actions-list {
    position: absolute;
    inset-inline-end: 0;
    top: 44px;
    min-width: 200px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-float);
    background: var(--surface);
    z-index: 5;
    flex-direction: column;
    align-items: stretch;
  }
    .fleet-actions-list .btn {
    width: 100%;
  }
  }

  .topbar-new .icon {
    width: 18px;
    height: 18px;
  }

  .account-menu {
    position: relative;
  }

  .account-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    padding: 4px 6px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
  }

  .account-menu-button:hover,
  .account-menu-button[aria-expanded=true] {
    background: var(--accent-softer);
  }

  .account-menu-button .user-avatar {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
  }

  .account-menu-button .icon {
    width: 16px;
    height: 16px;
  }

  .account-menu-panel {
    position: absolute;
    inset-block-start: calc(100% + 6px);
    inset-inline-end: 0;
    width: 280px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-float);
    z-index: 9;
  }

  .account-menu-panel[hidden] {
    display: none;
  }

  .account-menu-identity {
    display: grid;
    gap: 2px;
    padding: 8px 12px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }

  .account-menu-identity small {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .account-menu-identity strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: end;
    font-size: var(--text-small);
    font-weight: 600;
  }

  .account-menu-logout {
    margin: 0;
  }

  .account-menu-panel .account-menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 44px;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: var(--text-small);
    text-align: start;
    cursor: pointer;
  }

  .account-menu-panel .account-menu-item:hover,
  .account-menu-panel .account-menu-item:focus-visible {
    background: var(--accent-softer);
  }

  .account-menu-panel .account-menu-item.selected {
    background: var(--accent-soft);
  }

  .account-menu-panel .account-menu-item .icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--ink-muted);
  }

  .account-menu-panel .account-menu-item > span {
    display: grid;
  }

  .account-menu-panel .account-menu-item strong {
    font-weight: 500;
  }

  .account-menu-panel .account-menu-item small {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  @media (max-width: 900px) {
    .topbar-nav {
      display: none;
    }
  }

  @media (max-width: 600px) {
    .account-menu-button .icon {
      display: none;
    }
  }

  .workspace-tabs-row > .tabs {
    flex: 1;
    min-width: 0;
    padding-inline-start: 8px;
    border-bottom: 0;
  }

  .workspace-tabs-row > .sidebar-toggle {
    width: 40px;
    height: 40px;
    color: var(--ink-muted);
  }

  .workspace-tabs-row > .sidebar-toggle[aria-expanded=true] {
    color: var(--accent);
  }

  .workspace-main-chat .demo-note {
    margin: 16px auto 0;
  }

  /* Reserve the bold width so the active tab never shifts its neighbours. */
  .tabs a {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
  }

  .tabs a::after {
    content: attr(data-label);
    height: 0;
    overflow: hidden;
    visibility: hidden;
    font-weight: 700;
    user-select: none;
  }

  .tabs {
    scrollbar-width: none;
  }

  .page-back {
    margin-inline-start: -12px;
    margin-bottom: 8px;
  }

  .page-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
  }

  .page-title-row h1 {
    margin-block: 8px;
  }

  .bookmark-reader header .page-back {
    align-self: flex-start;
  }

  .sidebar-empty {
    padding-inline: 12px;
    font-size: var(--text-small);
  }

  .usage-stat {
    margin-bottom: 32px;
  }

  .team-member-notice {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 16px;
    width: var(--chat-content-width, auto);
    max-width: var(--chat-column-width, 760px);
    margin: 16px auto 8px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: var(--text-small);
  }

  .team-member-notice p {
    grid-column: 1;
    margin: 0;
  }

  .team-member-notice .btn {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .team-member-chat > summary {
    width: var(--chat-content-width, auto);
    max-width: var(--chat-column-width, 760px);
  }

  @media (max-width: 600px) {
    .team-member-notice {
      grid-template-columns: minmax(0, 1fr);
    }

    .team-member-notice .btn {
      grid-column: 1;
      grid-row: auto;
      margin-top: 8px;
    }
  }

  details.settings-form > summary.btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding-inline: 0;
  }

  details.settings-form > summary.btn h3 {
    margin: 0;
  }

  details.settings-form > summary.btn::after {
    margin: 0;
  }

  details.settings-form[open] > summary {
    margin-bottom: 8px;
  }

  details.settings-form > p {
    margin: 0 0 8px;
  }

  details.settings-form > form {
    margin-top: 16px;
  }
}

.agent-info-items:empty { display: none; }
.fleet-sidebar-chats { padding: 12px; border-bottom: 1px solid var(--line); }
.sidebar-agent-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sidebar-agent-row > a { flex: 1; min-width: 0; }
.sidebar-agent-row > form { flex: 0 0 auto; margin: 0; }
.sidebar-agent-edit-control { width: 40px; height: 40px; min-height: 40px; padding: 8px; color: var(--ink-muted); }
.sidebar-agent-row > [hidden], .sidebar-agent-row > form.sidebar-agent-rename[hidden], .sidebar-agent-rename-error[hidden] { display: none; }
.sidebar-agent-row > form.sidebar-agent-rename { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; }
.sidebar-agent-rename input { flex: 1; width: 0; min-width: 60px; padding: 8px; }
.sidebar-agent-rename-error { width: 100%; color: var(--danger); font-size: var(--text-small); }
.sidebar-new-agent { display: flex; width: 100%; margin-block-end: 12px; }
.workspace-agent-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.agent-header-actions { position: relative; flex: 0 0 auto; }
.agent-header-actions > summary { list-style: none; width: 40px; height: 40px; min-height: 40px; padding: 8px; justify-content: center; }
.agent-header-actions > summary::-webkit-details-marker { display: none; }
.agent-header-actions > summary::after { content: none; }
.agent-header-actions-menu { position: absolute; top: 100%; inset-inline-start: 0; z-index: 10; width: 200px; max-width: calc(100vw - 24px); padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-float); }
.agent-header-actions-menu form { margin: 0; }
.agent-header-actions-menu hr { margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
.agent-header-menu-item { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); text-align: start; cursor: pointer; }
.agent-header-menu-item:hover { background: var(--accent-softer); }
.agent-header-menu-delete { color: var(--danger); }
.agent-info-items section { padding: 12px; border-bottom: 1px solid var(--line); }
.agent-info-heading { font-size: var(--text-small); }
.agent-info-items dl { margin: 12px 0 0; }
.agent-info-item + .agent-info-item { margin-top: 12px; }
.agent-info-item dt { color: var(--ink-muted); font-size: var(--text-small); }
.agent-info-item dt, .agent-info-item dd { display: flex; align-items: start; gap: 6px; }
.agent-info-item dt { position: relative; }
.agent-info-item dd { margin: 4px 0 0; font-size: var(--text-small); }
.agent-info-item dt > span[dir], .agent-info-item dd > [data-clipboard-target="source"] { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.agent-info-icon { display: inline-flex; flex-shrink: 0; padding: 2px; border: 0; background: transparent; color: var(--ink-muted); cursor: pointer; }
.agent-info-icon .icon { width: 16px; height: 16px; }
.agent-info-help { display: inline-flex; }
.agent-info-tooltip { display: none; position: absolute; inset-inline-start: 0; top: 100%; z-index: 10; width: max-content; max-width: min(240px, 70vw); padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface, white); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--text-small); }
.agent-info-help:hover .agent-info-tooltip, .agent-info-help:focus-within .agent-info-tooltip { display: block; }
.agent-info-copy-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.waha-chat-options {
  display: grid;
  gap: 0.5rem;
  margin-block: 0.75rem;
}

.waha-chat-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 0.5rem;
  cursor: pointer;
}

.waha-selected-chats:empty {
  display: none;
}

@layer components {
  .default-ai-provider, .default-ai-model { display: grid; gap: 8px; min-width: 0; }
  .searchable-select { min-width: 0; width: 100%; }
  .searchable-select input { width: 100%; min-height: 44px; font-size: var(--text-small); font-weight: 400; }
  .searchable-select-field { position: relative; }
  .searchable-select-field input { padding-right: 44px; }
  .searchable-select-search-button { position: absolute; right: 2px; top: 2px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink-muted); }
  .searchable-select-search-button:hover { color: var(--accent); background: var(--accent-softer); }
  .searchable-select-selected-detail { margin: 6px 0 0; font-size: var(--text-caption); color: var(--ink-muted); }
  .model-pricing-help, .searchable-select-detail-info, .searchable-select-hint { display: block; margin-top: 6px; font-size: var(--text-caption); color: var(--ink-muted); font-weight: 400; }
  .searchable-select-options {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 5px;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 8px 28px #0002;
    font-size: var(--text-small);
  }
  .searchable-select-options li { padding: 9px 10px; border-radius: 6px; overflow-wrap: anywhere; }
  .searchable-select-options [role=option] { cursor: pointer; display: flex; align-items: center; gap: 12px; }
  .searchable-select-option-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .searchable-select-option-detail { flex: 0 0 auto; color: var(--ink-muted); font-size: var(--text-caption); font-weight: 400; white-space: nowrap; }
  .searchable-select-options [aria-selected=true] { font-weight: 600; }
  .searchable-select-options .active, .searchable-select-options [role=option]:hover { background: var(--accent-soft); }
}

@layer components {
  .imap-setup-form { display: grid; gap: 12px; min-width: 0; margin-top: 16px; }
  .imap-setup-form label { display: grid; gap: 6px; font-size: var(--text-small); }
  .imap-setup-form input:not([type=submit]):not([type=hidden]),
  .imap-setup-form select, .imap-setup-form textarea { width: 100%; min-width: 0; box-sizing: border-box; }
  .imap-setup-form .field-help, .imap-permission-summary { margin: 0; font-size: var(--text-caption); }
  .imap-setup-form .field-help { color: var(--ink-muted); }
  .imap-setup-options { border-top: 1px solid var(--line); padding-top: 10px; }
  .imap-setup-options > summary { cursor: pointer; color: var(--accent); font-size: var(--text-small); }
  .imap-setup-options[open] > summary { margin-bottom: 12px; }
  .imap-setup-options label + label { margin-top: 10px; }
  .imap-setup-form [hidden] { display: none !important; }
  .imap-setup-form > .btn { justify-self: start; }
}

@layer components {
  .chat-visualization { box-sizing: border-box; width: 100%; max-width: 800px; margin: 18px 0; padding: 18px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); min-width: 0; overflow: hidden; }
  .visualization-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
  .visualization-kind { font-size: 11px; color: var(--ink-muted); background: var(--surface-sunken); padding: 2px 8px; border-radius: var(--radius-pill); }
  .visualization-note { color: var(--ink-muted); font-size: 12px; margin: 8px 0; white-space: pre-wrap; }
  .visualization-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0; }
  .visualization-toolbar input[type=search] { min-height: 34px; padding: 4px 10px; width: 170px; max-width: 100%; font-size: 13px; }
  .visualization-table-wrap { overflow-x: auto; max-height: 600px; }
  .visualization-table-wrap table { margin: 0; width: 100%; font-size: 13px; }
  .visualization-table-wrap th { position: sticky; top: 0; background: var(--surface-sunken); white-space: nowrap; }
  .visualization-table-wrap th button { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-align: inherit; }
  .visualization-table-wrap td { max-width: 300px; }
  .visualization-pagination { display: flex; justify-content: center; align-items: center; gap: 12px; font-size: 12px; margin-top: 8px; }
  .visualization-chart svg { display: block; width: 100%; min-width: 320px; height: auto; font-family: 'Heebo', Arial, sans-serif; }
  .visualization-chart { position: relative; overflow-x: auto; }
  .visualization-tooltip { position: absolute; z-index: 1; transform: translateX(-50%); max-width: min(280px, 90%); padding: 6px 10px; border-radius: 6px; background: var(--ink); color: var(--surface, white); font-size: 13px; pointer-events: none; text-align: center; }
  .visualization-chart circle:focus, .visualization-chart rect:focus { outline: 2px solid var(--ink); outline-offset: 2px; }
  .visualization-kpi { font-size: clamp(30px, 5vw, 48px); font-weight: 700; font-variant-numeric: tabular-nums; }
  .visualization-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
  .visualization-series { font: inherit; font-size: 12px; color: var(--ink); border: 1px solid var(--line); background: transparent; border-radius: var(--radius-pill); padding: 3px 10px; cursor: pointer; }
  .visualization-series::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--series-color); margin-inline-end: 6px; }
  .visualization-series[aria-pressed=false] { opacity: .45; text-decoration: line-through; }
  .chat-visualization [hidden] { display: none !important; }
  @media (max-width: 600px) { .chat-visualization { padding: 10px; } }
}

.saved-prompt-send {
  width: 100%;
  flex-direction: column;
  align-items: stretch;
  text-align: start;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.saved-prompt-send small { color: var(--ink-muted); }
.saved-prompts-hint { color: var(--ink-muted); font-size: var(--text-small); margin-bottom: 12px; }

@layer components {
  .protected-resource-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
  .public-chat > header { flex-wrap: wrap; }
  .public-chat.files-open, .public-chat.prompts-open { padding-inline-end: 320px; max-width: 1060px; }
  .public-chat.public-chat-framed { max-width: none; }
  .public-chat .bookmarks-panel { inset-block-start: 0; }
  .protected-document-reader { max-width: 900px; margin: auto; padding: 24px; }
  @media (max-width: 600px) {
    .public-chat.files-open, .public-chat.prompts-open { padding-inline-end: 20px; }
    .public-chat .bookmarks-panel { inset-block-start: auto; }
    .protected-resource-toggles .bookmarks-toggle-label { display: none; }
  }
}

.saved-prompt-inputs { border: 0; margin: 0; padding: 12px; min-width: 0; display: grid; gap: 8px; }
.saved-prompt-inputs[hidden] { display: none; }
.saved-prompt-inputs legend { font-weight: 600; }
.saved-prompt-inputs input { width: 100%; box-sizing: border-box; }
.saved-prompt-inputs button { margin-top: 4px; }

@layer components {
  .workspace-main-chat .owner-chat-theme,
  .workspace-main-chat .owner-chat-theme .composer {
    background: var(--chat-background, var(--paper));
  }

  .owner-chat-theme .message-content {
    color: var(--chat-text, var(--ink));
    font-size: var(--chat-font-size, var(--text-body));
  }

  .owner-chat-theme .message.assistant .message-content {
    background: var(--chat-assistant-background, transparent);
    border-radius: var(--chat-bubble-radius, 0);
  }

  .owner-chat-theme .message.user .message-content {
    background: var(--chat-user-background, var(--surface));
    color: var(--chat-user-text, var(--chat-text, var(--ink)));
    border-color: var(--chat-border, var(--line));
    border-radius: var(--chat-bubble-radius, var(--radius-lg));
  }

  .owner-chat-theme .message-form {
    background: var(--chat-composer-background, var(--surface));
    border-color: var(--chat-border, var(--line-strong));
    border-radius: var(--chat-bubble-radius, var(--radius-lg));
  }

  .owner-chat-theme .message-form textarea {
    color: var(--chat-text, var(--ink));
    font-size: var(--chat-font-size, var(--text-body));
  }

  .owner-chat-theme .message-meta time,
  .owner-chat-theme .composer-note {
    color: var(--chat-muted-text, var(--ink-muted));
  }

  .owner-chat-theme .message-form textarea::placeholder {
    color: var(--chat-muted-text, var(--ink-subtle));
  }

  .owner-chat-theme .message-content a {
    color: var(--chat-accent, var(--accent));
  }

  .owner-chat-theme .chat-composer-button:not(:disabled) {
    background: var(--chat-accent, var(--primary));
    color: var(--chat-accent-text, var(--surface));
  }
}

@layer components {
  .agent-logs-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
  }

  .agent-logs-toolbar h2 { margin: 0; }

  .agent-log-list {
    margin-bottom: var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
    font-size: var(--text-small);
  }

  .agent-log-entry + .agent-log-entry { border-block-start: 1px solid var(--line); }

  .agent-log-line {
    display: grid;
    grid-template-columns: 9.5ch 9rem 6.5rem minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    line-height: 1.4;
    white-space: nowrap;
  }

  .agent-log-line::after { margin-inline: 0; }
  .agent-log-line:hover, .agent-log-entry[open] > .agent-log-line { background: var(--surface-tint); }
  .agent-log-line:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

  .agent-log-line time {
    color: var(--ink-subtle);
    font-size: var(--text-caption);
    font-variant-numeric: tabular-nums;
    text-align: start;
  }

  .agent-log-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-self: start;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-size: var(--text-caption);
    font-weight: 500;
  }

  .agent-log-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
  }

  .agent-log-entry:is([data-status="completed"], [data-status="connected"], [data-status="accepted"]) .agent-log-status { background: var(--success-soft); color: var(--success); }
  .agent-log-entry:is([data-status="failed"], [data-status="error"], [data-status="limit_exceeded"], [data-status="needs_attention"]) .agent-log-status { background: var(--danger-soft); color: var(--danger); }
  .agent-log-entry:is([data-status="running"], [data-status="sending"], [data-status="received"]) .agent-log-status { background: var(--info-soft); color: var(--info); }
  .agent-log-entry:is([data-status="pending"], [data-status="queued"]) .agent-log-status { background: var(--warning-soft); color: var(--warning); }

  .agent-log-kind { color: var(--ink-muted); }
  .agent-log-name { overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
  .agent-log-duration { color: var(--ink-subtle); font-size: var(--text-caption); font-variant-numeric: tabular-nums; }

  .agent-log-details {
    padding: var(--space-3) var(--space-4);
    border-block-start: 1px solid var(--line);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .agent-log-details pre {
    margin: var(--space-2) 0 0;
    padding: var(--space-3);
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .agent-log-empty {
    padding: var(--space-5);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-md);
    color: var(--ink-subtle);
    text-align: center;
  }

  @media (max-width: 700px) {
    .agent-log-line {
      grid-template-columns: auto auto minmax(0, 1fr) auto;
      grid-template-areas: "status kind time chevron" "name name duration duration";
      row-gap: var(--space-1);
    }

    .agent-log-line time { grid-area: time; justify-self: end; }
    .agent-log-status { grid-area: status; }
    .agent-log-kind { grid-area: kind; }
    .agent-log-name { grid-area: name; }
    .agent-log-duration { grid-area: duration; justify-self: end; }
    .agent-log-line::after { grid-area: chevron; }
  }
}

@layer components {
  .permission-request {
    margin-block: 12px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
  }

  .permission-request-row {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .permission-request-summary {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: var(--text-small);
    line-height: 1.6;
  }

  .permission-request-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
  }

  .permission-request-actions form { margin: 0; }

  .permission-request-details {
    margin-block-start: 6px;
    font-size: var(--text-small);
    color: var(--ink-muted);
  }

  .permission-request-details summary {
    width: fit-content;
    cursor: pointer;
  }

  .permission-request-details p { margin-block: 12px 8px; }
  .permission-request-details pre { overflow-x: auto; }

  @media (max-width: 480px) {
    .permission-request-row { flex-wrap: wrap; gap: 8px; }
  }
}

/* Fleet designer: one-screen map of agents, channels, connections and resources. */
@layer pages {
  .fleet-designer {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--paper);
  }

  .designer-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-5);
    align-items: flex-end;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    background: var(--surface);
    border-block-end: 1px solid var(--line);
  }

  .designer-heading h1 {
    margin: var(--space-1) 0 0;
    font-size: var(--text-h2);
  }

  .designer-heading .section-sub {
    margin: 0;
  }

  .designer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
  }

  .designer-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    border: 0;
  }

  .designer-filter {
    display: inline-flex;
    gap: var(--space-1);
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    font-size: var(--text-small);
    cursor: pointer;
  }

  .designer-filter::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--node-color);
  }

  .designer-filter input,
  .designer-toggle input {
    display: inline-block;
    margin: 0;
  }

  .designer-zoom {
    display: flex;
    gap: var(--space-1);
  }

  .designer-status {
    min-height: 1.5em;
    margin: 0;
    padding: var(--space-1) var(--space-5);
    font-size: var(--text-small);
    color: var(--ink-muted);
  }

  .designer-status.is-error {
    color: var(--danger);
  }

  .designer-body {
    display: grid;
    flex: 1;
    grid-template-columns: 280px minmax(0, 1fr) 400px;
    min-height: 0;
  }

  .designer-panel {
    overflow-y: auto;
    padding: var(--space-4);
    background: var(--surface);
  }

  .designer-panel h2 {
    margin: 0 0 var(--space-3);
    font-size: var(--text-h3);
  }

  .designer-findings {
    border-inline-end: 1px solid var(--line);
  }

  .designer-inspector {
    border-inline-start: 1px solid var(--line);
  }

  .designer-finding-list {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .designer-finding {
    display: grid;
    gap: var(--space-1);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: var(--text-small);
    text-align: start;
    cursor: pointer;
  }

  .designer-finding:hover,
  .designer-finding.is-selected {
    border-color: var(--line-strong);
    background: var(--surface-tint);
  }

  .designer-severity {
    justify-self: start;
    padding: 1px var(--space-2);
    border-radius: var(--radius-pill);
    font-size: var(--text-caption);
    font-weight: 600;
  }

  .severity-high {
    color: var(--danger);
    background: var(--danger-soft);
  }

  .severity-medium {
    color: var(--warning);
    background: var(--warning-soft);
  }

  .severity-low {
    color: var(--info);
    background: var(--info-soft);
  }

  .designer-viewport {
    position: relative;
    overflow: hidden;
    background-color: var(--paper);
    background-image: radial-gradient(var(--line) 1px, transparent 1px);
    background-size: 24px 24px;
    cursor: grab;
    touch-action: none;
  }

  .designer-viewport.is-panning {
    cursor: grabbing;
  }

  .designer-stage {
    position: absolute;
    inset-block-start: 0;
    left: 0;
    direction: ltr;
    transform-origin: 0 0;
  }

  .designer-hint {
    position: absolute;
    inset-block-end: var(--space-3);
    inset-inline-start: var(--space-3);
    max-width: 420px;
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-float);
    font-size: var(--text-caption);
    color: var(--ink-muted);
  }

  .designer-edges {
    position: absolute;
    overflow: visible;
    pointer-events: none;
  }

  .designer-edge-line {
    fill: none;
    stroke: var(--line-strong);
    stroke-width: 1.5;
  }

  .designer-edge-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 14;
    pointer-events: stroke;
    cursor: pointer;
  }

  .designer-edge-label {
    font: 600 11px Heebo, sans-serif;
    fill: var(--ink-muted);
    paint-order: stroke;
    stroke: var(--paper);
    stroke-width: 4;
  }

  .designer-marker {
    fill: var(--line-strong);
  }

  .edge-manages .designer-edge-line { stroke: var(--primary); stroke-width: 2; }
  .edge-routes .designer-edge-line { stroke: var(--info); }
  .edge-owns.is-granted .designer-edge-line,
  .edge-grant .designer-edge-line { stroke: var(--success); stroke-width: 2.5; }
  .edge-fleet_access .designer-edge-line { stroke: var(--warning); stroke-dasharray: 6 4; }
  .edge-published .designer-edge-line { stroke: var(--accent); stroke-dasharray: 3 3; }
  .edge-exposes .designer-edge-line { stroke: var(--danger); stroke-dasharray: 6 4; }
  .marker-manages { fill: var(--primary); }
  .marker-routes { fill: var(--info); }
  .marker-grant { fill: var(--success); }
  .marker-fleet_access { fill: var(--warning); }
  .marker-published { fill: var(--accent); }
  .marker-exposes { fill: var(--danger); }

  .designer-edge.is-dimmed {
    opacity: 0.15;
  }

  .designer-edge.is-related .designer-edge-line,
  .designer-edge.is-selected .designer-edge-line {
    stroke-width: 3;
  }

  .designer-edge.is-selected .designer-edge-line {
    filter: drop-shadow(0 0 3px var(--highlight));
  }

  .designer-edge-draft {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-dasharray: 4 4;
  }

  .designer-node {
    position: absolute;
    inset-block-start: 0;
    left: 0;
    display: flex;
    gap: var(--space-2);
    align-items: center;
    box-sizing: border-box;
    width: 208px;
    height: 64px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line);
    border-inline-start: 4px solid var(--node-color, var(--line-strong));
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 0 1px 2px #26342b0f;
    direction: rtl;
    cursor: pointer;
    user-select: none;
    touch-action: none;
  }

  .designer-node:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }

  .designer-node.is-dragging {
    box-shadow: var(--shadow-float);
    cursor: grabbing;
  }

  .designer-node.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }

  .designer-node.is-dimmed {
    opacity: 0.35;
  }

  .designer-node.is-drop-target {
    background: var(--accent-soft);
    border-color: var(--accent);
  }

  .designer-node.is-hidden {
    display: none;
  }

  .designer-node.is-disabled .designer-node-text {
    color: var(--ink-subtle);
  }

  .designer-type-agent { --node-color: var(--primary); }
  .designer-type-channel { --node-color: var(--info); }
  .designer-type-connection { --node-color: var(--warning); }
  .designer-type-tool { --node-color: var(--accent); }
  .designer-type-credential,
  .designer-type-input { --node-color: var(--danger); }
  .designer-type-documents,
  .designer-type-destination { --node-color: var(--line-strong); }

  .designer-role-leader {
    background: var(--accent-softer);
    border-color: var(--accent);
    border-inline-start-color: var(--node-color);
  }

  .designer-node.is-fleet-scope {
    border-style: dashed;
    border-inline-start-style: solid;
  }

  .designer-node-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--ink-muted);
  }

  .designer-node-icon .icon {
    width: 20px;
    height: 20px;
  }

  .designer-node-text {
    display: grid;
    min-width: 0;
  }

  .designer-node-text strong,
  .designer-node-text small {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .designer-node-text strong {
    font-size: var(--text-small);
  }

  .designer-node-text small {
    font-size: var(--text-caption);
    color: var(--ink-muted);
  }

  .designer-node-badge {
    position: absolute;
    inset-block-start: -8px;
    inset-inline-start: -8px;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: var(--text-caption);
    font-weight: 700;
  }

  .designer-node-handle {
    position: absolute;
    inset-block-start: calc(50% - 7px);
    inset-inline-end: -8px;
    width: 14px;
    height: 14px;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
    cursor: crosshair;
  }

  .designer-inspector-header {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    margin-block-end: var(--space-3);
  }

  .designer-inspector-header h2 {
    margin: 0;
  }

  .designer-inspector-header .section-sub {
    margin: 0;
    font-size: var(--text-small);
  }

  .designer-inspector-findings {
    display: grid;
    gap: var(--space-2);
    margin: 0 0 var(--space-3);
    padding: 0;
    list-style: none;
    font-size: var(--text-small);
  }

  .designer-inspector-findings li {
    display: grid;
    gap: var(--space-1);
  }

  .designer-fact {
    display: grid;
    gap: 2px;
    margin: 0 0 var(--space-3);
    font-size: var(--text-small);
  }

  .designer-fact span {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .designer-fact strong {
    font-weight: 500;
  }

  .designer-toggle,
  .designer-select {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    margin-block-end: var(--space-2);
    font-size: var(--text-small);
  }

  .designer-select {
    justify-content: space-between;
  }

  .designer-select select {
    max-width: 60%;
    margin: 0;
  }

  .designer-section {
    margin-block-start: var(--space-4);
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--line);
  }

  .designer-section h3 {
    margin: 0 0 var(--space-2);
    font-size: var(--text-body);
  }

  .designer-checklist {
    display: grid;
    margin: 0 0 var(--space-2);
    padding: 0;
    border: 0;
  }

  .designer-checklist legend {
    margin-block-end: var(--space-2);
    font-size: var(--text-small);
    font-weight: 600;
  }

  .designer-disclosure {
    margin-block: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
  }

  .designer-disclosure summary {
    font-size: var(--text-small);
    font-weight: 600;
    cursor: pointer;
  }

  .designer-disclosure[open] summary {
    margin-block-end: var(--space-2);
  }

  .designer-list {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-small);
  }

  .designer-list li,
  .designer-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    justify-content: space-between;
  }

  .designer-document-name {
    flex: 1 1 8rem;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .designer-document-actions {
    display: flex;
    gap: var(--space-1);
  }

  .designer-list li small {
    flex-basis: 100%;
    color: var(--ink-muted);
  }

  .designer-access-filter {
    display: grid;
    gap: var(--space-2);
    margin-block-end: var(--space-2);
  }

  .designer-access-list {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .designer-access-row {
    display: grid;
    gap: 2px;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-small);
  }

  .designer-access-row.is-allowed {
    background: var(--surface-tint);
  }

  .designer-access-row small {
    color: var(--ink-muted);
    font-size: var(--text-caption);
  }

  .designer-access-title {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: space-between;
  }

  .designer-capabilities h4 {
    margin: var(--space-3) 0 var(--space-1);
    font-size: var(--text-small);
    color: var(--ink-muted);
  }

  .designer-capability-count {
    margin: 0 0 var(--space-2);
    font-size: var(--text-small);
    font-weight: 600;
  }

  .designer-authority {
    margin: 0;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    font-size: var(--text-small);
  }

  .designer-authority.is-owner {
    color: var(--warning);
    background: var(--warning-soft);
  }

  .designer-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .designer-chip {
    display: inline-flex;
    align-items: center;
    padding-inline-start: var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    font-size: var(--text-caption);
  }

  .designer-dialog {
    width: min(440px, 92vw);
    padding: var(--space-5);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dialog);
  }

  .designer-dialog h2 {
    margin: 0;
    font-size: var(--text-h3);
  }

  .designer-dialog-actions {
    display: flex;
    gap: var(--space-2);
  }

  @media (max-width: 1100px) {
    .designer-body {
      grid-template-columns: minmax(0, 1fr) 320px;
      grid-template-rows: minmax(0, 2fr) minmax(0, 3fr);
    }

    .designer-viewport {
      grid-row: 1 / span 2;
      grid-column: 1;
    }

    .designer-findings {
      grid-row: 1;
      grid-column: 2;
      border-inline-end: 0;
      border-inline-start: 1px solid var(--line);
      border-block-end: 1px solid var(--line);
    }

    .designer-inspector {
      grid-row: 2;
      grid-column: 2;
    }
  }

  @media (max-width: 760px) {
    .fleet-designer {
      height: auto;
      min-height: 100dvh;
    }

    .designer-body {
      grid-template-columns: 1fr;
      grid-template-rows: auto 60vh auto;
    }

    .designer-findings,
    .designer-viewport,
    .designer-inspector {
      grid-row: auto;
      grid-column: 1;
      border-inline-start: 0;
      border-block-end: 1px solid var(--line);
    }
  }
}

.global-search-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: 75vh;
  margin: 12vh auto auto;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 16px;
  box-shadow: 0 24px 80px #0003;
}
.global-search-dialog::backdrop { background: #0006; }
.global-search-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.global-search-dialog input { width: 100%; box-sizing: border-box; padding: 12px; font: inherit; }
.global-search-results { max-height: 45vh; overflow-y: auto; margin-bottom: 12px; }
.global-search-results a { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 8px; color: inherit; text-decoration: none; }
.global-search-results a:hover, .global-search-results a:focus { background: #eee; outline-offset: -2px; }
.global-search-results small { opacity: .7; }

.agent-search-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  white-space: nowrap;
  text-align: center;
  color: var(--ink-muted);
  font-size: .9rem;
  line-height: 1.8;
}
.agent-search-hint kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: .85em;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: baseline;
}


@media (max-width: 1100px) {
  .app-topbar .agent-search-hint { display: none; }
}
