/* Axis Intelligence — dark console aesthetic.
   Warm-dark, amber accent, Helvetica for content, mono for labels. */

:root {
  --bg:         #0a0a0a;
  --bg-soft:    #0f1014;
  --panel:      rgba(255,255,255,0.025);
  --panel-2:    rgba(255,255,255,0.045);
  --panel-3:    rgba(255,255,255,0.065);
  --rule:       #242427;
  --rule-2:     #303033;
  --rule-soft:  rgba(255,255,255,0.06);

  --ink:        #f4f3ee;
  --ink-2:      #bcb8af;
  --ink-3:      #888884;
  --ink-4:      #5e5e5a;

  --amber:      #d4a155;
  --amber-2:    #e8b466;
  --amber-dim:  #8b6a37;
  --amber-soft: rgba(212,161,85,0.10);
  --green:      #5fb486;
  --red:        #d97a7a;

  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  font-weight: 400;
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 72% -12%, rgba(212,161,85,0.06), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1.5px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(circle at 50% 28%, #000 0%, transparent 82%);
          mask-image: radial-gradient(circle at 50% 28%, #000 0%, transparent 82%);
}

.label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.label.dim { color: var(--ink-4); }

.dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--amber); box-shadow: 0 0 7px var(--amber);
  animation: pulse 2.6s ease-in-out infinite;
}
.dot.sm { width: 6px; height: 6px; }
.dot.warn { background: var(--red); box-shadow: 0 0 7px var(--red); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.brand-mark {
  width: 11px; height: 11px; flex: none; background: var(--amber);
  transform: rotate(45deg); box-shadow: 0 0 9px var(--amber-soft);
}

::selection { background: rgba(212,161,85,0.28); color: #fff; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #1d1d20; border-radius: 0; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #2a2a2e; background-clip: content-box; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-body { display: grid; place-items: center; padding: 24px; }
.login-card {
  position: relative; z-index: 1; width: 380px; max-width: 92vw;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid var(--rule); padding: 42px 36px 30px;
  box-shadow:
    0 26px 70px rgba(0,0,0,0.55),
    0 0 50px rgba(212,161,85,0.05),
    inset 0 1px 0 rgba(255,255,255,0.06);
  animation: fade-up .5s cubic-bezier(.2,.7,.2,1) both;
}
.login-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: .7;
}
.corner { position: absolute; width: 9px; height: 9px; border: 1px solid var(--amber); opacity: .65; }
.corner.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.corner.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.corner.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.login-status { display: flex; align-items: center; gap: 9px; margin-bottom: 30px; }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 30px; }
.login-brand .brand-mark { margin-bottom: 4px; }
.wordmark { font-size: 25px; font-weight: 400; letter-spacing: -0.01em; margin: 0; line-height: 1; }
.brand-sub { color: var(--ink-3); }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field input, #input {
  font-family: var(--mono); font-size: 14px; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--rule-2);
  padding: 12px 13px; border-radius: 0; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, #input:focus {
  outline: none; border-color: var(--amber);
  box-shadow: 0 0 0 1px rgba(212,161,85,0.25), 0 0 18px rgba(212,161,85,0.10);
}
.login-error { color: var(--red); }

.btn-auth {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--amber-2); background: var(--amber-soft); border: 1px solid var(--amber);
  padding: 13px 16px; margin-top: 6px; cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn-auth:hover { background: var(--amber); color: #0a0a0a; box-shadow: 0 0 22px rgba(212,161,85,0.25); }
.btn-auth .arr { transition: transform .15s ease; }
.btn-auth:hover .arr { transform: translateX(3px); }
.login-foot { text-align: center; margin-top: 26px; color: var(--ink-4); }

/* ── App shell ──────────────────────────────────────────────────────────── */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 284px 1fr; height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: rgba(0,0,0,0.35); border-right: 1px solid var(--rule);
  backdrop-filter: blur(2px);
}
.side-head { padding: 18px 16px 14px; border-bottom: 1px solid var(--rule); }
.brand-row { display: flex; align-items: center; gap: 11px; }
.brand-name { font-size: 14px; font-weight: 500; letter-spacing: 0.01em; }
.brand-tag { margin-top: 4px; }
.btn-new {
  margin-top: 16px; width: 100%; display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2); background: var(--panel); border: 1px solid var(--rule-2);
  padding: 10px 12px; cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.btn-new:hover { border-color: var(--amber); color: var(--amber-2); background: var(--amber-soft); }
