@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300..800&family=Geist+Mono:wght@400..600&family=IBM+Plex+Sans+Thai:wght@300;400;500;600;700&display=swap");

/* YNW Design System - component styles. Every value comes from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary); font-family: var(--font-sans); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
:lang(th) { font-family: var(--font-thai); line-height: 1.7; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: var(--bw-focus) solid var(--focus-ring); outline-offset: 2px; }
svg.ynw-i { width: var(--icon-sm); height: var(--icon-sm); stroke: currentColor; stroke-width: var(--icon-stroke); fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.ynw-i.md { width: var(--icon-md); height: var(--icon-md); }
svg.ynw-i.xs { width: var(--icon-xs); height: var(--icon-xs); }

/* preview helpers */
.pv { padding: var(--space-6); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.pv-col { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.pv-grid { padding: var(--space-6); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }

/* ---------- Text primitives ---------- */
.ynw-eyebrow { font-family: var(--font-mono); font-size: 11px; line-height: 1.45; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.ynw-eyebrow b { color: var(--accent-text); font-weight: 500; }
.ynw-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.ynw-h2 { font-size: 40px; line-height: 1.05; font-weight: 600; letter-spacing: -0.035em; margin: 0; }
.ynw-h4 { font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.ynw-h5 { font-size: 17px; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.ynw-muted { color: var(--text-secondary); }
.ynw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.ynw-list li { display: flex; gap: var(--space-2); align-items: baseline; color: var(--text-secondary); font-size: 14px; }
.ynw-list li::before { content: ""; width: 6px; height: 6px; background: var(--accent); flex: none; transform: translateY(-2px); }
.ynw-kbd { font-family: var(--font-mono); font-size: 11px; line-height: 1; padding: 3px 5px; border: var(--bw-hairline) solid var(--border-strong); border-radius: var(--radius-xs); color: var(--text-secondary); background: var(--surface); }
.ynw-wordmark { font-weight: 700; letter-spacing: -0.06em; line-height: 0.9; }

/* ---------- Button ---------- */
.ynw-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-4); border-radius: var(--radius-sm); border: var(--bw-hairline) solid transparent; background: transparent; color: var(--text-primary); font-size: 14px; font-weight: 500; letter-spacing: -0.005em; cursor: pointer; white-space: nowrap; transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard); }
.ynw-btn--primary { background: var(--accent); color: var(--on-accent); }
.ynw-btn--primary:hover { background: var(--accent-hover); }
.ynw-btn--primary:active { background: var(--accent-pressed); }
.ynw-btn--secondary { border-color: var(--border-control); }
.ynw-btn--secondary:hover { background: var(--surface-hover); }
.ynw-btn--ghost { color: var(--text-secondary); }
.ynw-btn--ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
.ynw-btn--danger { background: var(--error-subtle); color: var(--error); }
.ynw-btn--icon { width: 36px; padding: 0; }
.ynw-btn--sm { height: 28px; padding: 0 var(--space-3); font-size: 13px; }
.ynw-btn--sm.ynw-btn--icon { width: 28px; padding: 0; }
.ynw-btn--lg { height: 44px; padding: 0 var(--space-5); font-size: 15px; }
.ynw-btn:disabled, .ynw-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.ynw-btn .arrow { font-family: var(--font-mono); }

/* ---------- Field / Input / Textarea / Select ---------- */
.ynw-field { display: grid; gap: 6px; min-width: 240px; }
.ynw-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.ynw-hint { font-size: 12px; color: var(--text-muted); }
.ynw-hint.is-error { color: var(--error); }
.ynw-input, .ynw-textarea, .ynw-select { width: 100%; height: 36px; padding: 0 var(--space-3); background: var(--surface); border: var(--bw-hairline) solid var(--border-control); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px; transition: border-color var(--dur-fast) var(--ease-standard); }
.ynw-textarea { height: auto; min-height: 88px; padding: 10px var(--space-3); resize: vertical; line-height: 1.55; }
.ynw-input::placeholder, .ynw-textarea::placeholder { color: var(--text-muted); }
.ynw-input:hover, .ynw-textarea:hover, .ynw-select:hover { border-color: var(--text-muted); }
.ynw-input:focus, .ynw-textarea:focus, .ynw-select:focus { outline: var(--bw-focus) solid var(--focus-ring); outline-offset: 1px; border-color: var(--accent); }
.ynw-input[aria-invalid="true"] { border-color: var(--error); }
.ynw-select-wrap { position: relative; }
.ynw-select { appearance: none; padding-right: 32px; cursor: pointer; }
.ynw-select-wrap::after { content: ""; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

/* ---------- Checkbox / Radio / Toggle ---------- */
.ynw-choice { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 14px; cursor: pointer; }
.ynw-check, .ynw-radio { appearance: none; margin: 0; width: 16px; height: 16px; border: var(--bw-hairline) solid var(--border-control); background: var(--surface); display: inline-grid; place-content: center; cursor: pointer; transition: background var(--dur-instant) var(--ease-standard); }
.ynw-check { border-radius: var(--radius-xs); }
.ynw-radio { border-radius: var(--radius-full); }
.ynw-check:checked { background: var(--accent); border-color: var(--accent); }
.ynw-check:checked::after { content: ""; width: 4px; height: 8px; border-right: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent); transform: translateY(-1px) rotate(45deg); }
.ynw-check:indeterminate { background: var(--accent); border-color: var(--accent); }
.ynw-check:indeterminate::after { content: ""; width: 8px; height: 2px; background: var(--on-accent); }
.ynw-radio:checked { border-color: var(--accent); }
.ynw-radio:checked::after { content: ""; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--accent); }
.ynw-toggle { appearance: none; margin: 0; width: 32px; height: 18px; border-radius: var(--radius-full); background: var(--surface-hover); border: var(--bw-hairline) solid var(--border-control); position: relative; cursor: pointer; transition: background var(--dur-fast) var(--ease-standard); }
.ynw-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: var(--radius-full); background: var(--text-secondary); transition: transform var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard); }
.ynw-toggle:checked { background: var(--accent); border-color: var(--accent); }
.ynw-toggle:checked::after { transform: translateX(14px); background: var(--on-accent); }

