:root {
  --app-sidebar-width: 16rem;
}

body {
  background: linear-gradient(180deg, #f8fafc 0%, #eef6f8 100%);
}

.card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.pill {
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.sidebar-link {
  display: block;
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  color: #334155;
  cursor: grab;
  -webkit-user-drag: none;
  user-select: none;
}

.sidebar-link:hover {
  background: #ecfeff;
  color: #0e7490;
}

.sidebar-link:active,
.sidebar-section-title:active {
  cursor: grabbing;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  border-radius: 0.45rem;
  cursor: grab;
  font-size: 1rem;
  line-height: 1.35;
  padding: 0.15rem 0.35rem;
  -webkit-user-drag: none;
  user-select: none;
}

.sidebar-section-title:hover {
  background: #f1f5f9;
}

.sidebar-dragging {
  opacity: 0.42;
}

.sidebar-drop-before {
  box-shadow: inset 0 3px 0 #0e7490;
}

.sidebar-drop-after {
  box-shadow: inset 0 -3px 0 #0e7490;
}

#app-sidebar-resizer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: calc(var(--app-sidebar-width) - 0.45rem);
  z-index: 35;
  display: none;
  width: 0.9rem;
  cursor: col-resize;
  background: transparent;
  touch-action: none;
}

#app-sidebar-resizer::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0.4rem;
  width: 2px;
  background: rgba(14, 116, 144, 0.16);
  content: "";
}

#app-sidebar-resizer:hover::after,
body.sidebar-resizing #app-sidebar-resizer::after {
  background: #0e7490;
}

body.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

body.sidebar-menu-dragging {
  user-select: none;
}

body.sidebar-menu-dragging .sidebar-link,
body.sidebar-menu-dragging .sidebar-section-title {
  cursor: grabbing;
}

.mobile-drawer-link {
  display: block;
  border-radius: 0.5rem;
  padding: 0.7rem 0.8rem;
  color: #334155;
}

.mobile-drawer-link:hover {
  background: #ecfeff;
  color: #0e7490;
}

@media (min-width: 1024px) {
  #app-sidebar {
    width: var(--app-sidebar-width) !important;
  }

  #app-content-shell {
    margin-left: var(--app-sidebar-width) !important;
  }

  #app-sidebar-resizer {
    display: block;
  }
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#stock-candidate-grid,
[data-stock-card],
[data-stock-card] form,
[data-stock-card] label,
[data-stock-card] input,
[data-stock-card] select,
[data-stock-card] textarea {
  min-width: 0;
  max-width: 100%;
}

[data-stock-card] {
  overflow-wrap: anywhere;
}

.stock-card-main {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  align-items: start;
  column-gap: 0.65rem;
  row-gap: 0.42rem;
}

.stock-card-thumb {
  grid-column: 1;
  grid-row: 1;
}

.stock-side-tags {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.32rem;
}

.stock-side-tag {
  display: inline-flex;
  min-height: 1.8rem;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #dbeafe;
  border-radius: 0.42rem;
  background: #f8fafc;
  padding: 0.32rem 0.38rem;
  color: #0f7c90;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-side-favorite {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.stock-side-category {
  border-color: #bae6fd;
  background: #ecfeff;
  color: #0e7490;
}

.stock-card-favorite {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

.stock-card-head {
  grid-column: 2;
}

.stock-card-body {
  grid-column: 1 / -1;
}

.stock-card-head > .mt-2 {
  margin-top: 0.35rem;
  gap: 0.4rem;
}

.stock-card-head > p {
  margin-top: 0.2rem;
}

.stock-card-badges {
  gap: 0.35rem;
}

.stock-card-badges > span {
  padding: 0.28rem 0.5rem;
}

.stock-card-metrics {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #f8fafc;
  padding: 0.35rem;
  font-weight: 900;
}

.stock-card-metrics > p,
.stock-card-metrics > label,
.stock-card-metrics > div {
  display: flex;
  min-height: 2.15rem;
  min-width: 0;
  align-items: baseline;
  gap: 0.35rem;
  border: 1px solid #edf2f7;
  border-radius: 0.4rem;
  background: #fff;
  padding: 0.34rem 0.45rem;
}

.stock-card-quick-form {
  align-items: stretch;
}

.stock-card-quick-form > label,
.stock-card-quick-form > div {
  flex-direction: column;
  align-items: stretch;
}

.stock-card-money-pair {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.16rem;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 900;
}

.stock-card-money-pair > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.12rem;
}

