:root {
  --topbar-h: 42px;
  --bg: #0f1410;
  --bg-2: #171d18;
  --panel: #1c241e;
  --line: rgba(212, 185, 140, 0.16);
  --text: #f3efe6;
  --muted: #9aa393;
  --accent: #c4a574;
  --accent-2: #7d9b6d;
  --user: #2a342c;
  --ai: #243028;
  --danger: #c45c4a;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  padding-top: var(--topbar-h);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(196,165,116,.18), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(125,155,109,.12), transparent 50%),
    linear-gradient(160deg, #0c100d, #141a15 40%, #0f1410);
}
.app { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - var(--topbar-h)); }
.rail {
  background: rgba(15,20,16,.86);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 14px;
  backdrop-filter: blur(8px);
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: contain; display: block; flex-shrink: 0;
  background: rgba(255,255,255,.04);
  box-shadow: 0 0 0 2px rgba(196,165,116,.18);
}
.brand-name { font-family: var(--display); font-size: 1.45rem; letter-spacing: .02em; line-height: 1; }
.brand-sub { font-size: .72rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.rail-label { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.project-list, #proposal-list { display: flex; flex-direction: column; gap: 6px; overflow: auto; flex: 1; }
.project-item, .proposal-item {
  text-align: left; border: 1px solid transparent; background: transparent; color: var(--text);
  padding: 10px 12px; border-radius: 10px; cursor: pointer; font: inherit;
}
.project-item:hover, .proposal-item:hover { background: rgba(255,255,255,.04); }
.project-item.active, .proposal-item.active {
  background: rgba(196,165,116,.12); border-color: rgba(196,165,116,.28);
}
.project-item .t, .proposal-item .t { font-weight: 600; font-size: .92rem; }
.project-item .s, .proposal-item .s { font-size: .75rem; color: var(--muted); margin-top: 3px; }
.rail-foot { margin-top: auto; font-size: .75rem; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.rail-foot a { color: var(--accent); text-decoration: none; }
.stage { min-width: 0; display: flex; flex-direction: column; }
.empty {
  margin: auto; max-width: 560px; padding: 48px 24px; text-align: center;
  animation: rise .6s ease both;
}
.empty h1, .ws-head h1 {
  font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 0 0 12px; letter-spacing: .01em;
}
.empty p { color: var(--muted); line-height: 1.55; margin: 0 0 24px; }
.workspace { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); }
.ws-head {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  padding: 22px 28px 12px; border-bottom: 1px solid var(--line);
}
.eyebrow { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.muted { color: var(--muted); font-size: .85rem; }
.ws-body { display: grid; grid-template-columns: 240px 1fr; flex: 1; min-height: 0; }
.proposal-rail { border-right: 1px solid var(--line); padding: 16px; overflow: auto; background: rgba(0,0,0,.15); }
.chat-pane { display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
}
.pill {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: .7rem; background: rgba(125,155,109,.2); color: #cfe0c4; vertical-align: middle;
}
.messages {
  flex: 1; overflow: auto; padding: 22px; display: flex; flex-direction: column; gap: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.02), transparent 40%),
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(196,165,116,.03) 24px);
}
.bubble {
  max-width: min(720px, 92%); padding: 12px 14px; border-radius: 14px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; animation: rise .35s ease both;
  border: 1px solid var(--line);
}
.bubble.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 4px; }
.bubble.quantara, .bubble.assistant, .bubble.ai {
  align-self: flex-start; background: var(--ai); border-bottom-left-radius: 4px;
}
.bubble .meta { font-size: .7rem; color: var(--muted); margin-bottom: 6px; }
.composer {
  border-top: 1px solid var(--line); padding: 14px 18px 18px; background: rgba(15,20,16,.75);
  backdrop-filter: blur(10px);
}
.composer textarea {
  width: 100%; resize: vertical; min-height: 72px; max-height: 200px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); padding: 12px 14px; font: inherit; outline: none;
}
.composer textarea:focus { border-color: rgba(196,165,116,.45); box-shadow: 0 0 0 3px rgba(196,165,116,.12); }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.btn {
  border: 0; border-radius: 10px; padding: 10px 14px; font: inherit; font-weight: 600;
  cursor: pointer; transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, #c4a574, #a8864f); color: #1a140c; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: rgba(255,255,255,.04); }
.hidden { display: none !important; }
dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; background: #1a211c; color: var(--text);
  width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
dialog::backdrop { background: rgba(6,8,7,.65); backdrop-filter: blur(4px); }
dialog form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
dialog h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.7rem; }
dialog label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
dialog input {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel);
  color: var(--text); font: inherit;
}
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); max-height: 42vh; }
  .ws-body { grid-template-columns: 1fr; }
  .proposal-rail { border-right: 0; border-bottom: 1px solid var(--line); max-height: 160px; }
  .workspace { height: auto; min-height: 100vh; }
}