.btn-new .plus { color: var(--amber); font-size: 13px; }

.side-section { padding: 16px 18px 8px; color: var(--ink-4); }
.conv-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; min-height: 0; }
.conv-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 11px;
  cursor: pointer; color: var(--ink-3); font-size: 13.5px; border-left: 2px solid transparent;
  transition: color .12s ease, background .12s ease, border-color .12s ease;
}
.conv-item:hover { background: var(--panel); color: var(--ink-2); }
.conv-item.active { background: var(--panel-2); color: var(--ink); border-left-color: var(--amber); }
.conv-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-del { opacity: 0; border: none; background: none; color: var(--ink-4); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; transition: color .12s; }
.conv-item:hover .conv-del { opacity: .8; }
.conv-del:hover { color: var(--red); }

.side-foot { border-top: 1px solid var(--rule); padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; color: var(--amber-2);
  background: var(--amber-soft); border: 1px solid var(--amber-dim);
}
.user-meta { min-width: 0; }
.uname { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ustatus { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--green); }
.ustatus .dot { background: var(--green); box-shadow: 0 0 7px var(--green); }
.icon-btn { border: 1px solid transparent; background: none; color: var(--ink-3); cursor: pointer; font-size: 15px; width: 32px; height: 32px; display: grid; place-items: center; text-decoration: none; transition: color .12s, border-color .12s; }
.icon-btn:hover { color: var(--red); border-color: var(--rule-2); }

