:root {
  --m60-red: #BF2619;
  --paper: #F5F5F7;
  --surface: #FFFFFF;
  --ink: #1A1A1A;
  --ink-sub: #666666;
  --muted: #9A9A9A;
  --line: rgba(0,0,0,.08);
  --soft-red: #FFF3F1;
  --sidebar-w: 280px;
  --topbar-h: 98px;
  --input-h: 132px;
  --font-main: "Noto Sans TC", "微軟正黑體", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-main);
  line-height: 1.85;
  letter-spacing: .03em;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  z-index: -1;
  background-image: radial-gradient(rgba(0,0,0,.055) 1px, transparent 1px);
  background-size: 32px 32px;
}
button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.m60-client-shell { min-height: 100vh; width: 100%; }

.m60-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 min(8vw, 78px);
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.m60-welcome-eyebrow2 { 
  color: var(--m60-red); 
  font-size: 10px; 
  font-weight: 600; 
  margin-bottom: 2px; 
  line-height: 10px;
}
.m60-topbar__left,
.m60-topbar__right { display: flex; align-items: center; gap: 18px; }
.m60-icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 7px;
  cursor: pointer;
}
.m60-icon-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: #333;
  margin: 2px 0;
  border-radius: 2px;
}
.m60-topbar__brand {
  color: var(--m60-black);
  font-weight: 900;
  letter-spacing: .08em;
  font-size: 20px;
  line-height: 20px;
}
.m60-member-label {
  color: #555;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.m60-logout-btn {
  height: 34px;
  padding: 8px;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 6px;
  background: #fff;
  color: #888;
  cursor: pointer;
  font-weight: 400;
  font-size:14px;
  text-decoration: none;
}

.m60-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 12px;
  background: #f7f7f9;
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  transition: transform .24s ease;
  box-shadow: 8px 0 36px rgba(0,0,0,.10);
}
body.sidebar-open .m60-sidebar { transform: translateX(0); }
.m60-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  background: rgba(0,0,0,.32);
  backdrop-filter: blur(4px);
  transition: opacity .24s ease;
}
body.sidebar-open .m60-sidebar-overlay { opacity: 1; pointer-events: auto; }

