:root {
  color-scheme: light;
  --navy: #10244b;
  --ink: #152846;
  --blue: #215bd5;
  --blue-dark: #1948af;
  --muted: #52647b;
  --border: #dbe4ef;
  --surface: #fff;
  --canvas: #f3f6fa;
  --green: #147352;
  --amber: #875021;
  --radius: 12px;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.52;
  background: var(--canvas);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
a { color: var(--blue-dark); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #4782ff; outline-offset: 3px; }
button:disabled, input:disabled { cursor: not-allowed; }
button:disabled { opacity: .55; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.55rem); line-height: 1.09; letter-spacing: -.045em; }
h2 { font-size: 1.28rem; line-height: 1.25; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
ul, ol { padding-left: 1.3rem; }
.small, small { font-size: .87rem; }
.muted { color: var(--muted); }
.skip { position: fixed; z-index: 20; left: 1rem; top: -5rem; padding: .6rem 1rem; background: #fff; }
.skip:focus { top: 1rem; }
.layout { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; min-height: 100svh; height: fit-content; position: sticky; top: 0; padding: 24px 17px 20px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 42px; color: inherit; text-decoration: none; }
.brand img { object-fit: cover; border-radius: 11px; }
.brand strong { display: block; font-size: 1.22rem; line-height: 1.22; letter-spacing: -.02em; }
.brand small { color: #9fb5d9; font-size: .69rem; letter-spacing: .12em; }
.nav { display: grid; gap: 5px; }
.nav a, .sidebar-help { min-width: 0; min-height: 46px; display: flex; align-items: center; gap: 11px; padding: 8px 12px; text-align: left; border-radius: 9px; text-decoration: none; color: #c5d3eb; }
.nav a:hover, .sidebar-help:hover { background: #1b355f; color: #fff; }
.nav a[aria-current="page"] { background: #284677; color: #fff; font-weight: 650; }
.nav-icon { min-width: 23px; text-align: center; font-size: 1.3rem; line-height: 1; }
.sidebar-help { margin-top: auto; border: 0; background: transparent; }
.sidebar-help span, .small-help { display: inline-grid; place-items: center; width: 25px; height: 25px; border: 1px solid currentcolor; border-radius: 50%; font-weight: 700; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 65px; padding: 0 clamp(16px, 4.5vw, 54px); border-bottom: 1px solid var(--border); background: #fff; }
.topbar strong { font-size: .97rem; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.demo-label { border: 1px solid #bdcce4; border-radius: 99px; padding: 3px 10px; font-size: .76rem; color: #334f7b; font-weight: 650; }
.small-help { display: none; color: var(--blue-dark); background: #fff; }
main { max-width: 1296px; margin: 0 auto; padding: clamp(16px, 4.5vw, 54px); }
.page { display: grid; gap: 20px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.page-heading p { margin-top: 8px; max-width: 69ch; }
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 19px; padding: clamp(20px, 3vw, 36px); isolation: isolate; border-radius: 16px; color: #fff; background: #132a55; }
.hero::before {
  content: ""; z-index: -1; pointer-events: none; position: absolute; right: -27px; top: -111px; width: 570px; height: 388px;
  background: radial-gradient(circle at center, #7cadff70 1.5px, transparent 3px), repeating-radial-gradient(circle at center, transparent 0 46px, #91b8fd2b 47px 48px, transparent 49px 60px);
  mask-image: linear-gradient(to left, #000, #000 51%, transparent 95%);
}
.hero h1 { margin: 13px 0 7px; }
.hero p { max-width: 60ch; color: #d2e0f5; }
.hero .button.secondary { background: #fff; border-color: #fff; }
.hero .button.stop { background: #f7e0e4; color: #942d44; border-color: #f7e0e4; }
.hero .actions { align-self: end; }
.flag { display: inline-flex; align-items: center; min-height: 26px; gap: .45ch; border-radius: 99px; padding: 4px 9px; background: #edf3ff; color: #234477; font-size: .79rem; font-weight: 680; line-height: 1.2; }
.flag::before { content: ""; flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.flag.readable { background: #e5f5ed; color: var(--green); }
.flag.connecting { background: #e8f0ff; color: #2855a2; }
.flag.approval { background: #fdf0df; color: var(--amber); }
.flag.unavailable { background: #eceff4; color: #556379; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.metric { min-width: 0; padding: 17px 21px; border-right: 1px solid var(--border); }
.metric:last-child { border-right: 0; }
.metric dt { color: var(--muted); font-size: .86rem; }
.metric dd { font-weight: 720; font-size: clamp(1.55rem, 3.5vw, 2.04rem); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric:first-child dd { color: var(--green); }
.cols { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); padding: clamp(15px, 2.4vw, 24px); min-width: 0; }
.panel-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: 14px; }
.panel p + p { margin-top: 10px; }
.panel p + .actions, .panel p + .button { margin-top: 13px; }
.lead-snippet { border-left: 3px solid #6b99ed; padding: 2px 0 2px 12px; }
.first-lead { display: grid; gap: 9px; }
.first-lead .panel-title { margin-bottom: 0; }
.first-lead .lead-snippet { margin-top: 3px; }
dl.details { display: grid; gap: 9px; }
.details > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 1px solid #ebf0f6; padding: 5px 0 9px; }
.details > div:last-child { border-bottom: 0; padding-bottom: 0; }
.details dt { color: var(--muted); }
.details dd { text-align: right; font-weight: 650; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button { display: inline-flex; min-height: 44px; justify-content: center; align-items: center; gap: 7px; max-width: 100%; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; text-decoration: none; color: #fff; background: var(--blue); text-align: center; }
.button:hover:not(:disabled) { background: var(--blue-dark); }
.button.secondary { color: var(--ink); border-color: #c9d6e8; background: #fff; }
.button.secondary:hover:not(:disabled) { background: #eaf1fd; }
.button.subtle { background: transparent; color: var(--blue-dark); border-color: transparent; }
.button.subtle:hover:not(:disabled) { background: #eaf1fd; }
.button[aria-pressed="true"] { background: #e7f1ff; border-color: #6294eb; color: #193f94; }
.button.stop:hover:not(:disabled) { background: #f8c8d2; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
label.field { display: grid; gap: 5px; color: var(--ink); font-weight: 630; font-size: .91rem; }
label.field .hint { font-weight: 400; color: var(--muted); }
input:not([type=checkbox]), select, textarea { width: 100%; min-height: 44px; border: 1px solid #b7c7db; border-radius: 8px; background: #fff; padding: 9px 10px; color: var(--ink); }
textarea { min-height: 94px; resize: vertical; }
.filterbar { display: grid; grid-template-columns: minmax(150px, 1.5fr) repeat(4, minmax(116px, 1fr)); gap: 9px; }
.filterbar label { font-size: .82rem; }
.catalog { display: grid; gap: 13px; }
.collection-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.collection-head h2 { font-size: 1.08rem; }
.filter-status { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; }
.collection { list-style: none; margin: 0; padding: 0; }
.chat-row { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(118px, auto); gap: 12px; align-items: center; min-height: 64px; padding: 9px 0; border-top: 1px solid #e5ecf5; }
.chat-row:first-child { border-top: 0; }
.chat-row .flag { justify-self: end; }
.chat-row .chat-name { display: block; font-weight: 690; line-height: 1.25; }
.chat-row small { display: block; margin-top: 3px; color: var(--muted); }
.chat-row input { display: grid; place-items: center; width: 19px; height: 19px; accent-color: var(--blue); margin: 0; }
.chat-row label { cursor: pointer; }
.chat-row.disabled label { cursor: default; }
.chat-row label::after { content: ""; position: absolute; inset: 0; }
.chat-row :focus-visible { outline-offset: 5px; }
.toggle-line { display: flex; align-items: center; gap: 7px; min-height: 44px; }
.toggle-line input { width: 18px; height: 18px; accent-color: var(--blue); }
.reserve { display: grid; gap: 13px; }
.reserve h2 { display: flex; align-items: center; gap: 10px; }
.center-empty { padding: 22px 0; color: var(--muted); }
.inline-note { padding: 10px 13px; background: #eef4fc; border-radius: 8px; color: #354e73; overflow-wrap: anywhere; }
.inline-note.warning { background: #fff3e1; color: #6c431d; }
.wizard { display: grid; gap: 16px; }
.wizard .steps { display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; gap: 8px; padding: 0; margin: 0; }
.steps li { color: var(--muted); border-top: 3px solid #cdd9e8; padding-top: 7px; font-size: .84rem; }
.steps li[aria-current="step"] { color: var(--blue-dark); border-color: var(--blue); font-weight: 700; }
.steps li.done { border-color: #58a88a; }
.form-stack { display: grid; gap: 15px; }
.wizard .actions { margin-top: 8px; }
.leads-list, .ticket-list { display: grid; gap: 11px; }
.lead { display: grid; gap: 11px; }
.lead header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lead header p { margin-top: 4px; }
.lead .flag { flex: 0 0 auto; }
.lead footer { display: flex; flex-wrap: wrap; gap: 7px; }
.ticket { border-top: 1px solid #e5ecf5; padding-top: 11px; }
.ticket:first-child { border: 0; padding-top: 0; }
.ticket summary { font-weight: 650; }
.ticket p { white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket p + p { margin-top: 6px; }
.ticket > div { margin-top: 9px; }
.keep-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
dialog { width: min(620px, calc(100vw - 26px)); max-height: 91svh; border: 1px solid var(--border); border-radius: 15px; padding: 20px; color: var(--ink); }
dialog::backdrop { background: #0c1c37ad; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.close { min-width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 8px; color: var(--ink); background: #fff; font-size: 1.5rem; }
.guide { display: grid; gap: 15px; }
.guide img { max-width: 100%; max-height: 380px; width: auto; display: block; margin: 0 auto; border: 1px solid var(--border); border-radius: 9px; }
.guide li { margin: 7px 0; }
.toast { position: fixed; left: 50%; bottom: 1rem; z-index: 5; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 28px); padding: 10px 15px; border-radius: 8px; background: var(--navy); color: #fff; box-shadow: 0 8px 25px #132a5531; visibility: hidden; }
.toast.visible { visibility: visible; }
@media (max-width: 1050px) {
  .filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filterbar .search-field { grid-column: 1 / -1; }
  .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .layout { display: block; }
  .sidebar { position: static; display: contents; }
  .brand { display: none; }
  .nav { position: fixed; z-index: 4; inset: auto 0 0; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0; padding: 4px 5px calc(4px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--border); }
  .nav a { text-align: center; justify-content: center; flex-direction: column; gap: 4px; min-height: 52px; padding: 4px 1px; color: var(--muted); border-radius: 7px; font-size: .77rem; }
  .nav a[aria-current="page"], .nav a:hover { background: #eaf1fc; color: var(--blue-dark); }
  .nav-icon { font-size: 1.23rem; }
  .topbar { min-height: 56px; }
  .topbar strong::before { content: ""; display: inline-block; width: 28px; height: 28px; background: url("logo.jpg") center / cover; vertical-align: middle; margin-right: 9px; border-radius: 6px; }
  .sidebar-help { display: none; }
  .small-help { display: inline-grid; width: 36px; height: 36px; }
  main { padding-bottom: calc(79px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(67px + env(safe-area-inset-bottom)); }
}
@media (max-width: 590px) {
  .page { gap: 14px; }
  .cols { grid-template-columns: 1fr; gap: 13px; }
  .fields { grid-template-columns: 1fr; }
  .metric { padding: 13px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .hero::before { top: -105px; right: -176px; mask-image: linear-gradient(to left, #000, #000 38%, transparent 83%); }
  .hero .actions .button { flex: 1 1 130px; }
  .chat-row { grid-template-columns: 22px minmax(0, 1fr); gap: 3px 9px; padding: 10px 0; }
  .chat-row .flag { grid-column: 2; justify-self: start; }
  .chat-row input { align-self: start; }
  .lead footer .button { flex: 1 1 124px; padding-inline: 6px; }
  .steps li { font-size: .76rem; }
}
.top-support {
  display: inline-grid; place-items: center; min-width: 44px; min-height: 44px;
  padding: 0; border: 0; border-radius: 9px; background: transparent;
  color: var(--blue-dark); font-weight: 750; font-size: 1.25rem; line-height: 1;
}
.top-support span {
  display: inline-grid; place-items: center; width: 25px; height: 22px;
  border: 1px solid currentcolor; border-radius: 6px; letter-spacing: .06em;
}
.top-support:hover { background: #edf3ff; }
@media (max-width: 820px) {
  .top-actions { gap: 6px; }
  .top-support { min-width: 43px; }
}

.connected-cabinet .hero h1, .connected-cabinet .panel { overflow-wrap: anywhere; }
.connected-cabinet .lead-snippet { white-space: pre-wrap; }
.connected-cabinet .page > .field { max-width: 24rem; }
.connected-cabinet .chat-row { grid-template-columns: minmax(0, 1fr) minmax(118px, auto); }
.connected-pager { margin-top: 12px; }
@media (max-width: 580px) {
  .connected-cabinet .chat-row { grid-template-columns: minmax(0, 1fr); }
  .connected-cabinet .chat-row .flag { grid-column: 1; }
}