/* ── Main ───────────────────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.main-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 26px; border-bottom: 1px solid var(--rule); }
.head-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.head-tag { color: var(--amber); flex: none; }
.conv-title { font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-info { flex: none; color: var(--ink-4); }

.banner {
  display: flex; align-items: center; gap: 10px; padding: 11px 26px;
  background: rgba(217,122,122,0.07); border-bottom: 1px solid rgba(217,122,122,0.2);
}
.banner .label { color: var(--red); letter-spacing: 0.08em; }
.banner code { font-family: var(--mono); background: rgba(255,255,255,0.07); padding: 1px 5px; color: var(--amber-2); }

.messages { flex: 1; overflow-y: auto; padding: 30px 0 12px; min-height: 0; }
.msg { max-width: 820px; margin: 0 auto 26px; padding: 0 26px; display: flex; flex-direction: column; }
.msg.user { align-items: flex-end; }
.msg-tag { margin-bottom: 7px; color: var(--ink-4); }
.msg.assistant .msg-tag { color: var(--amber); }
.bubble { font-size: 15px; line-height: 1.66; max-width: 92%; overflow-wrap: anywhere; }
.msg.user .bubble {
  background: var(--panel-2); border: 1px solid var(--rule-2); border-right: 2px solid var(--amber);
  color: var(--ink); padding: 12px 15px; font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
}
.msg.assistant .bubble {
  border-left: 2px solid var(--rule-2); padding: 1px 0 1px 18px; color: var(--ink);
  transition: border-color .2s ease;
}
.msg.assistant .bubble.streaming { border-left-color: var(--amber); }
.bubble.streaming::after { content: "▍"; color: var(--amber); animation: blink 1s steps(2) infinite; margin-left: 1px; }
.status { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--amber-2); margin: 0 0 9px 18px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 7px var(--amber); animation: pulse 1.2s ease-in-out infinite; }
.status:empty { display: none; }
.tool-tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-4); margin: 9px 0 0 18px; }

.bubble p { margin: 11px 0; }
.bubble p:first-child { margin-top: 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 { margin: 18px 0 9px; font-weight: 500; line-height: 1.3; color: var(--ink); }
.bubble h1 { font-size: 1.34em; } .bubble h2 { font-size: 1.18em; } .bubble h3 { font-size: 1.06em; } .bubble h4 { font-size: 1em; }
.bubble ul, .bubble ol { margin: 9px 0; padding-left: 22px; }
.bubble li { margin: 5px 0; }
.bubble li::marker { color: var(--amber); }
.bubble a { color: var(--amber-2); text-decoration: none; border-bottom: 1px solid rgba(232,180,102,0.4); }
.bubble a:hover { border-bottom-color: var(--amber-2); }
.bubble code { font-family: var(--mono); background: rgba(255,255,255,0.06); padding: 1.5px 5px; font-size: .86em; color: var(--amber-2); }
.bubble pre { background: var(--bg-soft); border: 1px solid var(--rule); padding: 13px 15px; overflow-x: auto; margin: 12px 0; }
.bubble pre code { background: none; padding: 0; color: var(--ink-2); font-size: .85em; line-height: 1.55; }

/* ── Composer ───────────────────────────────────────────────────────────── */
.composer { max-width: 820px; width: 100%; margin: 0 auto; padding: 8px 26px 20px; }
.composer-inner {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg-soft); border: 1px solid var(--rule-2); padding: 8px 8px 8px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer-inner:focus-within { border-color: var(--amber); box-shadow: 0 0 0 1px rgba(212,161,85,0.18), 0 0 26px rgba(212,161,85,0.08); }
#input {
  flex: 1; border: none; background: none; resize: none; max-height: 200px; line-height: 1.55;
  font-family: var(--sans); font-size: 15px; color: var(--ink); padding: 6px 0;
}
#input:focus { outline: none; box-shadow: none; }
#input::placeholder { color: var(--ink-4); }
.btn-send {
  flex: none; width: 38px; height: 38px; border: 1px solid var(--amber); cursor: pointer;
  background: var(--amber-soft); color: var(--amber-2); font-size: 17px; line-height: 1;
  display: grid; place-items: center; transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn-send:hover { background: var(--amber); color: #0a0a0a; box-shadow: 0 0 18px rgba(212,161,85,0.3); }
.btn-send:disabled { opacity: .4; cursor: default; background: var(--panel); color: var(--ink-4); border-color: var(--rule-2); box-shadow: none; }
.composer-hint { text-align: center; margin-top: 9px; color: var(--ink-4); letter-spacing: 0.14em; }

/* ── Motion ─────────────────────────────────────────────────────────────── */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shake { 10%,90%{transform:translateX(-1px);} 20%,80%{transform:translateX(2px);} 30%,50%,70%{transform:translateX(-4px);} 40%,60%{transform:translateX(4px);} }
.shake { animation: shake .5s, fade-up .5s cubic-bezier(.2,.7,.2,1) both; }

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ── Subtle "AI" presence (very slight) ─────────────────────────────────── */
.brand-mark { animation: mark-pulse 3.6s ease-in-out infinite; }
@keyframes mark-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(212,161,85,0.25); }
  50%      { box-shadow: 0 0 17px rgba(212,161,85,0.62); }
}

.grid-bg::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(620px 380px at 50% 6%, rgba(212,161,85,0.05), transparent 65%);
  animation: ai-breathe 6.5s ease-in-out infinite;
}
@keyframes ai-breathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

.login-brand .wordmark::after {
  content: "✦"; margin-left: 9px; font-size: 13px; color: var(--amber);
  vertical-align: 0.12em; animation: spark 3.6s ease-in-out infinite;
}
@keyframes spark {
  0%, 100% { opacity: .35; transform: scale(0.9); }
  50%      { opacity: 1;   transform: scale(1.06); }
}