.stock-card-money-pair input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: #0f172a;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.1;
  outline: 0;
}

.stock-card-money-pair input:focus {
  border-radius: 0.25rem;
  background: #ecfeff;
}

.stock-card-save-button {
  margin-top: 0.15rem;
  align-self: flex-start;
  line-height: 1;
}

.stock-route-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: end;
}

.stock-route-picker.hidden {
  display: none;
}

.stock-card-metric-label {
  display: inline;
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.stock-card-metric-value {
  display: inline;
  min-width: 0;
  margin-top: 0;
  overflow-wrap: anywhere;
  color: inherit;
  font-weight: 900;
  line-height: 1.2;
}

.stock-card-submeta > p {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  background: #fff;
  padding: 0.28rem 0.45rem;
  color: #475569;
  font-weight: 800;
}

.stock-card-submeta > p > span {
  margin-right: 0.25rem;
  color: #0f172a;
  font-weight: 900;
}

@media (min-width: 640px) {
  .stock-card-main {
    grid-template-columns: 4.5rem minmax(0, 1fr);
    column-gap: 0.7rem;
  }

  .stock-card-thumb {
    grid-row: 1;
  }

  .stock-card-body {
    grid-column: 1 / -1;
  }

  [data-stock-card] .stock-card-thumb img,
  [data-stock-card] .stock-card-thumb label {
    height: 4.5rem;
    width: 4.5rem;
  }

  .stock-card-metric-value {
    white-space: nowrap;
  }
}

.stock-edit-panel:not([open]) {
  display: none;
}

.stock-edit-form {
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}

.stock-edit-form input,
.stock-edit-form select,
.stock-edit-form textarea {
  min-width: 0;
}

.stock-edit-form > .lg\:col-span-2,
.stock-edit-form > .lg\:col-span-6 {
  grid-column: 1 / -1;
}

@keyframes app-progress-slide {
  0% {
    transform: translateX(-120%);
  }

  55% {
    transform: translateX(160%);
  }

  100% {
    transform: translateX(360%);
  }
}

.app-progress-topbar-track {
  animation: app-progress-slide 1.15s ease-in-out infinite;
}

@media (max-width: 640px) {
  body {
    background: #f8fafc;
  }

  .card {
    border-radius: 0.55rem;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
  }

  h1 {
    font-size: 1.55rem !important;
    line-height: 1.2 !important;
  }

  h2 {
    line-height: 1.25;
  }

  table {
    min-width: 720px;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  #mobile-menu-drawer .mobile-menu-panel {
    width: clamp(13.5rem, 56vw, 18rem);
    padding: 0.95rem 0.8rem 1.25rem;
  }

  #mobile-menu-drawer .mobile-menu-header {
    gap: 0.55rem;
  }

  #mobile-menu-drawer .mobile-menu-brand {
    max-width: calc(100% - 2.8rem);
    overflow: hidden;
    padding: 0.72rem 0.8rem;
    font-size: 1.08rem;
    line-height: 1.15;
    white-space: nowrap;
  }

  #mobile-menu-close {
    height: 2.25rem;
    width: 2.25rem;
    flex-shrink: 0;
  }

  #mobile-menu-drawer .mobile-menu-nav {
    gap: 1.05rem;
    font-size: 1.06rem;
    line-height: 1.25;
  }

  #mobile-menu-drawer section > p {
    padding-right: 0.45rem;
    padding-left: 0.45rem;
    font-size: 0.78rem;
  }

  .mobile-drawer-link {
    padding: 0.66rem 0.55rem;
    font-size: 1.06rem;
    line-height: 1.25;
  }

  #stock-candidate-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
  }

  [data-stock-card] {
    width: 100%;
    padding: 0.7rem;
  }

  [data-stock-card] .stock-card-main {
    grid-template-columns: 3.7rem minmax(0, 1fr);
    column-gap: 0.65rem;
    row-gap: 0.35rem;
  }

  [data-stock-card] .stock-card-thumb img,
  [data-stock-card] .stock-card-thumb label {
    height: 3.7rem;
    width: 3.7rem;
  }

  [data-stock-card] .stock-card-badges {
    gap: 0.35rem;
    font-size: 0.65rem;
    line-height: 1;
  }

  [data-stock-card] .stock-card-badges > span {
    padding: 0.35rem 0.5rem;
  }

  [data-stock-card] h3 {
    font-size: 0.98rem;
    line-height: 1.25;
  }

  [data-stock-card] .stock-card-head > .mt-2 {
    margin-top: 0.45rem;
    gap: 0.35rem;
  }

  [data-stock-card] .stock-card-head > p {
    margin-top: 0.25rem;
  }

  [data-stock-card] .stock-card-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem;
    margin-top: 0;
    font-size: 0.74rem;
    line-height: 1.25;
  }

  [data-stock-card] .stock-card-metrics > p,
  [data-stock-card] .stock-card-metrics > label,
  [data-stock-card] .stock-card-metrics > div {
    min-width: 0;
    border-radius: 0.45rem;
    background: #f8fafc;
    padding: 0.34rem 0.4rem;
  }

  [data-stock-card] .stock-card-metric-label {
    display: block;
    color: #64748b;
    font-size: 0.62rem;
    line-height: 1;
  }

  [data-stock-card] .stock-card-metric-value {
    display: block;
    margin-top: 0.12rem;
    overflow-wrap: anywhere;
    font-size: 0.68rem;
    line-height: 1.15;
  }

  [data-stock-card] .stock-card-money-pair {
    font-size: 0.62rem;
  }

  [data-stock-card] .stock-card-money-pair input {
    font-size: 0.68rem;
  }

  [data-stock-card] .stock-route-picker {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  [data-stock-card] .stock-route-picker button {
    grid-column: 1 / -1;
    min-height: 2.25rem;
  }

  [data-stock-card] .stock-card-submeta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.3rem;
    margin-top: 0.35rem;
    line-height: 1.25;
  }

  [data-stock-card] .stock-card-submeta > p {
    min-width: 0;
    border-radius: 0.4rem;
    background: #f8fafc;
    padding: 0.3rem 0.42rem;
  }

  [data-stock-card] .stock-card-links {
    flex-wrap: nowrap;
    gap: 0.35rem;
    margin-top: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.1rem;
    scrollbar-width: none;
  }

  [data-stock-card] .stock-card-links::-webkit-scrollbar {
    display: none;
  }

  [data-stock-card] .stock-card-links > a {
    flex: 0 0 auto;
    padding: 0.45rem 0.58rem;
    font-size: 0.68rem;
    line-height: 1;
  }

  [data-stock-card] .stock-card-footer {
    margin-top: 0.55rem;
    gap: 0.45rem;
  }

  [data-stock-card] .stock-card-footer > div:first-child {
    font-size: 0.68rem;
    line-height: 1.25;
  }

  [data-stock-card] .stock-card-footer > div:last-child {
    gap: 0.45rem;
  }

  [data-stock-card] .stock-card-footer button {
    min-height: 2.35rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  [data-stock-card] [data-route-label] {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

#draft-edit-form > * {
  order: 20;
}

#draft-title-field {
  order: 1;
}

