:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #eef3f5;
  --text: #17212b;
  --muted: #66717d;
  --line: #d9e0e4;
  --accent: #126b63;
  --accent-dark: #0b4e48;
  --danger: #a33b3b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .topbar,
body.auth-locked .layout {
  visibility: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button:hover,
.import-button:hover,
.secondary-button:hover {
  background: var(--accent-dark);
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent-dark);
}

.ghost-button:hover {
  background: var(--panel-soft);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 33, 43, 0.35);
  backdrop-filter: blur(3px);
}

.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 50px rgba(23, 33, 43, 0.18);
  padding: 28px;
}

.auth-eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-card h2 {
  margin: 8px 0 10px;
}

.auth-copy {
  margin-bottom: 18px;
}

.auth-panel {
  display: grid;
  gap: 12px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-field input {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 40px;
  padding: 0 11px;
}

.auth-message {
  min-height: 22px;
  margin-top: 14px;
  font-weight: 700;
}

.auth-message.error {
  color: var(--danger);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
  margin: 0 0 4px;
}

#summary {
  color: #1f5f67;
  display: inline-flex;
  font-weight: 700;
  line-height: 1.25;
  transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

#summary.error {
  color: var(--danger);
}

#summary.busy {
  animation: statusPulse 1.25s ease-in-out infinite;
  background: #e8f3ee;
  border: 1px solid #b8d8cb;
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(18, 107, 99, 0.16);
  color: #16483f;
  padding: 7px 12px;
}

#summary.busy::before {
  animation: statusDot 0.8s ease-in-out infinite;
  background: var(--accent);
  border-radius: 999px;
  content: "";
  height: 8px;
  margin-right: 8px;
  margin-top: 4px;
  width: 8px;
}

@keyframes statusPulse {
  0%,
  100% {
    background: #e8f3ee;
    box-shadow: 0 0 0 0 rgba(18, 107, 99, 0.12);
  }
  50% {
    background: #d5ebe4;
    box-shadow: 0 0 0 6px rgba(18, 107, 99, 0.08);
  }
}

@keyframes statusDot {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

p {
  margin: 0;
  color: var(--muted);
}

.import-button {
  align-items: center;
  background: var(--accent);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  min-height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}

.settings {
  position: relative;
}

.settings-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(23, 33, 43, 0.12);
  min-width: 320px;
  padding: 10px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
}

.ab-config {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
}

.ab-config label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ab-config textarea {
  min-height: 160px;
}

.import-button input {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  padding: 14px;
}

.workspace,
.detail,
.search-panel,
.table-wrap {
  min-width: 0;
}

.table-wrap.is-hidden {
  display: none;
}

.secondary-button {
  background: #2f5f89;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.clear-button {
  background: #6d7480;
}

.clear-button:hover {
  background: #4d5560;
}

.search-panel,
.detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.search-main {
  display: grid;
  gap: 7px;
  grid-template-columns: minmax(0, 1fr) 48px auto;
}

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

.filter-field {
  min-width: 0;
  position: relative;
}

.suggest-list {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(23, 33, 43, 0.14);
  left: 0;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  z-index: 30;
}

.suggest-list button {
  align-items: center;
  background: #ffffff;
  border-radius: 6px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  min-height: 34px;
  padding: 6px 8px;
  text-align: left;
  width: 100%;
}

.suggest-list button:hover,
.suggest-list button:focus {
  background: #e8f3ee;
  color: #16483f;
}

.suggest-list span {
  color: var(--muted);
  font-size: 12px;
  margin-left: 8px;
}

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 7px 10px;
  width: 100%;
}

#query {
  line-height: 1.35;
  max-height: 140px;
  min-height: 38px;
  overflow-y: auto;
  resize: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(18, 107, 99, 0.14);
}

.icon-button {
  font-size: 18px;
  padding: 0;
}

.icon-button.listening {
  background: #a6422f;
  box-shadow: 0 0 0 4px rgba(166, 66, 47, 0.18);
}

.voice-note.listening {
  background: #b73535;
  box-shadow: 0 0 0 4px rgba(183, 53, 53, 0.2);
}

.voice-note.listening:hover {
  background: #8f2424;
}

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
  overflow: auto;
}

.result-summary {
  background: #e8f3ee;
  border: 1px solid #b8d8cb;
  border-radius: 8px;
  color: #16483f;
  font-weight: 700;
  margin-top: 12px;
  padding: 11px 14px;
}

.result-summary.empty {
  background: #fff0e8;
  border-color: #e1b79f;
  color: #7a3828;
}

.note-answer {
  background: #f5f0ff;
  border: 1px solid #d7c9f4;
  border-radius: 8px;
  color: #33255d;
  margin-top: 12px;
  padding: 12px 14px;
}

