body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #f7f9fc 0%, #eef4ff 100%);
  color: #223043;
}

.home-shell {
  align-items: stretch;
  height: calc(100vh - 52px);
}

#app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  /* 布局由 #app 统一 flex-direction=column */
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  position: relative;
}

.new-msg-hint {
  position: sticky;
  bottom: 12px;
  align-self: center;
  z-index: 10;
  background: #4f8cff;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 140, 255, 0.35);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
}

.new-msg-hint:hover {
  background: #3f76dc;
}

.message-row {
  display: flex;
}

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

.assistant-row {
  justify-content: flex-start;
}

.message-card {
  max-width: 80%;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f3f7ff;
  border: 1px solid #e1ebff;
  white-space: pre-wrap;
}

.user-row .message-card {
  background: #e9f7ee;
  border-color: #ccebd8;
}

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  min-height: 80px;
  resize: vertical;
}

.composer button {
  min-width: 90px;
  height: 44px;
}

.page-shell {
  min-height: 0;
  display: flex;
  padding: 0;
  box-sizing: border-box;
}

.page-shell:not(.home-shell) {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.page-shell .card {
  min-height: 0;
  height: auto;
}



/* card.wide-card 组合：.page-shell .card 优先级更高，此处补回 min-height:100vh */
.page-shell .card.wide-card {
  flex: 1;
  min-height: 0;
}

.page-shell.home-shell {
  align-items: stretch;
  justify-content: center;
}

.page-shell.home-shell .card {
  min-height: 0;
  height: auto;
}

.card {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(34, 48, 67, 0.12);
  padding: 28px;
  box-sizing: border-box;
}

.wide-card {
  max-width: 1400px;
  min-width: 480px;
  flex: 1;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

h1 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}

.subtitle {
  margin: 0 0 4px;
  color: #617086;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

input, textarea, button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid #d8e0ea;
  padding: 10px 12px;
  box-sizing: border-box;
}

input:focus, textarea:focus {
  outline: none;
  border-color: #4f8cff;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.16);
}

button, .link-button {
  background: #4f8cff;
  color: white;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
}

button:hover, .link-button:hover {
  background: #3f76dc;
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e1ebff;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 12px 0 8px;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.edit-panel {
  margin-top: 0;
  padding: 14px;
  border: 1px solid #dce7f3;
  border-radius: 12px;
  background: #f9fbff;
}

.edit-row td {
  padding: 0;
  border-top: none;
}

.edit-row .edit-panel {
  margin: 8px;
}

.small-link {
  padding: 7px 10px;
  font-size: 13px;
}

.edit-toggle.active {
  background: #2f855a;
}

.secondary-link {
  background: #6b778d;
}

.secondary-link:hover {
  background: #556173;
}

.danger-button {
  background: #d9534f;
}

.danger-button:hover {
  background: #c9302c;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

th, td {
  border: 1px solid #e3eaf3;
  padding: 10px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
}

th {
  background: #f5f8ff;
}

tr:nth-child(even) td {
  background: #fbfdff;
}

@media (max-width: 768px) {
  body {
    background: #f7f9fc;
  }

  .page-shell.home-shell {
    height: calc(100dvh - 52px);
  }
  .page-shell {
    min-height: 0;
    padding: 0;
    align-items: stretch;
  }
  .page-shell:not(.home-shell) {
    min-height: 100dvh;
  }

  .card {
    max-width: none;
    width: 100%;
    border-radius: 0;
    padding: 6px;
    box-shadow: none;
    min-height: 100dvh;
  }

  .wide-card {
    max-width: none;
    min-width: 0;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 4px;
    gap: 2px;
  }

  h1 {
    font-size: 18px;
    margin-bottom: 0;
  }

  .subtitle {
    margin-bottom: 2px;
    font-size: 11px;
  }

  .composer {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }

  .composer textarea {
    min-height: 52px;
    padding: 7px 8px;
  }

  .composer button {
    width: 100%;
    height: 36px;
    padding: 0 10px;
  }

  .message-card {
    max-width: 100%;
    padding: 7px 9px;
    border-radius: 8px;
  }

  .message-list {
    gap: 5px;
  }

  .stack {
    gap: 5px;
  }

  .edit-panel {
    padding: 6px;
  }

  th, td {
    padding: 5px;
    font-size: 11px;
  }
}
/* ── 用户菜单 ── */
[v-cloak] { display: none; }

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(79, 140, 255, 0.1);
    border: 1px solid rgba(79, 140, 255, 0.25);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #223043;
    transition: background 0.2s;
}

.user-menu-btn:hover {
    background: rgba(79, 140, 255, 0.18);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid #dce7f3;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(34, 48, 67, 0.14);
    overflow: hidden;
    z-index: 100;
}

.dropdown-item {
    display: block;
    padding: 10px 14px;
    font-size: 14px;
    color: #223043;
    text-decoration: none;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #f0f5ff;
}

.danger-item {
    color: #d9534f;
}

.danger-item:hover {
    background: #fff5f5;
}


/* ???? ????????? ???? */
.pwd-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.pwd-modal {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(34, 48, 67, 0.2);
    width: 380px;
    max-width: 90vw;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.pwd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e1ebff;
    background: #f5f8ff;
}

.pwd-modal-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #223043;
}

.pwd-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #617086;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.pwd-modal-close:hover {
    color: #d9534f;
}