/* ---------- Tabs / Segmented ---------- */
.ynw-tabs { display: flex; gap: var(--space-6); border-bottom: var(--bw-hairline) solid var(--border); }
.ynw-tab { background: none; border: 0; padding: var(--space-3) 0; font-size: 14px; color: var(--text-muted); cursor: pointer; position: relative; display: inline-flex; gap: var(--space-2); align-items: center; }
.ynw-tab:hover { color: var(--text-primary); }
.ynw-tab[aria-selected="true"] { color: var(--text-primary); }
.ynw-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: var(--bw-focus); background: var(--accent); }
.ynw-tab .ynw-mono { font-size: 11px; }
.ynw-seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface); border: var(--bw-hairline) solid var(--border-strong); border-radius: var(--radius-md); }
.ynw-seg button { border: 0; background: none; height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); cursor: pointer; }
.ynw-seg button:hover { color: var(--text-primary); }
.ynw-seg button[aria-pressed="true"] { background: var(--surface-hover); color: var(--text-primary); }

/* ---------- Badge / Tag ---------- */
.ynw-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--space-2); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; background: var(--surface-raised); color: var(--text-secondary); border: var(--bw-hairline) solid var(--border); }
.ynw-badge::before { content: ""; width: 6px; height: 6px; background: currentColor; }
.ynw-badge--plain::before { display: none; }
.ynw-badge--accent { background: var(--accent-subtle); color: var(--accent-text); border-color: transparent; }
.ynw-badge--success { background: var(--success-subtle); color: var(--success); border-color: transparent; }
.ynw-badge--warning { background: var(--warning-subtle); color: var(--warning); border-color: transparent; }
.ynw-badge--error { background: var(--error-subtle); color: var(--error); border-color: transparent; }
.ynw-badge--info { background: var(--info-subtle); color: var(--info); border-color: transparent; }
.ynw-tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 var(--space-2) 0 10px; border-radius: var(--radius-sm); border: var(--bw-hairline) solid var(--border-strong); font-size: 13px; color: var(--text-secondary); background: var(--surface); }
.ynw-tag button { border: 0; background: none; color: var(--text-muted); cursor: pointer; padding: 0; display: inline-flex; }

