:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #262730;
  --muted: #5c6670;
  --accent: #3d5a6e;
  --accent-soft: #e8eef2;
  --border: #e2e6ea;
  --phrase: #fff5a3;
  --word: rgba(173, 216, 255, 0.55);
  --warn: #f0b429;
  --success: #2d6a3e;
  --danger: #9b1c1c;
  --danger-bg: #fde8e8;
  --shadow: 0 1px 3px rgba(38, 39, 48, 0.06), 0 4px 12px rgba(38, 39, 48, 0.04);
  --radius: 12px;
  --sidebar-w: 300px;
  --header-h: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem 1rem;
  text-align: center;
}

.site-header h1 {
  margin: 0 0 0.2rem;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 700;
}

.site-tagline {
  color: #555;
  font-size: 1.02rem;
}

.site-law-scope {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7c8a;
}

.site-law-scope em {
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
}

.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.mode-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mode-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mode-tab:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mode-tab .soon {
  font-size: 0.72rem;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  vertical-align: middle;
}

.mode-tab:not(.active) .soon {
  background: var(--accent-soft);
  color: var(--accent);
}

.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  align-items: start;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  max-width: 92vw;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  z-index: 200;
  transform: translate3d(-100%, 0, 0);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.25s ease, visibility 0.25s ease;
  box-shadow: var(--shadow);
}

.sidebar.open {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  pointer-events: auto;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 199;
}

