:root {
  color-scheme: dark;
  --surface: #1b1b1b;
  --surface-raised: #262626;
  --surface-input: #222222;
  --surface-hover: #303030;
  --surface-active: #383838;
  --border: #3e3e3e;
  --border-focus: #676767;
  --text: #e0e0e0;
  --text-secondary: #c4c4c4;
  --text-muted: #a3a3a3;
  --text-disabled: #858585;
  --scrollbar: #666666;
  --accent: #dc0838;
  --accent-hover: #b8072f;
  --accent-text: #ff6682;
  --accent-surface: #3b2229;
  --danger-text: #ff8297;
  --success-text: #87d9aa;
  --success-surface: #21372b;
  --on-accent: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--surface);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea { font: inherit; }
input, textarea, select { color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }
::selection { background: var(--accent); color: var(--on-accent); }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.eyebrow-dark { color: var(--accent-text); }
.pulse-dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #dc08381c; }

/* Anmeldung */
.login-screen, .login-panel { min-height: 100dvh; background: var(--surface); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: min(100%, 400px); }
.login-card h2 { font-size: 42px; letter-spacing: -.06em; margin: 10px 0 8px; }
.login-intro { color: var(--text-muted); margin: 0 0 38px; }
.login-card label, .add-user-form label { display: block; font-size: 13px; font-weight: 700; margin: 20px 0 9px; }
.login-card input, .add-user-form input { display: block; width: 100%; height: 49px; border: 1px solid var(--border); border-radius: 10px; padding: 0 15px; background: var(--surface-raised); color: var(--text); outline: none; }
.login-card input:focus, .add-user-form input:focus, .search-dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #dc083829; }
.primary-button { border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 700; padding: 14px 20px; }
.primary-button:hover { background: var(--accent-hover); }
.login-button { margin-top: 26px; width: 100%; display: flex; justify-content: space-between; font-size: 15px; }
.login-button span { font-size: 19px; line-height: 15px; }
.form-error { min-height: 19px; color: var(--danger-text); font-size: 13px; }
.auth-link { display: block; margin: 8px auto 0; padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); font-size: 12px; }
.auth-link:hover { color: var(--accent-text); background: var(--accent-surface); }
.auth-message { color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.auth-message:empty { display: none; }
.login-button:disabled { opacity: .55; cursor: wait; }

/* Arbeitsbereich */
.workspace { height: 100dvh; display: grid; grid-template-columns: 272px minmax(0, 1fr); overflow: hidden; }
.sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface-raised); border-right: 1px solid var(--border); padding: 22px 12px 14px; }
.sidebar-header { display: flex; flex: none; align-items: center; gap: 8px; margin-bottom: 25px; }
.sidebar-toggle { flex: none; }
.sidebar-toggle:focus-visible, .mobile-menu:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.workspace.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.workspace.sidebar-collapsed .sidebar { visibility: hidden; overflow: hidden; padding-inline: 0; border-right: 0; }
.workspace.sidebar-collapsed .mobile-menu { display: grid; }
.side-brand { display: flex; flex: 1; min-width: 0; align-items: center; padding: 0 10px; border: 0; background: transparent; color: inherit; text-align: left; }
.side-brand:hover { color: var(--accent-text); }
.side-brand:disabled { cursor: default; }
.side-brand strong, .side-brand small { display: block; }
.side-brand strong { font-size: 17px; line-height: 1.1; letter-spacing: -.025em; }
.side-brand small { margin-top: 3px; color: var(--text-muted); font-size: 12px; }
.sidebar-actions { display: grid; gap: 2px; }
.new-chat-button, .sidebar-action-button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 43px; border: 0; border-radius: 10px; background: transparent; color: var(--text); padding: 10px 12px; text-align: left; font-size: 13px; font-weight: 600; }
.new-chat-button:hover, .sidebar-action-button:hover, .sidebar-action-button.active { background: var(--surface-hover); }
.sidebar-action-icon { flex: none; width: 19px; height: 19px; color: var(--text-secondary); }
.new-chat-button .sidebar-action-icon { color: var(--accent-text); }
.sidebar-action-button.active { color: var(--accent-text); }
.sidebar-action-button.active .sidebar-action-icon { color: var(--accent-text); }
.side-section-label { padding: 31px 12px 10px; color: var(--text-muted); font-size: 11px; font-weight: 700; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.chat-list-row { display: flex; align-items: center; min-width: 0; border-radius: 9px; }
.chat-list-row:hover, .chat-list-row.active { background: var(--surface-active); }
.chat-list-row.active .chat-item { font-weight: 650; }
.chat-item { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; border-radius: 9px; background: transparent; color: var(--text-secondary); padding: 10px 12px; text-align: left; font-size: 13px; }
.chat-menu-button { flex: none; width: 30px; height: 30px; margin-right: 4px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); font-size: 21px; line-height: 1; }
.chat-menu-button:hover, .chat-menu-button[aria-expanded=true] { background: var(--surface-active); color: var(--text); }
.chat-menu { position: fixed; z-index: 40; width: 190px; padding: 5px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-raised); box-shadow: 0 8px 28px #0002; }
.chat-menu button { display: block; width: 100%; border: 0; border-radius: 7px; padding: 10px 12px; background: transparent; color: var(--text); text-align: left; font-size: 13px; }
.chat-menu button:hover { background: var(--surface-hover); }
.chat-menu button:disabled { color: var(--text-disabled); cursor: default; }
.chat-menu .danger-text { color: var(--danger-text); }
.shared-chat-notice { color: var(--text-muted); font-size: 12px; text-align: center; padding: 12px; }
.chat-action-dialog label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 650; }
.chat-action-dialog select { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-raised); font: inherit; font-size: 13px; }
.chat-action-dialog p { font-size: 13px; line-height: 1.6; }
.dialog-chat-name { font-weight: 700; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.chat-share-list { display: grid; gap: 10px; margin-top: 22px; }
.chat-share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.chat-share-row span { min-width: 0; overflow-wrap: anywhere; }
.search-result-row { display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.search-result-row .search-result { flex: 1; min-width: 0; border-bottom: 0; }
.sidebar-backdrop { display: none; }
.main-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.topbar { flex: none; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--border); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-left { flex: 1; }
.topbar-actions, .topbar-left .icon-button { flex: none; }
.topbar-title { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; font-weight: 680; letter-spacing: -.02em; white-space: nowrap; }
.environment-badge, .class-badge { display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface-input); color: var(--text-muted); padding: 6px 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.environment-badge .pulse-dot { width: 6px; height: 6px; }
.text-button, .icon-button { border: 0; background: transparent; color: var(--text-secondary); }
.text-button { font-size: 12px; font-weight: 650; white-space: nowrap; }
.text-button:hover, .icon-button:hover { color: var(--accent-text); }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; font-size: 22px; line-height: 1; }
.icon-button:hover { background: var(--surface-hover); }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: 12px; }
.mobile-menu { display: none; }