.note-answer ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.note-answer li {
  margin: 6px 0;
}

.note-answer span {
  color: #6f668a;
  display: block;
  font-size: 13px;
  margin-top: 2px;
}

.recent-notes-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px;
  overflow: hidden;
}

.recent-notes-panel summary {
  color: #1f5f67;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  padding: 12px 14px;
}

.recent-notes-panel summary::-webkit-details-marker {
  display: none;
}

.recent-notes-list {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.recent-notes-filters {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  padding: 10px;
}

.recent-notes-filters label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 4px;
}

.recent-notes-filters button {
  align-self: end;
}

.recent-note {
  background: #f8fafb;
  border: 1px solid #dce4e8;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 5px;
  height: auto;
  min-height: 0;
  padding: 10px 12px;
  text-align: left;
}

.recent-note:hover {
  background: #eef7f3;
}

.recent-note span {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
}

.recent-note strong {
  color: #17212b;
}

.recent-note small,
.recent-note time,
.recent-notes-empty {
  color: var(--muted);
}

.recent-note em {
  color: #3f4751;
  font-style: normal;
  line-height: 1.35;
}

.recent-note time {
  font-size: 12px;
}

.ai-answer-card {
  display: grid;
  gap: 14px;
}

.ai-answer-card header {
  border-bottom: 1px solid #d7c9f4;
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
}

.ai-answer-card header strong {
  color: #2f255d;
  font-size: 18px;
}

.ai-answer-body {
  color: #3f4751;
  display: grid;
  gap: 10px;
  line-height: 1.38;
}

.ai-answer-body p {
  color: #3f4751;
}

.ai-answer-body ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ai-answer-body li {
  background: #ffffff;
  border: 1px solid #ded8ee;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1.45;
  margin: 0;
  padding: 12px;
}

.ai-result-row {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.ai-result-row > span {
  font-size: inherit;
  min-width: 0;
}

.external-card-list {
  display: grid;
  gap: 10px;
}

.external-card {
  background: #ffffff;
  border: 1px solid #ded8ee;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.external-card-head {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.external-card-head strong {
  color: var(--text);
  font-size: 17px;
  line-height: 1.25;
}

.external-card-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.external-card-main span,
.external-url {
  color: #3f4751;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.external-phone {
  font-size: 17px;
  font-weight: 800;
  width: fit-content;
}

.external-card .route-menu summary {
  font-size: 13px;
  min-height: 30px;
  padding: 5px 12px;
}

.ai-sources,
.ai-map,
.ai-notes,
.ai-results {
  display: grid;
  gap: 8px;
}

.ai-sources h3,
.ai-map h3,
.ai-notes h3 {
  color: #2f255d;
  font-size: 15px;
  margin: 0;
}

.ai-notes p {
  color: #6f668a;
  font-size: 14px;
}

.source-list {
  display: grid;
  gap: 6px;
}

.source-list a,
.source-list span {
  color: #2f5f89;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: underline;
}

.source-list span {
  text-decoration: none;
}

.route-button,
.route-menu summary {
  background: #ffffff;
  border: 1px solid #ded8ee;
  border-radius: 999px;
  color: #1f5f67;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  padding: 8px 10px;
  text-decoration: none;
}

.source-list a:hover {
  color: var(--accent-dark);
}

.route-button:hover,
.route-menu summary:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.route-button,
.route-menu {
  flex: 0 0 auto;
}

.route-menu {
  position: relative;
}

.route-menu summary {
  cursor: pointer;
  list-style: none;
}

.route-menu summary::-webkit-details-marker {
  display: none;
}

.route-menu div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(23, 33, 43, 0.14);
  display: grid;
  gap: 4px;
  min-width: 160px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 35;
}

.route-menu div a {
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 9px;
  text-decoration: none;
}

.route-menu div a:hover {
  background: #e8f3ee;
  color: #16483f;
}

.open-provider {
  justify-self: start;
  min-height: 40px;
}

.phone-link {
  color: #0b6b5f;
  font-weight: 800;
  text-decoration: none;
}

.phone-link:hover {
  text-decoration: underline;
}

.ai-map iframe {
  aspect-ratio: 16 / 10;
  border: 1px solid #ded8ee;
  border-radius: 8px;
  min-height: 240px;
  width: 100%;
}

.detail-header-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 0;
}

.contact-route {
  min-height: 34px;
}

.ab-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.ab-heading {
  background: #eef5fb;
  border: 1px solid #c6dbea;
  border-radius: 8px;
  padding: 12px 14px;
}

.ab-heading h2 {
  font-size: 18px;
  margin: 0 0 4px;
}

