/* Professional counselor workbench UI. Loaded after the legacy base styles. */
:root {
  --wb-ink: #18211d;
  --wb-muted: #65706a;
  --wb-subtle: #89928d;
  --wb-line: #e0e6e2;
  --wb-line-strong: #cbd5cf;
  --wb-paper: #ffffff;
  --wb-sidebar: #f4f7f5;
  --wb-panel: #f8faf9;
  --wb-hover: #edf2ef;
  --wb-green: #21694f;
  --wb-green-hover: #19563f;
  --wb-green-soft: #e2eee8;
  --wb-blue: #315f86;
  --wb-blue-soft: #e5edf4;
  --wb-amber: #8a5b12;
  --wb-amber-soft: #f7ead0;
  --wb-red: #9b3838;
  --wb-red-soft: #f6e1e1;
}

body {
  background: var(--wb-paper);
  color: var(--wb-ink);
}

button,
input,
textarea {
  letter-spacing: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(33, 105, 79, .28);
  outline-offset: 2px;
}

.app {
  grid-template-columns: 236px minmax(0, 1fr) 316px;
  background: var(--wb-paper);
}

/* Sidebar */
.sidebar {
  background: var(--wb-sidebar);
  border-right: 1px solid var(--wb-line);
}

.sidebar-top {
  padding: 15px 14px 14px;
  border-bottom: 1px solid var(--wb-line);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.sidebar-brand img {
  width: 32px;
  height: 32px;
  border: 1px solid var(--wb-line-strong);
  border-radius: 50%;
  flex: 0 0 auto;
}

.sidebar-brand-title {
  color: var(--wb-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.sidebar-brand-sub {
  color: var(--wb-muted);
  font-size: 13px;
  line-height: 1.25;
  margin-top: 2px;
}

.btn-new {
  height: 38px;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--wb-green);
  border-radius: 6px;
  background: var(--wb-green);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
}

.btn-new:hover {
  background: var(--wb-green-hover);
  border-color: var(--wb-green-hover);
}

.section-title {
  padding: 14px 14px 7px;
  color: var(--wb-subtle);
  font-size: 13px;
  font-weight: 650;
}

.history-list {
  padding: 0 8px 12px;
}

.history-item {
  min-height: 38px;
  margin: 2px 0;
  padding: 9px 10px;
  border-radius: 5px;
  color: var(--wb-muted);
}

.history-item::after {
  content: none;
}

.history-item:hover {
  background: var(--wb-hover);
  color: var(--wb-ink);
}

.history-item.active {
  background: var(--wb-green-soft);
  color: var(--wb-ink);
  box-shadow: inset 3px 0 var(--wb-green);
}

.history-item .title {
  font-size: 14px;
  font-weight: 550;
}

.history-item .actions {
  gap: 1px;
}

.history-item:hover .actions,
.history-item:focus-within .actions {
  opacity: .65;
}

.history-item .actions span {
  padding: 2px 4px;
}

.sidebar-bottom {
  padding: 11px 12px 14px;
  border-top: 1px solid var(--wb-line);
}

.sidebar-user {
  min-height: 38px;
  padding: 6px 8px;
  border-radius: 5px;
  color: var(--wb-muted);
}

.sidebar-user:hover {
  background: var(--wb-hover);
}

.sidebar-user .avatar {
  width: 28px;
  height: 28px;
  background: var(--wb-green-soft);
  color: var(--wb-green);
  font-weight: 700;
}

.logout-btn {
  margin-top: 3px;
  padding: 7px 8px;
  border-radius: 5px;
  color: var(--wb-subtle);
  font-size: 13px;
}

.logout-btn:hover {
  background: var(--wb-hover);
  color: var(--wb-red);
}

/* Main work area */
.main {
  min-width: 0;
  background: var(--wb-paper);
}

.topbar {
  height: 58px;
  min-height: 58px;
  padding: 0 22px;
  gap: 12px;
  border-bottom: 1px solid var(--wb-line);
  background: #fff;
}

.topbar-copy {
  flex: 1;
  min-width: 0;
}

.topbar-title {
  display: block;
  overflow: hidden;
  color: var(--wb-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-toggle,
.summary-toggle,
.menu-toggle {
  display: none;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 18px;
}

.summary-toggle {
  display: none;
  min-width: 64px;
  height: 32px;
  gap: 5px;
  padding: 0 9px;
  border-color: var(--wb-line);
  background: var(--wb-panel);
  font-size: 13px;
}

.menu-toggle:hover,
.summary-toggle:hover {
  border-color: var(--wb-line);
  background: var(--wb-hover);
  color: var(--wb-ink);
}

.messages {
  background: #fff;
}

/* Welcome and mode introduction */
.welcome {
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  max-width: 820px;
  min-height: auto;
  margin: 0 auto;
  padding: 34px 28px 28px;
  text-align: left;
}

.welcome-kicker {
  margin-bottom: 5px;
  color: var(--wb-green);
  font-size: 13px;
  font-weight: 700;
}

.welcome h1 {
  margin-bottom: 3px;
  color: var(--wb-ink);
  font-size: 21px;
  font-weight: 750;
  line-height: 1.3;
}

.welcome .sub {
  margin-bottom: 20px;
  color: var(--wb-muted);
  font-size: 13px;
}

.welcome-intro {
  width: 100%;
  max-width: 640px;
}

.welcome-intro-lead {
  margin-bottom: 12px;
  color: var(--wb-ink);
  font-size: 14px;
  font-weight: 700;
}

.welcome-mode {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--wb-line);
  border-radius: 6px;
  background: #fff;
}

.welcome-mode-title {
  margin-bottom: 6px;
  color: var(--wb-ink);
  font-size: 14px;
  font-weight: 700;
}

.welcome-mode p {
  margin-bottom: 6px;
  color: var(--wb-muted);
  font-size: 13px;
  line-height: 1.6;
}

.welcome-mode p:last-child {
  margin-bottom: 0;
}

.welcome-example {
  font-style: italic;
  color: var(--wb-subtle);
}

.welcome-switch-hint {
  margin: 10px 0 6px;
  color: var(--wb-ink);
  font-size: 13px;
}

.welcome-privacy {
  color: var(--wb-subtle);
  font-size: 12px;
  line-height: 1.5;
}

/* Conversation document flow */
.msg {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--wb-line);
}

.msg.user {
  margin: 0;
  padding: 0;
  background: #f7f9f8;
}

.msg-group,
.msg.user .msg-group-inner {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 24px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.msg:not(.user) .msg-group,
.msg.user .msg-group-inner {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.msg-label {
  margin-bottom: 7px;
  color: var(--wb-subtle);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.msg-content {
  color: var(--wb-ink);
  font-size: 16px;
  line-height: 1.72;
}

.msg-content h1,
.msg-content h2,
.msg-content h3,
.msg-content h4,
.msg-content h5 {
  color: var(--wb-ink);
}

.msg-content h2 {
  font-size: 16px;
  border-bottom-color: var(--wb-line);
}

.msg-content h3 {
  font-size: 16px;
}

.msg-content h4,
.msg-content h5 {
  color: var(--wb-muted);
  font-size: 14px;
}

.msg-content code,
.msg-content pre {
  background: #f3f6f4;
}

.msg-content blockquote {
  border-left-color: var(--wb-green);
  color: var(--wb-muted);
}

.typing-dots span {
  background: var(--wb-green);
}

.cursor {
  background: var(--wb-green);
}

.error-box {
  border-color: #e9c2c2;
  border-radius: 6px;
  background: var(--wb-red-soft);
  color: var(--wb-red);
}

.retry-btn {
  border-radius: 5px;
  background: var(--wb-red);
}

/* Composer */
.composer-wrap {
  flex: 0 0 auto;
  padding: 12px 24px 10px;
  border-top: 1px solid var(--wb-line);
  background: #fff;
}

.composer {
  width: 100%;
  max-width: 820px;
  min-height: 52px;
  margin: 0 auto;
  padding: 6px 7px 6px 14px;
  border: 1px solid var(--wb-line-strong);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(24, 33, 29, .05);
}

.composer:focus-within {
  border-color: var(--wb-green);
  box-shadow: 0 0 0 3px rgba(33, 105, 79, .10);
}

.composer textarea {
  min-width: 0;
  min-height: 38px;
  max-height: 180px;
  overflow-y: hidden;
  padding: 8px 0;
  color: var(--wb-ink);
  font-size: 16px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: var(--wb-subtle);
}

.composer .send-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--wb-green);
  font-size: 16px;
}

.composer .send-btn:hover:not(:disabled) {
  background: var(--wb-green-hover);
}

.composer .send-btn:disabled {
  background: var(--wb-line-strong);
}

.composer-footer {
  display: block;
  max-width: 820px;
  margin: 6px auto 0;
  color: var(--wb-subtle);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.status-pill {
  padding: 5px 7px;
  border: 1px solid var(--wb-line);
  border-radius: 4px;
  background: #fff;
  color: var(--wb-muted);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.status-pill.ok {
  border-color: #bfd6c9;
  background: var(--wb-green-soft);
  color: var(--wb-green);
}

.status-pill.warn {
  border-color: #ead4a6;
  background: var(--wb-amber-soft);
  color: var(--wb-amber);
}

.status-pill.danger {
  border-color: #e8c2c2;
  background: var(--wb-red-soft);
  color: var(--wb-red);
}

.panel-block {
  padding: 17px 0 18px;
  border: 0;
  border-bottom: 1px solid var(--wb-line);
  border-radius: 0;
  background: transparent;
}

.panel-block:last-child {
  border-bottom: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--wb-ink);
  font-size: 13px;
  font-weight: 750;
}

.assistant-summary {
  color: var(--wb-ink);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.65;
}

.insight-list {
  display: grid;
  gap: 8px;
}

.insight-item {
  position: relative;
  padding: 0 0 0 14px;
  border: 0;
  color: var(--wb-muted);
  font-size: 13px;
  line-height: 1.55;
}

.insight-item::before {
  content: "";
  position: absolute;
  top: .6em;
  left: 1px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8db3a2;
}

/* Authentication modal */
.auth-overlay {
  background: rgba(24, 33, 29, .42);
  backdrop-filter: blur(3px);
}

.auth-card {
  max-width: 380px;
  padding: 28px;
  border: 1px solid var(--wb-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(24, 33, 29, .18);
}

.auth-card .logo {
  width: 48px;
  height: 48px;
  margin-bottom: 13px;
  border: 1px solid var(--wb-line);
}

.auth-card h1 {
  color: var(--wb-ink);
  font-size: 20px;
}

.auth-tabs {
  border-bottom-color: var(--wb-line);
}

.auth-tab.active {
  border-bottom-color: var(--wb-green);
  color: var(--wb-green);
}

.auth-field input {
  border-color: var(--wb-line-strong);
  border-radius: 6px;
}

.auth-field input:focus {
  border-color: var(--wb-green);
}

.auth-btn {
  border-radius: 6px;
  background: var(--wb-green);
}

.auth-btn:hover {
  background: var(--wb-green-hover);
}

.auth-close {
  color: var(--wb-muted);
}

.overlay {
  background: rgba(24, 33, 29, .34);
  backdrop-filter: blur(1px);
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: #c8cfcb;
}

::-webkit-scrollbar-thumb:hover {
  background: #aeb8b2;
}

/* Tablet: keep history visible, move insight into a drawer. */
@media (max-width: 1180px) {
  .app {
    grid-template-columns: 228px minmax(0, 1fr);
  }

  .summary-toggle {
    display: inline-flex;
  }
}

/* Phone */
@media (max-width: 768px) {
  html,
  body {
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }

  .app {
    grid-template-columns: 1fr;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    z-index: 120;
    top: 0;
    bottom: 0;
    left: 0;
    width: 84%;
    max-width: 300px;
    box-shadow: 12px 0 32px rgba(24, 33, 29, .14);
    transform: translateX(-102%);
    transition: transform .2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main,
  .messages,
  .welcome,
  .composer-wrap {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  .topbar {
    height: 54px;
    min-height: 54px;
    padding: 0 10px;
    gap: 8px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar-title {
    font-size: 14px;
  }

  .summary-toggle {
    min-width: 52px;
    height: 32px;
    padding: 0 8px;
  }

  .welcome {
    padding: 24px 14px 18px;
  }

  .welcome-kicker {
    font-size: 12px;
  }

  .welcome h1 {
    font-size: 19px;
  }

  .welcome .sub {
    margin-bottom: 16px;
  }

  .welcome-mode p {
    font-size: 12px;
    line-height: 1.55;
  }

  .msg-group,
  .msg.user .msg-group-inner {
    padding: 15px 14px 17px;
  }

  .msg-content {
    font-size: 14px;
    line-height: 1.68;
  }

  .composer-wrap {
    padding: 9px 10px 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .composer {
    min-height: 48px;
    padding: 5px 6px 5px 11px;
  }

  .composer textarea {
    min-height: 34px;
    max-height: 112px;
    padding: 7px 0;
    font-size: 14px;
  }

  .composer .send-btn {
    width: 34px;
    height: 34px;
  }

  .composer-footer {
    display: none;
  }

  .overlay.show {
    z-index: 110;
  }
}

@media (max-width: 380px) {
  .summary-toggle {
    min-width: 34px;
    width: 34px;
    padding: 0;
    font-size: 13px;
  }
}

/* 备案整改所需的用户可见入口与输出来源信息。 */
.upload-pop { position: fixed; z-index: 2200; left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: 380px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); overflow-y: auto; padding: 20px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35), 0 12px 40px rgba(0,0,0,.2); }
.upload-pop .upload-pop-title { font-size: 16px; }
.upload-pop p { font-size: 14px; line-height: 1.8; }
.compliance-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; padding: 5px 8px; }
.compliance-links button, .compliance-links a { border: 0; background: none; color: var(--text-secondary); font: inherit; font-size: 12px; min-height: 34px; cursor: pointer; text-decoration: underline; }
.compliance-links a { display: inline-flex; align-items: center; }
.support-contact { font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.support-contact a { color: var(--accent); display: inline-block; padding: 4px 0; font-weight: 600; }
.rights-policy { padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: #f7faf9; }
.rights-deadlines { color: var(--text-secondary); font-size: 12px; line-height: 1.8; }
.rights-deadlines.is-overdue { color: #a64223; border-left: 3px solid #a64223; padding-left: 10px; }
.sb-menu button:disabled { opacity: .55; cursor: not-allowed; }
.msg-provenance { margin: 6px 0 10px; color: var(--text-secondary); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.msg-provenance summary { cursor: pointer; min-height: 30px; display: list-item; }
.msg-provenance p { white-space: pre-wrap; margin: 4px 0; }
.rights-panel { padding: 22px; color: var(--text-primary); line-height: 1.7; }
.rights-panel h2 { font-size: 20px; margin: 0 0 12px; }
.rights-panel h3 { font-size: 16px; margin: 22px 0 8px; }
.rights-panel p { font-size: 13px; margin: 8px 0; }
.rights-panel label { display: block; font-size: 14px; margin: 12px 0 4px; }
.rights-panel input, .rights-panel select, .rights-panel textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font: inherit; font-size: 14px; color: var(--text-primary); background: white; }
.rights-panel textarea { resize: vertical; }
.rights-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rights-item { border-top: 1px solid var(--border); padding: 10px 0; overflow-wrap: anywhere; }
.rights-panel .rights-meta { color: var(--text-secondary); font-size: 12px; }
.rights-text, .rights-response { white-space: pre-wrap; }
.rights-response { border-left: 3px solid var(--accent); padding-left: 10px; }
#rights-status { min-height: 1.7em; }
@media (max-width: 768px) {
  .composer-footer { display: block; font-size: 11px; line-height: 1.5; padding-top: 6px; }
  .rights-panel { padding: 18px; }
  .upload-pop { max-width: calc(100vw - 32px); }
}
