﻿:root {
  --bg: #0b0b0d;
  --side: #111114;
  --card: #17171c;
  --line: #26262e;
  --text: #ececf1;
  --muted: #8c8c99;
  --accent: #3ddc97;
  --accent-ink: #05140d;
  --danger: #ff6b7a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  display: flex;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.hidden { display: none !important; }

input, textarea {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus { border-color: #4a4a57; }
textarea { resize: none; }

button {
  font: inherit;
  cursor: pointer;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}
button:hover { border-color: #3a3a46; }
button:disabled { opacity: 0.5; cursor: default; }

/* Sign-in page */
#auth {
  margin: auto;
  width: 100%;
  max-width: 400px;
  padding: 24px;
  background: transparent;
  border: 0;
  text-align: center;
}
.auth-top { margin-bottom: 56px; }
.auth-top .logo-box { display: inline-flex; background: #fff; border-radius: 10px; padding: 8px 14px; }
.auth-top .logo-box img { height: 26px; display: block; }

.auth-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 48px;
  letter-spacing: -0.5px;
  color: var(--text);
  margin: 0 0 14px;
}
.auth-sub {
  font-family: var(--serif);
  font-size: 19px;
  color: #c9c9d1;
  margin: 0 0 40px;
}

.auth-card {
  background: #121216;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  text-align: left;
}
.auth-card input {
  background: #1c1c22;
  border: 1px solid #2c2c35;
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  margin-bottom: 12px;
}
.auth-card input:focus { border-color: #5a5a68; }

.auth-primary, .auth-secondary {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
}
.auth-primary {
  background: #ececf1;
  border: 1px solid #ececf1;
  color: #0b0b0d;
}
.auth-primary:hover { background: #ffffff; }
.auth-secondary {
  background: #26262e;
  border: 1px solid #26262e;
  color: var(--text);
  margin-top: 10px;
}
.auth-secondary:hover { background: #2e2e38; border-color: #2e2e38; }

#authmsg {
  text-align: center;
  color: var(--danger);
  font-size: 14px;
  min-height: 20px;
  margin: 14px 0 0;
}

/* App layout */
#app { flex: 1; display: flex; min-width: 0; }

#side {
  width: 264px;
  flex-shrink: 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#side h3 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
#side textarea { height: 64px; }
#side button { width: 100%; }

#bal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
}
#bal strong {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  margin: 4px 0 2px;
}
#plan {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--muted);
}

#plist {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}
.proj {
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj:hover, .proj.on { background: var(--card); color: var(--text); }

/* Chat area */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#log { flex: 1; overflow-y: auto; padding: 24px 16px; }
.m {
  max-width: 720px;
  margin: 12px auto;
  padding: 12px 16px;
  border-radius: 12px;
  white-space: pre-wrap;
  line-height: 1.6;
  border: 1px solid var(--line);
  background: var(--side);
}
.m.user { background: #1b2a23; border-color: #24443a; }
.meta { font-size: 12px; color: var(--muted); margin-top: 8px; }
.err { color: var(--danger); border-color: #5a2630; }

.artbtn {
  margin-top: 10px;
  font-size: 13px;
  padding: 6px 12px;
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}

#bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--side);
}
#bar textarea { flex: 1; height: 56px; }
#bar button {
  height: 56px;
  padding: 0 24px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* Artifact panel */
#art {
  display: none;
  width: 45%;
  border-left: 1px solid var(--line);
  background: #fff;
}
#art iframe { width: 100%; height: 100%; border: 0; }

@media (max-width: 760px) {
  #side { width: 210px; }
  #art { width: 50%; }
}
@media (max-width: 560px) {
  body { flex-direction: column; height: auto; min-height: 100vh; }
  #app { flex-direction: column; }
  #side { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  #plist { max-height: 160px; }
  #art { width: 100%; height: 60vh; }
}
