:root {
  color-scheme: light;
  --page: #f1f5f0;
  --surface: #fff;
  --ink: #1b2c26;
  --muted: #52635b;
  --line: #dbe5de;
  --forest: #133d32;
  --green: #235e4b;
  --mint: #e8f3eb;
  --lavender: #f4f0fa;
  --violet: #634a97;
  --danger: #962f32;
  --body-font: 'Segoe UI', system-ui, sans-serif;
  --display-font: 'Bahnschrift', 'Arial Narrow', 'Segoe UI', sans-serif;
  font-family: var(--body-font);
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; min-height: 100vh; }
h1, h2, h3, p, ul { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.startup { padding: 2rem; text-align: center; color: var(--muted); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display-font);
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: .15em;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid currentColor;
  border-radius: 11px 11px 11px 3px;
}

.brand-mark i, .brand-mark i::before, .brand-mark i::after {
  width: 2px;
  height: 12px;
  background: currentColor;
  border-radius: 2px;
}

.brand-mark i::before, .brand-mark i::after { content: ''; position: absolute; top: 12px; height: 7px; }
.brand-mark i::before { left: 9px; }
.brand-mark i::after { right: 9px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 65px;
  padding: 0 clamp(18px, 3.4vw, 60px);
  background: var(--forest);
  color: white;
}

