@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --ink: #161616;
  --muted: #767672;
  --paper: #f7f7f3;
  --surface: rgba(255, 255, 252, 0.78);
  --line: #deded8;
  --green: #147a5b;
  --green-soft: #dceee5;
  --text: #3d3d3a;
  --faint: #aaa9a3;
  --card: rgba(255,255,252,.68);
  --bubble: rgba(255,255,252,.58);
  --on-ink: #ffffff;
  --sidebar-width: 278px;
}

:root[data-theme="dark"] {
  --ink: #f1f3ee;
  --muted: #9ca69d;
  --paper: #111512;
  --surface: rgba(27, 34, 29, .86);
  --line: #2d3830;
  --green: #63c99b;
  --green-soft: #1c3b2d;
  --text: #d3d8d1;
  --faint: #7d877f;
  --card: rgba(26,32,28,.92);
  --bubble: rgba(36,44,38,.92);
  --on-ink: #111512;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  overflow: hidden;
}

button, textarea { font: inherit; }
button { color: inherit; }
.ambient { position: fixed; width: 35vw; height: 35vw; border-radius: 50%; filter: blur(80px); opacity: .18; pointer-events: none; z-index: -1; }
.ambient-one { background: #bde5d3; top: -18vw; right: 5vw; animation: drift 16s ease-in-out infinite alternate; }
.ambient-two { background: #e8e1bb; bottom: -24vw; left: 22vw; animation: drift 20s ease-in-out infinite alternate-reverse; }
:root[data-theme="dark"] .ambient-one { background: #1e7654; opacity: .13; }
:root[data-theme="dark"] .ambient-two { background: #70673b; opacity: .08; }

.sidebar {
  width: var(--sidebar-width); height: 100vh; position: fixed; inset: 0 auto 0 0; z-index: 20;
  display: flex; flex-direction: column; padding: 31px 22px 24px;
  background: rgba(247, 247, 243, .88); border-right: 1px solid var(--line);
  backdrop-filter: blur(22px); transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .input-container { background: rgba(17, 21, 18, .88); }
.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 0 10px; margin-bottom: 58px; }
.brand-mark { width: 28px; height: 28px; position: relative; display: grid; place-items: center; }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ""; position: absolute; width: 19px; height: 7px; background: var(--ink); border-radius: 10px; transform: rotate(45deg); }
.brand-mark::after { transform: rotate(-45deg); }
.brand-mark span:first-child { width: 7px; height: 7px; background: var(--green); transform: translate(-6px, 6px); z-index: 2; }
.brand-mark span:last-child { display: none; }
.brand-lockup strong { display: block; font-size: 21px; letter-spacing: -.03em; line-height: 1; }
.brand-lockup small { display: block; margin-top: 5px; color: var(--muted); font: 10px "DM Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.eyebrow { color: var(--muted); font: 10px "DM Mono", monospace; letter-spacing: .13em; text-transform: uppercase; margin: 0 10px 13px; }
.files-list { height: calc(100vh - 280px); overflow-y: auto; padding: 2px 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.files-empty { display: flex; align-items: center; gap: 10px; padding: 12px 10px; color: var(--muted); font-size: 12px; }
.sidebar-footer { margin-top: auto; }
.privacy-note { display: flex; align-items: flex-start; gap: 10px; padding: 15px 10px; color: var(--muted); font-size: 11px; line-height: 1.5; border-top: 1px solid var(--line); }
.privacy-note i { color: var(--green); margin-top: 2px; }
.participant-badge { display: flex; align-items: center; gap: 8px; padding: 11px 12px; background: var(--green-soft); border-radius: 8px; color: var(--green); font-size: 10px; font-weight: 700; }
.status-dot { width: 6px; height: 6px; background: #31a86d; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px rgba(49,168,109,.12); }

.sidebar-toggle { display: none; }
.main-content { min-height: 100vh; height: 100vh; margin-left: var(--sidebar-width); display: flex; flex-direction: column; }
.top-bar { padding: 22px 6.5%; border-bottom: 1px solid var(--line); }
.top-bar-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1120px; margin: auto; }
.breadcrumb { color: var(--muted); font-size: 11px; letter-spacing: .01em; }
.breadcrumb span:not(.breadcrumb-dot) { margin: 0 7px; color: #b1b1ab; }
:root[data-theme="dark"] .breadcrumb span:not(.breadcrumb-dot) { color: #677168; }
.breadcrumb b { color: var(--ink); font-weight: 600; }
.breadcrumb-dot { width: 6px; height: 6px; margin-right: 8px; display: inline-block; border-radius: 50%; background: var(--green); vertical-align: 1px; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.live-label { display: flex; align-items: center; gap: 8px; color: var(--green); font: 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
.icon-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: color .2s; }
.icon-button:hover { color: var(--ink); }

.chat-container { width: min(1120px, 87%); flex: 1; overflow-y: auto; padding: 70px 0 40px; margin: 0 auto; scrollbar-width: none; }
.chat-container::-webkit-scrollbar { display: none; }
.welcome-block { max-width: 700px; margin-bottom: 68px; animation: reveal .7s both; }
.welcome-kicker { display: flex; align-items: center; gap: 9px; color: var(--green); font: 11px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
.spark { width: 7px; height: 7px; display: inline-block; background: var(--green); border-radius: 2px 50% 50% 50%; transform: rotate(45deg); }
h1 { margin: 20px 0 18px; font-size: clamp(42px, 6vw, 76px); line-height: .98; letter-spacing: -.085em; font-weight: 700; }
h1 em { color: var(--green); font-style: normal; }
.welcome-copy { max-width: 510px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 29px; }
.prompt-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 100px; padding: 10px 14px; background: rgba(255,255,255,.35); color: #4d4d49; cursor: pointer; font-size: 11px; transition: transform .2s, border-color .2s, background .2s; }
.prompt-chip i { color: var(--green); font-size: 10px; }
.prompt-chip:hover { border-color: #a8cdbc; background: var(--green-soft); transform: translateY(-2px); }
:root[data-theme="dark"] .prompt-chip { background: rgba(255,255,255,.04); color: var(--ink); }
:root[data-theme="dark"] .prompt-chip:hover { border-color: var(--green); }

.message { max-width: 850px; margin: 22px auto; display: flex; gap: 15px; animation: reveal .45s both; }
.message.user { align-items: flex-start; margin-top: 34px; margin-bottom: 30px; }
.message.user .message-content { padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bubble); color: var(--ink); }
.message.user .message-content p { margin: 0; }
.message-avatar { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--ink); color: var(--on-ink); font: 700 14px "DM Mono", monospace; }
.assistant-avatar { position: relative; background: var(--green); color: #fff; }
.assistant-avatar span { width: 5px; height: 5px; position: absolute; bottom: 7px; right: 7px; border: 1px solid white; border-radius: 50%; }
.message-content { min-width: 0; flex: 1; padding: 2px 0; background: transparent; color: var(--text); font-size: 14px; line-height: 1.75; }
.message-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; color: var(--ink); font-size: 11px; font-weight: 800; }
.message-meta time { color: var(--faint); font: 10px "DM Mono", monospace; font-weight: 400; }
.intro-message { padding-top: 20px; border-top: 1px solid var(--line); }
.input-container { padding: 16px 6.5% 23px; border-top: 1px solid var(--line); background: rgba(247,247,243,.78); backdrop-filter: blur(18px); }
.input-box { max-width: 850px; margin: auto; position: relative; }
.message-input { display: block; width: 100%; min-height: 58px; max-height: 180px; padding: 18px 60px 17px 20px; resize: none; outline: none; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--ink); font-size: 14px; box-shadow: 0 7px 25px rgba(30,30,20,.035); transition: border-color .2s, box-shadow .2s; }
.message-input:focus { border-color: #8bbca6; box-shadow: 0 0 0 4px rgba(20,122,91,.08); }
.message-input::placeholder { color: var(--faint); }
.send-button { position: absolute; right: 11px; bottom: 11px; width: 36px; height: 36px; border: 0; border-radius: 9px; background: var(--ink); color: var(--on-ink); cursor: pointer; transition: transform .2s, background .2s; }
.send-button:hover { background: var(--green); transform: translateY(-2px); }
.send-button:disabled { opacity: .5; cursor: not-allowed; }
.input-hint { position: absolute; right: 58px; top: -20px; color: var(--faint); font: 9px "DM Mono", monospace; }
.hint-key { display: inline-block; margin-left: 7px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 3px; }
.input-disclaimer { margin-top: 10px; color: var(--faint); text-align: center; font-size: 10px; }

.folder, .file-item { margin: 3px 0; border-radius: 7px; color: var(--text); cursor: pointer; font-size: 12px; transition: background .2s, color .2s; }
.folder:hover, .file-item:hover { background: var(--green-soft); color: var(--green); }
.folder-row, .file-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; }
.folder-row { min-height: 34px; }
.folder i, .file-item i { flex: 0 0 13px; width: 13px; color: var(--green); font-size: 11px; }
.folder.open > .folder-row { color: var(--green); font-weight: 700; }
.folder.open > .folder-row i { transform: scale(1.05); }
.folder-content { margin: 0 0 4px 14px; padding-left: 9px; border-left: 1px solid var(--line); }
.folder-content .folder { margin: 1px 0; }
.file-item { overflow: hidden; }
.file-item { white-space: nowrap; }
.file-item::after { content: ""; width: 4px; height: 4px; margin-left: auto; flex: 0 0 4px; border-radius: 50%; background: var(--faint); }
.file-item:hover::after { background: var(--green); }
.loader-state { width: min(520px, 100%); display: grid; gap: 14px; margin: 30px auto 42px; padding: 18px 20px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--muted); box-shadow: 0 18px 40px -28px rgba(20, 60, 40, .35); backdrop-filter: blur(10px); animation: reveal .35s both; }
.loader-head { display: flex; align-items: center; gap: 14px; }
.loader-orbit { position: relative; width: 28px; height: 28px; flex: 0 0 28px; border: 1px solid rgba(20,122,91,.25); border-radius: 50%; animation: spin 2s linear infinite; }
.loader-orbit::before { content: ""; position: absolute; inset: 5px; border: 1px solid var(--green); border-radius: 50%; }
.loader-orbit span { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.loader-orbit span:first-child { top: -2px; left: 11px; }
.loader-orbit span:nth-child(2) { right: -2px; top: 11px; opacity: .55; }
.loader-orbit span:last-child { bottom: -2px; left: 11px; opacity: .3; }
.loader-copy { display: grid; gap: 4px; min-width: 0; flex: 1; font-size: 12px; }
.loader-copy strong { color: var(--ink); font-size: 13px; }
.loader-detail { font: 10px "DM Mono", monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loader-detail b { color: var(--green); font-weight: 500; }
.loader-percent { color: var(--ink); font: 500 22px "DM Mono", monospace; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.loader-percent span { display: inline-block; min-width: 2ch; text-align: right; }
.loader-track { position: relative; height: 6px; overflow: hidden; border-radius: 99px; background: var(--green-soft); }
.loader-fill { position: relative; width: 0; height: 100%; overflow: hidden; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--green) 65%, transparent), var(--green)); transition: width .3s linear; }
.loader-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); transform: translateX(-100%); animation: shimmer 1.6s ease-in-out infinite; }
.loader-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; list-style: none; font: 9.5px "DM Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.loader-steps li { display: flex; align-items: center; gap: 6px; white-space: nowrap; transition: color .3s; }
.loader-steps li::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border: 1px solid var(--line); border-radius: 50%; transition: background .3s, border-color .3s, box-shadow .3s; }
.loader-steps li.active { color: var(--ink); }
.loader-steps li.active::before { border-color: var(--green); background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 1.4s ease-in-out infinite; }
.loader-steps li.done { color: var(--green); }
.loader-steps li.done::before { border-color: var(--green); background: var(--green); }
.loader-state.complete .loader-orbit { animation: none; border-color: var(--green); }
.loader-state.complete .loader-fill { transition-duration: .25s; }
.loader-state.complete .loader-fill::after { animation: none; }
.ai-responses-container { max-width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 33px auto 48px; animation: reveal .5s both; }
.response-headline { grid-column: 1 / -1; display: flex; align-items: center; gap: 13px; margin-top: 8px; color: var(--muted); font: 10px "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.response-headline::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.response-headline.sub-headline { margin-top: 18px; color: var(--green); }
.response-headline.sub-headline::after { background: var(--green-soft); }
.ai-response { min-width: 0; min-height: 360px; max-height: 475px; display: flex; flex-direction: column; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); box-shadow: 0 3px 12px rgba(35,48,38,.025); transition: transform .25s, border-color .25s, box-shadow .25s; }
.ai-response:hover { transform: translateY(-4px); border-color: var(--green); box-shadow: 0 12px 24px rgba(30,60,40,.06); }
.ai-response .message-avatar { width: 100%; height: auto; min-height: 29px; flex: none; justify-content: space-between; padding: 0 9px; border-radius: 7px; background: var(--green-soft); color: var(--green); font: 10px "DM Mono", monospace; }
.response-index { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Card header tools: response time, copy, share */
.ai-response .message-avatar { display: flex; align-items: center; gap: 8px; }
.card-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; flex: none; }
.card-time { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; color: var(--green); opacity: .85; white-space: nowrap; }
.card-tool {
  width: 24px; height: 24px; display: inline-grid; place-items: center; border: 0; border-radius: 6px;
  background: transparent; color: var(--green); cursor: pointer; font-size: 11px; transition: background .15s, color .15s;
}
.card-tool:hover { background: rgba(20,122,91,.12); }
:root[data-theme="dark"] .card-tool:hover { background: rgba(99,201,155,.15); }
.card-tool:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.card-tool.done { color: var(--on-ink); background: var(--green); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ai-response .message-content { min-height: 0; max-height: 385px; overflow-y: auto; padding-right: 5px; font-size: 12px; line-height: 1.7; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ai-response .message-content p { margin: 0; }
.ai-response .message-content h1, .ai-response .message-content h2, .ai-response .message-content h3 { margin: 8px 0 4px; font-size: 14px; line-height: 1.3; letter-spacing: -.03em; }
.ai-response .message-content strong { color: var(--ink); }
.ai-response .message-content a { color: var(--green); }
.ai-response .message-content code { padding: 1px 4px; border-radius: 4px; background: var(--green-soft); color: var(--ink); font: 11px "DM Mono", monospace; }
.ai-response .message-content pre { overflow-x: auto; padding: 8px 10px; border-radius: 7px; background: var(--green-soft); }
.ai-response .message-content pre code { padding: 0; background: none; }
.ai-response .message-content hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.message-rating { display: flex; gap: 3px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.star { color: var(--faint); cursor: pointer; font-size: 13px; transition: color .2s, transform .2s; }
.star:hover, .star.active { color: #d58a37; transform: scale(1.12); }
.star:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }

/* Rating styles (chosen on the admin page) */
.message-rating { align-items: center; flex-wrap: wrap; }
.rating-options { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.rating-anchor { font-size: 10px; color: var(--muted); }
.rating-faces_numbers .star { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; min-width: 18px; }
.rating-faces_numbers .star small { font: 9px "DM Mono", monospace; }
.rating-stars .star { font-size: 14px; }
.rating-stars .star:hover, .rating-stars .star.active { transform: scale(1.12); }
.rating-stars .star.filled { color: #e3a008; }
.rating-stars .rating-options:hover .star { color: #e3a008; }
.rating-stars .rating-options .star:hover ~ .star { color: var(--faint); }
.rating-numbers .star, .rating-words .star {
  min-width: 26px; height: 24px; padding: 0 7px; display: inline-grid; place-items: center; border: 1px solid var(--line);
  border-radius: 7px; font: 600 11px "DM Mono", monospace; color: var(--muted);
}
.rating-words .star { font: 600 10px "Manrope", sans-serif; }
.rating-numbers .star:hover, .rating-words .star:hover { color: var(--green); border-color: var(--green); transform: none; }
.rating-numbers .star.active, .rating-words .star.active { background: var(--green); border-color: var(--green); color: #fff; transform: none; }
:root[data-theme="dark"] .rating-numbers .star.active, :root[data-theme="dark"] .rating-words .star.active { color: #111512; }
.submit-rating-button { grid-column: 1 / -1; justify-self: center; padding: 10px 18px; border: 0; border-radius: 8px; background: var(--ink); color: var(--on-ink); cursor: pointer; font-size: 11px; }
.submit-rating-button:hover { background: var(--green); color: #fff; }
@keyframes reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vw, 3vw) scale(1.12); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; } }

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); box-shadow: 15px 0 40px rgba(0,0,0,.08); }
  .sidebar.visible { transform: translateX(0); }
  .sidebar-toggle { display: grid; place-items: center; position: fixed; top: 16px; left: 15px; z-index: 30; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; }
  .main-content { margin-left: 0; }
  .top-bar { padding-left: 68px; }
  .ai-responses-container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  body { overflow: auto; }
  .main-content { min-height: 100vh; height: auto; }
  .top-actions { display: flex; }
  .top-actions .live-label, .top-actions > .icon-button:not(.theme-toggle) { display: none; }
  .chat-container { width: 88%; padding-top: 54px; }
  .welcome-block { margin-bottom: 48px; }
  h1 { font-size: clamp(42px, 13vw, 62px); }
  .input-container { position: sticky; bottom: 0; }
  .input-hint { display: none; }
}
@media (max-width: 440px) {
  .breadcrumb { font-size: 10px; }
  .prompt-chips { display: grid; }
  .prompt-chip { justify-content: flex-start; }
  .loader-steps { grid-template-columns: repeat(2, 1fr); }
  .ai-responses-container { grid-template-columns: 1fr; }
  .response-headline { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