#draft-description-field {
  order: 2;
}

#draft-specifics-field {
  order: 3;
}

.cross-search-app {
  display: grid;
  min-height: 100dvh;
  grid-template-rows: auto auto 1fr auto;
  background: #f8fafc;
}

.cross-search-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.94);
  padding: max(0.65rem, env(safe-area-inset-top)) 0.75rem 0.65rem;
  backdrop-filter: blur(14px);
}

.cross-search-icon-button,
.cross-search-action-button {
  display: inline-grid;
  min-height: 2.5rem;
  place-items: center;
  border-radius: 0.5rem;
  background: white;
  padding: 0 0.8rem;
  font-weight: 900;
  color: #0e7490;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.cross-search-icon-button {
  width: 2.5rem;
  padding: 0;
  font-size: 1.45rem;
  line-height: 1;
}

.cross-search-tabs {
  position: sticky;
  top: 3.8rem;
  z-index: 19;
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.94);
  padding: 0.55rem 0.75rem;
  scrollbar-width: none;
  backdrop-filter: blur(14px);
}

.cross-search-tabs::-webkit-scrollbar,
.cross-search-carousel::-webkit-scrollbar {
  display: none;
}

.cross-search-tab {
  min-width: 6.75rem;
  max-width: 9rem;
  flex: 0 0 auto;
  border-radius: 0.5rem;
  background: white;
  padding: 0.5rem 0.65rem;
  text-align: left;
  color: #334155;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.cross-search-tab.is-active {
  background: #0e7490;
  color: white;
}

