/* v2.18 Academic research environment */

/* ── Layout ── */
.rs-main { background: var(--bg); }
.rs-wrap, .rs-page, .rs-proj-wrap, .rs-overview, .rs-library, .rs-write,
.rs-analyse, .rs-tools, .rs-autopilot, .rs-apps-page, .rs-lab-page { max-width: 760px; margin: 0 auto; padding: 0 16px 80px; }

/* ── Setup wizard ── */
.rs-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px; margin: 20px 0 12px; }
.rs-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.rs-ic { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; flex-shrink: 0; }
.rs-ic svg { width: 22px; height: 22px; }
.rs-head h2 { margin: 0 0 4px; font-size: 1.1rem; }
.rs-head p { margin: 0; }
.rs-body { display: flex; flex-direction: column; gap: 14px; }
.rs-foot { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.rs-foot .btn.ghost { align-self: flex-start; }
.rs-dots { display: flex; gap: 8px; justify-content: center; padding: 4px 0; }
.rs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background 0.2s, width 0.2s; }
.rs-dot.on { width: 24px; border-radius: 4px; background: var(--accent); }
.rs-dot.done { background: var(--accent); opacity: 0.4; }

/* ── Citation style picker ── */
.rs-style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rs-style-card { border: 2px solid var(--border); border-radius: 10px; padding: 12px 8px; cursor: pointer; background: var(--card); font-size: 0.95rem; transition: border-color 0.15s, background 0.15s; }
.rs-style-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.rs-style-card b { display: block; text-align: center; }

/* ── Mode picker ── */
.rs-mode-grid { display: flex; flex-direction: column; gap: 10px; }
.rs-mode-card { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 12px; border: 2px solid var(--border); border-radius: 12px; padding: 14px 12px; cursor: pointer; background: var(--card); text-align: left; transition: border-color 0.15s, background 0.15s; }
.rs-mode-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.rs-mc-ico { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; }
.rs-mc-ico svg { width: 18px; height: 18px; }
.rs-mc-text b { display: block; margin-bottom: 2px; }
.rs-mc-text span { font-size: 0.82rem; color: var(--muted); line-height: 1.4; }