.m60-new-chat {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 6px;
  background: #fff;
  color: #111;
  cursor: pointer;
  font-weight: 800;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.m60-new-chat:hover { background: #fafafa; transform: translateY(-1px); }
.m60-plus { font-size: 20px; line-height: 1; }

.m60-sidebar__section { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.m60-sidebar__label {
  color: #777;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: .1em;
  padding: 0 8px;
  text-transform: uppercase;
}
.m60-thread-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-bottom: 12px; }
.m60-thread-item {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 4px;
  align-items: center;
  padding: 12px 8px 12px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #1b1b1b;
  text-align: left;
}
.m60-thread-item.active { background: rgba(0,0,0,.06); }
.m60-thread-main { min-width: 0; cursor: pointer; }
.m60-thread-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .02em;
}
.m60-thread-date {
  margin-top: 4px;
  color: #555;
  font-family: var(--font-mono);
  font-size: 11px;
}
.m60-thread-delete {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #888;
  cursor: pointer;
  opacity: .85;
}
.m60-thread-delete:hover { background: rgba(0,0,0,.06); color: var(--m60-red); }
.m60-thread-empty { color: #888; font-size: 13px; padding: 10px 12px; }

.m60-sidebar__footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  color: var(--ink-sub);
  font-size: 12px;
  font-family: var(--font-mono);
}
.m60-status-dot { width: 8px; height: 8px; border-radius: 999px; background: #20A05B; box-shadow: 0 0 0 4px rgba(32,160,91,.12); }

.m60-main { min-height: 100vh; padding-bottom: var(--input-h); }
.m60-chat-list { width: min(100%, 1000px); margin: 0 auto; padding: calc(var(--topbar-h) + 122px) 48px 56px; }
.m60-welcome { min-height: calc(100vh - var(--topbar-h) - var(--input-h) - 80px); display: grid; align-items: start; }
.m60-welcome.is-hidden { display: none; }
.m60-welcome-card { max-width: 760px; padding-top: 32px; }
.m60-welcome-eyebrow { color: var(--m60-red); font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.m60-welcome h1 { margin: 0 0 4px; font-size: 28px; line-height: 1.25; font-weight: 900; letter-spacing: .02em; }
.m60-welcome p { margin: 0; color: var(--ink-sub); font-size: 14px; }

.m60-turn { margin: 0 0 58px; scroll-margin-top: calc(var(--topbar-h) + 18px); }
.m60-msg { display: flex; width: 100%; margin: 14px 0; }
.m60-msg.user { justify-content: flex-end; }
.m60-msg.ai { justify-content: flex-start; }
.m60-bubble { max-width: min(860px, 100%); overflow-wrap: anywhere; }
.m60-msg.user .m60-bubble {
  max-width: min(760px, 84%);
  padding: 13px 28px;
  border-radius: 22px 22px 6px 22px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
  line-height: 1.45;
  font-size: 1em;
}
.m60-msg.ai .m60-bubble {
  border-left: 3px solid var(--m60-red);
  padding-left: 22px;
  color: #222;
  font-size: 1em;
  line-height: 1.85;
}
.m60-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  margin: 8px 0 18px;
  color: var(--m60-red);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.m60-status:empty { display: none; }
.m60-status:not(:empty)::before { content: ""; width: 14px; height: 14px; border: 1.5px solid var(--m60-red); border-radius: 50%; display: inline-block; animation: m60-pulse 1s linear infinite; }
@keyframes m60-pulse { 0% { transform: scale(.8); opacity: .45; } 50% { transform: scale(1); opacity: 1; } 100% { transform: scale(.8); opacity: .45; } }

.m60-sources { display: none; }
.m60-answer { line-height: 1.85; }
.m60-answer p { margin: 0 0 18px; }
.m60-answer ol { margin: 10px 0 18px 1.55em; padding: 0; }
.m60-answer ul { margin: 10px 0 18px 1.2em; padding: 0; }
.m60-answer li { margin: 8px 0; }
.m60-answer strong { font-weight: 900; }
.m60-citation { color: var(--m60-red); font-weight: 900; text-decoration: none; white-space: nowrap; }
.m60-citation:hover { text-decoration: underline; }
.m60-error { margin-top: 14px; padding: 12px 14px; border-radius: 14px; color: #A30015; background: #FFF1F1; border: 1px solid #FFD1D1; font-size: 15px; }
.m60-trace { display: none; }
.m60-entry__actions, .m60-copy-btn { margin-top: 16px; }
.m60-copy-btn { display: inline-flex; align-items: center; gap: 6px; border: none; background: transparent; color: var(--ink-sub); cursor: pointer; padding: 6px 8px; border-radius: 8px; opacity: .6; }
.m60-copy-btn:hover { opacity: 1; background: rgba(0,0,0,.045); color: var(--m60-red); }

.m60-input-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  padding: 32px 48px 26px;
  pointer-events: none;
  background: linear-gradient(to top, var(--paper) 66%, rgba(245,245,247,0));
}
.m60-input-plate {
  width: min(100%, 760px);
  margin: 0 auto;
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 18px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 44px rgba(0,0,0,.11);
  transition: transform .2s ease, box-shadow .2s ease;
}
.m60-input-plate.focused { transform: translateY(-2px); box-shadow: 0 18px 54px rgba(0,0,0,.14); }
.m60-input-plate textarea {
  flex: 1;
  width: 100%;
  min-height: 48px;
  max-height: 210px;
  padding: 12px 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
}
.m60-send-btn {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--m60-red);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, color .18s ease, opacity .18s ease;
}
.m60-send-btn:hover:not(:disabled) { transform: scale(1.08); background: var(--soft-red); }
.m60-send-btn:disabled { color: #D6D6D6; cursor: not-allowed; opacity: .75; }
.m60-input-hint {
  width: min(100%, 760px);
  margin: 8px auto 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.m60-policy-block {
  margin-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 12px;
}

.m60-policy-block summary {
  cursor: pointer;
  list-style: none;
  font-size: 15px;
  font-weight: 700;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.m60-policy-block summary::-webkit-details-marker {
  display: none;
}

.m60-policy-block summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 600;
  color: #c90012;
  line-height: 1;
}

.m60-policy-block[open] summary::after {
  content: "−";
}

.m60-policy-content {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.8;
  color: #555;
}

.m60-policy-content p {
  margin: 0 0 8px;
}

.m60-policy-content ul {
  margin: 0;
  padding-left: 1.2em;
}

.m60-policy-content li {
  margin: 6px 0;
}


@media (max-width: 720px) {
  :root { --topbar-h: 74px; --input-h: 126px; }
  .m60-topbar { padding: 0 18px; }
  .m60-topbar__brand { font-size: 16px; }
  .m60-member-label { display: none; }
  .m60-logout-btn { height: 32px; padding: 0 12px; }
  .m60-chat-list { padding: calc(var(--topbar-h) + 58px) 20px 48px; }
  .m60-msg.ai .m60-bubble { font-size: 16px; padding-left: 18px; }
  .m60-msg.user .m60-bubble { font-size: 15px; max-width: 88%; }
  .m60-input-dock { padding: 24px 16px 18px; }
  .m60-input-plate { border-radius: 18px; }
  .m60-input-hint { font-size: 9px; }
}
