:root{--bg:#f6f7f2;--panel:#fff;--text:#1e2420;--muted:#626c66;--line:#d9ded7;--accent:#146c5c;--assistant:#eef6f2;--user:#e9eef8;--warn:#7a401a;--warn-bg:#fff1df}*{box-sizing:border-box}body{margin:0;min-height:100vh;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif}.app{width:min(1180px,100%);min-height:100vh;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:18px;padding:18px}.panel,.side{background:var(--panel);border:1px solid var(--line);border-radius:8px}.panel{min-height:calc(100vh - 36px);display:grid;grid-template-rows:auto 1fr auto;overflow:hidden}.topbar{display:flex;justify-content:space-between;gap:16px;padding:18px;border-bottom:1px solid var(--line)}h1,h2,p{margin:0}h1{font-size:22px;line-height:1.25}.topbar p{margin-top:8px;color:var(--muted);line-height:1.6}button{border:0;border-radius:6px;background:var(--accent);color:#fff;font-size:15px;cursor:pointer}button:disabled{cursor:wait;opacity:.6}#resetBtn{width:72px;height:38px;background:#eef1ed;color:var(--text);border:1px solid var(--line)}.messages{padding:18px;overflow-y:auto}.empty{color:var(--muted);line-height:1.8;padding:24px;background:#f8faf7;border:1px dashed var(--line);border-radius:8px}.message{max-width:820px;margin:0 0 14px;padding:14px 16px;border-radius:8px;line-height:1.75;white-space:pre-wrap;word-break:break-word}.message.user{margin-left:auto;background:var(--user)}.message.assistant{margin-right:auto;background:var(--assistant)}.composer{display:grid;grid-template-columns:1fr 96px;gap:12px;padding:14px;border-top:1px solid var(--line);background:#fbfcfa}textarea{width:100%;resize:vertical;min-height:88px;max-height:220px;border:1px solid var(--line);border-radius:8px;padding:12px;font-size:16px;line-height:1.6;color:var(--text)}textarea:focus{outline:2px solid rgba(20,108,92,.2);border-color:var(--accent)}.side{align-self:start;padding:18px;position:sticky;top:18px}.side h2{font-size:18px;margin-bottom:12px}.side ul{margin:0;padding-left:20px;color:var(--muted);line-height:1.9}.notice{margin-top:18px;padding:12px;border-radius:8px;background:var(--warn-bg);color:var(--warn);line-height:1.7}@media(max-width:860px){.app{grid-template-columns:1fr;padding:10px}.panel{min-height:78vh}.composer{grid-template-columns:1fr}.composer button{height:44px}.side{position:static}}

.message.thinking {
  color: var(--muted);
}

.message.thinking::after {
  content: "";
  display: inline-block;
  width: 28px;
  height: 10px;
  margin-left: 8px;
  background: radial-gradient(circle, var(--muted) 35%, transparent 38%) 0 50% / 9px 9px repeat-x;
  animation: pulse 1s infinite ease-in-out;
  vertical-align: baseline;
}

.decision-note {
  margin: 0 18px 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #efcf9c;
  background: var(--warn-bg);
  color: var(--warn);
  line-height: 1.7;
  font-size: 14px;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.hidden {
  display: none !important;
}

.auth-shell {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(246, 247, 242, 0.96);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.auth-card h1 {
  margin-bottom: 8px;
}

.auth-card p {
  color: var(--muted);
  line-height: 1.7;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0;
}

.auth-tabs button {
  height: 40px;
  background: #eef1ed;
  color: var(--text);
  border: 1px solid var(--line);
}

.auth-tabs button.active {
  background: var(--accent);
  color: #fff;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 16px;
}

.code-line {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
}

.remember-line {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  color: var(--muted) !important;
}

#authSubmit {
  height: 44px;
}

.auth-message {
  min-height: 24px;
  margin-top: 12px;
}

.auth-message.error {
  color: #a33a1f;
}

.auth-note {
  margin-top: 10px;
  font-size: 13px;
}

.account-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#currentUser {
  color: var(--muted);
  font-size: 14px;
}

#logoutBtn {
  width: 72px;
  height: 38px;
  background: #eef1ed;
  color: var(--text);
  border: 1px solid var(--line);
}


/* Auth layout: single primary action + secondary account switch */
.auth-tabs {
  display: none !important;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0;
}

.link-button {
  border: 0;
  background: transparent !important;
  color: var(--accent) !important;
  width: auto;
  height: auto;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
}

.link-button:hover {
  color: var(--accent-dark) !important;
  text-decoration: underline;
}

.remember-line {
  margin: 0;
}


/* Back to login placement */
.auth-card {
  position: relative;
}

.back-login {
  position: absolute;
  top: 14px;
  left: 16px;
  border: 0;
  background: transparent !important;
  color: var(--accent) !important;
  width: auto;
  height: auto;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
}

.back-login:hover {
  color: var(--accent-dark) !important;
  text-decoration: underline;
}

.auth-card h1 {
  padding-top: 10px;
}

/* Back link alignment and spacing fix */
.back-login {
  position: static !important;
  display: inline-block;
  margin: 0 0 14px 0;
  text-align: left;
}

.auth-card h1 {
  padding-top: 0 !important;
  margin-top: 0;
  margin-bottom: 14px;
}

.auth-card > p {
  margin-bottom: 18px;
}

.auth-form {
  gap: 16px;
}

.auth-form label {
  gap: 8px;
}

.code-line {
  margin-top: 2px;
}

.auth-row {
  margin-top: 4px;
  margin-bottom: 4px;
}

#authSubmit {
  margin-top: 6px;
}


.password-line {
  position: relative;
  display: block;
}

.password-line input {
  width: 100%;
  padding-right: 48px !important;
}

.icon-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.icon-button:hover {
  background: #eef1ed;
  color: var(--text);
}


.filing-number {
  text-align: center;
  font-size: 13px;
}

.filing-number a,
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.filing-number a:hover,
.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.auth-filing {
  margin-top: 10px;
  margin-bottom: 0 !important;
}

.site-footer {
  padding: 12px 16px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