.ab-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.ab-card.is-different {
  border-color: #d2b66d;
}

.ab-card > header {
  align-items: center;
  background: #f4f7f8;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
}

.ab-card > header span {
  color: var(--muted);
  font-size: 13px;
}

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

.ab-columns section {
  padding: 12px;
}

.ab-columns section + section {
  border-left: 1px solid var(--line);
}

.ab-columns h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

.ab-columns small {
  color: var(--muted);
  font-weight: 400;
}

.ab-columns ol {
  margin: 0;
  padding-left: 20px;
}

.ab-columns li {
  margin: 8px 0;
}

.ab-columns li span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 2px;
}

.ab-model {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-soft);
  color: #2b3742;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #edf6f4;
}

.exact-result {
  background: #f0faf3;
}

.exact-result:hover,
.exact-result.selected {
  background: #dff3e6;
}

.similar-result {
  background: #fffaf0;
}

.similar-result:hover,
.similar-result.selected {
  background: #f7edcf;
}

.group-row td,
.group-row:hover {
  background: #fff5df;
  color: #745015;
  cursor: default;
  font-weight: 700;
}

.group-row:hover td {
  background: #fff5df;
}

.load-more-container {
  background: #f4f7f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
  padding: 12px;
  width: 100%;
}

.load-more-container:empty {
  display: none;
}

.load-more-row td {
  background: #f4f7f8;
  text-align: center;
}

.load-more-button,
.back-top-button {
  flex: 1 1 180px;
  min-width: 0;
}

.back-top-button {
  background: #2f5f89;
}

.inline-detail-row td {
  background: #f8fbff;
  border-bottom: 1px solid #cbdbe8;
  padding: 0;
}

.inline-detail {
  border-left: 4px solid var(--accent);
  padding: 14px;
}

.inline-detail .company-title {
  font-size: 18px;
}

.side-detail,
.inline-detail {
  display: grid;
  gap: 14px;
}

.detail-header {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.detail-header .company-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.close-detail {
  background: #b73535;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
}

.close-detail:hover,
.danger-button:hover {
  background: #8f2424;
}

.danger-button {
  background: #b73535;
}

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

.edit-grid label {
  display: grid;
  gap: 4px;
}

.edit-grid .wide-field {
  grid-column: 1 / -1;
}

.edit-grid textarea {
  min-height: 66px;
}

.edit-grid span {
  color: var(--muted);
  font-size: 13px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.notes-title {
  color: var(--text);
  font-size: 16px;
  margin: 2px 0 -4px;
}

.detail-actions button,
.note-actions button,
.results-actions button {
  flex: 1 1 150px;
  min-width: 0;
}

.paste-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 43, 0.18);
}