.pwd-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pwd-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pwd-form-group label {
    font-weight: 600;
    font-size: 13px;
    color: #223043;
}

.pwd-msg {
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 8px;
}

.pwd-msg-success {
    background: #e9f7ee;
    color: #2f855a;
    border: 1px solid #ccebd8;
}

.pwd-msg-error {
    background: #fff5f5;
    color: #d9534f;
    border: 1px solid #f5cccc;
}

.pwd-submit-btn {
    background: #4f8cff;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

.pwd-submit-btn:hover {
    background: #3f76dc;
}

.pwd-submit-btn:disabled {
    background: #a8c4ff;
    cursor: not-allowed;
}
/* ── 统一导航栏 ── */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 500;
    background: #ffffff;
    border-bottom: 1px solid #e1ebff;
    box-shadow: 0 1px 4px rgba(34, 48, 67, 0.06);
    transition: box-shadow 0.2s;
}

.top-nav.nav-logged-in {
    box-shadow: 0 2px 8px rgba(79, 140, 255, 0.12);
}

.nav-inner {
    max-width: none;
    margin: 0;
    padding: 0 16px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 17px;
    font-weight: 700;
    color: #4f8cff;
    text-decoration: none;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-brand:hover {
    color: #3a7af0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-login-btn {
    background: #4f8cff;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.nav-login-btn:hover {
    background: #3a7af0;
}

/* 未登录时主内容区缩小 */
.home-shell-guest .card.wide-card {
    max-width: 480px;
    margin-top: 0;
    align-self: center;
    flex: none;
}

/* ── 登录弹窗 ── */
.login-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

.login-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(34, 48, 67, 0.2);
    width: 380px;
    max-width: 90vw;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.login-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e1ebff;
    background: #f5f8ff;
}

.login-modal-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #223043;
}

.login-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #617086;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.login-modal-close:hover {
    color: #d9534f;
}

.login-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-error {
    font-size: 13px;
    color: #d9534f;
    background: #fff5f5;
    border: 1px solid #f5cccc;
    border-radius: 8px;
    padding: 8px 10px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-weight: 600;
    font-size: 13px;
    color: #223043;
}

.login-field input {
    padding: 10px 12px;
    border: 1px solid #dce7f3;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.login-field input:focus {
    border-color: #4f8cff;
}

.login-submit {
    background: #4f8cff;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.15s;
}

.login-submit:hover {
    background: #3a7af0;
}

.login-submit:disabled {
    background: #a8c4ff;
    cursor: not-allowed;
}


/* 全局 Toast 提示 */
.app-toast {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 6px 20px rgba(34, 48, 67, 0.18);
    animation: toastIn 0.25s ease;
    white-space: nowrap;
}
.app-toast-success {
    background: #1a9c4a;
}
.app-toast-error {
    background: #d9534f;
}
@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