/* ---------- Tooltip ---------- */
.ynw-tooltip { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.ynw-tooltip-body { background: var(--text-primary); color: var(--bg); font-size: 12px; line-height: 1.4; padding: 5px var(--space-2); border-radius: var(--radius-sm); white-space: nowrap; display: inline-flex; gap: var(--space-2); align-items: center; }
.ynw-tooltip-body .ynw-kbd { background: transparent; color: var(--bg); border-color: var(--text-muted); }

/* ---------- Menu / Dropdown ---------- */
.ynw-menu { min-width: 220px; padding: var(--space-1); background: var(--surface-overlay); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); }
.ynw-menu-label { padding: var(--space-2) var(--space-2) var(--space-1); }
.ynw-menu-item { display: flex; align-items: center; gap: var(--space-2); height: 32px; padding: 0 var(--space-2); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.ynw-menu-item:hover, .ynw-menu-item[data-active] { background: var(--surface-hover); color: var(--text-primary); }
.ynw-menu-item .end { margin-left: auto; display: inline-flex; gap: 4px; }
.ynw-menu-item.is-danger { color: var(--error); }
.ynw-menu-sep { height: 1px; background: var(--border-strong); margin: var(--space-1) calc(-1 * var(--space-1)); }

/* ---------- Command palette ---------- */
.ynw-cmdk { width: 100%; max-width: 560px; background: var(--surface-overlay); border-radius: var(--radius-lg); box-shadow: var(--shadow-overlay); overflow: hidden; }
.ynw-cmdk-input { display: flex; align-items: center; gap: var(--space-3); height: 52px; padding: 0 var(--space-4); border-bottom: var(--bw-hairline) solid var(--border-strong); color: var(--text-muted); }
.ynw-cmdk-input input { flex: 1; border: 0; background: none; outline: none; font-size: 15px; color: var(--text-primary); }
.ynw-cmdk-input input::placeholder { color: var(--text-muted); }
.ynw-cmdk-list { padding: var(--space-2); }
.ynw-cmdk-item { display: flex; align-items: center; gap: var(--space-3); height: 36px; padding: 0 var(--space-2); border-radius: var(--radius-sm); font-size: 14px; color: var(--text-secondary); }
.ynw-cmdk-item[data-active] { background: var(--surface-hover); color: var(--text-primary); }
.ynw-cmdk-item[data-active]::before { content: ""; width: 6px; height: 6px; background: var(--accent); margin-left: -2px; }
.ynw-cmdk-item .end { margin-left: auto; display: inline-flex; gap: 4px; }
.ynw-cmdk-foot { display: flex; gap: var(--space-4); padding: var(--space-2) var(--space-4); border-top: var(--bw-hairline) solid var(--border-strong); }

/* ---------- Modal / Sheet ---------- */
.ynw-scrim { background: var(--scrim); display: grid; place-items: center; padding: var(--space-6); }
.ynw-modal { width: 100%; max-width: 440px; background: var(--surface-raised); border: var(--bw-hairline) solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-overlay); }
.ynw-modal-head { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-5) var(--space-5) 0; }
.ynw-modal-head .ynw-btn { margin-left: auto; margin-top: -4px; margin-right: -8px; }
.ynw-modal-body { padding: var(--space-3) var(--space-5) var(--space-5); color: var(--text-secondary); font-size: 14px; }
.ynw-modal-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-top: var(--bw-hairline) solid var(--border); }
.ynw-sheet-stage { position: relative; display: flex; justify-content: flex-end; background: var(--scrim); height: 100%; }
.ynw-sheet { width: 360px; max-width: 100%; height: 100%; background: var(--surface); border-left: var(--bw-hairline) solid var(--border-strong); display: flex; flex-direction: column; }
.ynw-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: var(--bw-hairline) solid var(--border); }
.ynw-sheet-body { flex: 1; padding: var(--space-5); display: grid; gap: var(--space-4); align-content: start; }
.ynw-sheet-foot { padding: var(--space-4) var(--space-5); border-top: var(--bw-hairline) solid var(--border); display: flex; justify-content: flex-end; gap: var(--space-2); }

