:root {
  color-scheme: light;
  --ink: #142127;
  --muted: #67757a;
  --line: #dbe2df;
  --soft: #f3f6f4;
  --paper: #fbfcfb;
  --white: #ffffff;
  --forest: #123d35;
  --forest-2: #1f594d;
  --mint: #dcebe5;
  --lime: #c9dc77;
  --gold: #d0a856;
  --danger: #a14343;
  --shadow: 0 18px 60px rgba(20, 43, 36, 0.09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, textarea { font: inherit; }
button { color: inherit; }

.app-shell { display: grid; grid-template-columns: 246px minmax(440px, 1fr) 320px; min-height: 100vh; }
.sidebar { background: var(--forest); color: #eaf2ef; display: flex; flex-direction: column; padding: 26px 18px 18px; min-height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 26px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; color: var(--lime); font-weight: 800; letter-spacing: -.06em; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 14px; letter-spacing: .01em; }
.brand div span { margin-top: 2px; font-size: 11px; color: #a9c0b9; }
.new-thread { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(255,255,255,.17); border-radius: 10px; padding: 10px 12px; background: rgba(255,255,255,.07); color: white; cursor: pointer; font-weight: 650; }
.new-thread:hover { background: rgba(255,255,255,.12); }
.mode-nav { margin-top: 28px; }
.nav-label { margin: 0 10px 9px; text-transform: uppercase; letter-spacing: .14em; font-size: 10px; color: #88a89e; font-weight: 800; }
.mode-button { width: 100%; display: flex; align-items: center; gap: 11px; text-align: start; border: 0; border-radius: 9px; padding: 10px 11px; margin: 2px 0; background: transparent; color: #bcd0ca; cursor: pointer; font-size: 13px; }
.mode-button > span:first-child { width: 18px; text-align: center; color: #86aa9f; font-weight: 900; }
.mode-button:hover, .mode-button.active { background: rgba(255,255,255,.1); color: white; }
.mode-button.active { box-shadow: inset 3px 0 var(--lime); }
.mode-button.active > span:first-child { color: var(--lime); }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; }
.sidebar-footer a { display: flex; gap: 11px; padding: 9px 10px; color: #9fbab2; text-decoration: none; font-size: 12px; }
.sidebar-footer a:hover { color: white; }

.workspace { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; background: var(--white); }
.workspace.remote-access { grid-template-rows: auto auto 1fr auto; }
.owner-access { padding: 14px 28px; background: var(--soft); border-bottom: 1px solid var(--line); }
.owner-access form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.owner-access label, .owner-access p { font-size: 12px; }
.owner-access p { color: var(--muted); margin-bottom: 0; }
.owner-access input { flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.owner-access button { border: 0; border-radius: 8px; padding: 9px 14px; color: white; background: var(--forest); cursor: pointer; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 21px 28px; border-bottom: 1px solid var(--line); }
.eyebrow { text-transform: uppercase; letter-spacing: .13em; font-weight: 800; font-size: 9px; color: #82908c; margin: 0 0 5px; }
.topbar h1 { font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 500; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.status-pill { display: flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.status-pill i { width: 6px; height: 6px; background: #aaa; border-radius: 50%; }
.status-pill.ready i { background: #48a270; box-shadow: 0 0 0 3px rgba(72,162,112,.12); }
.status-pill.setup i { background: var(--gold); }
.language-switch { display: flex; background: var(--soft); border-radius: 8px; padding: 3px; }
.language-switch button { border: 0; background: transparent; padding: 5px 8px; border-radius: 6px; cursor: pointer; color: #73807c; font-size: 10px; font-weight: 750; }
.language-switch button.active { background: white; color: var(--forest); box-shadow: 0 2px 8px rgba(22,55,47,.1); }

.conversation { overflow-y: auto; padding: 28px clamp(24px, 5vw, 72px); }
.welcome { max-width: 760px; margin: 7vh auto 0; text-align: center; }
.orb { width: 64px; height: 64px; margin: 0 auto 22px; border: 1px solid #d2ded9; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #eef6f2, #d5e5df); box-shadow: 0 14px 30px rgba(28,77,63,.12); }
.orb span { width: 25px; height: 25px; border-radius: 8px 50% 50% 50%; background: var(--forest-2); transform: rotate(45deg); box-shadow: 10px 10px 0 -5px var(--lime); }
.welcome h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: clamp(28px, 4vw, 42px); margin: 7px 0 12px; letter-spacing: -.035em; }
.welcome > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; max-width: 620px; margin: 0 auto; font-size: 14px; }
.prompt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 34px; text-align: start; }
.prompt-card { min-height: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 15px; background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; box-shadow: 0 8px 24px rgba(23,50,42,.04); }
.prompt-card:hover { border-color: #9bb9af; transform: translateY(-2px); box-shadow: var(--shadow); }
.prompt-icon { font-family: Georgia, serif; color: var(--gold); font-size: 12px; border-bottom: 1px solid #e7d7b6; padding-bottom: 7px; margin-bottom: 24px; }
.prompt-card strong { font-family: Georgia, serif; font-weight: 600; font-size: 15px; }
.prompt-card small { color: var(--muted); line-height: 1.45; margin-top: 5px; }
.messages { display: none; max-width: 820px; margin: 0 auto; }
.messages.active { display: block; }
.message { padding: 21px 0; border-bottom: 1px solid #e7ecea; }
.message-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.message-meta strong { font-size: 12px; }
.avatar { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--forest); color: white; font-size: 10px; font-weight: 800; }
.message.user .avatar { background: #e5e9e7; color: var(--forest); }
.copy-button { margin-inline-start: auto; border: 0; background: transparent; color: #82908c; font-size: 10px; cursor: pointer; }
.message-content { font-size: 14px; line-height: 1.72; color: #263439; }
.message-content h1, .message-content h2, .message-content h3 { font-family: Georgia, serif; line-height: 1.25; margin: 1.3em 0 .5em; }
.message-content h1 { font-size: 24px; }.message-content h2 { font-size: 20px; }.message-content h3 { font-size: 17px; }
.message-content p { margin: .6em 0; }.message-content ul, .message-content ol { padding-inline-start: 22px; }
.message-content pre { white-space: pre-wrap; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.message-content table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.message-content th, .message-content td { border: 1px solid var(--line); padding: 8px; text-align: start; min-width: 110px; }
.message.thinking .message-content { color: var(--muted); }
.dots { display: inline-flex; gap: 4px; }.dots i { width: 5px; height: 5px; border-radius: 50%; background: #78948b; animation: pulse 1.2s infinite; }.dots i:nth-child(2){animation-delay:.2s}.dots i:nth-child(3){animation-delay:.4s}
@keyframes pulse { 0%,100%{opacity:.25;transform:translateY(0)} 50%{opacity:1;transform:translateY(-3px)} }

.composer-wrap { padding: 12px clamp(24px, 5vw, 72px) 18px; background: linear-gradient(rgba(255,255,255,.2), white 20%); }
.composer { max-width: 820px; margin: 0 auto; border: 1px solid #cfdad6; border-radius: 13px; padding: 13px 13px 10px; box-shadow: 0 12px 38px rgba(22,58,48,.08); background: white; }
.composer:focus-within { border-color: #7da398; box-shadow: 0 12px 38px rgba(22,58,48,.12), 0 0 0 3px rgba(31,89,77,.07); }
.composer textarea { width: 100%; min-height: 42px; max-height: 170px; resize: none; border: 0; outline: 0; color: var(--ink); line-height: 1.5; }
.composer textarea::placeholder { color: #9ba6a2; }
.composer-row { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; }
.privacy-note { color: #99a39f; font-size: 9px; }
.send-button { border: 0; border-radius: 8px; padding: 7px 8px 7px 12px; display: flex; align-items: center; gap: 8px; color: white; background: var(--forest); cursor: pointer; font-size: 11px; font-weight: 750; }
.send-button b { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 5px; background: rgba(255,255,255,.12); }
.send-button:disabled { opacity: .55; cursor: wait; }
.disclaimer { max-width: 820px; margin: 8px auto 0; color: #9aa4a1; font-size: 8.5px; text-align: center; }

.context-panel { background: #f5f7f5; border-inline-start: 1px solid var(--line); padding: 27px 22px; }
.context-head { padding: 0 3px 20px; border-bottom: 1px solid var(--line); }
.context-head h2 { font-family: Georgia, serif; font-size: 22px; font-weight: 500; margin: 4px 0 7px; }
.context-head > p:last-child { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.context-form { padding-top: 20px; display: grid; gap: 15px; }
.context-form label > span { display: block; font-size: 10px; font-weight: 800; color: #52625d; margin-bottom: 6px; }
.context-form input, .context-form textarea { width: 100%; border: 1px solid #d5ddda; border-radius: 8px; background: white; padding: 9px 10px; outline: none; color: var(--ink); font-size: 11px; resize: vertical; }
.context-form input:focus, .context-form textarea:focus { border-color: #7ca095; box-shadow: 0 0 0 3px rgba(31,89,77,.06); }
.generate-button { border: 0; border-radius: 9px; background: var(--forest); color: white; padding: 10px; cursor: pointer; font-size: 11px; font-weight: 750; }
.generate-button:hover { background: var(--forest-2); }
.context-tip { display: flex; gap: 10px; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); }
.context-tip > span { flex: 0 0 18px; width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid #aab8b3; border-radius: 50%; font-family: Georgia, serif; font-size: 11px; }
.context-tip p { margin: 0; font-size: 10px; line-height: 1.5; }

html[dir="rtl"] .mode-button.active { box-shadow: inset -3px 0 var(--lime); }
html[dir="rtl"] .message-content, html[dir="rtl"] textarea, html[dir="rtl"] input { text-align: right; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .context-panel { display: none; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { min-height: auto; padding: 14px; }
  .brand { padding-bottom: 13px; }.new-thread { display: none; }
  .mode-nav { display: flex; overflow-x: auto; margin-top: 0; gap: 5px; }.nav-label { display: none; }
  .mode-button { width: auto; flex: 0 0 auto; padding: 8px 10px; }
  .mode-button.active { box-shadow: inset 0 -3px var(--lime); }
  .sidebar-footer { margin-top: 8px; padding-top: 5px; }
  .sidebar-footer a { display: none; }
  .sidebar-footer #telegramLink { display: flex; padding: 5px 8px; color: #eaf2ef; }
  .workspace { min-height: calc(100vh - 120px); }
  .topbar { padding: 15px 17px; align-items: flex-start; }.status-pill { display: none; }
  .topbar-actions { display: block; }.language-switch { margin-top: 3px; }
  .conversation { padding: 20px 18px; }.welcome { margin-top: 3vh; }.prompt-grid { grid-template-columns: 1fr; }.prompt-card { min-height: 105px; }
  .composer-wrap { padding: 10px 14px 14px; }
}