/* Chat */
.chat-main { min-width: 0; min-height: 0; flex: 1; display: flex; flex-direction: column; }
.messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 28px 20px; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.thinking-status { display: inline-flex; align-items: center; gap: 11px; padding: 9px 0; color: var(--text-muted); font-size: 14px; }
.thinking-dots { display: inline-flex; align-items: center; gap: 4px; height: 14px; }
.thinking-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: thinking-pulse 1.2s ease-in-out infinite; }
.thinking-dots span:nth-child(2) { animation-delay: .16s; }
.thinking-dots span:nth-child(3) { animation-delay: .32s; }
@keyframes thinking-pulse { 0%, 70%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .thinking-dots span { animation: none; opacity: .7; } }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; text-align: center; padding: 20px 0 55px; }
.empty-state h2, .empty-state p { max-width: 100%; overflow-wrap: anywhere; }
.empty-state h2 { margin: 0; font-size: clamp(25px, 3vw, 33px); line-height: 1.2; letter-spacing: -.045em; font-weight: 650; }
.empty-state p { margin: 14px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.message-row { display: flex; width: min(100%, 760px); margin: 0 auto 30px; }
.message-body { min-width: 0; max-width: 100%; }
.message-meta { margin-bottom: 7px; color: var(--text-muted); font-size: 11px; font-weight: 600; }
.message-row.assistant .message-meta { display: flex; align-items: center; gap: 6px; }
.message-meta .message-model-icon { width: 16px; height: 16px; }
.message-content { color: var(--text); font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-row.user { justify-content: flex-end; }
.message-row.user .message-body { max-width: min(85%, 590px); }
.message-row.user .message-meta { text-align: right; }
.message-row.user .message-content { border-radius: 18px; background: var(--surface-hover); padding: 11px 16px; }
.composer-wrap { flex: none; width: min(100% - 48px, 800px); margin: 0 auto; padding: 0 0 16px; background: var(--surface); }
.composer { display: flex; flex-direction: column; gap: 10px; min-height: 76px; border: 1px solid var(--border); border-radius: 23px; background: var(--surface); padding: 12px 13px; box-shadow: 0 3px 18px #0000000b; }
.composer-row { display: flex; align-items: flex-end; gap: 10px; min-width: 0; }
.attachment-button { flex: none; align-self: flex-start; margin-top: 1.5px; display: grid; place-items: center; width: 34px; height: 36px; border: 0; border-radius: 50%; color: var(--text); background: transparent; }
.attachment-button:hover { background: var(--surface-raised); }
.attachment-button:disabled { opacity: .5; cursor: wait; }
.composer-attachments, .message-attachments { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.message-attachments { margin-top: 12px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; background: var(--surface-raised); font-size: 12px; overflow-wrap: anywhere; }
.attachment-chip > span { min-width: 0; }
.attachment-chip button { flex: none; border: 0; background: transparent; color: var(--text-muted); font-size: 20px; line-height: 1; }
.attachment-status { margin: 0; font-size: 12px; color: var(--text-muted); }
.composer:focus-within { border-color: var(--border-focus); box-shadow: 0 4px 20px #00000014; }
.composer textarea { flex: 1; min-width: 0; resize: none; overflow-y: hidden; border: 0; outline: 0; background: transparent; color: var(--text); padding: 9px 0 6px; line-height: 1.5; font-size: 14px; }
.composer textarea::placeholder { color: var(--text-muted); }
.model-picker { position: relative; flex: none; }
.model-picker-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 5px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-raised); cursor: pointer; }
.model-picker-button:hover { background: var(--surface-hover); }
.model-picker-button:focus-visible, .model-menu button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.model-picker-button:disabled { opacity: .55; cursor: default; }
.model-logo { flex: none; display: block; width: 24px; height: 24px; object-fit: contain; }
.model-logo-openai { filter: brightness(0) invert(1); }
.model-menu { position: absolute; right: 0; bottom: 46px; z-index: 45; width: min(272px, calc(100vw - 48px)); padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-raised); box-shadow: 0 8px 30px #0005; }
.model-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.model-menu button:hover, .model-menu button:focus-visible { background: var(--surface-hover); }
.model-menu button[aria-checked=true] { background: var(--surface-hover); }
.model-menu button[aria-checked=true]::after { content: '✓'; margin-left: auto; color: var(--accent-text); }
.model-menu strong, .model-menu small { display: block; }
.model-menu strong { font-size: 13px; font-weight: 600; }
.model-menu small { margin-top: 3px; font-size: 11px; color: var(--text-muted); }
.send-button { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 22px; line-height: 1; }
.send-button:hover { background: var(--accent-hover); }
.send-button:disabled { opacity: .5; cursor: wait; }
.dictation-button { flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--text); }
.dictation-button:hover { background: var(--surface-raised); }
.dictation-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dictation-button:disabled { opacity: .5; cursor: default; }
.dictation-button[aria-pressed=true] { color: var(--accent-text); border-color: var(--accent); background: var(--accent-surface); animation: dictation-pulse 1.4s ease-in-out infinite; }
.dictation-status { margin: 0; font-size: 12px; color: var(--text-muted); }
@keyframes dictation-pulse { 50% { box-shadow: 0 0 0 4px var(--accent-surface); } }
@media (prefers-reduced-motion: reduce) { .dictation-button[aria-pressed=true] { animation: none; } }
.composer-foot { display: flex; justify-content: flex-end; padding: 10px 14px 0; color: var(--text-muted); font-size: 10px; line-height: 1.4; text-align: right; }

/* Agenten und Dialoge */
.agents-view { min-height: 0; flex: 1; width: min(100%, 900px); margin: 0 auto; padding: 26px 28px; display: flex; flex-direction: column; }
.agents-heading { padding: 4px 0 20px; border-bottom: 1px solid var(--border); }
.agents-heading h1 { margin: 8px 0 0; font-size: 27px; letter-spacing: -.04em; }
.agents-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; }
.agents-empty-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--accent-surface); color: var(--accent-text); font-size: 34px; }
.agents-empty h2 { margin: 23px 0 7px; font-size: 25px; letter-spacing: -.035em; }
.agents-empty p { max-width: 420px; margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.agents-empty .primary-button { margin-top: 23px; }
.users-dialog, .search-dialog { width: min(92vw, 710px); max-height: min(88dvh, 760px); border: 1px solid var(--border); border-radius: 18px; padding: 27px 30px; background: var(--surface-raised); color: var(--text); box-shadow: 0 25px 80px #0003; }
.search-dialog { width: min(92vw, 620px); }
.users-dialog::backdrop, .search-dialog::backdrop { background: #17171788; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-header h2 { margin: 7px 0 20px; font-size: 26px; letter-spacing: -.04em; }
.users-list { max-height: 240px; overflow: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.user-row { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.user-row:last-child { border: 0; }
.user-row-main { flex: 1 1 160px; min-width: 0; }
.user-row-main strong, .user-row-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-main strong { font-size: 13px; }
.user-row-main small { margin-top: 3px; color: var(--text-muted); font-size: 11px; }
.user-role { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.state-button { border: 1px solid var(--border); border-radius: 7px; background: var(--surface-raised); color: var(--text-secondary); padding: 7px 10px; font-size: 11px; }
.state-button:hover { border-color: var(--accent); color: var(--accent-text); }
.add-user-form { margin-top: 22px; }
.add-user-form h3 { margin: 0 0 3px; font-size: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.add-user-form label { margin-top: 13px; }
.field-help { margin: 6px 0 17px; color: var(--text-muted); font-size: 11px; }
.search-dialog input { width: 100%; height: 48px; border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; background: var(--surface-raised); color: var(--text); outline: 0; }
.search-results { min-height: 100px; max-height: 380px; overflow-y: auto; margin-top: 18px; color: var(--text-muted); font-size: 13px; scrollbar-width: thin; }
.search-result { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 13px 5px; background: var(--surface-raised); color: var(--text); text-align: left; }
.search-result:hover, .search-result:focus-visible { background: var(--surface-hover); }
.search-result-title { display: block; font-size: 14px; font-weight: 700; }
.search-result-meta { display: block; margin-top: 5px; color: var(--text-muted); font-size: 11px; }
.status-message { position: fixed; z-index: 30; bottom: 24px; right: 24px; max-width: 330px; padding: 11px 15px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-hover); color: var(--text); font-size: 13px; box-shadow: 0 14px 35px #0002; opacity: 0; transform: translateY(8px); transition: .18s; pointer-events: none; }
.status-message.visible { opacity: 1; transform: none; }

@media (max-width: 980px) {
  .environment-badge { display: none; }
  .topbar { padding: 0 20px; }
}
@media (max-width: 700px) {
  .workspace { display: block; }
  .main-column { height: 100dvh; }
  .sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(84vw, 290px); transform: translateX(-100%); transition: transform .2s ease; box-shadow: 12px 0 34px #0002; }
  .sidebar.open { transform: none; }
  .sidebar-backdrop:not([hidden]) { display: block; position: fixed; z-index: 19; inset: 0; width: 100%; height: 100%; border: 0; background: #0006; }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 13px; }
  .topbar-left, .topbar-actions { gap: 8px; }
  .topbar-title { font-size: 13px; }
  .user-name { display: none; }
  .text-button { max-width: 116px; overflow: hidden; text-overflow: ellipsis; }
  .messages { padding: 18px 18px 8px; }
  .empty-state { padding-bottom: 20px; }
  .empty-state h2 { font-size: 26px; }
  .composer-wrap { width: calc(100% - 24px); padding-bottom: 10px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .agents-view { padding: 22px 18px; }
  .agents-empty { padding: 20px; }
  .users-dialog, .search-dialog { padding: 23px 20px; }
}
@media (max-width: 400px) {
  .environment-badge { display: none; }
  .topbar-actions { margin-left: auto; }
  .composer { flex-wrap: wrap; }
  .composer-row textarea { flex-basis: auto; }
  .model-picker { margin-left: auto; }
}

/* Agentenbereich */
.agents-view { width: 100%; max-width: none; min-height: 0; margin: 0; padding: 0 28px 28px; overflow-y: auto; }
.agent-catalog, .agent-editor { width: min(100%, 1220px); margin: 0 auto; }
.agents-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 30px 0 22px; border-bottom: 1px solid var(--border); }
.agents-heading h1, .agent-editor-title h1 { margin: 5px 0 0; font-size: 29px; letter-spacing: -.045em; }
.agents-heading p { margin: 8px 0 0; color: var(--text-muted); font-size: 13px; }
.secondary-button { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-raised); color: var(--text); padding: 10px 14px; font-size: 13px; font-weight: 650; }
.secondary-button:hover { background: var(--surface-hover); border-color: var(--border-focus); }
.agent-tabs { display: flex; gap: 5px; border-bottom: 1px solid var(--border); margin-top: 9px; overflow-x: auto; }
.agent-tab { flex: none; border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 14px 15px 12px; color: var(--text-muted); font-size: 13px; font-weight: 650; }
.agent-tab:hover { color: var(--text); }
.agent-tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.agent-filters { display: grid; grid-template-columns: minmax(150px, 2fr) repeat(4, minmax(90px, 1fr)); align-items: end; gap: 10px; padding: 22px 0; }
.agent-filters label, .agent-form label, .agent-share label, .agent-test-form label, .agent-input-row label { display: grid; gap: 6px; color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.agent-filters input, .agent-filters select, .agent-form input:not([type=checkbox]):not([type=file]), .agent-form select, .agent-form textarea, .agent-share textarea, .agent-test-form textarea, .agent-input-row input, .agent-input-row select { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-raised); color: var(--text); padding: 10px 11px; outline: none; font-size: 13px; }
.agent-filters input:focus, .agent-filters select:focus, .agent-form input:focus, .agent-form select:focus, .agent-form textarea:focus, .agent-test-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #dc083819; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(275px, 1fr)); gap: 15px; }
.agent-card { display: flex; flex-direction: column; min-height: 224px; border: 1px solid var(--border); border-radius: 15px; padding: 18px; background: var(--surface-raised); }
.agent-card:hover { border-color: var(--border-focus); box-shadow: 0 5px 20px #0000000b; }
.agent-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.agent-card-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 11px; background: var(--accent-surface); color: var(--accent-text); font-size: 20px; }
.agent-card h2 { margin: 15px 0 6px; font-size: 17px; line-height: 1.3; }
.agent-card p { flex: 1; margin: 0 0 16px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.agent-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.agent-card-meta span, .agent-status { display: inline-flex; align-items: center; border-radius: 99px; background: var(--surface-hover); color: var(--text-muted); padding: 5px 8px; font-size: 10px; font-weight: 650; }
.agent-status.ready { background: var(--success-surface); color: var(--success-text); }
.agent-status.blocked { background: var(--accent-surface); color: var(--accent-text); }
.agent-card-actions { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 13px; border-top: 1px solid var(--border); }
.agent-card-actions button { border: 0; border-radius: 7px; background: var(--surface-hover); color: var(--text); padding: 7px 9px; font-size: 11px; font-weight: 650; }
.agent-card-actions button:hover { background: var(--border); }
.agent-card-actions .use { background: var(--accent); color: var(--on-accent); }
.agent-card-actions .use:hover { background: var(--accent-hover); }
.agent-empty { grid-column: 1 / -1; padding: 55px 20px; border: 1px dashed var(--border); border-radius: 14px; color: var(--text-muted); text-align: center; }
.agent-empty strong { display: block; margin-bottom: 7px; color: var(--text); font-size: 16px; }
.agent-pagination { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 22px; font-size: 12px; color: var(--text-muted); }
.agent-editor-top, .agent-editor-title { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.agent-editor-top { padding: 18px 0; color: var(--text-muted); font-size: 12px; }
.agent-editor-title { padding-bottom: 20px; }
.agent-step-nav { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 15px; }
.agent-step-nav button { flex: none; border: 1px solid var(--border); border-radius: 99px; background: var(--surface-raised); padding: 8px 11px; color: var(--text-muted); font-size: 11px; font-weight: 650; }
.agent-step-nav button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.agent-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 350px); align-items: start; gap: 18px; }
.agent-form, .agent-test-panel { min-width: 0; border: 1px solid var(--border); border-radius: 15px; padding: 22px; background: var(--surface-raised); }
.agent-step { display: grid; gap: 18px; min-width: 0; margin: 0; padding: 0; border: 0; }
.agent-step legend { margin-bottom: 17px; font-size: 19px; font-weight: 700; letter-spacing: -.025em; }
.agent-step label small { color: var(--text-muted); font-size: 10px; font-weight: 400; }
.agent-step textarea { resize: vertical; }
.agent-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.agent-form-actions, .agent-test-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.agent-form-actions #agent-prev { margin-right: auto; }
.agent-check { display: flex !important; flex-direction: row; align-items: center; gap: 9px !important; font-size: 12px; }
.agent-check input { accent-color: var(--accent); }
.agent-preview { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-input); padding: 13px; font-size: 12px; }
.agent-preview pre { margin-bottom: 0; overflow-wrap: anywhere; white-space: pre-wrap; color: var(--text-secondary); font: inherit; line-height: 1.5; }
.agent-input-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.agent-input-row { display: grid; grid-template-columns: 1fr 1.3fr 1fr 1fr auto; align-items: end; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.agent-input-row button { border: 0; border-radius: 8px; padding: 9px; background: var(--surface-hover); }
.agent-documents { display: grid; gap: 8px; }
.agent-document { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 9px; padding: 10px; color: var(--text-secondary); font-size: 12px; }
.agent-document span { margin-left: auto; color: var(--text-muted); font-size: 11px; }
.agent-document input { accent-color: var(--accent); }
.agent-review { display: grid; gap: 7px; border-radius: 10px; background: var(--surface-input); padding: 15px; color: var(--text-secondary); font-size: 12px; }
.agent-validation { color: var(--accent-text); font-size: 12px; white-space: pre-wrap; }
.agent-share { display: grid; gap: 14px; border-top: 1px solid var(--border); padding-top: 15px; }
.agent-share h3 { margin: 0; font-size: 15px; }
.agent-share .secondary-button { justify-self: start; }
.agent-test-panel { position: sticky; top: 12px; }
.agent-test-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.agent-test-header strong, .agent-test-header small { display: block; }
.agent-test-header small { margin-top: 4px; color: var(--text-muted); font-size: 10px; }
.agent-test-messages { display: grid; align-content: start; gap: 12px; min-height: 170px; max-height: 330px; overflow-y: auto; padding: 15px 0; }
.agent-test-message { border-radius: 10px; background: var(--surface-hover); padding: 10px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
.agent-test-message.assistant { background: var(--accent-surface); }
.agent-muted { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.agent-test-form { display: grid; gap: 8px; border-top: 1px solid var(--border); padding-top: 13px; }
.agent-test-values { display: grid; gap: 8px; }
#agent-approval-content { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 9px; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
#agent-versions-list { display: grid; gap: 10px; }
.agent-version-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 12px; }
.agent-version-item strong { display: block; margin-bottom: 5px; }
@media (max-width: 1050px) {
  .agent-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .agent-editor-layout { grid-template-columns: minmax(0, 1fr) minmax(260px, 300px); }
}
@media (max-width: 760px) {
  .agents-view { padding: 0 16px 22px; }
  .agents-heading { align-items: flex-start; }
  .agents-heading h1 { font-size: 25px; }
  .agent-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-editor-layout { display: block; }
  .agent-test-panel { display: none; position: static; }
  .agent-editor-layout.show-test .agent-form { display: none; }
  .agent-editor-layout.show-test .agent-test-panel { display: block; }
  .agent-input-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .agents-heading { flex-direction: column; }
  .agent-filters { grid-template-columns: 1fr 1fr; }
  .agent-field-row { grid-template-columns: 1fr; }
  .agent-form, .agent-test-panel { padding: 17px; }
}