/* ---------- Toast ---------- */
.ynw-toast { width: 360px; max-width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-3); align-items: start; padding: var(--space-3) var(--space-4); background: var(--surface-overlay); border-radius: var(--radius-md); box-shadow: var(--shadow-overlay); }
.ynw-toast-mark { width: 8px; height: 8px; margin-top: 7px; background: var(--text-muted); }
.ynw-toast--success .ynw-toast-mark { background: var(--success); }
.ynw-toast--error .ynw-toast-mark { background: var(--error); }
.ynw-toast--accent .ynw-toast-mark { background: var(--accent); }
.ynw-toast-title { font-size: 14px; font-weight: 500; }
.ynw-toast-desc { font-size: 13px; color: var(--text-secondary); }

/* ---------- Avatar ---------- */
.ynw-avatar { --s: 28px; width: var(--s); height: var(--s); border-radius: var(--radius-sm); display: inline-grid; place-items: center; flex: none; font-family: var(--font-mono); font-size: 11px; font-weight: 500; background: var(--surface-hover); color: var(--text-secondary); position: relative; overflow: visible; }
.ynw-avatar--sm { --s: 20px; font-size: 10px; }
.ynw-avatar--lg { --s: 40px; font-size: 13px; }
.ynw-avatar--agent { background: var(--accent-subtle); color: var(--accent-text); }
.ynw-avatar--agent-alt { background: var(--info-subtle); color: var(--info); }
.ynw-avatar--agent-gold { background: var(--warning-subtle); color: var(--warning); }
.ynw-avatar[data-status]::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border: 2px solid var(--bg); background: var(--text-muted); }
.ynw-avatar[data-status="online"]::after { background: var(--success); }
.ynw-avatar[data-status="busy"]::after { background: var(--accent); }
.ynw-avatar-stack { display: inline-flex; }
.ynw-avatar-stack .ynw-avatar { box-shadow: 0 0 0 2px var(--bg); }
.ynw-avatar-stack .ynw-avatar + .ynw-avatar { margin-left: -6px; }

/* ---------- Card ---------- */
.ynw-card { background: var(--surface); border: var(--bw-hairline) solid var(--border); border-radius: var(--radius-md); padding: var(--space-5); display: grid; gap: var(--space-3); align-content: start; transition: border-color var(--dur-fast) var(--ease-standard); }
.ynw-card:hover { border-color: var(--border-strong); }
.ynw-card-top { display: flex; justify-content: space-between; align-items: center; }
.ynw-card-index { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--accent-text); }
.ynw-card p { margin: 0; font-size: 14px; color: var(--text-secondary); }

/* ---------- Section header ---------- */
.ynw-section-head { display: grid; gap: var(--space-3); padding-top: var(--space-4); border-top: var(--bw-hairline) solid var(--border); max-width: 720px; }
.ynw-section-head p { margin: 0; font-size: 18px; line-height: 1.6; color: var(--text-secondary); }
.ynw-section-head-row { display: flex; justify-content: space-between; align-items: baseline; }

/* ---------- Ticker ---------- */
.ynw-ticker { overflow: hidden; border-top: var(--bw-hairline) solid var(--border); border-bottom: var(--bw-hairline) solid var(--border); padding: var(--space-3) 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.ynw-ticker-track { display: flex; width: max-content; animation: ynw-marquee var(--dur-ticker) var(--ease-linear) infinite; }
.ynw-ticker:hover .ynw-ticker-track { animation-play-state: paused; }
.ynw-ticker-item { display: inline-flex; align-items: center; gap: var(--space-6); padding-right: var(--space-6); font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); white-space: nowrap; }
.ynw-ticker-item::after { content: ""; width: 6px; height: 6px; background: var(--accent); }
@keyframes ynw-marquee { to { transform: translateX(-50%); } }