.cross-search-empty {
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

.cross-search-carousel {
  display: flex;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.cross-search-pane {
  display: grid;
  min-width: 100vw;
  max-width: 100vw;
  grid-template-rows: auto 1fr;
  scroll-snap-align: start;
  background: white;
}

.cross-search-frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  padding: 0.55rem 0.75rem;
}

.cross-search-frame {
  min-height: 0;
  height: 100%;
  width: 100%;
  border: 0;
  background: white;
}

.cross-search-external-panel {
  display: grid;
  min-height: 0;
  place-items: center;
  background: #f1f5f9;
  padding: 1rem;
}

.cross-search-external-card {
  width: min(32rem, 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.65rem;
  background: white;
  padding: 1.25rem;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
}

.cross-search-searchbar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.96);
  padding: 0.65rem 0.75rem max(0.65rem, env(safe-area-inset-bottom));
  backdrop-filter: blur(14px);
}

.cross-search-input {
  min-width: 0;
  border-radius: 0.6rem;
  border: 1px solid #cbd5e1;
  padding: 0.85rem 0.95rem;
  font-size: 16px;
  font-weight: 800;
}

.cross-search-submit {
  border-radius: 0.6rem;
  background: #0e7490;
  padding: 0.85rem 1.1rem;
  font-weight: 900;
  color: white;
}

.cross-search-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
}

.cross-search-drawer.is-open {
  display: flex;
}

.cross-search-drawer-panel {
  height: 100dvh;
  width: min(100vw, 32rem);
  overflow-y: auto;
  background: white;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  box-shadow: -16px 0 40px rgba(15, 23, 42, 0.18);
}

.cross-search-site-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: 0.5rem;
  background: #f8fafc;
  padding: 0.75rem;
}

.cross-search-toggle input {
  position: absolute;
  opacity: 0;
}

.cross-search-toggle span {
  display: block;
  height: 1.65rem;
  width: 2.85rem;
  border-radius: 999px;
  background: #cbd5e1;
  padding: 0.18rem;
  transition: background 0.18s ease;
}

.cross-search-toggle span::after {
  display: block;
  height: 1.29rem;
  width: 1.29rem;
  border-radius: 999px;
  background: white;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.24);
  content: "";
  transition: transform 0.18s ease;
}

.cross-search-toggle input:checked + span {
  background: #0e7490;
}

.cross-search-toggle input:checked + span::after {
  transform: translateX(1.18rem);
}

.cross-search-site-name,
.cross-search-site-url,
.cross-search-site-language,
.cross-search-drawer-input {
  width: 100%;
  border-radius: 0.45rem;
  border: 1px solid #cbd5e1;
  background: white;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
  font-weight: 800;
}

.cross-search-site-url {
  margin-top: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: #475569;
}

.cross-search-site-language {
  max-width: 8rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.76rem;
}

.cross-search-delete {
  display: grid;
  height: 2rem;
  width: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.45rem;
  background: white;
  font-size: 1.1rem;
  font-weight: 900;
  color: #be123c;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

@media (min-width: 960px) {
  .cross-search-pane {
    min-width: 100vw;
  }

  .cross-search-tab {
    min-width: 8rem;
  }
}
