:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #fff;
  --ink: #17243b;
  --muted: #566783;
  --soft: #f0f3fa;
  --line: #e5ebf4;
  --blue: #315cfa;
  --blue-dark: #2149d8;
  --blue-soft: #edf2ff;
  --green: #08794e;
  --red: #b6243e;
  --shadow: 0 18px 60px rgba(28, 51, 105, .10);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #839dff; outline-offset: 3px; }
button:disabled { opacity: .55; cursor: not-allowed; }
svg.ico { width: 19px; height: 19px; flex: 0 0 auto; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 34px); line-height: 1.16; letter-spacing: -.035em; }
h2 { font-size: 18px; line-height: 1.35; letter-spacing: -.015em; }
h3 { font-size: 15px; }
p { line-height: 1.55; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12px; }
.stack { display: grid; gap: 16px; }
.stack.compact { gap: 8px; }
.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.right { justify-content: flex-end; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 19px; font-weight: 780; letter-spacing: -.035em; white-space: nowrap; }
.brand img { width: 37px; height: 37px; }
.btn {
  min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; color: var(--ink);
  background: var(--panel); font-weight: 650; text-decoration: none; line-height: 1.25;
}
.btn:hover:not(:disabled) { background: #f6f8fe; border-color: #d6dff3; text-decoration: none; }
.btn.primary { color: #fff; background: var(--blue); border-color: var(--blue); box-shadow: 0 4px 9px #315cfa29; }
.btn.primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.small { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.btn.small svg { width: 15px; height: 15px; }
.btn.icon { width: 38px; padding: 7px; }
.btn.block { width: 100%; }
select.lang { width: auto; min-width: 114px; min-height: 37px; background: #fff; font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-soft); color: var(--blue-dark); padding: 5px 8px; border-radius: 6px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge.green { background: #e6f7ef; color: #08724b; }
.badge.gray { background: #eef1f6; color: #495a75; }
.badge.amber { background: #fff0d7; color: #8b530c; }
.badge.dot:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; background: #e9eeff; color: #3255ca; font-weight: 750; }
.topbar { background: #fff; min-height: 66px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 11px 25px; gap: 16px; }
.topbar strong { font-size: 13px; }
.topbar .trail { color: var(--muted); font-size: 12px; }
.topbar .trail svg { width: 14px; height: 14px; }
.shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; padding: 21px 14px 14px; min-width: 0; }
.side > .brand { margin: 0 8px 26px; }
.side-name { display: flex; align-items: center; gap: 9px; background: #f6f8fd; border: 1px solid var(--line); padding: 9px; border-radius: 10px; margin: 0 0 27px; min-width: 0; }
.side-name .avatar { width: 31px; height: 31px; border-radius: 8px; }
.side-name div:last-child { overflow: hidden; }
.side-name b, .side-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-name span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav-label { margin: 0 9px 8px; font-size: 10px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .10em; }
.nav { display: grid; gap: 4px; }
.nav a { color: #435473; text-decoration: none; min-height: 44px; display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 9px 11px; font-weight: 640; white-space: nowrap; }
.nav a:hover { background: #f3f6fd; }
.nav a[aria-current=page] { color: var(--blue-dark); background: #eaf0ff; font-weight: 750; }
.side-bottom { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.side-bottom a { display: flex; gap: 8px; align-items: center; padding: 8px; color: var(--muted); font-size: 12px; }
.main { padding: 30px 30px 48px; width: min(100%, 1370px); margin-inline: auto; }
.page-head { margin-bottom: 21px; align-items: flex-start; }
.page-head p { color: var(--muted); margin-top: 7px; }
.banner { isolation: isolate; position: relative; overflow: hidden; color: #fff; background: linear-gradient(112deg, #2442bf, #3563f4 70%, #4c79ff); border: 1px solid #3b64ee; border-radius: 15px; padding: 24px 27px; min-height: 139px; margin-bottom: 17px; box-shadow: 0 7px 22px #315cfa27; }
.banner:after, .banner:before { content: ""; position: absolute; z-index: -1; pointer-events: none; border: 1px solid #ffffff3c; border-radius: 50%; width: 350px; height: 350px; right: -30px; top: -151px; box-shadow: 0 0 0 21px #ffffff12, 0 0 0 43px #ffffff0b, 0 0 0 66px #ffffff0b; }
.banner:after { width: 114px; height: 114px; right: 112px; top: 46px; box-shadow: 0 0 0 18px #ffffff0f, 0 0 0 34px #ffffff09; }
.banner .balance { font-weight: 780; font-size: 33px; letter-spacing: -.03em; display: block; margin: 6px 0 1px; font-variant-numeric: tabular-nums; }
.banner p { color: #edf3ff; font-size: 12px; position: relative; }
.banner .badge { background: #ffffff22; border: 1px solid #ffffff38; color: white; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.card.pad { padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 15px 17px; }
.card-head h2 { font-size: 16px; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; min-width: 590px; font-size: 13px; table-layout: auto; }
th { font-size: 11px; font-weight: 750; text-align: left; background: #f6f8fc; color: #51617b; white-space: nowrap; }
td, th { padding: 11px 15px; border-top: 1px solid var(--line); vertical-align: middle; }
td { color: var(--ink); }
tr:hover td { background: #fafbff; }
td .flex { flex-wrap: nowrap; }
td.word, .word { overflow-wrap: anywhere; }
td.numeric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.target-details table { min-width: 0; }
.target-details td, .target-details th { padding-inline: 9px; }
.target-details .card-head select { width: auto; max-width: 100%; min-height: 37px; font-size: 12px; }
td .progress { width: min(105px, 98%); height: 6px; display: block; accent-color: var(--blue); margin-top: 5px; }
.bottom { padding: 11px 15px; border-top: 1px solid var(--line); }
.empty { text-align: center; padding: 35px 16px; display: grid; gap: 7px; justify-items: center; }
.empty-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--blue-soft); color: var(--blue-dark); margin-bottom: 3px; }
.empty-mark svg { width: 25px; height: 25px; }
.empty .btn { margin-top: 6px; }
.channel { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.channel-mark { border-radius: 9px; display: inline-grid; flex: 0 0 auto; place-items: center; width: 29px; height: 29px; color: #0a7c54; background: #e4f7ef; }
.channel-mark.telegram { color: #1570ab; background: #e5f5ff; }
.channel-mark svg { width: 17px; height: 17px; }
.fields { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span:first-child { font-weight: 670; }
input:not([type=file]), select, textarea { min-height: 41px; width: 100%; border-radius: 8px; border: 1px solid #d9e2f2; background: white; color: var(--ink); padding: 8px 10px; }
input::placeholder, textarea::placeholder { color: #687992; }
textarea { min-height: 95px; resize: vertical; }
textarea.targets { min-height: 155px; font: 13px/1.55 ui-monospace, monospace; }
input.error, textarea.error { border-color: var(--red); }
.flash-error { border: 1px solid #f6cad3; background: #fff0f2; color: #972039; padding: 9px 10px; border-radius: 8px; font-size: 12px; overflow-wrap: anywhere; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.auth-layout { min-height: 100dvh; padding: 25px 5vw 42px; background: radial-gradient(ellipse at 9% 2%, #e6edff 0, transparent 52%), #f6f8fd; }
.auth-header { width: min(1140px, 100%); margin: 0 auto 45px; }
.auth-grid { width: min(1050px, 100%); margin: auto; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr); align-items: start; gap: 26px; }
.auth-hero {
  position: relative; isolation: isolate; overflow: hidden; border-radius: 23px; min-height: 476px; padding: clamp(25px, 4vw, 49px);
  background: linear-gradient(140deg, #1c3fc3 0%, #315cfa 67%, #5582ff 100%); color: white; box-shadow: 0 23px 56px #203ebc37;
}
.auth-hero h1 { font-size: clamp(33px, 4.6vw, 53px); line-height: 1.05; max-width: 10.7em; letter-spacing: -.055em; margin: 20px 0 14px; }
.auth-hero p { font-size: 15px; color: #eaf0ff; max-width: 29em; }
.auth-hero .badge { background: #ffffff22; border: 1px solid #ffffff35; color: white; }
.orbit { position: absolute; z-index: -1; pointer-events: none; bottom: -155px; right: -60px; width: 430px; height: 430px; border: 1px solid #ffffff67; border-radius: 50%; box-shadow: 0 0 0 33px #ffffff1e, 0 0 0 68px #ffffff12, 0 0 0 108px #ffffff0d; }
.hero-shapes { position: absolute; bottom: 28px; right: 27px; width: 175px; height: 144px; }
.hero-shapes i { display: block; position: absolute; width: 106px; height: 56px; border: 1px solid #fff7; border-radius: 11px; transform: rotate(-24deg) skewX(17deg); background: linear-gradient(140deg,#ffffff99,#a3b9ff29); box-shadow: 0 8px 24px #1e3cc344; }
.hero-shapes i:nth-child(1) { left: 22px; top: 77px; }
.hero-shapes i:nth-child(2) { left: 36px; top: 51px; }
.hero-shapes i:nth-child(3) { left: 49px; top: 25px; }
.auth-card { background: white; border: 1px solid var(--line); border-radius: 20px; padding: clamp(22px, 4vw, 34px); box-shadow: var(--shadow); }
.auth-card h2 { font-size: 26px; letter-spacing: -.035em; }
.auth-card > p { margin: 8px 0 18px; color: var(--muted); }
.segment { display: inline-flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 9px; flex-wrap: wrap; }
.segment button { border: 0; background: transparent; color: var(--muted); padding: 8px 11px; border-radius: 6px; font-size: 12px; font-weight: 720; }
.segment button[aria-selected=true] { background: #fff; color: var(--blue-dark); box-shadow: 0 1px 5px #24356b12; }
.auth-card .segment { display: flex; margin-bottom: 18px; }
.auth-card .segment button { flex: 1; }
.captcha { display: grid; gap: 7px; }
.captcha-grid { position: relative; aspect-ratio: 1; max-width: 216px; width: 100%; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); align-self: start; }
.captcha-grid img, .captcha-cells { position: absolute; inset: 0; width: 100%; height: 100%; }
.captcha-cells { display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr); }
.captcha-cells button { display: grid; place-items: center; border: 1px solid transparent; background: transparent; color: var(--blue-dark); font-size: 0; }
.captcha-cells button:hover { background: #315cfa18; }
.captcha-cells button[aria-pressed=true] { background: #315cfa25; border: 2px solid var(--blue); }
.captcha-cells button[aria-pressed=true]::after { content: "✓"; font-size: 22px; font-weight: 800; color: #163cb8; }
dialog { top: 0; border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(640px, 94vw); max-height: 92dvh; box-shadow: 0 24px 90px #17243b45; color: var(--ink); }
dialog::backdrop { background: #1b29496c; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 19px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 18px 19px; }
.dialog-body .btn.right { justify-self: end; }
.dialog-foot { padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.worker-app-qr { display: block; margin-inline: auto; max-width: 100%; height: auto; background: #fff; image-rendering: pixelated; }
.quote { padding: 13px; background: var(--blue-soft); border-radius: 10px; }
.quote strong { font-size: 22px; color: var(--blue-dark); }
.channel-dropdown { position: relative; }
.channel-dropdown summary { list-style: none; min-height: 40px; border: 1px solid #d9e2f2; border-radius: 8px; padding: 4px 9px; display: flex; gap: 10px; align-items: center; justify-content: space-between; cursor: pointer; }
.channel-dropdown summary::-webkit-details-marker { display: none; }
.channel-dropdown summary > svg { transform: rotate(90deg); }
.channel-options { position: absolute; z-index: 2; inset: calc(100% + 4px) 0 auto; background: white; border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); padding: 4px; }
.channel-options button { display: block; width: 100%; border: 0; padding: 5px; border-radius: 6px; text-align: left; color: var(--ink); background: white; }
.channel-options button:hover, .channel-options button[aria-pressed=true] { background: var(--blue-soft); }
.kv { display: grid; grid-template-columns: minmax(110px, .4fr) minmax(0, 1fr); margin: 0; border-top: 1px solid var(--line); }
.kv dt, .kv dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { padding-left: 10px; font-weight: 640; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px; margin: 0; background: #f1f5fc; border-radius: 8px; max-height: 200px; overflow: auto; }
.receipt-img { max-width: 100%; max-height: 50vh; width: auto; object-fit: contain; margin-inline: auto; border-radius: 8px; }
.deck { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px,1fr)); gap: 15px; }
.toast { position: fixed; z-index: 8; right: 22px; bottom: 20px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); background: #fff; color: var(--ink); max-width: calc(100vw - 44px); }
.toast.error { color: var(--red); }
@media (max-width: 850px) {
  .shell { grid-template-columns: 183px minmax(0, 1fr); }
  .main { padding: 22px 17px 36px; }
  .side { padding-inline: 9px; }
  .topbar { padding-inline: 16px; }
  .auth-header { margin-bottom: 24px; }
}
@media (max-width: 640px) {
  .shell { display: block; }
  .side { position: static; height: auto; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); border-right: 0; }
  .side > .brand { margin: 0 3px 9px; }
  .side > .brand img { width: 30px; height: 30px; }
  .nav { display: flex; overflow: auto; gap: 3px; }
  .nav a { padding: 6px 8px; min-height: 35px; font-size: 12px; flex: 0 0 auto; }
  .nav a svg { width: 15px; height: 15px; }
  .side-name, .nav-label, .side-bottom, .topbar .trail { display: none; }
  .topbar { min-height: 50px; padding: 6px 12px; }
  .main { padding: 16px 11px 27px; }
  .auth-layout { padding: 13px 12px 25px; }
  .auth-header { margin-bottom: 15px; gap: 6px; }
  .auth-header .brand { font-size: 17px; }
  .auth-header .brand img { width: 29px; height: 29px; }
  .auth-header a.btn { font-size: 11px; padding: 5px 7px; min-height: 32px; }
  select.lang { min-width: 95px; }
  .auth-grid { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .auth-hero { min-height: 200px; padding: 19px; }
  .auth-hero h1 { max-width: 15em; font-size: 30px; margin: 13px 0 9px; }
  .auth-hero p { font-size: 13px; max-width: 22em; }
  .hero-shapes { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a { transition: background .15s, border-color .15s, color .15s; }
}

.hint.inset { padding: 0 17px 13px; }
.search-input { width: 185px; }

.permission-list { display: grid; gap: 10px; }
.permission-group { border: 1px solid var(--line); border-radius: 9px; margin: 0; min-width: 0; padding: 8px 13px 13px; }
.permission-group legend { padding: 0 5px; margin-left: -5px; font-weight: 690; color: var(--ink); }
.permission-options { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 15px; }
.permission-options label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.permission-options label:has(input:disabled) { color: var(--muted); }
.permission-options input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--blue); }

.credential-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.credential-row .btn { min-height: 41px; }
