@font-face { font-family: Plex; src: url('/static/fonts/ibm-plex-arabic-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Plex; src: url('/static/fonts/ibm-plex-arabic-600.woff2') format('woff2'); font-weight: 600 800; font-display: swap; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body { font: 14px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; border: 0; background: none; min-height: var(--touch); touch-action: manipulation; transition: background var(--duration-fast), transform var(--duration-fast); }
button:disabled { opacity: .35; cursor: default; }
button:active:not(:disabled) { transform: scale(.96); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:where(button, a, input, textarea, select, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.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; }
.glass { background: var(--glass); backdrop-filter: blur(var(--blur)) saturate(130%); -webkit-backdrop-filter: blur(var(--blur)) saturate(130%); }
.app-shell { position: fixed; top: var(--visual-top,0px); inset-inline: 0; height: var(--app-height,100dvh); display: flex; flex-direction: column; width: 100%; max-width: 1800px; margin: auto; background: var(--bg); }
.app-header { height: calc(var(--header-height) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0; display: flex; align-items: center; gap: var(--space-1); flex-shrink: 0; z-index: var(--z-header); border-bottom: 1px solid var(--line); background: var(--glass-subtle); }
.brand { position: relative; font: 600 15px/1 system-ui; color: var(--text); text-decoration: none; letter-spacing: -.7px; min-width: var(--touch); min-height: var(--touch); display: flex; justify-content: center; align-items: center; direction: ltr; }
.connection-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); margin: -10px 0 0 2px; }
.connection-dot.offline { background: var(--accent); }
.address { position: relative; display: flex; align-items: center; max-width: 600px; height: var(--touch); flex: 1; margin-inline: auto; min-width: 0; padding-inline-start: 10px; direction: ltr; }
.address::before { content: ''; position: absolute; inset: 6px 0; border-radius: var(--radius-sm); background: var(--surface-input); border: 1px solid #ffffff08; pointer-events: none; }
.address input { z-index: 1; border: 0; background: none; color: var(--muted); min-width: 0; flex: 1; padding: 0; font: 16px/1.3 system-ui; text-overflow: ellipsis; text-align: center; transform: scale(.82); transform-origin: center; }
.address input:focus { text-align: left; color: var(--text); }
.address button { z-index: 1; width: var(--touch); flex-shrink: 0; padding: 0; display: grid; place-items: center; color: var(--muted); }
.address button svg { width: 13px; height: 13px; }
.icon-button { height: var(--touch); min-height: var(--touch); width: var(--touch); min-width: var(--touch); display: grid; place-items: center; border-radius: var(--radius-md); padding: 0; color: var(--muted); }
.icon-button:hover { background: #ffffff08; }
.workspace { flex: 1; min-height: 0; position: relative; isolation: isolate; display: grid; grid-template-rows: min(var(--browser-display-height,320px),max(64px,calc(var(--app-height,100dvh) - var(--header-height) - 96px))) minmax(0,1fr) auto; background: var(--bg); overflow: hidden; }
.viewport { position: relative; grid-row: 1; min-height: 0; overflow: auto; direction: ltr; overscroll-behavior: contain; scrollbar-width: none; }
.viewport::-webkit-scrollbar, .chat-scroll::-webkit-scrollbar { display: none; }
.browser-stage { position: relative; display: block; width: 100%; margin: 0 auto; aspect-ratio: 16/10; overflow: hidden; direction: ltr; background: var(--bg); }
.browser-stage img { display: block; width: 100%; height: auto; max-width: none; margin: 0; object-position: 50% 0; user-select: none; touch-action: none; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: #69635b; }
.empty svg { width: 30px; height: 30px; stroke-width: .8; opacity: .6; }
.reconnecting { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--glass-border); background: #211e1add; border-radius: 50%; pointer-events: none; z-index: var(--z-chat); }
.loader { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line-strong); border-top-color: var(--text); animation: rotate 1s linear infinite; }
.chat-layer { position: relative; grid-row: 2; min-height: 0; display: flex; flex-direction: column; overflow: hidden; z-index: var(--z-chat); padding-top: 12px; background: linear-gradient(#ffffff02,transparent 28px); }
.chat-scroll { flex: 1; width: 100%; max-width: var(--content-width); align-self: center; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; overflow-anchor: none; padding: 8px 20px 14px; }
.messages { display: flex; flex-direction: column; gap: 13px; }
.chat-message { position: relative; max-width: 90%; min-width: 0; align-self: flex-start; animation: message-in var(--duration-enter) var(--ease); }
.chat-message.user { align-self: flex-end; }
.message-bubble { font-size: var(--text-body); line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); unicode-bidi: plaintext; }
.user .message-bubble { background: var(--glass-subtle); border: 1px solid var(--line); border-radius: 17px 17px 4px 17px; padding: 8px 13px; box-shadow: inset 0 1px #ffffff0c; }
.assistant .message-bubble { padding: 1px 0; }
.message-footer { height: 24px; display: flex; justify-content: flex-end; opacity: .65; }
.edit-message { width: var(--touch); height: var(--touch); min-height: var(--touch); margin-block: -10px; display: grid; place-items: center; color: var(--muted); padding: 0; border-radius: var(--radius-sm); }
.edit-message svg { width: 12px; height: 12px; }
.chat-message:hover .message-footer, .chat-message:focus-within .message-footer { opacity: 1; }
.outdated { opacity: .45; }
.activity-message { display: flex; align-items: baseline; gap: 9px; width: 100%; padding: 0 2px; font-size: var(--text-xs); line-height: 1.8; color: var(--muted); animation: message-in var(--duration-fast) ease-out; }
.activity-marker { width: 13px; flex-shrink: 0; text-align: center; color: #ce967d; font: 13px/1.7 system-ui; }
.activity-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.activity-elapsed { margin-inline-start: auto; flex-shrink: 0; font: 10px/1.6 system-ui; color: var(--faint); font-variant-numeric: tabular-nums; direction: ltr; }
.activity-message.active .activity-marker { animation: pulse 1.8s ease-in-out infinite; }
.activity-message.active .activity-text { color: var(--text); }
.activity-message.event-error .activity-marker { color: #d99b87; }
.activity-message + .activity-message { margin-top: -5px; }
.activity-message + .chat-message, .chat-message + .activity-message { margin-top: 8px; }
.jump-latest { position: absolute; z-index: var(--z-controls); bottom: 8px; inset-inline-end: max(20px,calc((100% - var(--content-width))/2 + 20px)); border: 1px solid var(--glass-border-strong); box-shadow: var(--glass-shadow); color: var(--text); border-radius: 50%; background: var(--glass-strong); }
.jump-latest svg { transform: rotate(180deg); }
.jump-latest .new-count { position: absolute; top: -4px; inset-inline-end: -4px; background: var(--text); color: #24211d; border-radius: var(--radius-pill); min-width: 17px; height: 17px; display: grid; place-items: center; font: 10px system-ui; padding-inline: 3px; }
.composer-dock { position: relative; grid-row: 3; z-index: var(--z-controls); padding: 4px max(12px,env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)); background: var(--bg); }
.composer { max-width: var(--content-width); margin: 0 auto; display: flex; align-items: flex-end; gap: 4px; padding: 4px; border: 1px solid var(--glass-border); border-radius: 28px; box-shadow: var(--glass-shadow); }
.composer:focus-within { border-color: #e8e2d449; box-shadow: var(--glass-shadow), 0 0 0 3px #e8e2d405; }
.composer textarea { width: 100%; min-width: 0; flex: 1; resize: none; min-height: 44px; height: 44px; max-height: 112px; outline: none; border: 0; background: none; color: var(--text); padding: 10px 0; font-size: 16px; line-height: 24px; }
.composer textarea::placeholder { color: var(--faint); font-size: 13px; }
.composer > .icon-button { border-radius: 50%; }
.composer > .icon-button svg { transition: transform var(--duration-enter); }
.composer > .icon-button[aria-expanded=true] svg { transform: rotate(45deg); }
.send-button { width: var(--touch); height: var(--touch); min-height: var(--touch); border-radius: 50%; display: grid; place-items: center; background: var(--text); border: 1px solid #f4eddd; color: #22201c; box-shadow: inset 0 1px #fff6; flex-shrink: 0; padding: 0; }
.send-button svg { height: 18px; width: 18px; }
#activityOpen { display: none !important; }
.edit-notice { max-width: var(--content-width); margin: 0 auto 3px; display: flex; align-items: center; justify-content: space-between; color: var(--accent); height: 44px; padding-inline: 6px; }
.edit-notice > svg { width: 13px; height: 13px; }
.connection-notice { max-width: var(--content-width); margin: 0 auto 7px; text-align: center; font-size: var(--text-xs); color: var(--muted); }
.tools { position: absolute; z-index: var(--z-popover); bottom: calc(100% - 4px); inset-inline-start: max(12px,calc((100% - var(--content-width))/2)); padding: 6px; border: 1px solid var(--glass-border-strong); border-radius: var(--radius-lg); display: flex; flex-wrap: wrap; gap: 3px; max-width: 300px; background: var(--glass-strong); box-shadow: var(--glass-shadow-strong); }
.tools .icon-button { background: #ffffff03; }
.tools .icon-button[aria-pressed=true] { color: var(--text); background: var(--accent-soft); }
.approval { display: flex; align-items: center; gap: 10px; border-inline-start: 2px solid #ce785e77; margin: 14px 0 0; padding: 3px 12px; background: var(--accent-soft); border-radius: var(--radius-sm); }
.approval p { margin: 0; flex: 1; font-size: var(--text-sm); }
.file-link { display: block; font-size: var(--text-sm); color: var(--text); margin: 10px 0; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.focus-mode { grid-template-rows: minmax(0,1fr) auto; }
.focus-mode .chat-layer { display: none; }
.focus-mode .viewport { grid-row: 1; }
.focus-mode .composer-dock { grid-row: 2; }
.primary, .secondary { display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); min-height: var(--touch); padding: 10px 13px; font-size: var(--text-sm); }
.primary { background: var(--text); color: #25211b; }
.primary svg { width: 15px; height: 15px; }
.secondary { background: var(--surface-input); }
.wide { width: 100%; margin-top: 12px; }
.text-button { font-size: var(--text-xs); color: var(--muted); }
dialog { position: fixed; top: calc(var(--visual-top,0px) + var(--app-height,100dvh)/2); bottom: auto; inset-inline: 0; transform: translateY(-50%); margin: 0 auto; width: min(440px,calc(100% - 24px)); padding: 0; max-height: calc(var(--app-height,100dvh) - 24px); background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-border-strong); border-radius: var(--radius-panel); box-shadow: var(--glass-shadow-strong); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
dialog::backdrop { background: #0009; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.dialog-content { padding: var(--space-6); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h2 { font-size: 18px; font-weight: 600; margin: 5px 0 10px; }
.dialog-content p { font-size: var(--text-xs); color: var(--muted); line-height: 1.9; }
.dialog-content label:not(.switch):not(.auto-setting) { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-xs); color: var(--muted); margin-top: 14px; }
.dialog-content input:not([type=checkbox]), .dialog-content select { width: 100%; min-width: 0; min-height: var(--touch); background: #14120f; border: 1px solid var(--line-strong); color: var(--text); border-radius: var(--radius-sm); padding: 11px; font-size: 16px; }
.dialog-content .auto-setting { display: flex; flex-direction: row; align-items: center; gap: 7px; font-size: var(--text-xs); color: var(--muted); margin-bottom: 18px; }
.auto-setting input { accent-color: var(--accent); width: 18px; height: 18px; }
.auto-setting { min-height: var(--touch); }
.agent-avatar { width: 43px; height: 43px; border: 1px solid var(--glass-border); border-radius: var(--radius-md); display: grid; place-items: center; direction: ltr; letter-spacing: 4px; padding-left: 4px; color: var(--text); font: 600 24px system-ui; background: var(--glass); margin-bottom: 18px; }
.setting-block { border-top: 1px solid var(--line); margin-top: 19px; padding-top: 12px; }
.setting-block h3 { font-size: 13px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 7px; }
.setting-block h3 svg { height: 16px; width: 16px; color: var(--accent); }
.setting-block small { display: block; font-size: var(--text-xs); color: var(--muted); line-height: 1.8; margin-top: 10px; }
.setting-title { display: flex; align-items: center; justify-content: space-between; }
.dialog-content details { margin-top: 12px; color: var(--muted); font-size: var(--text-xs); }
summary { cursor: pointer; min-height: var(--touch); padding-block: 10px; }
.switch { display: flex; align-items: center; justify-content: center; width: var(--touch); min-height: var(--touch); position: relative; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 35px; height: 21px; display: block; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface-input); }
.switch span::before { content: ''; display: block; margin: 3px; width: 13px; height: 13px; border-radius: 50%; background: #969087; transition: transform var(--duration-enter); }
.switch input:checked+span { background: #ce785e35; border-color: #ce785e6a; }
.switch input:checked+span::before { background: var(--accent); transform: translateX(-14px); }
.switch input:focus-visible+span { outline: 2px solid var(--accent); }
.field-row { display: flex; gap: 8px; }
.field-row > label, .field-row > button { flex: 1; min-width: 0; }
.field-row > button { margin-top: 12px; }
.key-row { display: flex; gap: 7px; margin-top: 15px; }
.key-row button { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); flex: 1; }
.error { color: #d99b87 !important; }
.activity-panel { padding: 12px 18px; width: min(520px,calc(100% - 24px)); max-height: min(70dvh,calc(var(--app-height,100dvh) - 24px)); }
.activity-panel h2 { font-size: 13px; margin: 0; }
.activity-panel h2 span { font: 10px system-ui; color: var(--faint); margin-inline-start: 6px; }
.activity-list { padding: 0 0 8px; margin: 4px 0 0; list-style: none; }
.activity-list li { display: grid; grid-template-columns: 14px minmax(0,1fr) 35px; gap: 8px; align-items: start; padding: 10px 0; font-size: var(--text-xs); color: var(--muted); }
.event-icon { border: 1px solid var(--glass-border); border-radius: 50%; width: 13px; height: 13px; margin-top: 3px; display: grid; place-items: center; font-size: 8px; color: var(--accent); }
.activity-list time { font: 10px/1.8 system-ui; color: var(--faint); direction: ltr; }
.activity-placeholder { display: block !important; color: var(--faint); padding: 20px 0 !important; }
.usage-details { margin: 0 0 16px; padding: 0; border-bottom: 1px solid var(--line); }
.usage-details summary { font-size: var(--text-sm); color: var(--muted); }
.usage-details p { font-size: var(--text-sm); line-height: 1.9; overflow-wrap: anywhere; }
.usage-details small { font-size: var(--text-xs); color: var(--muted); display: block; padding-bottom: 12px; }
#toast { position: fixed; z-index: var(--z-toast); bottom: max(18px,env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); width: max-content; background: var(--surface-solid); border: 1px solid var(--glass-border); color: var(--text); font-size: var(--text-xs); border-radius: var(--radius-md); padding: 10px 15px; box-shadow: var(--glass-shadow); }
.verification-banner { display: flex; align-items: center; gap: 7px; max-width: var(--content-width); margin: 0 auto 8px; padding: 0 8px; border: 1px solid var(--glass-border); border-radius: var(--radius-md); color: var(--text); }
.verification-banner > span:nth-child(2) { font-size: var(--text-xs); line-height: 1.7; flex: 1; }
.verification-light { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.verification-banner[data-state=checking] .verification-light, .verification-banner[data-state=ai_solving] .verification-light { animation: pulse 1.8s ease-in-out infinite; }
.verification-banner .icon-button svg { width: 14px; height: 14px; }
.keyboard-open .verification-banner { display: none; }
.compact-keyboard .workspace { grid-template-rows: min(140px,max(72px,calc(var(--app-height,100dvh)*.3))) minmax(0,1fr) auto; }
.compact-keyboard .focus-mode { grid-template-rows: minmax(0,1fr) auto; }
/* Rich text is a deliberately restricted, sanitized Markdown surface. */
.message-bubble.rich-text { white-space: normal; }
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p { margin: 0 0 10px; }
.rich-text :where(h1,h2,h3,h4) { font-size: 1em; font-weight: 600; margin: 14px 0 6px; }
.rich-text a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.rich-text :where(ul,ol) { padding-inline-start: 20px; margin-block: 8px; }
.rich-text li { margin-block: 4px; }
.rich-text blockquote { border-inline-start: 2px solid var(--line-strong); margin: 10px 0; padding-inline-start: 12px; color: var(--muted); }
.rich-text code { font: .9em/1.8 var(--font-mono); background: var(--surface-code); padding: 2px 5px; border-radius: 4px; direction: ltr; unicode-bidi: isolate; }
.code-block { border: 1px solid var(--line-strong); border-radius: var(--radius-md); overflow: hidden; margin-block: 12px; background: var(--surface-code); min-width: 0; max-width: 100%; }
.code-heading { display: flex; justify-content: space-between; align-items: center; padding-inline: 12px 4px; min-height: 44px; color: var(--muted); font-size: var(--text-xs); border-bottom: 1px solid var(--line); }
.code-heading .icon-button svg { width: 14px; height: 14px; }
.code-block pre { margin: 0; padding: 12px; max-width: 100%; overflow-x: auto; direction: ltr; text-align: left; white-space: pre; scrollbar-width: thin; }
.code-block pre code { padding: 0; background: none; font-size: 12px; }
.table-scroll { overflow-x: auto; max-width: 100%; margin-block: 12px; }
.rich-text table { border-collapse: collapse; font-size: var(--text-sm); min-width: 100%; }
.rich-text :where(td,th) { padding: 8px; border: 1px solid var(--line-strong); text-align: start; }
.rich-text hr { border: 0; border-top: 1px solid var(--line-strong); }
[hidden] { display: none !important; }
@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes message-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (min-width: 901px) {
  .workspace { grid-template-rows: min(48vh,480px) minmax(0,1fr) auto; }
  .focus-mode { grid-template-rows: minmax(0,1fr) auto; }
  .chat-scroll { padding-inline: 26px; }
  .message-bubble { font-size: 14px; }
}
@media (max-width: 600px) { .chat-scroll { padding-inline: 18px; } .dialog-content { padding: 20px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (prefers-reduced-transparency: reduce) {
  .glass, .tools, dialog { background: var(--surface-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .chat-layer { background: var(--bg); }
  dialog::backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@supports not (backdrop-filter: blur(1px)) { .glass, .tools, dialog { background: var(--surface-solid); } }

.older-events { margin: 0 auto 4px; border: 1px solid var(--line-strong); border-radius: 50%; }

.older-messages { margin: 0 auto 12px; border: 1px solid var(--line-strong); border-radius: 50%; }
