:root {
  color-scheme: light;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: #142622;
  background: #eef3f0;
  --ink: #142622;
  --muted: #4e6760;
  --deep: #12362f;
  --leaf: #146655;
  --bright: #d8f0df;
  --line: #d8e4de;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--leaf); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .58; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #208167; outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.14rem; }
h3 { font-size: 1rem; }
.skip-link { position: fixed; z-index: 2; inset-block-start: 8px; inset-inline-start: 8px; padding: 10px; background: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.brand-mark {
  display: grid; align-items: center; justify-items: center; flex: 0 0 auto;
  width: 45px; height: 45px; border-radius: 15px 15px 4px 15px;
  background: var(--bright); color: var(--deep); font-weight: 800; font-size: 1.13rem;
}
.primary, .secondary {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 8px 14px; border-radius: 10px;
  font-size: .9rem; font-weight: 650; line-height: 1.32; text-decoration: none;
}
.primary { border: 1px solid var(--leaf); background: var(--leaf); color: #fff; }
.primary:hover:not(:disabled) { background: #104e42; }
.secondary { border: 1px solid #d1ded8; background: #fbfdfc; color: var(--deep); }
.secondary:hover:not(:disabled) { background: #edf7f1; border-color: #acc9bf; }
.compact { min-height: 34px; padding: 6px 10px; }
.muted, .context-label, .voice-note { color: var(--muted); font-size: .88rem; line-height: 1.65; }
.feedback { color: #93282d; font-size: .87rem; line-height: 1.55; }
.login-shell {
  display: grid; grid-template-columns: minmax(220px, .85fr) minmax(300px, 1fr);
  max-width: 765px; margin: clamp(28px, 14vh, 120px) auto 28px; padding: 0;
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: #fff;
  box-shadow: 0 15px 58px #173b2b15;
}
.login-aside {
  padding: 36px 34px; color: #f5fff7;
  background: radial-gradient(ellipse at 100% 100%, #246654, var(--deep) 60%);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 13px;
}
.login-aside p { color: #d0e8db; line-height: 1.7; }
.login-panel { padding: 38px 35px; }
.login-panel form { display: grid; gap: 10px; margin-top: 20px; }
.login-panel .primary { margin-top: 7px; }
label { font-weight: 650; font-size: .9rem; }
input:not([type=file]), textarea {
  width: 100%; color: var(--ink); background: #fff; border: 1px solid #b9ccc3;
  border-radius: 10px; padding: 10px 12px; line-height: 1.7;
}
.workspace {
  display: grid; grid-template-columns: 245px minmax(0, 1fr);
  min-height: 100vh; max-width: 1540px; margin: 0 auto;
}
.project {
  color: #f4fff7; background: var(--deep); padding: 23px 17px;
  display: flex; flex-direction: column; gap: 19px; min-width: 0;
}
.brand { display: flex; gap: 11px; align-items: center; }
.brand p { color: #b9ddcc; font-size: .81rem; }
.brand h1 { margin-top: 1px; font-size: 1.12rem; line-height: 1.5; }
.logout {
  border: 1px solid #689588; margin-inline-start: auto; border-radius: 8px; min-height: 36px;
  padding: 4px 9px; background: #183f37; color: #f5fff7; font-size: .84rem;
}
.project-nav { display: grid; gap: 6px; margin-top: 8px; }
.nav-button {
  width: 100%; text-align: start; min-height: 44px; padding: 8px 12px;
  border: 1px solid transparent; border-radius: 9px; background: transparent; color: #e3f5eb; font-size: .93rem;
}
.nav-button[aria-pressed=true] { background: #dbf2e3; color: #143a30; font-weight: 700; }
.nav-button:hover:not([aria-pressed=true]) { background: #27564a; }
.storage {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  border: 1px solid #557c70; border-radius: 10px; padding: 10px; font-size: .82rem;
}
.storage span, .sidebar-muted { color: #c5e1d1; }
.storage strong { white-space: nowrap; }
.admin { border-top: 1px solid #62867a; padding-top: 16px; }
.admin h3 { margin: 14px 0 3px; }
.admin-toggle { border-color: #719a8b; margin-top: 10px; }
.sidebar-muted { margin-top: 5px; font-size: .85rem; line-height: 1.7; }
.admin .feedback { color: #ffd7c8; }
.alerts { list-style: none; margin: 8px 0 0; padding: 0; }
.alerts li { border-block-start: 1px solid #557c70; padding-block: 9px; font-size: .87rem; line-height: 1.55; }
.alerts button { min-height: 32px; margin-top: 5px; padding: 4px 10px; }
.content-panel {
  margin: 22px; min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: #fff;
  box-shadow: 0 7px 24px #173b2b0c; display: flex; flex-direction: column;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 23px; border-bottom: 1px solid var(--line);
}
.context-label { margin-bottom: 4px; }
.status-wrap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.status {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 99px; padding: 5px 10px;
  background: #eaf5ee; color: #275444; font-size: .81rem; line-height: 1.5;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: #287056; }
.status[data-state=running] { background: #fcf0d9; color: #6f440a; }
.status[data-state=running]::before { background: #b06810; }
.status[data-state=paused] { background: #f4e9e6; color: #7d3b2d; }
.status[data-state=paused]::before { background: #9a513f; }
.messages {
  flex: 1; overflow-y: auto; max-height: 61vh; min-height: 235px;
  display: flex; flex-direction: column; gap: 16px; padding: 22px 23px;
  background: linear-gradient(#fff 70%, #fbfdfa);
}
.empty { margin: auto; text-align: center; padding: 18px 0; }
.empty h3 { font-size: 1.26rem; }
.empty p { color: var(--muted); line-height: 1.7; margin-top: 8px; }
.starters { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.message {
  padding: 12px 15px; border-radius: 13px; max-width: min(88%, 760px); overflow: hidden;
  border: 1px solid var(--line);
}
.message.iman { align-self: flex-start; background: #e9f5ed; border-color: #cde5d6; border-start-start-radius: 4px; }
.message.assistant { align-self: flex-end; background: #f4f7f5; border-start-end-radius: 4px; }
.message-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.message-author { color: #3d5b51; font-size: .86rem; font-weight: 700; }
.copy-button { border: 0; min-height: 29px; border-radius: 6px; padding: 4px 7px; color: #365a4e; background: #e4ede8; font-size: .79rem; }
.copy-button:hover { color: #fff; background: var(--leaf); }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.78; }
.message-body pre, .file-preview pre {
  overflow: auto; white-space: pre; border-radius: 9px; padding: 13px;
  margin: 8px 0; background: #173831; color: #f2fbf6; font-size: .92rem; line-height: 1.6;
}
.composer { border-top: 1px solid var(--line); padding: 15px 23px 11px; }
.entry { border: 1px solid #b9cdc3; border-radius: 15px; background: #fff; padding: 12px; }
.entry:focus-within { border-color: #34836d; }
.composer label { display: block; margin-inline: 4px; }
.composer textarea { border: 0; padding: 7px 4px; min-height: 80px; resize: vertical; }
.composer textarea:focus-visible { outline-offset: 0; }
textarea:placeholder-shown { direction: rtl; text-align: start; }
.composer-tools { display: flex; justify-content: space-between; align-items: flex-end; gap: 9px; }
.voice-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.voice-controls .secondary { min-height: 35px; padding-inline: 10px; font-size: .84rem; }
.composer-tools .primary { min-height: 38px; min-width: 72px; }
.composer-meta { margin-top: 6px; min-height: 24px; }
.voice-note { font-size: .82rem; }
.files-content { padding: 18px 23px; }
.file-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); padding: 8px; border-radius: 9px; }
.file-row .file-open { white-space: normal; overflow-wrap: anywhere; text-align: left; max-width: 84%; justify-content: flex-start; }
.file-preview { border: 1px solid var(--line); padding: 12px; border-radius: 12px; }
.file-preview header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.file-preview h3 { overflow-wrap: anywhere; }
.file-preview pre { max-height: 46vh; }

@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .project { padding: 12px 14px; gap: 10px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px 12px 4px 12px; }
  .brand p { display: none; }
  .project-nav { grid-template-columns: 1fr 1fr; margin-top: 0; }
  .nav-button { min-height: 39px; }
  .storage { display: none; }
  .content-panel { margin: 10px; min-height: min(690px, 80vh); border-radius: 14px; }
  .panel-header, .composer, .messages, .files-content { padding-inline: 13px; }
  .panel-header { gap: 6px; padding-block: 11px; }
  .context-label { display: none; }
  .status-wrap { gap: 5px; }
  .status { padding: 4px 7px; }
  .messages { min-height: 240px; max-height: 51vh; gap: 11px; }
  .message { max-width: 94%; }
  .composer-tools { align-items: stretch; flex-wrap: wrap; }
  .voice-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1 0 100%; }
  .composer-tools .primary { margin-inline-start: auto; }
  .voice-controls .secondary { width: 100%; }
  .login-shell { margin: 22px 12px; grid-template-columns: 1fr; }
  .login-aside, .login-panel { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
.messages, .entry, .composer-meta { width: 100%; max-width: 880px; margin-inline: auto; }
.messages { padding-inline: 22px; }
.files-content:has(.file-preview:not([hidden])) {
  display: grid; grid-template-columns: minmax(175px, .55fr) minmax(0, 1.45fr); gap: 12px;
}
.files-content > .muted { grid-column: 1 / -1; }
.file-row { padding: 0; background: #f8faf9; }
.file-row .file-open {
  min-height: 44px; max-width: none; width: 100%; border: 0; text-align: left;
  padding-inline: 13px; font-variant-ligatures: none;
}
.file-row.selected { border-color: #4e917c; }
.file-row.selected .file-open { background: #e5f4eb; color: #184a3b; font-weight: 700; }
.file-preview { align-self: start; min-width: 0; }
.copy-button { min-height: 32px; }
@media (max-width: 760px) {
  .messages { padding-inline: 13px; }
  .files-content:has(.file-preview:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .file-list { margin-block: 8px 2px; }
}

.attachment {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid #ccdfd4; background: #eef7f1; padding: 7px 9px;
  border-radius: 8px; margin: 0 0 8px; font-size: .85rem;
}
.attachment span { overflow-wrap: anywhere; min-width: 0; }
.attachment button { flex: 0 0 auto; }
@media (max-width: 760px) {
  .voice-controls .secondary, .composer-tools .primary { min-height: 42px; }
  .messages { min-height: 205px; }
  .composer textarea { min-height: 65px; }
}

main { display: flow-root; }
.files-content:has(.file-preview:not([hidden])) .file-list { margin-block: 0; align-self: start; }
.admin .alerts .secondary { color: var(--deep); }