/* ---------- Empty state ---------- */
.ynw-empty { display: grid; justify-items: center; text-align: center; gap: var(--space-3); padding: var(--space-10) var(--space-6); border: var(--bw-hairline) dashed var(--border-strong); border-radius: var(--radius-md); }
.ynw-empty-glyph { width: 48px; height: 48px; display: grid; place-items: center; border: var(--bw-hairline) solid var(--border-strong); border-radius: var(--radius-md); color: var(--accent-text); background: radial-gradient(var(--border-strong) 1px, transparent 1.5px) 0 0 / 8px 8px; }
.ynw-empty p { margin: 0; max-width: 340px; font-size: 14px; color: var(--text-secondary); }

/* ---------- Skeleton ---------- */
.ynw-skel { background: var(--surface-raised); border-radius: var(--radius-xs); position: relative; overflow: hidden; height: 12px; }
.ynw-skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--surface-hover), transparent); animation: ynw-shimmer var(--dur-pulse) var(--ease-standard) infinite; }
@keyframes ynw-shimmer { to { transform: translateX(100%); } }

/* ---------- Navbar ---------- */
.ynw-nav { height: 56px; display: flex; align-items: center; gap: var(--space-8); padding: 0 var(--space-6); border-bottom: var(--bw-hairline) solid var(--border); background: var(--bg); }
.ynw-nav .ynw-wordmark { font-size: 22px; }
.ynw-nav-links { display: flex; gap: var(--space-6); font-size: 14px; }
.ynw-nav-links a { color: var(--text-secondary); text-decoration: none; }
.ynw-nav-links a:hover, .ynw-nav-links a[aria-current] { color: var(--text-primary); }
.ynw-nav-end { margin-left: auto; display: flex; gap: var(--space-2); align-items: center; }

/* ---------- Footer ---------- */
.ynw-footer { border-top: var(--bw-hairline) solid var(--border); padding: var(--space-10) var(--space-6) 0; overflow: hidden; display: grid; gap: var(--space-8); }
.ynw-footer-cols { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: var(--space-6); }
.ynw-footer-cols h6 { margin: 0 0 var(--space-3); }
.ynw-footer-cols a { display: block; font-size: 13px; color: var(--text-secondary); text-decoration: none; padding: 3px 0; }
.ynw-footer-cols a:hover { color: var(--text-primary); }
.ynw-slogan { display: grid; font-size: 15px; line-height: 1.5; color: var(--text-secondary); }
.ynw-slogan span:first-child { color: var(--text-primary); }
.ynw-footer-mark { font-size: 200px; margin-bottom: -0.2em; color: var(--surface-hover); user-select: none; }
.ynw-footer-bar { display: flex; justify-content: space-between; border-top: var(--bw-hairline) solid var(--border); padding: var(--space-3) 0; }

/* ---------- Hero ---------- */
.ynw-hero { position: relative; overflow: hidden; padding: var(--space-12) var(--space-6) 260px; min-height: 560px; display: grid; align-content: start; gap: var(--space-4); background: radial-gradient(60% 40% at 70% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), var(--bg); }
.ynw-hero-waves { position: absolute; inset: auto 0 0 0; width: 100%; height: 300px; stroke: var(--accent); fill: none; opacity: 0.35; }
.ynw-hero-mark { position: absolute; left: -0.03em; bottom: -0.2em; font-size: 340px; color: var(--text-primary); pointer-events: none; }
.ynw-hero h1 { margin: 0; font-size: 56px; line-height: 1; font-weight: 600; letter-spacing: -0.04em; max-width: 720px; position: relative; }
.ynw-hero h1 span { display: block; color: var(--text-muted); }
.ynw-hero p { margin: 0; max-width: 440px; font-size: 18px; color: var(--text-secondary); position: relative; }
.ynw-hero-cta { display: flex; gap: var(--space-2); position: relative; }