.paste-modal-card {
  width: min(680px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 50px rgba(23, 33, 43, 0.2);
  display: grid;
  gap: 12px;
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 18px;
}

.paste-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.paste-modal-head strong {
  display: block;
  font-size: 20px;
  margin-bottom: 4px;
}

.paste-modal-head p,
.paste-modal-message {
  color: var(--muted);
  margin: 0;
}

.paste-modal-field {
  display: grid;
  gap: 6px;
}

.paste-contact-input {
  min-height: 180px;
}

.paste-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.paste-show-input {
  margin-left: auto;
}

.paste-modal-message.error {
  color: var(--danger);
  font-weight: 700;
}

.paste-preview {
  display: grid;
}

.paste-preview-card {
  background: #f6fbfa;
  border: 1px solid #cfe3dd;
  border-radius: 12px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.paste-preview-card strong {
  color: var(--accent-dark);
  font-size: 15px;
}

.paste-preview-grid {
  display: grid;
  gap: 8px;
}

.paste-preview-row {
  display: grid;
  gap: 2px;
}

.paste-preview-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.paste-preview-row p {
  margin: 0;
  white-space: pre-wrap;
}

.paste-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paste-preview-actions button {
  flex: 1 1 180px;
}

.paste-candidate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paste-candidate-tab {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  min-height: 38px;
  padding: 0 14px;
}

.paste-candidate-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.edit-note-form {
  display: grid;
  gap: 8px;
}

.edit-note-body {
  min-height: 72px;
}

.detail {
  align-self: start;
  max-height: calc(100vh - 116px);
  overflow: auto;
  padding: 14px;
  position: sticky;
  scroll-margin-top: 104px;
  top: 92px;
}

.empty-state {
  color: var(--muted);
  display: grid;
  gap: 6px;
  padding: 24px 0;
  text-align: center;
}

.company-title {
  font-size: 22px;
  margin: 0 0 12px;
  scroll-margin-top: 104px;
}

.meta {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.meta-row {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 6px;
  grid-template-columns: 92px minmax(0, 1fr);
  padding: 5px 0;
}

.meta-row span:first-child {
  color: var(--muted);
}

.note-form {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.notes {
  display: grid;
  gap: 10px;
}

.note {
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.note.is-highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 107, 99, 0.16);
}

.note time {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
}

.error {
  color: var(--danger);
}

@media (max-width: 900px) {
  .topbar {
    align-items: center;
    display: grid;
    gap: 8px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px;
  }

  .topbar > div:first-child {
    display: contents;
  }

  .topbar h1 {
    align-self: center;
    grid-column: 1;
    grid-row: 1;
    margin: 0;
  }

  .topbar .settings {
    align-self: center;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  #summary {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 8px;
    width: 100%;
  }

  .recent-notes-panel:not([open]) .recent-notes-list {
    display: none;
  }

  .recent-notes-panel:not([open]) .recent-notes-filters {
    display: none;
  }

  .recent-notes-panel summary {
    background: #e8f3ee;
    min-height: 48px;
  }

  .recent-notes-filters {
    box-sizing: border-box;
    column-gap: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 14px;
    padding-right: 14px;
  }

  .recent-notes-filters label {
    overflow: hidden;
    min-width: 0;
  }

  .recent-notes-filters label:first-of-type {
    padding-right: 0;
  }

  .recent-notes-filters label:nth-of-type(2) {
    padding-left: 0;
  }

  .recent-notes-filters input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    font-size: 16px;
    inline-size: 100%;
    max-width: 100%;
    min-inline-size: 0;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
    width: 100%;
  }

  .recent-notes-filters button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .layout {
    display: block;
    padding: 12px;
  }

  .search-panel {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }

  .results-actions,
  .recent-notes-panel,
  .table-wrap,
  .load-more-container {
    box-sizing: border-box;
    margin-left: 14px;
    margin-right: 14px;
    width: calc(100% - 28px);
  }

  .load-more-button,
  .back-top-button {
    flex-basis: calc(50% - 5px);
    padding-left: 8px;
    padding-right: 8px;
  }

  .filters {
    grid-template-columns: 1fr;
    order: 3;
  }

  .search-main {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .search-main #query {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 78px;
    order: 1;
  }

  .search-main .icon-button {
    grid-column: 2;
    grid-row: 2;
    justify-self: stretch;
    min-width: 0;
    order: 2;
    width: 100%;
  }

  .search-main button[type="submit"] {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
    margin-left: 0;
    order: 2;
    width: 100%;
  }

  .settings-panel {
    left: auto;
    max-width: calc(100vw - 24px);
    min-width: min(320px, calc(100vw - 24px));
  }

  .ab-columns {
    grid-template-columns: 1fr;
  }

  .ab-columns section + section {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .detail {
    margin-top: 12px;
    max-height: none;
    position: static;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }

  td {
    border: 0;
    display: grid;
    gap: 4px;
    grid-template-columns: 92px minmax(0, 1fr);
    padding: 4px 0;
  }

  td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 13px;
  }

  .inline-detail-row {
    padding: 0;
  }

  .inline-detail-row td {
    display: block;
    padding: 0;
  }

  .inline-detail-row td::before {
    content: none;
  }

  .inline-detail {
    border-left-width: 3px;
    padding: 12px;
    width: 100%;
  }

  .detail-header {
    align-items: stretch;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-header-actions {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    width: 100%;
  }

  .detail-header-actions .route-menu {
    flex: 0 1 auto;
    min-width: 0;
  }

  .detail-header-actions .route-menu summary {
    width: auto;
  }

  .contact-route,
  .close-detail {
    flex: 0 0 auto;
  }

  .edit-grid {
    grid-template-columns: 1fr;
  }

  .detail-actions,
  .note-actions,
  .results-actions {
    display: flex;
    flex-wrap: nowrap;
  }

  .paste-modal-head {
    flex-direction: column;
  }

  .paste-modal-actions {
    justify-content: stretch;
  }

  .paste-modal-actions button,
  .paste-modal-head .ghost-button {
    width: 100%;
  }

  .detail-actions button,
  .note-actions button,
  .results-actions button {
    flex: 1 1 0;
    padding-left: 10px;
    padding-right: 10px;
  }

  .ai-answer-body li {
    font-size: 22px;
    line-height: 1.42;
    padding: 14px;
  }

  .route-menu summary {
    font-size: 16px;
    min-height: 44px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .external-card .route-menu summary {
    font-size: 13px;
    min-height: 30px;
    padding: 5px 12px;
  }

  .close-detail {
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
    width: 52px;
  }
}
