:root {
  --ink: #18201d;
  --muted: #6a746f;
  --line: #dde4df;
  --paper: #fbfcfa;
  --panel: #f3f6f2;
  --accent: #176b52;
  --accent-dark: #10503d;
  --accent-soft: #e3f2eb;
  --danger: #a73737;
  --shadow: 0 24px 70px rgba(26, 42, 35, .12);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(35, 133, 98, .13), transparent 32rem),
    radial-gradient(circle at 82% 88%, rgba(215, 181, 99, .12), transparent 28rem),
    #f7f9f6;
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card {
  width: min(100%, 410px);
  padding: 42px;
  border: 1px solid rgba(44, 69, 59, .12);
  border-radius: 24px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.brand-mark, .welcome-mark {
  display: grid; place-items: center; width: 48px; height: 48px;
  border-radius: 14px; background: var(--accent); color: white; font-weight: 800; letter-spacing: -.04em;
}
.eyebrow { margin: 24px 0 8px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.login-card h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.login-copy { margin: 12px 0 28px; color: var(--muted); line-height: 1.65; font-size: 14px; }
.login-form { display: grid; gap: 18px; }
.login-form label { display: grid; gap: 8px; color: #3e4944; font-size: 13px; font-weight: 700; }
.login-form input {
  width: 100%; height: 48px; padding: 0 14px; border: 1px solid #d6ded9; border-radius: 12px;
  outline: none; background: white; transition: .18s border-color, .18s box-shadow;
}
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(23, 107, 82, .1); }
.primary-button { height: 48px; border: 0; border-radius: 12px; color: white; background: var(--accent); font-weight: 750; }
.primary-button:hover { background: var(--accent-dark); }
.form-error { margin: -8px 0 18px; padding: 11px 13px; border-radius: 10px; color: var(--danger); background: #fff0f0; font-size: 13px; }
.login-footnote { margin: 22px 0 0; text-align: center; color: #8a948f; font-size: 12px; }

.app-page { height: 100vh; overflow: hidden; background: var(--paper); }
.app-shell { height: 100vh; display: grid; grid-template-columns: 286px 1fr; }
.sidebar { min-width: 0; display: flex; flex-direction: column; padding: 18px 14px 14px; border-right: 1px solid var(--line); background: var(--panel); }
.sidebar-head { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand span { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 850; }
.brand strong { letter-spacing: -.03em; }
.new-chat { height: 44px; margin: 18px 2px 20px; border: 1px solid #cbd7d0; border-radius: 11px; background: #fff; color: var(--ink); text-align: left; padding: 0 13px; font-weight: 700; }
.new-chat:hover { border-color: var(--accent); color: var(--accent); }
.new-chat span { margin-right: 7px; font-size: 20px; font-weight: 400; vertical-align: -1px; }
.conversation-label { padding: 0 10px 8px; color: #8b958f; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.conversation-list { flex: 1; min-height: 0; overflow: auto; }
.conversation-item { position: relative; display: flex; align-items: center; min-height: 42px; margin: 2px 0; padding: 0 38px 0 11px; border: 0; border-radius: 9px; background: transparent; color: #44504a; width: 100%; text-align: left; }
.conversation-item > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item:hover, .conversation-item.active { background: #e5ebe7; color: var(--ink); }
.delete-chat { position: absolute; right: 7px; display: none; width: 25px; height: 25px; border: 0; border-radius: 7px; background: transparent; color: #7c8982; }
.conversation-item:hover .delete-chat, .conversation-item.active .delete-chat { display: block; }
.delete-chat:hover { background: #d3ded7; color: var(--danger); }
.sidebar-account { display: flex; align-items: center; gap: 10px; padding: 13px 8px 2px; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; flex: 0 0 35px; height: 35px; border-radius: 50%; background: #dbe8e0; color: var(--accent); font-weight: 800; }
.account-copy { flex: 1; min-width: 0; display: grid; }
.account-copy strong { font-size: 13px; }
.account-copy span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.logout-button { border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.logout-button:hover { color: var(--danger); }

.chat-panel { min-width: 0; height: 100vh; display: grid; grid-template-rows: 64px 1fr auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; border-bottom: 1px solid rgba(221, 228, 223, .75); background: rgba(251, 252, 250, .88); backdrop-filter: blur(10px); }
.topbar > div { min-width: 0; display: flex; align-items: center; gap: 12px; }
.topbar strong { max-width: min(50vw, 520px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.model-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 11px; font-weight: 700; }
.model-pill i { width: 6px; height: 6px; border-radius: 50%; background: #20a272; }
.privacy-note { color: var(--muted); font-size: 12px; }
.messages { min-height: 0; overflow-y: auto; padding: 34px max(24px, calc((100% - 820px) / 2)); scroll-behavior: smooth; }
.welcome { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 9vh; text-align: center; }
.welcome-mark { width: 54px; height: 54px; border-radius: 16px; box-shadow: 0 12px 30px rgba(23, 107, 82, .2); }
.welcome h1 { margin: 22px 0 8px; font-size: clamp(27px, 4vw, 38px); letter-spacing: -.045em; }
.welcome p { margin: 0; color: var(--muted); }
.suggestions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(100%, 650px); margin-top: 32px; }
.suggestions button { min-height: 78px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: #44504a; text-align: left; line-height: 1.45; }
.suggestions button:hover { border-color: #a8bbb0; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(33, 53, 44, .07); }
.message { width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 13px; margin: 0 0 28px; }
.message-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: white; background: var(--accent); font-size: 11px; font-weight: 850; }
.message.user .message-avatar { background: #353e3a; }
.message-body { min-width: 0; padding-top: 5px; color: #27312d; font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.message-body p { margin: 0 0 12px; }
.message-body pre { margin: 12px 0; padding: 15px; overflow: auto; border-radius: 11px; background: #17201c; color: #eaf1ed; font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.message-body code { padding: 2px 5px; border-radius: 5px; background: #e9eeeb; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.message-body pre code { padding: 0; background: transparent; }
.typing { display: inline-flex; gap: 5px; padding: 7px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #809088; animation: pulse 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .13s; }.typing i:nth-child(3) { animation-delay: .26s; }
@keyframes pulse { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
.composer-wrap { padding: 10px max(24px, calc((100% - 820px) / 2)) 16px; background: linear-gradient(to top, var(--paper) 75%, rgba(251,252,250,0)); }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 10px 10px 10px 16px; border: 1px solid #cfd9d3; border-radius: 17px; background: #fff; box-shadow: 0 8px 30px rgba(34, 51, 43, .08); }
.composer:focus-within { border-color: #8caa9b; box-shadow: 0 0 0 4px rgba(23, 107, 82, .07), 0 8px 30px rgba(34, 51, 43, .08); }
.composer textarea { flex: 1; max-height: 180px; resize: none; padding: 7px 0; border: 0; outline: 0; color: var(--ink); background: transparent; line-height: 1.5; }
.composer textarea::placeholder { color: #98a29d; }
.composer button { flex: 0 0 38px; height: 38px; border: 0; border-radius: 11px; background: var(--accent); color: white; font-size: 20px; font-weight: 700; }
.composer button:disabled { opacity: .42; cursor: not-allowed; }
.composer-wrap > p { margin: 8px 0 0; color: #929c97; text-align: center; font-size: 11px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-size: 20px; }
.mobile-only { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .mobile-only { display: grid; }
  .sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: min(86vw, 310px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 20px 0 50px rgba(20,32,27,.18); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 20; inset: 0; background: rgba(14, 22, 19, .35); }
  .sidebar-backdrop.show { display: block; }
  .topbar { padding: 0 14px; }
  .privacy-note, .model-pill { display: none; }
  .messages { padding: 24px 16px; }
  .composer-wrap { padding: 8px 12px 12px; }
  .suggestions { grid-template-columns: 1fr; width: 100%; }
  .suggestions button { min-height: 54px; text-align: center; }
  .login-card { padding: 32px 24px; border-radius: 20px; }
}