/* =================== Agentic chat =================== */
.ynw-thread { display: grid; gap: var(--space-6); max-width: var(--chat-max); }
.ynw-msg { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); }
.ynw-msg-head { display: flex; align-items: baseline; gap: var(--space-2); font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.ynw-msg-body { font-size: 15px; line-height: 1.6; color: var(--text-primary); }
.ynw-msg-body p { margin: 0 0 var(--space-2); }
.ynw-msg-body code { font-family: var(--font-mono); font-size: 13px; background: var(--surface-raised); border: var(--bw-hairline) solid var(--border); padding: 1px 5px; border-radius: var(--radius-xs); }
.ynw-msg--user { display: flex; justify-content: flex-end; }
.ynw-msg--user .ynw-msg-bubble { max-width: 80%; background: var(--surface-raised); border: var(--bw-hairline) solid var(--border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); font-size: 15px; }
.ynw-msg-actions { display: flex; gap: 2px; margin-top: var(--space-1); color: var(--text-muted); }
.ynw-sysnote { display: flex; align-items: center; gap: var(--space-3); }
.ynw-sysnote::before, .ynw-sysnote::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.ynw-composer { max-width: var(--chat-max); background: var(--surface); border: var(--bw-hairline) solid var(--border-control); border-radius: var(--radius-lg); transition: box-shadow var(--dur-base) var(--ease-standard); }
.ynw-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ynw-composer.is-streaming { box-shadow: var(--shadow-glow); border-color: transparent; }
.ynw-composer textarea { display: block; width: 100%; min-height: 56px; border: 0; background: none; resize: none; outline: none; padding: var(--space-3) var(--space-4) 0; font-size: 15px; line-height: 1.6; }
.ynw-composer textarea::placeholder { color: var(--text-muted); }
.ynw-composer-chips { display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-4) 0; flex-wrap: wrap; }
.ynw-composer-bar { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-2); }
.ynw-composer-bar .spacer { flex: 1; }
.ynw-model { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--space-2); border-radius: var(--radius-sm); border: 0; background: none; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.ynw-model:hover { background: var(--surface-hover); color: var(--text-primary); }
.ynw-send { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.ynw-send:hover { background: var(--accent-hover); }
.ynw-send:disabled { background: var(--surface-hover); color: var(--text-muted); cursor: not-allowed; }
.ynw-send--stop { background: var(--text-primary); color: var(--bg); }
.ynw-send--stop:hover { background: var(--text-secondary); }
.ynw-send--stop span { width: 10px; height: 10px; background: currentColor; border-radius: 1px; }
.ynw-mention { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; height: 22px; border-radius: var(--radius-sm); background: var(--accent-subtle); color: var(--accent-text); font-size: 13px; font-weight: 500; }
.ynw-slash { width: 300px; }
.ynw-slash .cmd { font-family: var(--font-mono); color: var(--text-primary); font-size: 12px; min-width: 80px; }

.ynw-thinking { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.ynw-dots { display: inline-flex; gap: 3px; }
.ynw-dots i { width: 5px; height: 5px; background: var(--accent); animation: ynw-pulse var(--dur-pulse) var(--ease-standard) infinite; }
.ynw-dots i:nth-child(2) { animation-delay: 150ms; }
.ynw-dots i:nth-child(3) { animation-delay: 300ms; }
@keyframes ynw-pulse { 0%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.ynw-caret { display: inline-block; width: 8px; height: 1.05em; background: var(--accent); vertical-align: text-bottom; margin-left: 2px; animation: ynw-blink 1s steps(2, start) infinite; }
@keyframes ynw-blink { to { visibility: hidden; } }

.ynw-plan { border: var(--bw-hairline) solid var(--border); border-radius: var(--radius-md); background: var(--surface); max-width: var(--chat-max); }
.ynw-plan > summary { list-style: none; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); cursor: pointer; }
.ynw-plan > summary::-webkit-details-marker { display: none; }
.ynw-plan > summary .chev { margin-left: auto; color: var(--text-muted); transition: transform var(--dur-base) var(--ease-standard); }
.ynw-plan[open] > summary .chev { transform: rotate(180deg); }
.ynw-steps { list-style: none; margin: 0; padding: var(--space-1) var(--space-3) var(--space-3); display: grid; gap: 2px; border-top: var(--bw-hairline) solid var(--border); }
.ynw-step { display: grid; grid-template-columns: 16px 1fr auto; gap: var(--space-3); align-items: center; padding: 6px 0; font-size: 14px; color: var(--text-secondary); }
.ynw-step-ico { width: 14px; height: 14px; display: grid; place-items: center; border-radius: var(--radius-xs); }
.ynw-step[data-status="pending"] .ynw-step-ico { border: var(--bw-hairline) solid var(--border-control); }
.ynw-step[data-status="running"] { color: var(--text-primary); }
.ynw-step[data-status="running"] .ynw-step-ico { background: var(--accent); animation: ynw-pulse var(--dur-pulse) var(--ease-standard) infinite; }
.ynw-step[data-status="done"] .ynw-step-ico { color: var(--success); }
.ynw-step[data-status="done"] .label { text-decoration: line-through; text-decoration-color: var(--border-strong); }
.ynw-step[data-status="failed"] { color: var(--text-primary); }
.ynw-step[data-status="failed"] .ynw-step-ico { color: var(--error); }

.ynw-tool { border: var(--bw-hairline) solid var(--border); border-radius: var(--radius-md); background: var(--surface); max-width: var(--chat-max); overflow: hidden; }
.ynw-tool.is-running { box-shadow: var(--shadow-glow); border-color: transparent; }
.ynw-tool > summary { list-style: none; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); cursor: pointer; }
.ynw-tool > summary::-webkit-details-marker { display: none; }
.ynw-tool-ico { width: 24px; height: 24px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--surface-raised); border: var(--bw-hairline) solid var(--border); color: var(--text-secondary); }
.ynw-tool-name { font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); }
.ynw-tool > summary .end { margin-left: auto; display: inline-flex; gap: var(--space-3); align-items: center; }
.ynw-tool[open] > summary .chev { transform: rotate(180deg); }
.ynw-tool .chev { color: var(--text-muted); transition: transform var(--dur-base) var(--ease-standard); }
.ynw-tool-body { border-top: var(--bw-hairline) solid var(--border); display: grid; }
.ynw-tool-sec { padding: var(--space-3); display: grid; gap: 6px; }
.ynw-tool-sec + .ynw-tool-sec { border-top: var(--bw-hairline) solid var(--border); }
.ynw-code { margin: 0; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; color: var(--text-secondary); background: var(--bg); border: var(--bw-hairline) solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); white-space: pre-wrap; overflow: auto; }
.ynw-code .k { color: var(--accent-text); }
.ynw-code .s { color: var(--info); }

