:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f5f5f5;
  --line: #e8ebf1;
  --line-strong: #d9dee8;
  --text: #101421;
  --muted: #737987;
  --soft: #f5f5f5;
  --sidebar: #ffffff;
  --green: #19b461;
  --red: #ff4057;
  --blue: #4767f6;
  --shadow: 0 18px 48px rgba(14, 20, 32, 0.045);
}

body.dark-theme {
  --bg: #121212;
  --panel: #1c1c1c;
  --panel-2: #171717;
  --line: #2a2a2a;
  --line-strong: #383838;
  --text: #f8fafc;
  --muted: #a3a3a3;
  --soft: #2b2b2b;
  --sidebar: #232323;
  --green: #11d98d;
  --red: #ff2d63;
  --blue: #6aa2ff;
  --shadow: none;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 46%, transparent) transparent;
}

[hidden] {
  display: none !important;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 42%, transparent);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 68%, transparent);
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

select {
  appearance: none;
  padding-right: 34px !important;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) !important;
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50% !important;
  background-repeat: no-repeat !important;
  background-size: 5px 5px, 5px 5px !important;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.number-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: stretch;
  width: 100%;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.number-control input[type="number"] {
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  padding: 0 11px !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0;
  color: var(--text);
  background: transparent !important;
  font: inherit;
}

.number-stepper {
  display: grid;
  grid-template-rows: 1fr 1fr;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--soft) 70%, var(--panel));
}

.number-stepper button {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.number-stepper button:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
}

.number-stepper button:first-child {
  border-bottom: 1px solid var(--line);
}

.number-stepper svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

.number-stepper button:first-child svg {
  transform: rotate(180deg);
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.dark-theme {
  background: var(--bg);
}

body.modal-open {
  overflow: hidden;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sprite {
  display: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 304px;
  padding: 34px 20px 24px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

body.dark-theme .sidebar {
  background: var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 34px;
  margin-bottom: 62px;
  color: #111827;
  overflow: visible;
}

body.dark-theme .brand,
body.dark-theme .brand span {
  color: var(--text);
}

.brand svg {
  flex: 0 0 42px;
  width: 42px;
  height: 36px;
  stroke: none;
}

.brand span {
  display: block;
  color: #111827;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 5px;
  line-height: 1;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 16px;
  height: 58px;
  padding: 0 16px;
  color: #111827;
  text-decoration: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
}

body.dark-theme .nav-item {
  color: var(--text);
}

body.dark-theme .nav-item svg {
  color: var(--text);
}

.nav-item.active,
.nav-item:hover {
  background: #f1f3f7;
}

body.dark-theme .nav-item.active,
body.dark-theme .nav-item:hover {
  background: var(--soft);
}

.nav-item svg {
  color: #111827;
}

.nav-item b {
  padding: 3px 7px;
  border-radius: 5px;
  color: #4c3ee8;
  background: #eceaff;
  font-size: 10px;
}

.sidebar-bottom {
  position: absolute;
  right: 20px;
  bottom: 24px;
  left: 20px;
}

.status-card,
.profile-card,
.matches-panel,
.selected-match,
.insight-card,
.telegram-banner {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.status-card {
  padding: 20px;
}

.status-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
}

.status-title i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(25, 180, 97, 0.12);
}

.status-card p {
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.mini-line {
  width: 100%;
  height: 42px;
  color: #9299a8;
}

.mini-line polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.profile-card {
  display: grid;
  grid-template-columns: 46px 1fr 18px;
  align-items: center;
  gap: 14px;
  height: 82px;
  padding: 0 16px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  color: white;
  background: #111827;
  font-size: 20px;
  font-weight: 700;
}

body.dark-theme .avatar,
body.dark-theme .telegram-logo,
body.dark-theme .telegram-banner button {
  background: #0b0e14;
}

.profile-card strong {
  display: block;
  font-size: 14px;
}

.profile-card span {
  color: #3952d9;
  font-size: 13px;
}

body.dark-theme .profile-card svg {
  color: var(--text);
}

.profile-card svg {
  width: 16px;
  height: 16px;
  color: #111827;
}

.page {
  margin-left: 304px;
  padding: 36px 40px 28px;
  max-width: 1686px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 34px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search,
.icon-button {
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.topbar .search[hidden] {
  display: none !important;
}

body.dark-theme .search,
body.dark-theme .icon-button {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
}

body.dark-theme .search {
  border-color: color-mix(in srgb, var(--green) 52%, var(--line));
  box-shadow: 0 0 0 1px rgba(17, 217, 141, 0.06);
}

.search {
  display: grid;
  grid-template-columns: 22px 1fr 34px;
  align-items: center;
  gap: 12px;
  width: 290px;
  padding: 0 16px;
  color: #6f7685;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
}

body.dark-theme .search input {
  color: var(--text);
}

body.dark-theme .search input::placeholder {
  color: var(--muted);
}

.search kbd {
  color: #7b808c;
  font: inherit;
  font-size: 13px;
}

body.dark-theme .icon-button[aria-pressed="true"] {
  color: var(--green);
  background: var(--soft);
}

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  border: 1px solid var(--line);
  cursor: pointer;
}

.theme-toggle {
  overflow: hidden;
}

.theme-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity 180ms ease, transform 180ms ease, color 180ms ease;
}

.theme-icon svg {
  width: 20px;
  height: 20px;
}

.theme-icon-sun {
  color: #f7c948;
  opacity: 0;
  transform: translateY(12px) rotate(-45deg) scale(0.72);
}

.theme-icon-moon {
  color: var(--muted);
  opacity: 1;
  transform: translateY(0) rotate(0deg) scale(1);
}

body.dark-theme .theme-icon-sun {
  opacity: 1;
  transform: translateY(0) rotate(0deg) scale(1);
}

body.dark-theme .theme-icon-moon {
  opacity: 0;
  transform: translateY(-12px) rotate(45deg) scale(0.72);
}

.icon-button.has-dot::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #5267ff;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) 560px;
  gap: 24px;
}

.matches-panel {
  position: relative;
  overflow: hidden;
}

.panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  min-height: 90px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
}

h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
}