/* ── Hero (empty state) ── */
.rs-hero { text-align: center; padding: 48px 20px; }
.rs-hero-ic { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 20px; background: var(--accent); color: #fff; margin: 0 auto 20px; }
.rs-hero-ic svg { width: 36px; height: 36px; }
.rs-hero h1 { margin: 0 0 8px; }
.rs-hero p { color: var(--muted); max-width: 420px; margin: 0 auto 24px; }
.rs-hero-acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ── Projects list ── */
.rs-ph { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 0 12px; }
.rs-ph h1 { margin: 0 0 2px; }
.rs-proj-grid { display: flex; flex-direction: column; gap: 12px; }
.rs-proj-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; cursor: pointer; transition: box-shadow 0.15s, transform 0.1s; }
.rs-proj-card:hover { box-shadow: 0 4px 16px color-mix(in srgb, var(--fg) 8%, transparent); transform: translateY(-1px); }
.rs-proj-card:active { transform: none; }
.rs-pc-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.rs-pc-ic { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); flex-shrink: 0; }
.rs-pc-ic svg { width: 18px; height: 18px; }
.rs-pc-info { flex: 1; min-width: 0; }
.rs-pc-info b { display: block; margin-bottom: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-pc-info small { color: var(--muted); font-size: 0.8rem; }
.rs-pc-q { margin: 0 0 10px; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.rs-pc-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rs-stage { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; background: color-mix(in srgb, var(--sc, #6c757d) 12%, transparent); color: var(--sc, #6c757d); border: 1px solid color-mix(in srgb, var(--sc, #6c757d) 30%, transparent); }
.rs-pc-mode { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--muted); }
.rs-pc-mode svg { width: 12px; height: 12px; }
.rs-pc-date { font-size: 0.78rem; margin-left: auto; }
.rs-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0; }
.rs-new-btn { display: inline-flex; }

/* ── Project workspace ── */
.rs-proj-topbar { display: flex; align-items: center; gap: 10px; padding: 14px 0 8px; }
.rs-proj-title { flex: 1; margin: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-tabs { display: flex; overflow-x: auto; gap: 2px; padding: 0 0 12px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.rs-tabs::-webkit-scrollbar { display: none; }
.rs-tab { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 8px; border: none; background: none; cursor: pointer; color: var(--muted); font-size: 0.85rem; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.rs-tab svg { width: 15px; height: 15px; }
.rs-tab.on { background: color-mix(in srgb, var(--accent) 10%, var(--card)); color: var(--accent); font-weight: 600; }
.rs-tab:hover:not(.on) { background: var(--hover); color: var(--fg); }
.rs-content { padding-top: 16px; }

/* ── Overview ── */
.rs-overview { display: grid; gap: 20px; }
@media (min-width: 600px) { .rs-overview { grid-template-columns: 1fr 1fr; } }
.rs-question { border-left: 4px solid var(--accent); padding: 10px 14px; margin: 0 0 14px; background: color-mix(in srgb, var(--accent) 6%, var(--card)); border-radius: 0 8px 8px 0; font-style: italic; }
.rs-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.85rem; }
.rs-meta dt { color: var(--muted); }
.rs-meta dd { margin: 0; }
.rs-ov-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rs-ov-ai h3 { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; font-size: 0.95rem; }
.rs-ov-ai h3 svg { width: 16px; height: 16px; color: var(--accent); }

/* ── AI panels ── */
.rs-ai-panel { margin-bottom: 10px; }
.rs-ai-out { margin-top: 12px; }
.rs-ai-out.hidden { display: none; }
.rs-ai-result { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.rs-ai-saved { display: flex; align-items: center; gap: 5px; color: var(--accent); margin-bottom: 8px; }
.rs-ai-saved svg { width: 14px; height: 14px; }
.rs-sources { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.rs-sources b { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.rs-src { display: block; font-size: 0.8rem; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.rs-ai-section { margin-top: 20px; }
.rs-ai-section h4 { font-size: 0.9rem; color: var(--muted); margin-bottom: 10px; }

/* ── Library ── */
.rs-lib-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.rs-lib-head h3 { margin: 0; }
.rs-lib-head div { display: flex; gap: 8px; }
.rs-lib-ai { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.rs-lib-ai h4 { font-size: 0.9rem; color: var(--muted); margin-bottom: 10px; }
.rs-item-list { display: flex; flex-direction: column; gap: 8px; }
.rs-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.rs-item-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.rs-item-ic { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, var(--card)); color: var(--accent); flex-shrink: 0; }
.rs-item-ic svg { width: 14px; height: 14px; }
.rs-item-head > div { flex: 1; min-width: 0; }
.rs-item-head b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-item-head small { font-size: 0.75rem; color: var(--muted); }
.rs-item-preview { font-size: 0.82rem; color: var(--muted); line-height: 1.5; margin: 0; }
.rs-work { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.rs-work b { display: block; margin-bottom: 4px; }
.rs-work small { font-size: 0.78rem; color: var(--muted); display: block; margin-bottom: 6px; }
.rs-work-abs { font-size: 0.82rem; margin: 4px 0 8px; color: var(--muted); }
.rs-work-acts { display: flex; gap: 8px; }
.rs-search-results { max-height: 60vh; overflow-y: auto; }

/* ── Write ── */
.rs-write-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.rs-write-head h3 { margin: 0; }
.rs-write-ai { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.rs-write-ai h4 { font-size: 0.9rem; color: var(--muted); margin-bottom: 10px; }

/* ── Analyse / Tools ── */
.rs-analyse h3, .rs-tools h3 { margin-bottom: 16px; }
.rs-tool-sec { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.rs-tool-sec h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; font-size: 0.9rem; }
.rs-tool-sec h4 svg { width: 15px; height: 15px; color: var(--accent); }

/* ── Autopilot ── */
.rs-ap-hero { display: flex; align-items: flex-start; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.rs-ap-ic { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; flex-shrink: 0; }
.rs-ap-ic svg { width: 22px; height: 22px; }
.rs-ap-hero h3 { margin: 0 0 4px; }
.rs-ap-hero p { margin: 0; font-size: 0.85rem; color: var(--muted); }
.rs-warn { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: color-mix(in srgb, #fd7e14 10%, var(--card)); border: 1px solid color-mix(in srgb, #fd7e14 25%, transparent); border-radius: 10px; font-size: 0.85rem; color: #c95b00; margin-bottom: 12px; }
.rs-warn svg { width: 15px; height: 15px; }
.rs-ap-log { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.rs-ap-log h4 { font-size: 0.9rem; color: var(--muted); margin-bottom: 10px; }
.rs-log-list { display: flex; flex-direction: column; gap: 4px; padding: 0; list-style: none; font-size: 0.82rem; }
.rs-log-list li { display: flex; align-items: baseline; gap: 5px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.rs-log-actor { font-weight: 600; padding: 1px 7px; border-radius: 20px; font-size: 0.72rem; }
.rs-log-actor.simrah { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.rs-log-actor.learner { background: var(--hover); color: var(--fg); }
.rs-log-list time { margin-left: auto; color: var(--muted); font-size: 0.72rem; }

/* ── Apps comparison ── */
.rs-apps-head { padding: 20px 0 16px; }
.rs-apps-head h1 { margin: 0 0 8px; }
.rs-app-grid { display: flex; flex-direction: column; gap: 16px; }
.rs-app-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.rs-app-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.rs-app-ic { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.rs-app-ic svg { width: 18px; height: 18px; }
.rs-app-focus { font-size: 0.85rem; color: var(--muted); margin: 0 0 14px; }
.rs-app-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.rs-app-cols h5 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin: 0 0 6px; }
.rs-app-cols ul { margin: 0; padding-left: 16px; font-size: 0.82rem; }
.rs-app-cols li { margin-bottom: 3px; }
.rs-app-simrah { background: color-mix(in srgb, var(--accent) 7%, var(--card)); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 10px; padding: 12px 14px; }
.rs-app-simrah b { display: flex; align-items: center; gap: 7px; font-size: 0.85rem; color: var(--accent); margin-bottom: 6px; }
.rs-app-simrah b svg { width: 14px; height: 14px; }
.rs-app-simrah p { font-size: 0.85rem; margin: 0; }
.rs-app-cta { text-align: center; padding: 24px 0; }

/* ── Lab ── */
.rs-lab-page h1 { padding: 20px 0 8px; }
.rs-lab-sec { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.rs-lab-sec h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 0.95rem; }
.rs-lab-sec h2 svg { width: 16px; height: 16px; color: var(--accent); }
.rs-lab-cite-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
@media (max-width: 480px) { .rs-lab-cite-fields { grid-template-columns: 1fr; } }
.rs-lab-cite-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; }
.rs-lab-cite-out { flex: 1; font-size: 0.85rem; background: var(--hover); border-radius: 8px; padding: 10px 12px; min-height: 40px; line-height: 1.6; }
.rs-lab-stats-out { margin-top: 10px; font-size: 0.85rem; }
.rs-lab-table { border-collapse: collapse; width: auto; }
.rs-lab-table td { padding: 3px 14px 3px 0; }
.rs-lab-table td:last-child { font-variant-numeric: tabular-nums; color: var(--accent); }
.rs-lab-links { display: flex; gap: 8px; padding: 8px 0 20px; }

/* ── Empty & shared ── */
.rs-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px; text-align: center; color: var(--muted); }
.rs-empty svg { width: 36px; height: 36px; opacity: 0.5; }
.rs-empty b { color: var(--fg); }
.row-gap { display: flex; gap: 8px; }

/* ── v2.18.1 project screen, phone first ── */
.rs-proj-wrap { padding-top: 6px; }
.rs-proj-top { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0 10px; }
.rs-proj-id { flex: 1; min-width: 0; }
.rs-proj-title { margin: 0; font-size: 1.2rem; line-height: 1.25; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rs-proj-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.rs-proj-sub small { color: var(--muted); }
.rs-icon-btn { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--fg); cursor: pointer; }
.rs-icon-btn svg { width: 18px; height: 18px; }
.rs-tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 -16px; padding: 8px 16px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rs-tab { flex: none; scroll-snap-align: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: .88rem; gap: 6px; }
.rs-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.rs-tab.on svg { color: #fff; }
.rs-content { padding-top: 14px; }
.rs-content > div > h3 { font-size: 1.05rem; margin: 0 0 10px; }
.rs-content h4 { margin: 18px 0 10px; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rs-overview { display: flex; flex-direction: column; gap: 16px; padding: 0; }
.rs-ov-info, .rs-ov-ai { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.rs-ov-ai h3 { margin: 0 0 10px; }
.rs-meta { grid-template-columns: 92px 1fr; gap: 8px 10px; }
.rs-ov-actions .btn { flex: 1 1 auto; justify-content: center; }
.rs-library, .rs-write, .rs-analyse, .rs-tools, .rs-autopilot { padding: 0; }
.rs-lib-head, .rs-write-head { flex-wrap: wrap; }
.rs-lib-head > div { width: 100%; }
.rs-lib-head > div .btn { flex: 1; justify-content: center; }
.rs-lib-ai, .rs-write-ai, .rs-ai-section { border-top: 0; padding-top: 0; }
.rs-tool-sec { padding: 14px; }
.field textarea.input, .field input.input, .field select.input { width: 100%; }

/* AI action rows: one tidy card per action, the answer opens inside it */
.rs-ai-panel { display: contents; }
.rs-act { background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin: 0 0 10px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.rs-act:active { border-color: var(--accent); }
.rs-act.busy { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.rs-act-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; cursor: pointer; min-height: 64px; }
.rs-act-ic { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.rs-act-ic svg { width: 18px; height: 18px; }
.rs-act-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rs-act-t b { font-size: .95rem; line-height: 1.25; }
.rs-act-t small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.rs-act-go { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 12px; background: linear-gradient(135deg, #0a2a4d, #0c6e9c); color: #fff; cursor: pointer; }
.rs-act-go svg { width: 18px; height: 18px; }
.rs-act-go:disabled { opacity: .5; }
.rs-act .rs-ai-out { border-top: 1px solid var(--border); padding: 14px; background: color-mix(in srgb, var(--bg) 60%, var(--card)); margin: 0; }
.rs-act .rs-ai-result { background: none; border: 0; padding: 0; }
.rs-working { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.rs-dots3 { display: inline-flex; gap: 4px; }
.rs-dots3 i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: rsb 1s infinite ease-in-out; }
.rs-dots3 i:nth-child(2) { animation-delay: .15s; } .rs-dots3 i:nth-child(3) { animation-delay: .3s; }
@keyframes rsb { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .rs-dots3 i { animation: none; opacity: .7; } }
.rs-ai-err { color: #b3261e; font-size: .9rem; margin: 0; }
.rs-ai-result .prose { font-size: .93rem; line-height: 1.65; overflow-wrap: anywhere; }
.rs-ai-result .prose h1, .rs-ai-result .prose h2, .rs-ai-result .prose h3 { font-size: 1rem; margin: 14px 0 6px; }
.rs-ai-result .prose table { display: block; overflow-x: auto; max-width: 100%; }
.rs-ai-result .btn { margin-top: 10px; }
.rs-item { border-radius: 14px; }
.rs-item-head b { white-space: normal; }

/* ── Administration → Research ── */
.ar-main { background: var(--bg); }
.ar-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 90px; display: flex; flex-direction: column; gap: 14px; }
.ar-top h1 { margin: 18px 0 4px; }
.ar-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ar-card h2 { margin: 0; font-size: 1rem; } .ar-card h3 { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }
.ar-head { display: flex; gap: 12px; align-items: flex-start; }
.ar-ic { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--accent); color: #fff; }
.ar-ic svg { width: 20px; height: 20px; }
.ar-pill { align-self: flex-start; font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.ar-pill.good { background: color-mix(in srgb, #198754 14%, transparent); color: #198754; } .ar-pill.warn { background: color-mix(in srgb, #fd7e14 14%, transparent); color: #b45309; }
.ar-acts { display: flex; flex-wrap: wrap; gap: 8px; } .ar-acts .btn { flex: 1 1 140px; justify-content: center; }
.ar-test { font-size: .85rem; color: var(--muted); word-break: break-word; } .ar-test.ok { color: #198754; } .ar-test.bad { color: #b3261e; }
.ar-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); }
.ar-row:first-of-type { border-top: 0; } .ar-row b { display: block; font-size: .93rem; } .ar-row small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.ar-sw { flex: none; width: 52px; height: 30px; border-radius: 999px; border: 0; background: var(--border); position: relative; cursor: pointer; transition: background .15s; }
.ar-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.ar-sw.on { background: #198754; } .ar-sw.on::after { transform: translateX(22px); }
.ar-inline { display: flex; gap: 8px; align-items: center; } .ar-limit { width: 84px; }
.ar-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ar-stat { background: color-mix(in srgb, var(--accent) 6%, var(--card)); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.ar-stat b { font-size: 1.35rem; } .ar-stat span { font-size: .8rem; } .ar-stat small { color: var(--muted); font-size: .72rem; }
.ar-li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .88rem; flex-wrap: wrap; }
.ar-li.bad small { color: #b3261e; flex-basis: 100%; }
.ar-projects { display: flex; flex-direction: column; gap: 8px; }
.ar-proj { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); cursor: pointer; }
.ar-proj small { color: var(--muted); font-size: .78rem; }
.ar-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; } .ar-item summary { cursor: pointer; font-size: .9rem; }
.bad { color: #b3261e; }
.rs-ov-ai { background: none; border: 0; padding: 0; }
.rs-ov-ai h3 { padding: 0 2px; }

/* ═══ v2.18.2 workspace: fixed five-tab navigation, editor, chat, export ═══ */
.rs-proj-wrap { padding: 0 0 24px; }
.rs-proj-top { display: flex; gap: 10px; align-items: flex-start; padding: 14px 0 12px; }
.rs-proj-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rs-proj-title { margin: 0; font-size: 1.15rem; line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rs-stage-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 8px 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--fg); font-size: .78rem; font-weight: 600; cursor: pointer; }
.rs-stage-chip svg { width: 14px; height: 14px; color: var(--muted); }
.rs-proj-btns { display: flex; gap: 8px; flex: none; }
.rs-pill-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--fg); font-weight: 600; font-size: .88rem; cursor: pointer; }
.rs-pill-btn svg { width: 16px; height: 16px; }
.rs-icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; }
.rs-icon-btn.sm svg { width: 16px; height: 16px; }

.rs-seg { position: sticky; top: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 6px; margin: 0 0 14px; border-radius: 18px; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: 0 6px 20px color-mix(in srgb, var(--fg) 8%, transparent); }
.rs-seg-b { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; padding: 6px 2px; border: 0; border-radius: 13px; background: none; color: var(--muted); font-size: .7rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; -webkit-tap-highlight-color: transparent; }
.rs-seg-b svg { width: 21px; height: 21px; }
.rs-seg-b.on { background: linear-gradient(135deg, #0a2a4d, #0c6e9c); color: #fff; box-shadow: 0 4px 12px rgba(10, 42, 77, .3); }
.rs-seg-n { position: absolute; top: 3px; right: 12%; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font: 700 .62rem/17px system-ui; text-align: center; font-style: normal; }
.rs-content { padding-top: 0; }
.rs-stack { display: flex; flex-direction: column; gap: 12px; }
.rs-stack > h4, .rs-content h4 { margin: 10px 2px 0; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.rs-stage-list { display: flex; flex-direction: column; gap: 8px; }
.rs-stage-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); cursor: pointer; text-align: left; font-size: .95rem; }
.rs-stage-row.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.rs-stage-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--border); font-size: .8rem; font-weight: 700; } .rs-stage-row.on .rs-stage-n { background: var(--accent); color: #fff; } .rs-stage-n svg { width: 14px; height: 14px; }

/* tool rows */
.rs-act-row2, .rs-next, .rs-exp, .rs-note, .rs-doc { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--card); color: var(--fg); cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: border-color .15s, transform .1s; }
.rs-act-row2:active, .rs-next:active, .rs-exp:active, .rs-doc:active, .rs-note:active { transform: scale(.985); border-color: var(--accent); }
.rs-act-ic.on { background: var(--accent); color: #fff; }
.rs-go { flex: none; color: var(--muted); display: grid; place-items: center; } .rs-go svg { width: 18px; height: 18px; }
.rs-next { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--card)), var(--card)); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.rs-next .rs-act-t small:first-child { text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--accent); font-size: .68rem; }
.rs-exp { min-height: 64px; }
.rs-check { display: flex; align-items: center; gap: 10px; font-size: .9rem; } .rs-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.rs-acts-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; } .rs-acts-row .btn { flex: 1 1 auto; justify-content: center; }

/* question + stats + contribution */
.rs-q-card, .rs-q-empty { display: block; width: 100%; text-align: left; padding: 16px; border-radius: 18px; border: 1px solid var(--border); background: var(--card); cursor: pointer; color: var(--fg); position: relative; }
.rs-q-card small { color: var(--accent); font-weight: 700; font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; }
.rs-q-card p { margin: 6px 0 0; font-size: 1.05rem; line-height: 1.45; font-weight: 600; padding-right: 54px; }
.rs-q-edit { position: absolute; top: 14px; right: 14px; display: inline-flex; gap: 4px; align-items: center; font-size: .75rem; color: var(--muted); } .rs-q-edit svg { width: 13px; height: 13px; }
.rs-q-empty { display: flex; gap: 12px; align-items: center; border-style: dashed; border-width: 2px; border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); } .rs-q-empty svg { width: 22px; height: 22px; color: var(--accent); } .rs-q-empty small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.rs-q-edit-box { padding: 12px; border: 1px solid var(--accent); border-radius: 18px; background: var(--card); }
.rs-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rs-stat { padding: 12px 8px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); text-align: center; display: flex; flex-direction: column; } .rs-stat b { font-size: 1.3rem; } .rs-stat span { font-size: .72rem; color: var(--muted); }
.rs-contrib { padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); }
.rs-bar { height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 22%, var(--border)); overflow: hidden; } .rs-bar i { display: block; height: 100%; background: #0c6e9c; border-radius: 6px; }
.rs-bar-l { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 600; margin: 6px 0; }
.rs-note { flex-direction: column; align-items: flex-start; gap: 2px; } .rs-note small { color: var(--muted); font-size: .72rem; } .rs-note p { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }

/* library */
.rs-searchbar { display: flex; gap: 8px; } .rs-searchbar .input { flex: 1; min-width: 0; } .rs-searchbar .btn { flex: none; }
.rs-found, .rs-saved { display: flex; flex-direction: column; gap: 10px; }
.rs-src-card { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.rs-src-card .grow { flex: 1; min-width: 0; } .rs-src-card b { display: block; font-size: .9rem; line-height: 1.3; } .rs-src-card small { color: var(--muted); font-size: .75rem; }
.rs-sn { flex: none; min-width: 34px; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); font: 700 .75rem/28px system-ui; text-align: center; }
.btn.done { opacity: .7; }

/* chips */
.rs-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.rs-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--fg); font-size: .84rem; cursor: pointer; text-align: left; }
.rs-chip svg { width: 14px; height: 14px; } .rs-chip.on, .rs-chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* write */
.rs-docs { display: flex; flex-direction: column; gap: 10px; }
.rs-doc { flex-direction: column; align-items: stretch; gap: 4px; } .rs-doc p { margin: 0; color: var(--muted); font-size: .85rem; } .rs-doc small { color: var(--muted); font-size: .72rem; }
.rs-doc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; } .rs-doc-top b { font-size: .98rem; }
.rs-who { flex: none; font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--border); color: var(--fg); }
.rs-who.simrah { background: color-mix(in srgb, #0c6e9c 16%, transparent); color: #0c6e9c; } .rs-who.both { background: color-mix(in srgb, #198754 16%, transparent); color: #198754; }
.rs-empty.tight { padding: 28px 12px; }
.rs-editor { display: flex; flex-direction: column; gap: 10px; }
.rs-ed-top { display: flex; align-items: center; gap: 8px; } .rs-ed-top .rs-who { margin-right: auto; }
.rs-ed-title { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--fg); font: 700 1.25rem/1.3 inherit; padding: 6px 2px 10px; outline: none; } .rs-ed-title:focus { border-color: var(--accent); }
.rs-ed-body { width: 100%; min-height: 280px; resize: none; border: 0; background: var(--card); color: var(--fg); border-radius: 16px; padding: 16px; font: 1.02rem/1.75 Georgia, "Times New Roman", serif; outline: none; box-shadow: inset 0 0 0 1px var(--border); } .rs-ed-body:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.rs-ed-meta { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); } .rs-ed-status { cursor: pointer; }
.rs-ed-bar { position: sticky; bottom: 92px; z-index: 5; display: flex; gap: 8px; overflow-x: auto; padding: 8px; border-radius: 16px; background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: 0 8px 24px color-mix(in srgb, var(--fg) 12%, transparent); scrollbar-width: none; }
.rs-ed-bar::-webkit-scrollbar { display: none; }
.rs-ed-ai { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--fg); font-weight: 600; font-size: .84rem; cursor: pointer; }
.rs-ed-ai svg { width: 15px; height: 15px; color: var(--accent); } .rs-ed-ai:disabled { opacity: .5; }
.rs-ed-result { padding: 14px; border-radius: 16px; border: 1px solid var(--accent); background: var(--card); } .rs-ed-result.hidden { display: none; }
.rs-ed-res-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

/* analyse */
.rs-card2 { padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; } .rs-card2 h3 { margin: 0; font-size: 1.02rem; }
.rs-data { font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.rs-find { padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); } .rs-find pre { margin: 6px 0 0; white-space: pre-wrap; font: .82rem/1.5 ui-monospace, Menlo, monospace; color: var(--muted); }

/* chat */
.rs-chat { display: flex; flex-direction: column; gap: 10px; }
.rs-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--border); }
.rs-sub button { min-height: 38px; border: 0; border-radius: 11px; background: none; color: var(--muted); font-weight: 700; font-size: .88rem; cursor: pointer; } .rs-sub button.on { background: var(--card); color: var(--fg); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.rs-thread { display: flex; flex-direction: column; gap: 12px; min-height: 40vh; padding: 4px 0; }
.rs-msg { max-width: 92%; padding: 11px 14px; border-radius: 18px; font-size: .95rem; line-height: 1.55; overflow-wrap: anywhere; }
.rs-msg.user { align-self: flex-end; background: linear-gradient(135deg, #0a2a4d, #0c6e9c); color: #fff; border-bottom-right-radius: 6px; } .rs-msg.user p { margin: 0; }
.rs-msg.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.rs-msg .prose { font-size: .93rem; line-height: 1.6; } .rs-msg .prose > :first-child { margin-top: 0; } .rs-msg .prose > :last-child { margin-bottom: 0; } .rs-msg .prose table { display: block; overflow-x: auto; }
.rs-msg-acts { display: flex; gap: 14px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); } .rs-msg-acts button { display: inline-flex; gap: 5px; align-items: center; border: 0; background: none; color: var(--muted); font-size: .76rem; font-weight: 600; cursor: pointer; padding: 4px 0; } .rs-msg-acts svg { width: 13px; height: 13px; }
.rs-chat-empty { text-align: center; padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; } .rs-chat-empty small { color: var(--muted); max-width: 300px; }
.rs-hero-ic.sm { width: 52px; height: 52px; border-radius: 16px; margin: 0 0 6px; } .rs-hero-ic.sm svg { width: 26px; height: 26px; }
.rs-composer { position: sticky; bottom: 92px; z-index: 5; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 22px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 8px 24px color-mix(in srgb, var(--fg) 14%, transparent); }
.rs-chat-in { flex: 1; min-width: 0; border: 0; background: none; color: var(--fg); font: 1rem/1.4 inherit; resize: none; outline: none; padding: 9px 0; max-height: 140px; }
.rs-send { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: linear-gradient(135deg, #0a2a4d, #0c6e9c); color: #fff; display: grid; place-items: center; cursor: pointer; } .rs-send:disabled { opacity: .5; } .rs-send svg { width: 20px; height: 20px; }
.rs-compose-out { display: flex; flex-direction: column; gap: 8px; } .rs-compose-out .prose { font-size: .93rem; line-height: 1.6; overflow-wrap: anywhere; }
@media (min-width: 700px) { .rs-seg-b { flex-direction: row; gap: 8px; font-size: .85rem; min-height: 46px; } .rs-ed-bar, .rs-composer { bottom: 16px; } }
.rs-act-ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--accent) 13%, var(--card)); color: var(--accent); }
.rs-act-ic svg { width: 19px; height: 19px; }
.rs-act-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; } .rs-act-t b { font-size: .95rem; line-height: 1.25; } .rs-act-t small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.rs-ed-bar { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; }
.rs-ed-ai { justify-content: center; padding: 0 6px; font-size: .8rem; }
.rs-chat > .rs-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; } .rs-chat > .rs-chips::-webkit-scrollbar { display: none; } .rs-chat > .rs-chips .rs-chip { flex: none; }
.rs-thread { min-height: 30vh; }
.rs-ed-title { font-size: 1.3rem; font-weight: 700; line-height: 1.3; font-family: inherit; }
.rs-chat-in { font-size: 1rem; line-height: 1.4; font-family: inherit; }
.rs-ed-bar { position: static; bottom: auto; box-shadow: none; padding: 6px; gap: 6px; background: var(--card); }
.rs-ed-body { min-height: 240px; }