.ynw-approval { max-width: var(--chat-max); border: var(--bw-hairline) solid var(--accent); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-glow); overflow: hidden; }
.ynw-approval-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--accent-subtle); }
.ynw-approval-head .ynw-eyebrow { color: var(--accent-text); }
.ynw-approval-body { padding: var(--space-4); display: grid; gap: var(--space-3); }
.ynw-approval-body p { margin: 0; font-size: 14px; color: var(--text-secondary); }
.ynw-approval-foot { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: var(--bw-hairline) solid var(--border); }
.ynw-approval-foot .ynw-choice { margin-right: auto; font-size: 13px; color: var(--text-secondary); }
.ynw-approval.is-resolved { box-shadow: none; border-color: var(--border); }

.ynw-artifact { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3); padding: var(--space-3); max-width: 420px; border: var(--bw-hairline) solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.ynw-artifact:hover { border-color: var(--border-strong); }
.ynw-artifact-tile { width: 40px; height: 48px; border-radius: var(--radius-sm); border: var(--bw-hairline) solid var(--border-strong); background: radial-gradient(var(--border-strong) 1px, transparent 1.5px) 0 0 / 6px 6px, var(--surface-raised); display: grid; place-items: end start; padding: 4px; }
.ynw-artifact-tile span { font-family: var(--font-mono); font-size: 9px; font-weight: 600; color: var(--on-accent); background: var(--accent); padding: 0 3px; border-radius: 2px; }
.ynw-artifact-name { font-size: 14px; font-weight: 500; }
.ynw-artifact-preview { grid-column: 1 / -1; height: 120px; border-radius: var(--radius-sm); border: var(--bw-hairline) solid var(--border); background: var(--bg); padding: var(--space-3); font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; color: var(--text-muted); overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }

.ynw-agent-opt { display: flex; align-items: center; gap: var(--space-3); padding: 6px var(--space-2); border-radius: var(--radius-sm); cursor: pointer; }
.ynw-agent-opt:hover, .ynw-agent-opt[data-active] { background: var(--surface-hover); }
.ynw-agent-opt .meta { display: grid; line-height: 1.3; }
.ynw-agent-opt .meta b { font-size: 13px; font-weight: 500; }
.ynw-agent-opt .meta span { font-size: 12px; color: var(--text-muted); }
.ynw-agent-opt .end { margin-left: auto; color: var(--accent-text); }
.ynw-handoff { display: inline-flex; align-items: center; gap: var(--space-2); padding: 4px var(--space-2) 4px 4px; border: var(--bw-hairline) solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; }
.ynw-handoff-line { width: 28px; height: 1px; background: repeating-linear-gradient(90deg, var(--accent) 0 4px, transparent 4px 7px); position: relative; }
.ynw-handoff-line::after { content: ""; position: absolute; right: -1px; top: -3px; width: 5px; height: 5px; border-top: 1.5px solid var(--accent); border-right: 1.5px solid var(--accent); transform: rotate(45deg); }

.ynw-side { width: var(--sidebar-w); background: var(--surface); border-right: var(--bw-hairline) solid var(--border); display: flex; flex-direction: column; height: 100%; }
.ynw-side-ws { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3); border-bottom: var(--bw-hairline) solid var(--border); }
.ynw-side-ws b { font-size: 14px; font-weight: 600; }
.ynw-side-ws .end { margin-left: auto; }
.ynw-side-scroll { flex: 1; overflow: auto; padding: var(--space-2); display: grid; gap: var(--space-4); align-content: start; }
.ynw-side-group { display: grid; gap: 1px; }
.ynw-side-group > .ynw-eyebrow { padding: var(--space-1) var(--space-2); display: flex; justify-content: space-between; }
.ynw-side-item { display: flex; align-items: center; gap: var(--space-2); height: 30px; padding: 0 var(--space-2); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ynw-side-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.ynw-side-item[aria-current] { background: var(--surface-hover); color: var(--text-primary); }
.ynw-side-item[aria-current]::after { content: ""; width: 6px; height: 6px; background: var(--accent); margin-left: auto; flex: none; }
.ynw-side-item .hash { font-family: var(--font-mono); color: var(--text-muted); width: 16px; text-align: center; }
.ynw-side-item .ynw-dots { margin-left: auto; }
.ynw-side-foot { padding: var(--space-3); border-top: var(--bw-hairline) solid var(--border); }

.ynw-cite { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; margin: 0 2px; border-radius: var(--radius-sm); background: var(--surface-raised); border: var(--bw-hairline) solid var(--border); font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); text-decoration: none; vertical-align: 1px; }
.ynw-cite:hover { border-color: var(--accent); color: var(--text-primary); }
.ynw-cite b { color: var(--accent-text); font-weight: 500; }
.ynw-sources { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ynw-source { display: grid; gap: 2px; width: 200px; padding: var(--space-2) var(--space-3); border: var(--bw-hairline) solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; color: inherit; }
.ynw-source:hover { border-color: var(--border-strong); }
.ynw-source b { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ynw-meter { display: grid; gap: 6px; min-width: 220px; }
.ynw-meter-row { display: flex; justify-content: space-between; align-items: baseline; }
.ynw-meter-track { height: 4px; background: var(--surface-hover); border-radius: var(--radius-xs); overflow: hidden; display: flex; gap: 2px; }
.ynw-meter-fill { height: 100%; background: var(--accent); }
.ynw-meter.is-warning .ynw-meter-fill { background: var(--warning); }
.ynw-meter.is-over .ynw-meter-fill { background: var(--error); }
.ynw-meter-seg { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; height: 8px; }
.ynw-meter-seg i { background: var(--surface-hover); }
.ynw-meter-seg i.on { background: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .ynw-ticker-track, .ynw-dots i, .ynw-caret, .ynw-skel::after, .ynw-step-ico { animation: none !important; }
}
