:root {
  color-scheme: light;
  --bg: #f5fafc;
  --bg-soft: #eef8fb;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --text: #1f2a37;
  --muted: #6b7a8c;
  --line: #dce9ef;
  --line-strong: #c8dce5;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-soft: #e8f1ff;
  --mint: #16b8a6;
  --mint-soft: #e5fbf6;
  --danger: #e15b64;
  --shadow: 0 18px 50px rgba(31, 68, 90, 0.12);
  --shadow-soft: 0 8px 26px rgba(31, 68, 90, 0.08);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(59, 130, 246, 0.12), transparent 28rem),
    radial-gradient(circle at 85% 25%, rgba(22, 184, 166, 0.13), transparent 26rem),
    linear-gradient(135deg, #f7fbff 0%, #f4fbf8 54%, #f7fafc 100%);
}
button, textarea { font: inherit; }
button { cursor: pointer; }

.sidebar {
  position: fixed;
  inset: 14px auto 14px 14px;
  width: 292px;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  border: 1px solid rgba(203, 223, 231, 0.85);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
}
.brand span {
  display: block;
  color: #175078;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.brand-mark, .hero-icon {
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #18b9a7);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.24);
  font-weight: 900;
}
.brand-mark { width: 38px; height: 38px; }
.hero-icon {
  width: 58px;
  height: 58px;
  margin: auto;
  border-radius: 22px;
  font-size: 25px;
}

.new-session {
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 12px 15px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #20b8a6);
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.22);
  text-align: left;
  font-weight: 700;
}
.new-session:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(59, 130, 246, 0.28);
}

.sidebar-heading {
  padding: 24px 10px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.session-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
}
.session {
  display: flex;
  gap: 4px;
  align-items: center;
  margin: 5px 0;
  border: 1px solid transparent;
  border-radius: 16px;
  color: #486174;
  transition: 0.18s ease;
}
.session:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
}
.session.active {
  background: #ffffff;
  border-color: #cce4ef;
  color: #174c73;
  box-shadow: var(--shadow-soft);
}
.session-title {
  flex: 1;
  overflow: hidden;
  border: 0;
  padding: 11px 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.delete-session {
  border: 0;
  width: 30px;
  height: 30px;
  margin-right: 6px;
  border-radius: 10px;
  color: #91a1ad;
  background: transparent;
  opacity: 0;
}
.session:hover .delete-session { opacity: 1; }
.delete-session:hover {
  color: #fff;
  background: var(--danger);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 14px 10px 4px;
  border-top: 1px solid var(--line);
}
.sidebar-footer strong {
  color: #28526b;
  font-size: 13px;
}
.sidebar-footer small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #15c08d;
  box-shadow: 0 0 0 6px rgba(21, 192, 141, 0.14);
}