/* --- project/proposal form + date markers --- */
.date-marker, .date-row .date-marker {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: rgba(196,165,116,.1);
  border: 1px solid rgba(196,165,116,.22); border-radius: 999px;
  padding: 2px 8px; white-space: nowrap;
}
.date-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-head-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.chip-field { border: 0; margin: 0; padding: 0; }
.chip-field legend { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 8px 12px; font: inherit; font-size: .82rem; cursor: pointer;
}
.chip.active, .chip[aria-checked="true"] {
  background: rgba(196,165,116,.18); border-color: rgba(196,165,116,.45); color: #f3e6c8;
}
.range-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
dialog select {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel);
  color: var(--text); font: inherit; width: 100%;
}
dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto; }
.msg-day {
  align-self: center; margin: 8px 0 4px;
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.msg-day span {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(0,0,0,.25);
}
#chat-specs { margin-top: 4px; font-size: .8rem; }
.project-item .date-marker, .proposal-item .date-marker { margin-top: 6px; }
@media (max-width: 560px) {
  .range-grid { grid-template-columns: 1fr; }
}


/* GEODOMAS topbar (hub style) */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 80;
  min-height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px clamp(12px, 3vw, 28px);
  color: rgba(255,255,255,.88);
  background: rgba(8, 12, 10, .82);
  border-bottom: 1px solid rgba(212,185,140,.18);
  backdrop-filter: blur(14px);
  font-size: 13px;
  box-sizing: border-box;
}
.topbar-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; margin-left: auto; }
.lang-flags { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; flex-shrink: 1; min-width: 0; overflow: auto; }
.lang-flag {
  display: inline-flex; padding: 0; border: 1px solid rgba(255,255,255,.20);
  border-radius: 2px; overflow: hidden; line-height: 0; opacity: .78;
  transition: opacity .15s ease, border-color .15s ease, transform .15s ease;
}
.lang-flag:hover { opacity: 1; border-color: rgba(255,255,255,.42); transform: translateY(-1px); }
.lang-flag.is-active {
  opacity: 1; border-color: rgba(196,165,116,.62);
  box-shadow: 0 0 0 1px rgba(196,165,116,.28);
}
.lang-flag svg { width: 17px; height: 11px; display: block; }
.topbar-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; min-width: 28px; height: 28px; min-height: 28px; padding: 0;
  border: 1px solid rgba(255,255,255,.24); border-radius: 8px;
  background: rgba(255,255,255,.08); color: #f3efe6;
  transition: .18s; text-decoration: none;
}
.topbar-button:hover { transform: translateY(-1px); background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.38); }
.topbar-button svg { width: 15px; height: 15px; display: block; }
.topbar-button-chat {
  background: rgba(22,163,74,.14)!important;
  border-color: rgba(110,231,183,.45)!important;
}
.topbar-wa-icon { display: inline-flex; width: 17px; height: 17px; line-height: 0; }
.topbar-wa-icon svg { width: 100%; height: 100%; }
@media (max-width: 560px) {
  :root { --topbar-h: 44px; }
  .topbar { gap: 6px; padding: 7px 10px; }
  .lang-flags { gap: 3px; }
  .lang-flag svg { width: 15px; height: 10px; }
  .topbar-actions { gap: 4px; }
}
