body {
  margin: 0;
  background: #eef0f4;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: #172033;
}
.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  width: min(1400px, 96vw);
  height: 94vh;
  margin: 3vh auto;
}
.history,
.main {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  padding: 18px;
  overflow: auto;
}
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  align-items: end;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}
.filters select,
.filters input {
  width: 100%;
  height: 36px;
  border: 1px solid #ccd4df;
  border-radius: 8px;
  box-sizing: border-box;
}
.filters .filter-span-2 {
  grid-column: span 2;
}
.filters .filter-span-full {
  grid-column: 1 / -1;
}
.messages {
  height: 55vh;
  background: #eef3ff;
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
}
.bubble {
  max-width: 88%;
  margin: 10px 0;
  padding: 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 14px;
}
.user {
  margin-left: auto;
  background: #4868ed;
  color: #fff;
}
.assistant {
  background: #fff;
}
.composer {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 10px;
  margin-top: 12px;
}
.composer textarea {
  min-height: 90px;
  border: 1px solid #ccd4df;
  border-radius: 12px;
  padding: 12px;
}
.composer button,
.manual button {
  border: 0;
  border-radius: 10px;
  background: #4868ed;
  color: #fff;
  padding: 10px 16px;
  margin: 4px;
  cursor: pointer;
}
.composer button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.manual button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hidden {
  display: none;
}
.eval-line {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #eee;
  padding: 8px 0;
}
.eval-line span {
  width: 220px;
  font-weight: 700;
}

.account-menu-btn {
  position: fixed;
  top: 18px;
  right: 24px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: block;
}
.account-icon:before {
  content: "";
  position: absolute;
  top: 2px;
  left: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
}
.account-icon:after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 3px;
  width: 18px;
  height: 10px;
  border-radius: 12px 12px 6px 6px;
  background: #64748b;
}
.account-menu {
  position: fixed;
  top: 76px;
  right: 18px;
  width: 220px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  padding: 12px;
  z-index: 49;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-menu button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: #eef3ff;
  color: #172033;
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}
.account-menu button:hover {
  background: #dfe8ff;
}
.account-menu button#logoutBtn {
  background: #4868ed;
  color: #fff;
}
.history #sessions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.session-btn {
  width: 100%;
  border: 1px solid #d5ddeb;
  border-radius: 12px;
  background: #f8fbff;
  color: #172033;
  text-align: left;
  padding: 12px;
  line-height: 1.4;
  font-weight: 700;
  white-space: pre-wrap;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(72, 104, 237, 0.08);
}
.session-btn:hover {
  border-color: #4868ed;
  background: #eef3ff;
}
.eval-question {
  border-bottom: 1px solid #e8edf5;
  padding: 14px 0;
}
.eval-question p {
  margin: 0 0 10px;
  font-weight: 700;
}
.manual h3 span,
.eval-description {
  color: #64748b;
  font-size: 14px;
  font-weight: 400;
}
.eval-description {
  margin: 0 0 10px;
}
.feedback-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.manual .feedback-options button {
  background: #f8fbff;
  border: 1px solid #ccd4df;
  color: #172033;
  margin: 0;
}
.manual .feedback-options button.selected {
  background: #4868ed;
  border-color: #4868ed;
  color: #fff;
}
.feedback-detail label,
.eval-question > label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
  white-space: pre-line;
}
.eval-question label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 24px;
}
.term-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.term-input-row input {
  flex: 1;
  min-height: 38px;
  border: 1px solid #ccd4df;
  border-radius: 10px;
  padding: 0 10px;
}
.term-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.term-list span {
  background: #eef3ff;
  border: 1px solid #d5ddeb;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
}
.star-rating {
  display: flex;
  gap: 6px;
}
.star-rating button {
  background: transparent !important;
  color: #f59e0b !important;
  border: 0 !important;
  padding: 2px !important;
  margin: 0 !important;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.eval-question textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid #ccd4df;
  border-radius: 12px;
  padding: 10px;
  box-sizing: border-box;
}
.auth-bar {
  display: none;
}

.account-menu.hidden {
  display: none !important;
}
.mfa-setup {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.5);
  padding: 20px;
}
.mfa-setup.hidden {
  display: none;
}
.mfa-setup-panel {
  position: relative;
  width: min(480px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.mfa-setup-panel h2 {
  margin-top: 0;
}
.mfa-setup-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
}
.mfa-setup-panel input {
  height: 38px;
  border: 1px solid #ccd4df;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 18px;
  letter-spacing: 0.2em;
}
.mfa-setup-panel button:not(.mfa-setup-close) {
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  background: #4868ed;
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
.mfa-setup-close {
  position: absolute;
  right: 12px;
  top: 8px;
  border: 0;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
}
.mfa-setup-qr {
  display: block;
  width: 240px;
  height: 240px;
  margin: 16px auto;
}
.mfa-setup-qr.hidden {
  display: none;
}
.mfa-setup-panel code {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.mfa-setup-message {
  min-height: 1.5em;
  color: #b42318;
}

.threads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.threads-head h3 {
  margin: 0;
  font-size: 18px;
}
.new-thread-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #d5ddeb;
  border-radius: 50%;
  background: #f8fbff;
  color: #4868ed;
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(72, 104, 237, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.new-thread-btn:hover {
  border-color: #4868ed;
  background: #eef3ff;
}
.new-thread-btn:active {
  transform: translateY(1px);
}