.main {
  min-height: 100vh;
  margin-left: 320px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 34px 16px;
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.92), rgba(247, 251, 255, 0.72));
  backdrop-filter: blur(14px);
}
.topbar strong {
  color: #17324a;
  font-size: 17px;
}
.topbar span {
  margin-left: 12px;
  color: var(--muted);
  font-size: 13px;
}
.topbar-link {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 14px;
  color: #246895;
  background: rgba(255, 255, 255, 0.68);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.topbar-link:hover {
  border-color: #9fd5df;
  color: #0f7c75;
  background: #fff;
}

.empty-state {
  max-width: 800px;
  margin: 0 auto;
  padding: 19vh 26px 220px;
  text-align: center;
}
.eyebrow {
  margin: 18px 0 8px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.empty-state h1 {
  margin: 0 0 12px;
  color: #16344c;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.16;
  letter-spacing: -0.04em;
}
.empty-state p {
  max-width: 640px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.75;
}
.quick-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.quick-actions button {
  border: 1px solid #cfe4ec;
  border-radius: 999px;
  padding: 10px 16px;
  color: #246895;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  font-weight: 700;
}
.quick-actions button:hover {
  transform: translateY(-1px);
  border-color: #98d8db;
  color: #0d8276;
  background: #fff;
}

.messages {
  max-width: 920px;
  margin: 0 auto;
  padding: 36px 28px 230px;
}
.hidden { display: none; }
.message {
  display: flex;
  margin: 0 0 18px;
}
.message.user { justify-content: flex-end; }
.bubble {
  max-width: 84%;
  border-radius: 22px;
  padding: 13px 17px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}
.user .bubble {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #18a999);
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.18);
}
.assistant .bubble {
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(214, 231, 239, 0.8);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  color: #24384b;
}
.assistant .bubble a {
  color: #2563eb;
  font-weight: 700;
}
.assistant .bubble > :first-child { margin-top: 0; }
.assistant .bubble > :last-child { margin-bottom: 0; }
.assistant .bubble h1,
.assistant .bubble h2,
.assistant .bubble h3 {
  margin: 15px 0 8px;
  color: #17324a;
  line-height: 1.3;
}
.assistant .bubble h1 { font-size: 22px; }
.assistant .bubble h2 {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}
.assistant .bubble h3 { font-size: 16px; }
.assistant .bubble p { margin: 6px 0 9px; }
.assistant .bubble ul,
.assistant .bubble ol {
  margin: 6px 0 10px;
  padding-left: 22px;
}
.assistant .bubble li { margin: 3px 0; }
.assistant .bubble strong { color: #122b42; }
.assistant .bubble hr {
  height: 1px;
  margin: 14px 0;
  border: 0;
  background: var(--line);
}
.assistant .bubble blockquote {
  margin: 10px 0;
  padding: 9px 12px;
  border-left: 4px solid var(--mint);
  border-radius: 0 12px 12px 0;
  color: #496174;
  background: var(--mint-soft);
}
.assistant .bubble table {
  display: block;
  width: 100%;
  margin: 10px 0 14px;
  overflow-x: auto;
  border-collapse: collapse;
  border-spacing: 0;
}
.assistant .bubble th,
.assistant .bubble td {
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid #d7e7ef;
  text-align: left;
  vertical-align: top;
}
.assistant .bubble th {
  color: #17324a;
  background: #edf7fb;
}
.assistant .bubble tr:nth-child(even) td { background: #f7fbfd; }
.assistant .bubble code {
  border-radius: 7px;
  padding: 2px 6px;
  color: #1d5db7;
  background: var(--primary-soft);
}
.assistant .bubble pre {
  overflow-x: auto;
  border: 1px solid #d7e7ef;
  border-radius: 14px;
  padding: 12px;
  background: #f7fbfd;
}
.assistant .bubble pre code {
  padding: 0;
  background: transparent;
}

.composer-wrap {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 320px;
  padding: 24px 24px 14px;
  background: linear-gradient(180deg, rgba(245, 250, 252, 0), rgba(245, 250, 252, 0.96) 28%, #f5fafc);
}
.active-resume {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 880px;
  margin: 0 auto 9px;
  padding: 9px 13px;
  border: 1px solid #bee7e1;
  border-radius: 16px;
  color: #14756d;
  background: rgba(229, 251, 246, 0.9);
  font-size: 13px;
}
.active-resume.hidden { display: none; }
.active-resume strong { color: #0d615c; }
.active-resume button {
  border: 0;
  color: #0f766e;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.active-resume button:hover { color: #0b4e49; }

.composer {
  max-width: 880px;
  margin: auto;
  border: 1px solid #cddfea;
  border-radius: 28px;
  padding: 16px 17px 11px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.composer:focus-within {
  border-color: #91d7df;
  box-shadow: 0 18px 54px rgba(31, 68, 90, 0.16), 0 0 0 4px rgba(22, 184, 166, 0.10);
}
.composer.dragging {
  border-color: var(--mint);
  background: #f1fffb;
  box-shadow: 0 0 0 4px rgba(22, 184, 166, 0.14), var(--shadow);
}
.composer.uploading {
  opacity: 0.68;
  pointer-events: none;
}
textarea {
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  line-height: 1.55;
}
textarea::placeholder { color: #97a8b4; }
.composer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  color: #7b8a98;
  font-size: 12px;
}
.composer-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.composer-tool {
  border: 1px solid #cce5ef;
  border-radius: 999px;
  padding: 7px 11px;
  color: #226b91;
  background: #eef8ff;
  font-size: 12px;
  font-weight: 700;
}
.composer-tool:hover {
  border-color: #9ed8e8;
  color: #0f766e;
  background: #f3fffc;
}
.send-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #18a999);
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.24);
  font-size: 22px;
  font-weight: 800;
}
.send-button:hover { transform: translateY(-1px); }
.send-button:disabled {
  opacity: 0.45;
  cursor: wait;
  transform: none;
}
.notice {
  margin: 10px auto 0;
  color: #7f8f9c;
  font-size: 12px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 440px;
  border: 1px solid #cfe3ec;
  border-radius: 16px;
  padding: 13px 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: #294052;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
  pointer-events: none;
  white-space: pre-wrap;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(19, 44, 60, 0.28);
  backdrop-filter: blur(10px);
}
.modal.hidden { display: none; }
.modal-card {
  width: min(640px, 100%);
  border: 1px solid #d5e7ee;
  border-radius: 24px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px;
}
.modal-header h2 {
  margin: 0 0 5px;
  color: #17324a;
  font-size: 21px;
}
.modal-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.modal-close {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #7b8c9a;
  background: #f1f7fa;
  font-size: 24px;
  line-height: 1;
}
.modal-close:hover {
  color: #17324a;
  background: #e8f3f7;
}
.dropzone {
  display: grid;
  place-items: center;
  min-height: 176px;
  border: 1.5px dashed #9ecfdc;
  border-radius: 20px;
  padding: 24px;
  color: #217391;
  background: linear-gradient(135deg, #f3fbff, #f1fffb);
  text-align: center;
  transition: 0.18s ease;
}
.dropzone:hover,
.dropzone.dragging {
  border-color: var(--mint);
  background: #effffc;
  transform: translateY(-1px);
}
.dropzone.uploading {
  opacity: 0.6;
  pointer-events: none;
}
.dropzone input { display: none; }
.dropzone strong { font-size: 16px; }
.dropzone span {
  margin-top: 8px;
  color: #315e74;
}
.dropzone small {
  margin-top: 12px;
  color: #7f8f9c;
}
.resume-list-wrap {
  margin-top: 18px;
  color: #30465a;
}
.resume-list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  margin-top: 10px;
  overflow-y: auto;
  color: #7a8a98;
  font-size: 13px;
}
.resume-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid #e2edf2;
  border-radius: 14px;
  padding: 9px 10px;
  color: #30465a;
  background: #ffffff;
}
.resume-item.active {
  border-color: #a9dfda;
  background: #f0fffb;
}
.resume-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resume-actions {
  display: flex;
  gap: 7px;
}
.resume-actions button {
  border: 0;
  border-radius: 10px;
  padding: 6px 9px;
  color: #1c6b91;
  background: #eef8ff;
  font-size: 12px;
  font-weight: 700;
}
.resume-actions button:hover { background: #e1f2fb; }
.resume-actions button:disabled {
  color: #7b948f;
  background: #e5fbf6;
  cursor: default;
}
.resume-actions .danger {
  color: #c2414b;
  background: #fff0f1;
}
.resume-actions .danger:hover {
  color: #fff;
  background: var(--danger);
}

@media (max-width: 820px) {
  .sidebar {
    inset: 10px auto 10px 10px;
    width: 78px;
    padding: 14px 8px;
    border-radius: 24px;
  }
  .brand { justify-content: center; padding: 4px 0 16px; }
  .brand div:not(.brand-mark),
  .sidebar-heading,
  .session-title,
  .sidebar-footer div:not(.status-dot) {
    display: none;
  }
  .new-session {
    width: 52px;
    overflow: hidden;
    padding: 12px;
    text-align: center;
    white-space: nowrap;
  }
  .delete-session { opacity: 1; }
  .main { margin-left: 96px; }
  .composer-wrap { left: 96px; }
  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }
  .topbar span { display: none; }
  .messages { padding-left: 16px; padding-right: 16px; }
  .bubble { max-width: 92%; }
  .composer-tools span { display: none; }
}
.invisible-admin-link {
  opacity: 0;
}