.panel-tool {
  border: 0;
  background: transparent;
  color: #3b4250;
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(7, 10, 16, 0.58);
  backdrop-filter: blur(2px);
}

.insight-card {
  padding: 20px 22px;
}

.insight-title {
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 800;
}

.insight-title span {
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 5px;
  color: #4c3ee8;
  background: #eceaff;
  font-size: 10px;
}

.insight-card p {
  margin-bottom: 16px;
  font-size: 14px;
}

.confidence-row {
  display: grid;
  grid-template-columns: 90px 1fr 42px;
  align-items: center;
  gap: 12px;
  color: #6f7685;
  font-size: 13px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #e5e8ef;
  overflow: hidden;
}

body.dark-theme .bar {
  background: #303746;
}

.bar i {
  display: block;
  width: 82%;
  height: 100%;
  border-radius: inherit;
  background: #4c5de7;
}

.ev-row {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  color: #6f7685;
  font-size: 14px;
}

.ev-row strong {
  color: var(--green);
}

.telegram-banner {
  display: grid;
  grid-template-columns: 54px 1fr 236px;
  align-items: center;
  gap: 22px;
  height: 94px;
  margin-top: 24px;
  padding: 0 22px;
}

.telegram-logo {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  color: white;
  background: #111827;
}

.telegram-logo svg {
  width: 30px;
  height: 30px;
}

.telegram-banner strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.telegram-banner p {
  color: var(--muted);
}

.telegram-banner button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 50px;
  border: 0;
  border-radius: 6px;
  color: white;
  background: #111827;
  font-size: 15px;
  font-weight: 700;
}

.placeholder-view {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 164px);
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.placeholder-panel {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
  text-align: center;
}

.placeholder-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--green);
  background: var(--soft);
}

.placeholder-icon svg {
  width: 26px;
  height: 26px;
}

.placeholder-panel h2 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.15;
}

.placeholder-panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.empty,
.error {
  padding: 28px;
  color: var(--muted);
}

.error {
  color: var(--red);
}

@media (max-width: 1400px) {
  .content-grid {
    grid-template-columns: minmax(720px, 1fr) 500px;
  }

}

@media (min-width: 1200px) {
  body {
    min-width: 1120px;
  }

  .sidebar {
    width: 248px;
    padding: 22px 14px 18px;
  }

  .brand {
    margin-bottom: 42px;
  }

  .brand svg {
    flex-basis: 34px;
    width: 34px;
    height: 30px;
  }

  .brand span {
    font-size: 13px;
    letter-spacing: 4px;
  }

  .nav {
    gap: 6px;
  }

  .nav-item {
    grid-template-columns: 22px 1fr auto;
    gap: 12px;
    height: 46px;
    padding: 0 12px;
    font-size: 13px;
  }

  .sidebar-bottom {
    right: 14px;
    bottom: 18px;
    left: 14px;
  }

  .status-card {
    padding: 16px;
  }

  .status-card p {
    margin: 14px 0;
  }

  .mini-line {
    height: 32px;
  }

  .profile-card {
    grid-template-columns: 38px 1fr 16px;
    gap: 12px;
    height: 64px;
    padding: 0 12px;
  }

  .avatar {
    width: 38px;
    height: 38px;
    font-size: 17px;
  }

  .page {
    margin-left: 248px;
    padding: 28px 28px 24px;
    max-width: none;
  }

  .topbar {
    gap: 22px;
    margin-bottom: 28px;
  }

  h1 {
    font-size: 24px;
  }

  .topbar p {
    font-size: 14px;
  }

  .controls {
    gap: 12px;
  }

  .search,
  .icon-button {
    height: 44px;
  }

  .search {
    width: 260px;
    padding: 0 14px;
  }

  .content-grid {
    grid-template-columns: minmax(690px, 1fr) 460px;
    gap: 18px;
  }

  .panel-header {
    grid-template-columns: minmax(0, 1fr) 28px;
    min-height: 74px;
    padding: 0 24px;
  }

  h2 {
    font-size: 17px;
  }

  .insight-card {
    padding: 18px;
  }

  .telegram-banner {
    height: 78px;
    margin-top: 18px;
  }
}
