*{box-sizing:border-box}html,body{margin:0;height:100%;background:#070b14;color:#f7f8ff;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;overflow:hidden}.app{height:100dvh;display:flex;background:#070b14}.sidebar{width:310px;background:#0d1423;border-right:1px solid #26344f;padding:24px;display:flex;flex-direction:column;gap:14px}.brand{display:flex;gap:14px;align-items:center;margin-bottom:18px}.logo{width:52px;height:52px;border-radius:50%;background:#ffc83d;color:#07101f;display:grid;place-items:center;font-weight:900}.brand strong{display:block;font-size:22px}.brand span,.project span,.topbar p{color:#9faabe}.new-project,.project{border:1px solid #293755;background:#121a2b;color:#fff;border-radius:22px;padding:18px;text-align:left;font-size:18px}.project.active{border-color:#ffc83d}.project strong{display:block;font-size:21px}.safe{margin-top:auto;color:#9faabe;border-top:1px solid #293755;padding-top:18px}.main{flex:1;min-width:0;height:100dvh;display:flex;flex-direction:column}.topbar{height:96px;display:flex;align-items:center;gap:16px;padding:18px 22px;border-bottom:1px solid #26344f;background:#0b1120}.topbar h1{font-size:28px;margin:0}.topbar p{margin:3px 0 0;font-size:15px}.icon-btn,.round-btn,.send-btn{border:1px solid #2b3b5d;background:#121a2b;color:#fff;border-radius:20px;font-size:24px;font-weight:800}.icon-btn{width:58px;height:58px}.chat{flex:1;overflow:auto;padding:22px 18px 120px}.message-row{display:flex;gap:10px;margin:18px 0;align-items:flex-end}.message-row.user{justify-content:flex-end}.avatar{width:38px;height:38px;border-radius:50%;background:#ffc83d;color:#07101f;font-weight:900;display:grid;place-items:center;flex:0 0 38px}.bubble{max-width:78%;padding:15px 18px;border-radius:24px;background:#121a2b;border:1px solid #293755;font-size:18px;line-height:1.38}.user .bubble{background:#1c2940}.typing{display:inline-flex;gap:5px}.typing span{width:7px;height:7px;background:#fff;border-radius:50%;animation:pulse 1s infinite}.typing span:nth-child(2){animation-delay:.2s}.typing span:nth-child(3){animation-delay:.4s}@keyframes pulse{0%,80%,100%{opacity:.25}40%{opacity:1}}.composer{position:fixed;left:310px;right:0;bottom:0;padding:12px 14px calc(12px + env(safe-area-inset-bottom));display:flex;gap:10px;align-items:flex-end;background:#070b14;border-top:1px solid #182238}.round-btn{width:54px;height:54px;flex:0 0 54px}.send-btn{width:58px;height:54px;flex:0 0 58px;background:#ffc83d;color:#07101f;border-color:#ffc83d}textarea{flex:1;min-height:54px;max-height:130px;resize:none;border:1px solid #2b3b5d;background:#101827;color:#fff;border-radius:22px;padding:15px 17px;font-size:18px;outline:none}.attachment-menu{position:fixed;left:326px;bottom:82px;background:#101827;border:1px solid #2b3b5d;border-radius:20px;padding:10px;display:none;z-index:20}.attachment-menu.open{display:block}.attachment-menu button{display:block;width:220px;border:0;background:transparent;color:#fff;text-align:left;padding:14px;font-size:17px}.attachment-preview{position:fixed;left:326px;right:14px;bottom:82px;display:flex;gap:8px;overflow:auto;pointer-events:none}.chip{background:#1b263b;border:1px solid #34476b;border-radius:16px;padding:8px 12px;color:#fff;font-size:14px}@media(max-width:760px){.sidebar{position:fixed;z-index:30;inset:0 auto 0 0;width:82vw;max-width:330px;transform:translateX(-105%);transition:.2s}.sidebar.open{transform:translateX(0)}.composer{left:0}.attachment-menu{left:14px}.attachment-preview{left:14px}.bubble{max-width:82%;font-size:17px}.topbar{height:98px;padding-top:max(18px,env(safe-area-inset-top))}.topbar h1{font-size:25px}}
/* === Phase J: ChatGPT-like Chat === */

.message-row {
  margin: 20px 0;
  display: flex;
  width: 100%;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.luma {
  justify-content: flex-start;
}

.message-row .avatar {
  display: none !important;
}

.bubble {
  max-width: 86%;
  border-radius: 26px;
  padding: 16px 18px;
  font-size: 17px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message-row.user .bubble {
  background: #1f2d46;
  border: 1px solid #334867;
  color: #ffffff;
  border-bottom-right-radius: 8px;
}

.message-row.luma .bubble {
  background: transparent;
  border: 0;
  color: #f7f8ff;
  max-width: 94%;
  padding-left: 4px;
}

.typing {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffc83d;
  animation: lumaBlink 1.1s infinite;
}

.typing span:nth-child(2) {
  animation-delay: .2s;
}

.typing span:nth-child(3) {
  animation-delay: .4s;
}

@keyframes lumaBlink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.chat {
  padding-top: 26px;
}


/* === Phase K1: Chat UX === */
.msg-meta{
  margin-top:8px;
  font-size:11px;
  color:#7f8aa3;
}

.file-cards{
  margin-top:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.file-card{
  padding:10px 12px;
  border-radius:14px;
  background:#111a2c;
  border:1px solid #2c3d5d;
  color:#f7f8ff;
  font-size:14px;
}

pre{
  position:relative;
  overflow:auto;
  background:#0b1020;
  border:1px solid #293755;
  border-radius:16px;
  padding:14px;
  margin:10px 0;
}

code{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  font-size:14px;
}

.copy-code{
  position:absolute;
  top:8px;
  right:8px;
  border:1px solid #334867;
  background:#172238;
  color:white;
  border-radius:10px;
  padding:6px 8px;
}

.typing-bubble{
  width:auto;
  min-width:58px;
}

textarea{
  overflow-y:auto;
}

/* === Phase L4: Luma readable answers === */
.luma-list-item {
  margin: 8px 0;
  line-height: 1.45;
}

.message-row.luma h2 {
  font-size: 22px;
  margin: 18px 0 10px;
  line-height: 1.2;
}

/* === Phase L5: Markdown headings === */
.message-row.luma h1,
.message-row.luma h2,
.message-row.luma h3 {
  font-weight: 900;
  color: #f7f8ff;
}

.message-row.luma h2 {
  font-size: 23px;
  margin: 24px 0 8px;
}

/* M6.18 Logout Button */
.ghost-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.ghost-btn:hover {
  background: rgba(255,255,255,.08);
}

/* M6.22 - Luma Login Responsive Fix */
* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body.luma-login-page {
  margin: 0;
  min-height: 100dvh;
  width: 100%;
  overflow-x: hidden;
  background: #0b1220;
  color: #ffffff;
  font-family: Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.luma-login-shell {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.luma-login-card {
  width: min(100%, 460px);
  background: #1f2937;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  padding: clamp(28px, 6vw, 48px);
  box-shadow: 0 22px 80px rgba(0,0,0,.32);
}

.luma-login-logo {
  font-size: clamp(44px, 10vw, 72px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 28px;
}

.luma-login-kicker {
  margin: 0 0 28px;
  color: #f8fafc;
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1.25;
}

.luma-login-label {
  display: block;
  margin: 0 0 8px;
  color: #cbd5e1;
  font-size: 15px;
}

.luma-login-input {
  width: 100%;
  min-height: 58px;
  margin: 0 0 18px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  color: #111827;
  font-size: 16px;
  line-height: 1.2;
  outline: none;
}

.luma-login-input:focus {
  box-shadow: 0 0 0 4px rgba(59,130,246,.38);
}

.luma-login-button {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 15px;
  background: #2563eb;
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.luma-login-button:disabled {
  opacity: .65;
  cursor: wait;
}

.luma-login-status {
  min-height: 22px;
  margin: -4px 0 16px;
  color: #fca5a5;
  font-size: 16px;
}

.luma-login-note {
  margin: 24px 0 0;
  color: #aab4c5;
  text-align: center;
  font-size: clamp(16px, 4vw, 20px);
  line-height: 1.4;
}

@media (max-width: 480px) {
  .luma-login-shell {
    align-items: flex-start;
    padding-top: max(54px, env(safe-area-inset-top));
  }

  .luma-login-card {
    border-radius: 22px;
    padding: 30px 18px 28px;
  }

  .luma-login-logo {
    text-align: center;
    margin-bottom: 26px;
  }

  .luma-login-button {
    font-size: 18px;
  }
}

@media (min-width: 900px) {
  .luma-login-card {
    width: 460px;
  }
}