.sidebar-backdrop.open {
  display: block;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sidebar h2 {
  margin: 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  flex-shrink: 0;
}

.btn-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.sidebar-pin {
  display: none;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.panel-toolbar .btn-icon {
  display: inline-flex;
}

.field {
  margin-bottom: 0.85rem;
}

.field label {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.field input[type="text"],
.field input[type="date"],
.field select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(61, 90, 110, 0.25);
  border-color: var(--accent);
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.btn-compact {
  margin-top: 0.45rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.55rem;
}

.check-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.corpus-stat {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--muted);
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.62rem 1rem;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.main {
  padding: 1rem 1.25rem 2.5rem;
  min-width: 0;
}

.search-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.search-row {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
}

.search-row input {
  flex: 1;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1.02rem;
}

.search-row input:focus {
  outline: 2px solid rgba(61, 90, 110, 0.25);
  border-color: var(--accent);
}

.search-row .btn-primary {
  padding-left: 1.35rem;
  padding-right: 1.35rem;
  white-space: nowrap;
}

.search-hint {
  margin-top: 0.65rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.mobile-filter-btn {
  display: none !important;
}

.progress-panel {
  display: none;
  align-items: center;
  gap: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.progress-panel.active {
  display: flex;
}

.progress-bar-wrap {
  flex: 1;
  height: 6px;
  background: #eef1f4;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #5a7f96);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.progress-text {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.dots {
  display: inline-flex;
  gap: 0.3rem;
}

.dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--warn);
  animation: bounce 1.2s infinite ease-in-out;
}

.dot:nth-child(2) {
  animation-delay: 0.15s;
}

.dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.alert {
  display: none;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.alert.error {
  display: block;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f5c2c2;
}

.alert.hidden {
  display: none;
}

.summary-bar {
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 500;
}

.results-empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.case-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-left: 4px solid var(--accent);
}

.case-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  user-select: none;
}

.case-head-main {
  min-width: 0;
  flex: 1;
}

.case-head:hover {
  background: #fafbfc;
}

.case-title {
  font-weight: 600;
  font-size: 0.98rem;
  min-width: 0;
  line-height: 1.35;
}

.case-head-meta {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.case-head-summary {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: #4a5560;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.case-chevron {
  color: var(--muted);
  transition: transform 0.2s;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.case-card.open .case-chevron {
  transform: rotate(180deg);
}

.case-body {
  display: none;
  padding: 0.25rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfcfd 0%, var(--surface) 100%);
}

.case-card.open .case-body {
  display: block;
}

.case-subtitle {
  margin: 0.65rem 0 0.35rem;
  font-size: 0.95rem;
  color: #444;
  line-height: 1.4;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.case-meta span {
  padding: 0.15rem 0.45rem;
  background: #f3f5f7;
  border-radius: 6px;
}

.badge-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.case-block {
  margin: 0.75rem 0;
  padding: 0.75rem 0.85rem;
  background: #fff;
  border: 1px solid #edf0f3;
  border-radius: 10px;
}

.case-block-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.case-block-text {
  font-size: 0.94rem;
  line-height: 1.55;
}

.case-link {
  margin: 0.5rem 0 0.75rem;
}

.case-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.case-snippets-label {
  margin: 0.85rem 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.snippet {
  margin-top: 0.5rem;
  padding: 0.75rem 0.85rem;
  background: #fafbfc;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.case-preview-wrap {
  margin-top: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.case-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: none;
  background: #f6f8fa;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.case-preview-head:hover {
  background: #eef2f5;
}

.case-preview-head .case-chevron {
  font-size: 0.7rem;
}

.case-preview-wrap.open .case-preview-head .case-chevron {
  transform: rotate(180deg);
}

.case-preview-body {
  display: none;
  border-top: 1px solid var(--border);
}

.case-preview-wrap.open .case-preview-body {
  display: block;
}

.preview-frame {
  display: block;
  width: 100%;
  height: 420px;
  border: none;
  background: #fff;
}

.preview-loading,
.preview-missing {
  padding: 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.snippet mark.phrase {
  background: var(--phrase);
  padding: 0 0.12em;
  border-radius: 0.15em;
}

.snippet mark.word {
  background: var(--word);
  padding: 0 0.12em;
  border-radius: 0.15em;
}

.more-wrap {
  text-align: center;
  margin: 1.25rem 0;
}

.legacy-link {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar-section.hidden {
  display: none;
}

.sidebar-close-btn {
  width: 100%;
  margin-top: 0.5rem;
}

.neural-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.neural-panel.hidden,
.search-panel.hidden {
  display: none;
}

.neural-history {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.neural-turn {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.user-prompt {
  align-self: flex-end;
  max-width: min(92%, 720px);
  padding: 0.75rem 1rem;
  border-radius: 14px 14px 4px 14px;
  background: var(--accent-soft);
  border: 1px solid #d5e0e8;
  box-shadow: var(--shadow);
}

.user-prompt-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.user-prompt-text {
  font-size: 0.96rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.answer-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.answer-panel-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, #f8fafb 0%, #f2f5f7 100%);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.answer-panel-body {
  padding: 1rem 1.1rem 1.15rem;
  font-size: 0.97rem;
  line-height: 1.65;
  color: #2a2d33;
}

.answer-panel-body p {
  margin: 0 0 0.85rem;
}

.answer-panel-body p:last-child {
  margin-bottom: 0;
}

.answer-panel-body ul {
  margin: 0.35rem 0 0.85rem 1.2rem;
  padding: 0;
}

.answer-panel-body li {
  margin: 0.35rem 0;
}

.answer-panel-body strong {
  color: var(--text);
}

.answer-panel-body .md-h {
  margin: 1rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.answer-panel-body .md-h:first-child {
  margin-top: 0;
}

.answer-panel-body h1.md-h {
  font-size: 1.08rem;
}

.answer-panel-body h2.md-h {
  font-size: 1.02rem;
}

.answer-panel-body h3.md-h {
  font-size: 0.98rem;
  color: var(--accent);
}

.answer-panel-body .md-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.answer-panel-body .md-quote {
  margin: 0.75rem 0;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--accent);
  background: #f6f8fa;
  color: #4a5560;
}

.answer-panel-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: #f3f5f7;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.answer-panel-body a {
  word-break: break-all;
}

.md-table-wrap {
  overflow-x: auto;
  margin: 0.85rem 0 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.45;
}

.md-table th,
.md-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #edf0f3;
  text-align: left;
  vertical-align: top;
}

.md-table th {
  background: #f6f8fa;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.md-table tr:last-child td {
  border-bottom: none;
}

.md-table td a {
  font-size: 0.84rem;
}

.neural-compose {
  margin-bottom: 0;
}

.neural-input-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.neural-input-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: end;
}

.neural-input-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f6f8fa;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.neural-input-attach:hover {
  background: var(--accent-soft);
  border-color: #c5d3dc;
  color: #2a4252;
}

.neural-input-attach svg {
  width: 1.15rem;
  height: 1.15rem;
}

.neural-input-send {
  white-space: nowrap;
  align-self: end;
}

.neural-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  max-width: 100%;
  padding: 0.35rem 0.55rem 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #d0dbe3;
  font-size: 0.84rem;
  color: var(--accent);
}

.neural-attach-chip.hidden {
  display: none;
}

.neural-attach-chip span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.upload-chip-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
}

.upload-chip-remove:hover {
  color: var(--danger);
}

.sidebar-upload {
  margin: 0.85rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fafbfc;
}

.sidebar-upload-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.sidebar-upload-toggle:hover {
  background: #f0f3f6;
}

.sidebar-upload.open .sidebar-upload-toggle .case-chevron {
  transform: rotate(180deg);
}

.sidebar-upload-body {
  padding: 0 0.75rem 0.75rem;
  border-top: 1px solid var(--border);
}

.sidebar-upload-body[hidden] {
  display: none;
}

.upload-pick-btn {
  width: 100%;
  margin-top: 0.65rem;
}

.sidebar-upload-body textarea {
  width: 100%;
  min-height: 5.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  font-size: 0.88rem;
  line-height: 1.45;
}

.upload-meta {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}

.upload-meta.ok {
  color: #2d6a3e;
}

.upload-meta.err {
  color: var(--danger);
}

.neural-input-box textarea {
  width: 100%;
  resize: vertical;
  min-height: 3.25rem;
  max-height: 12rem;
  padding: 0.65rem 0.2rem 0.65rem 0;
  border: none;
  border-radius: 0;
  background: transparent;
  line-height: 1.5;
}

.neural-input-box textarea:focus {
  outline: none;
}

.neural-input-box:focus-within {
  outline: 2px solid rgba(61, 90, 110, 0.22);
  border-color: var(--accent);
}

.neural-hint {
  margin: 0;
}

.section-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text);
}

.neural-sources-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.neural-sources-section.hidden {
  display: none;
}

.neural-sources-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: none;
  background: linear-gradient(180deg, #f8fafb 0%, #f2f5f7 100%);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.neural-sources-head:hover {
  background: #eef2f5;
}

.neural-sources-section.open .neural-sources-head .case-chevron {
  transform: rotate(180deg);
}

.neural-sources-body {
  display: none;
  padding: 0.65rem 0.85rem 0.85rem;
  border-top: 1px solid var(--border);
}

.neural-sources-section.open .neural-sources-body {
  display: block;
}

.neural-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.neural-toolbar.hidden {
  display: none;
}

.neural-toolbar-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0.15rem;
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #cfd8df;
  background: #fff;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-tool:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #2a4252;
  text-decoration: none;
}

.btn-tool svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  stroke: currentColor;
  color: inherit;
}

.btn-tool span {
  line-height: 1;
}

.neural-status {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

#neural_progress.active {
  display: flex;
}

@media (min-width: 901px) {
  .sidebar-pin {
    display: inline-flex;
  }

  .sidebar-close-btn {
    display: none;
  }
}

body.sidebar-scroll-lock {
  overflow: hidden;
}

@media (max-width: 900px) {
  .sidebar {
    width: min(88vw, 320px);
  }

  .sidebar-backdrop {
    background: rgba(0, 0, 0, 0.35);
  }

  .sidebar-pin {
    display: none;
  }

  .sidebar-close-btn {
    display: block;
  }

  .search-row {
    flex-direction: column;
  }

  .neural-input-row {
    grid-template-columns: auto 1fr;
  }

  .neural-input-send {
    grid-column: 1 / -1;
    width: 100%;
  }

  .main {
    padding: 0.85rem 0.85rem 2rem;
  }
}