.topbar-actions { display: flex; align-items: center; gap: clamp(10px, 2vw, 27px); }
.connection-status { display: inline-flex; gap: 8px; align-items: center; font-size: .79rem; font-weight: 600; color: #e1eee5; }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #e4c978; }
.is-configured .status-dot { background: #92e2a9; box-shadow: 0 0 0 3px #92e2a923; }

.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: .83rem;
  font-weight: 600;
  white-space: nowrap;
}

.quiet-button:hover { background: var(--mint); border-color: #b6cdbd; }
.quiet-button:disabled { opacity: .6; }
.topbar .quiet-button { background: transparent; color: #f9fdf9; border-color: #719185; }
.topbar .quiet-button:hover { background: #ffffff17; }
.topbar .quiet-button:focus-visible { outline-color: #a6dfba; }

.icon { display: inline-block; position: relative; flex-shrink: 0; }
.icon-exit { width: 11px; height: 13px; border: 1.5px solid currentColor; border-right: 0; border-radius: 3px 0 0 3px; }
.icon-exit::before { content: ''; width: 8px; height: 1.5px; position: absolute; left: 4px; top: 4px; background: currentColor; }
.icon-exit::after { content: ''; width: 6px; height: 6px; position: absolute; left: 8px; top: 2px; border: 1.5px solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }
.icon-refresh { font-size: 1.22rem; line-height: 1; }
.icon-search { width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 50%; margin: 0 11px 2px 1px; }
.icon-search::after { content: ''; width: 6px; height: 1.5px; position: absolute; right: -5px; bottom: -2px; border-radius: 2px; transform: rotate(45deg); background: currentColor; }
.icon-lock { width: 9px; height: 7px; margin-top: 3px; border: 1.2px solid currentColor; border-radius: 2px; }
.icon-lock::before { content: ''; width: 5px; height: 5px; position: absolute; top: -5px; left: 1px; border: 1.2px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; }

.workspace { padding: clamp(22px, 3vw, 45px) clamp(18px, 3.4vw, 60px) 30px; max-width: 1800px; margin-inline: auto; }
.workspace-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 23px; }
.workspace-heading h1 { color: var(--forest); font-family: var(--display-font); font-size: clamp(1.9rem, 3.4vw, 3rem); font-weight: 650; letter-spacing: -.04em; line-height: 1.03; }
.workspace-heading p { margin-top: 7px; color: var(--muted); font-size: .92rem; }
.refresh-button { margin-bottom: 1px; }
.mobile-nav { display: none; }

.board {
  display: grid;
  grid-template-columns: minmax(232px, .84fr) minmax(310px, 1.38fr) minmax(290px, 1.01fr);
  min-height: 490px;
  height: calc(100dvh - 234px);
  overflow: hidden;
  border-radius: 17px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 9px 25px #2543340a;
}

.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane + .pane { border-left: 1px solid var(--line); }
.pane-heading { min-height: 76px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; padding: 14px 19px; border-bottom: 1px solid var(--line); }
.pane-heading h2 { font-size: 1.01rem; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.pane-heading p { margin-top: 4px; color: var(--muted); font-size: .76rem; line-height: 1.3; overflow-wrap: anywhere; }
.inbox-heading { display: block; padding-top: 19px; padding-bottom: 14px; }
.inbox-heading h2 { margin-bottom: 12px; }
.search-box { display: flex; align-items: center; padding: 0 11px; height: 37px; background: #f5f8f5; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.search-box:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.search-box input { min-width: 0; width: 100%; padding: 5px 0; color: var(--ink); border: 0; outline: 0; background: transparent; font-size: .82rem; }
.search-box input::placeholder, .composer textarea::placeholder { color: #606b64; opacity: 1; }

.chat-list, .message-list, .assistant-feed { flex: 1; min-height: 0; min-width: 0; overflow: auto; scrollbar-color: #afc1b4 transparent; scrollbar-width: thin; }
.chat-list { list-style: none; padding: 7px 8px 12px; }
.chat-list:empty { padding: 0; }
.list-status { margin: 16px 19px 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.list-status.is-error { color: var(--danger); }
.history-controls { padding: 12px; border-top: 1px solid var(--line); }
.history-controls .quiet-button { width: 100%; font-size: .77rem; }
.history-summary { margin-top: 7px; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.history-controls .form-error { margin: 6px 0 0; }
.older-controls { display: grid; justify-items: center; gap: 7px; margin: 5px 0 7px; text-align: center; }
.older-controls .quiet-button { min-height: 32px; font-size: .75rem; }
.older-controls .form-error { margin: 0; }
.chat-item {
  width: 100%; min-height: 65px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 9px;
  padding: 9px 9px 9px 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); text-align: left;
}
.chat-item:hover { background: #f3f7f3; }
.chat-item.is-active { background: var(--mint); border-color: #d0e5d6; }
.chat-item:focus-visible { outline-offset: -2px; }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: #e6efe7; color: #315b49; font-size: .73rem; font-weight: 700; }
.avatar[data-tone='1'] { background: #eeecf9; color: #57447f; }
.avatar[data-tone='2'] { background: #f7ece3; color: #774f30; }
.avatar[data-tone='3'] { background: #e5eff4; color: #345c74; }
.heading-avatar { width: 40px; height: 40px; }
.chat-copy { display: grid; gap: 4px; min-width: 0; }
.chat-title, .chat-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title { font-size: .84rem; font-weight: 700; }
.chat-preview { color: var(--muted); font-size: .75rem; line-height: 1.3; }
.chat-time { color: var(--muted); font-size: .68rem; align-self: start; padding-top: 3px; white-space: nowrap; }

.message-pane { background: #fcfdfb; }
.message-heading { background: white; }
.message-title-group { min-width: 0; flex: 1; }
.read-only { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; color: var(--green); background: var(--mint); border: 1px solid #d9e9dc; border-radius: 6px; padding: 5px 7px; font-weight: 700; font-size: .69rem; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 8px; padding: 23px; text-align: center; }
.empty-state h3 { color: var(--ink); font-size: .94rem; font-weight: 700; }
.empty-state p { max-width: 245px; font-size: .83rem; line-height: 1.5; color: var(--muted); }
.empty-icon { position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; margin: 0 0 4px; }
.empty-inbox { background: var(--mint); color: var(--green); }
.empty-inbox span:first-child { width: 22px; height: 16px; border: 1.5px solid currentColor; border-radius: 5px 5px 5px 1px; transform: translate(1px, -1px); }
.empty-inbox span:last-child, .empty-inbox span:last-child::after { width: 10px; height: 1.5px; background: currentColor; border-radius: 2px; }
.empty-inbox span:last-child { position: absolute; left: 20px; top: 21px; }
.empty-inbox span:last-child::after { content: ''; width: 6px; position: absolute; left: 0; top: 4px; }
.message-list { padding: 9px clamp(13px, 1.8vw, 24px) 17px; overflow-anchor: none; }
.day-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .72rem; margin: 17px 0 13px; text-align: center; }
.day-divider::before, .day-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.message-bubble {
  width: fit-content; max-width: min(90%, 36rem); min-width: 100px; margin: 0 0 8px; padding: 9px 11px 7px;
  border: 1px solid #e1e8e2; border-radius: 3px 10px 10px 10px; background: white;
}
.message-bubble.from-me { margin-left: auto; border-color: #d9e8da; border-radius: 10px 3px 10px 10px; background: var(--mint); }
.message-sender { margin-bottom: 4px; color: var(--green); font-size: .73rem; line-height: 1.35; font-weight: 700; overflow-wrap: anywhere; }
.message-text { color: var(--ink); font-size: .87rem; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.message-time { display: block; margin-top: 4px; color: var(--muted); font-size: .67rem; text-align: right; }

.assistant-pane { background: #faf8fd; }
.assistant-heading { background: #faf8fd; border-color: #e8e1ef; }
.assistant-icon { width: 35px; height: 35px; display: grid; place-items: center; flex-shrink: 0; border-radius: 11px 11px 3px 11px; color: var(--violet); background: #ece3fa; font-size: 1.24rem; }
.scope-control { display: flex; align-items: center; gap: 10px; margin: 12px 15px 0; padding: 7px 8px 7px 10px; border: 1px solid #e8e1f0; border-radius: 9px; background: var(--lavender); }
.scope-control label { font-size: .73rem; color: #644d7d; font-weight: 700; }
.scope-control select { min-width: 0; width: 100%; border: 0; padding: 3px 18px 3px 2px; color: #423354; background: transparent; text-overflow: ellipsis; font-size: .77rem; font-weight: 600; }
.assistant-feed { display: flex; flex-direction: column; padding: 0 15px 8px; scrollbar-color: #bcafcb transparent; }
.assistant-empty { min-height: 135px; }
.empty-assistant { background: #ede4f8; color: var(--violet); font-size: 1.43rem; }
.empty-assistant::before, .empty-assistant::after { content: ''; position: absolute; inset: -4px; border: 1px solid #e4d6f2; border-radius: 19px; }
.empty-assistant::after { inset: -8px; border-color: #ede6f3; border-radius: 21px; }
.assistant-empty .empty-icon { margin-bottom: 10px; }
.assistant-transcript:empty { display: none; }
.assistant-transcript { display: flex; flex-direction: column; gap: 11px; padding-top: 14px; }
.assistant-turn { width: fit-content; max-width: 95%; min-width: 95px; padding: 8px 10px 10px; border: 1px solid #e9e0f0; border-radius: 3px 10px 10px 10px; background: white; }
.assistant-turn.is-user { align-self: end; background: #eee7f7; border-color: #e8dcf4; border-radius: 10px 3px 10px 10px; }
.assistant-turn b { display: block; margin-bottom: 4px; color: var(--violet); font-size: .73rem; }
.assistant-turn p { font-size: .85rem; color: var(--ink); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-working { margin: 11px 0 3px; color: var(--violet); font-size: .79rem; }
.assistant-form { padding: 0 15px 15px; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) 36px; align-items: end; gap: 6px; padding: 6px; border: 1px solid #d8c9e7; border-radius: 12px; background: white; }
.composer:focus-within { border-color: #9679b6; box-shadow: 0 0 0 2px #bca4d944; }
.composer textarea { width: 100%; min-width: 0; padding: 7px 6px; border: 0; outline: 0; background: transparent; resize: vertical; min-height: 43px; max-height: 200px; font-size: .85rem; line-height: 1.35; }
.ask-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: var(--violet); color: white; font-size: 1.2rem; line-height: 1; }
.ask-button:hover { background: #4f337f; }
.ask-button:disabled { background: #d9d1e5; color: #625573; }
.form-error { color: var(--danger); font-size: .82rem; line-height: 1.45; margin: 0 0 9px; }

.login {
  width: min(calc(100% - 36px), 890px); min-height: min(490px, calc(100dvh - 56px)); margin: max(28px, calc((100dvh - 490px) / 2)) auto 28px;
  display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 22px;
  background: white; box-shadow: 0 16px 52px #28433617;
}
.login-identity { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; background: var(--forest); color: white; padding: clamp(25px, 4.6vw, 48px); }
.login-identity-copy h1 { font: 650 clamp(2.5rem, 6.7vw, 5.05rem) / .92 var(--display-font); letter-spacing: -.058em; }
.login-identity-copy p { max-width: 260px; margin-top: 20px; color: #e0eee4; font-size: .94rem; line-height: 1.56; }
.login-pattern { position: absolute; z-index: -1; inset: 0; overflow: hidden; mask-image: linear-gradient(152deg, transparent 30%, black 80%); }
.login-pattern i { position: absolute; right: -130px; bottom: -120px; width: 420px; height: 340px; border: 1px solid #a3d8b257; border-radius: 90px 90px 90px 6px; transform: rotate(-18deg); }
.login-pattern i:nth-child(2) { translate: -26px 29px; }
.login-pattern i:nth-child(3) { translate: -54px 57px; }
.login-access { align-self: center; width: 100%; padding: clamp(25px, 4.6vw, 49px); }
.login-content h2 { margin-bottom: 25px; font-size: 1.39rem; font-weight: 700; }
.login-content label { display: block; margin-bottom: 7px; color: var(--ink); font-size: .84rem; font-weight: 700; }
.login-content input { width: 100%; min-height: 43px; padding: 7px 10px; margin-bottom: 13px; border: 1px solid #b9c9bf; border-radius: 8px; background: #fcfefc; color: var(--ink); }
.primary { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0 13px; border: 0; border-radius: 8px; color: white; background: var(--green); font-weight: 700; }
.primary:hover { background: var(--forest); }
.primary:disabled { opacity: .65; }

@media (max-width: 955px) {
  .workspace { padding-inline: 17px; }
  .board { grid-template-columns: minmax(191px, .76fr) minmax(225px, 1.18fr) minmax(254px, 1fr); }
  .pane-heading { padding-inline: 12px; }
  .scope-control { margin-inline: 10px; }
  .assistant-feed, .assistant-form { padding-inline: 10px; }
}

@media (max-width: 720px) {
  .topbar { min-height: 57px; }
  .topbar .quiet-button { min-height: 33px; padding-inline: 9px; }
  .workspace { padding: 21px 12px 13px; }
  .workspace-heading { align-items: start; margin-bottom: 15px; }
  .workspace-heading p { display: none; }
  .mobile-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 0 9px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #e8efe8; }
  .mobile-nav button { padding: 8px 3px; font-size: .8rem; font-weight: 700; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); }
  .mobile-nav button[aria-pressed='true'] { background: white; border-color: var(--line); color: var(--forest); }
  .board { display: flex; height: calc(100dvh - 184px); min-height: 360px; border-radius: 12px; }
  .pane { width: 100%; }
  .pane + .pane { border-left: 0; }
  .board[data-pane='inbox'] :is(.message-pane, .assistant-pane),
  .board[data-pane='messages'] :is(.inbox-pane, .assistant-pane),
  .board[data-pane='assistant'] :is(.inbox-pane, .message-pane) { display: none; }
  .pane-heading { min-height: 66px; }
  .inbox-heading { min-height: 0; padding-top: 13px; }
  .login { grid-template-columns: 1fr; max-width: 455px; margin: 22px auto; }
  .login-identity { gap: 26px; }
  .login-identity-copy h1 br { display: none; }
  .login-identity-copy p { margin-top: 11px; }
}

@media (max-width: 380px) {
  .topbar { padding-inline: 11px; }
  .connection-status { font-size: .71rem; }
  .topbar-actions { gap: 8px; }
  .workspace-heading { gap: 7px; }
  .refresh-button { padding-inline: 8px; }
}
