/* Infotrak AI Portal — Claude-style warm palette */
:root {
  --bg: #faf9f5;
  --bg-side: #f0eee6;
  --bg-card: #ffffff;
  --bubble-user: #ebe8de;
  --ink: #3d3929;
  --ink-dim: #8a8570;
  --line: #e3e0d5;
  --accent: #d97757;
  --accent-deep: #c05f3f;
  --danger: #b3261e;
  --serif: "Tiempos Text", Georgia, "Times New Roman", serif;
  --sans: "Styrene A", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", Consolas, Menlo, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
}

/* ---------- Auth screens ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 8px 32px rgba(61, 57, 41, 0.06);
  text-align: center;
}
.auth-logo { font-size: 30px; color: var(--accent); }
.auth-card h1 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  margin: 10px 0 4px;
}
.auth-sub { color: var(--ink-dim); font-size: 14px; margin: 0 0 24px; }
.auth-card form { text-align: left; }
.auth-card label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-dim);
  margin: 14px 0 5px;
}
.auth-card label .hint { font-weight: 400; opacity: 0.8; }
.auth-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
}
.auth-card input:focus { outline: none; border-color: var(--accent); }
.auth-error {
  margin-top: 14px;
  color: var(--danger);
  font-size: 13.5px;
  background: rgba(179, 38, 30, 0.07);
  border-radius: 8px;
  padding: 8px 10px;
}
.btn-primary {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-deep); }

/* ---------- App layout ---------- */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.side-head { padding: 16px 14px 10px; }
.side-brand {
  display: block;
  font-family: var(--serif);
  font-size: 16px;
  margin-bottom: 14px;
}
.btn-new {
  width: 100%;
  padding: 9px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  padding-left: 12px;
}
.btn-new:hover { border-color: var(--accent); color: var(--accent-deep); }

.conv-list { flex: 1; overflow-y: auto; padding: 6px 8px; }
.conv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}
.conv-item:hover { background: rgba(61, 57, 41, 0.05); }
.conv-item.active { background: rgba(217, 119, 87, 0.12); }
.conv-title { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.conv-del {
  border: none;
  background: none;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  visibility: hidden;
}
.conv-item:hover .conv-del { visibility: visible; }
.conv-del:hover { color: var(--danger); }

.side-foot { border-top: 1px solid var(--line); padding: 12px 14px; }
.gauge-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 5px;
}
.gauge-top span:first-child { font-family: var(--mono); color: var(--ink); }
.gauge-track {
  height: 5px;
  background: rgba(61, 57, 41, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.gauge-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s;
}
.gauge-fill.full { background: var(--danger); }

.roster { margin-top: 12px; font-size: 12.5px; }
.roster summary { cursor: pointer; color: var(--ink-dim); }
.roster-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--ink);
}
.roster-row b { font-weight: 500; }
.roster-row span { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }

.side-user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
}
.side-user a {
  color: var(--accent-deep);
  font-size: 12.5px;
  text-decoration: none;
  margin-right: 10px;
}
.side-user button {
  border: none;
  background: none;
  color: var(--ink-dim);
  font-size: 12.5px;
  cursor: pointer;
}
.side-user button:hover { color: var(--danger); }

/* ---------- Chat ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.quota-banner {
  margin: 12px auto 0;
  max-width: 720px;
  width: calc(100% - 48px);
  background: rgba(179, 38, 30, 0.08);
  border: 1px solid rgba(179, 38, 30, 0.35);
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
}
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-thread { max-width: 720px; margin: 0 auto; padding: 28px 24px 12px; }
.chat-empty {
  max-width: 720px;
  margin: 18vh auto 0;
  text-align: center;
  color: var(--ink-dim);
}
.empty-mark { font-size: 34px; color: var(--accent); }
.chat-empty h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  color: var(--ink);
  margin: 12px 0 6px;
}

.msg { margin-bottom: 22px; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-user .msg-body {
  background: var(--bubble-user);
  border-radius: 14px;
  padding: 11px 15px;
  max-width: 85%;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.msg-assistant .msg-body {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.65;
}
.msg-assistant .msg-body p { margin: 0 0 12px; }
.msg-assistant .msg-body h1, .msg-assistant .msg-body h2, .msg-assistant .msg-body h3 {
  font-family: var(--sans);
  font-size: 16px;
  margin: 18px 0 8px;
}
.msg-assistant .msg-body ul, .msg-assistant .msg-body ol { margin: 0 0 12px; padding-left: 22px; }
.msg-assistant .msg-body li { margin-bottom: 4px; }
.msg-assistant .msg-body code {
  font-family: var(--mono);
  font-size: 13px;
  background: rgba(61, 57, 41, 0.07);
  border-radius: 4px;
  padding: 1px 5px;
}
.msg-assistant .msg-body pre {
  background: #282524;
  color: #f5f0e8;
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px;
}
.msg-assistant .msg-body pre code { background: none; color: inherit; padding: 0; }
.msg-assistant .msg-body a { color: var(--accent-deep); }
.msg-error {
  color: var(--danger);
  font-size: 13.5px;
  background: rgba(179, 38, 30, 0.07);
  border-radius: 8px;
  padding: 9px 12px;
}
.cursor-blink { animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Composer ---------- */
.composer-wrap { padding: 8px 24px 14px; }
.composer {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(61, 57, 41, 0.06);
  padding: 10px 12px 8px;
}
.composer textarea {
  width: 100%;
  border: none;
  resize: none;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  max-height: 200px;
  line-height: 1.5;
}
.composer textarea:focus { outline: none; }
.composer-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.model-select {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-dim);
  border-radius: 8px;
  font-size: 12.5px;
  padding: 5px 8px;
}
.send-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.send-btn:disabled { background: var(--line); color: var(--ink-dim); cursor: default; }
.send-btn:hover:not(:disabled) { background: var(--accent-deep); }
.composer-note {
  max-width: 720px;
  margin: 8px auto 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-dim);
}

@media (max-width: 760px) {
  .sidebar { display: none; }
}
