/* NewsDroid AI — личный кабинет. Токены совпадают с лендингом (newsdroid.ru):
   сознательно тёмная тема, как у основного сайта. */
:root{
  color-scheme: dark;
  --bg:#0B0F14;
  --surface:#121822;
  --surface-2:#1A2230;
  --surface-3:#222C3D;
  --border:#232C3A;
  --border-strong:#33405A;
  --text:#E8ECF1;
  --text-muted:#8A94A3;
  --text-dim:#5F6A7A;
  --accent:#FF6A3D;
  --accent-soft:rgba(255,106,61,.12);
  --ai:#4FD1C5;
  --ai-soft:rgba(79,209,197,.12);
  /* семантика состояний - отдельно от фирменного акцента */
  --ok:#3DD68C;   --ok-soft:rgba(61,214,140,.12);
  --warn:#F5B84C; --warn-soft:rgba(245,184,76,.12);
  --bad:#F2545B;  --bad-soft:rgba(242,84,91,.12);
  --font-display:'Space Grotesk',system-ui,sans-serif;
  --font-body:'Inter',system-ui,sans-serif;
  --font-mono:'JetBrains Mono',ui-monospace,monospace;
  --radius:12px;
  --radius-sm:8px;
  --sidebar:236px;
}
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{background:var(--bg);color:var(--text);font-family:var(--font-body);font-size:14.5px;line-height:1.5;min-height:100vh;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid var(--ai);outline-offset:2px}
[hidden]{display:none!important}
h1,h2,h3{font-family:var(--font-display);font-weight:600;letter-spacing:-.01em;text-wrap:balance}
.mono{font-family:var(--font-mono)}
.muted{color:var(--text-muted)}
.dim{color:var(--text-dim)}
.nowrap{white-space:nowrap}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---------- каркас ---------- */
.shell{display:grid;grid-template-columns:var(--sidebar) minmax(0,1fr);min-height:100vh}
.side{position:sticky;top:0;height:100vh;display:flex;flex-direction:column;gap:4px;padding:20px 14px;border-right:1px solid var(--border);background:rgba(18,24,34,.6);overflow-y:auto}
.brand{display:flex;align-items:center;gap:9px;padding:4px 10px 18px;font-family:var(--font-display);font-weight:700;font-size:18px}
.brand i{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 10px var(--accent)}
.brand b{color:var(--accent);font-weight:700;margin-left:-6px}
.nav-group{font-family:var(--font-mono);font-size:10.5px;text-transform:uppercase;letter-spacing:.08em;color:var(--text-dim);padding:14px 10px 6px}
.nav a{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--radius-sm);color:var(--text-muted);font-weight:500;transition:background .15s,color .15s}
.nav a svg{width:17px;height:17px;flex-shrink:0;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.nav a:hover{background:var(--surface-2);color:var(--text)}
.nav a.active{background:var(--surface-2);color:var(--text);box-shadow:inset 2px 0 0 var(--accent)}
.nav a .count{margin-left:auto;font-family:var(--font-mono);font-size:11px;color:var(--text-muted);background:var(--surface-3);border-radius:999px;padding:1px 8px}
.side-foot{margin-top:auto;padding:14px 10px 0;border-top:1px solid var(--border);display:flex;flex-direction:column;gap:10px}
.who{display:flex;align-items:center;gap:10px;min-width:0}
.avatar{width:32px;height:32px;border-radius:50%;background:var(--surface-3);display:grid;place-items:center;font-family:var(--font-display);font-weight:600;color:var(--ai);flex-shrink:0}
.who-name{font-weight:600;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.who-sub{font-size:11.5px;color:var(--text-muted)}
.main{min-width:0;padding:32px clamp(18px,4vw,48px) 80px}
.page{max-width:1040px;margin:0 auto}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:24px}
.page-head h1{font-size:28px;line-height:1.15}
.page-head p{color:var(--text-muted);margin-top:4px;max-width:60ch}
.page-actions{display:flex;gap:10px;flex-wrap:wrap}

@media (max-width:880px){
  .shell{grid-template-columns:1fr}
  .side{position:sticky;top:0;z-index:50;height:auto;flex-direction:row;align-items:center;gap:6px;padding:10px 14px;border-right:0;border-bottom:1px solid var(--border);background:rgba(11,15,20,.92);backdrop-filter:blur(10px);overflow-x:auto}
  .brand{padding:0 8px 0 0}
  .nav{display:flex;gap:2px}
  .nav a{padding:7px 11px;white-space:nowrap}
  .nav a svg{display:none}
  .nav-group,.side-foot .who{display:none}
  .side-foot{margin:0 0 0 auto;padding:0;border:0;flex-direction:row}
  .main{padding-top:22px}
}

/* ---------- базовые компоненты ---------- */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px}
.card + .card{margin-top:16px}
.grid > .card + .card,.grid > .kpi + .kpi,.grid > .item + .item{margin-top:0}
.grid + .card,.card + .grid,.grid + .grid,.alerts + .grid,.page-head + .grid,.page-head + .card{margin-top:16px}
.card-title{font-family:var(--font-display);font-size:16px;font-weight:600;margin-bottom:4px}
.card-sub{color:var(--text-muted);font-size:13px;margin-bottom:16px;max-width:70ch}
.grid{display:grid;gap:16px}
.g2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media (max-width:900px){.g4{grid-template-columns:repeat(2,minmax(0,1fr))}.g3{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:620px){.g2,.g3,.g4{grid-template-columns:1fr}}
.stack{display:flex;flex-direction:column;gap:16px}
.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.row.between{justify-content:space-between}
.section-label{font-family:var(--font-mono);font-size:11px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-muted);margin:28px 0 12px}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:1px solid var(--border-strong);background:var(--surface-2);color:var(--text);font-weight:600;font-size:13.5px;padding:9px 16px;border-radius:999px;transition:border-color .15s,background .15s,transform .15s,box-shadow .15s;white-space:nowrap}
.btn:hover{border-color:var(--text-muted)}
.btn:active{transform:translateY(1px)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#0B0F14}
.btn.primary:hover{box-shadow:0 6px 20px rgba(255,106,61,.3);transform:translateY(-1px)}
.btn.ghost{background:transparent}
.btn.danger{color:var(--bad);border-color:rgba(242,84,91,.4);background:transparent}
.btn.danger:hover{background:var(--bad-soft);border-color:var(--bad)}
.btn.sm{padding:6px 12px;font-size:12.5px}
.btn[disabled]{opacity:.5;pointer-events:none}
.btn svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.icon-btn{width:32px;height:32px;display:inline-grid;place-items:center;border-radius:var(--radius-sm);border:1px solid var(--border);background:var(--surface-2);color:var(--text-muted);transition:border-color .15s,color .15s}
.icon-btn:hover{border-color:var(--ai);color:var(--ai)}
.icon-btn.danger:hover{border-color:var(--bad);color:var(--bad)}
.icon-btn svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

.pill{display:inline-flex;align-items:center;gap:6px;font-family:var(--font-mono);font-size:11px;padding:3px 10px;border-radius:999px;border:1px solid var(--border-strong);color:var(--text-muted);background:var(--surface-2);white-space:nowrap}
.pill::before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor}
.pill.ok{color:var(--ok);background:var(--ok-soft);border-color:rgba(61,214,140,.3)}
.pill.warn{color:var(--warn);background:var(--warn-soft);border-color:rgba(245,184,76,.3)}
.pill.bad{color:var(--bad);background:var(--bad-soft);border-color:rgba(242,84,91,.3)}
.pill.ai{color:var(--ai);background:var(--ai-soft);border-color:rgba(79,209,197,.3)}
.pill.plain::before{display:none}
.tag{font-family:var(--font-mono);font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;padding:2px 8px;border-radius:6px;background:var(--surface-3);color:var(--text-muted)}

/* ---------- формы ---------- */
.field{display:flex;flex-direction:column;gap:6px;margin-bottom:16px}
.field label,.label{font-size:12.5px;font-weight:600;color:var(--text)}
.hint{font-size:12px;color:var(--text-muted)}
input[type=text],input[type=email],input[type=number],input[type=search],select,textarea{width:100%;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius-sm);padding:10px 12px;font-size:14px;transition:border-color .15s}
input::placeholder,textarea::placeholder{color:var(--text-dim)}
input:hover,select:hover,textarea:hover{border-color:var(--border-strong)}
input:focus,select:focus,textarea:focus{border-color:var(--ai);outline:none}
textarea{resize:vertical;min-height:130px;line-height:1.5}
select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238A94A3' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:32px}
.counter{font-family:var(--font-mono);font-size:11px;color:var(--text-dim);text-align:right}
.counter.over{color:var(--bad)}
.input-row{display:flex;gap:10px}
.input-row > *:first-child{flex:1}
.switch{position:relative;display:inline-flex;align-items:center;gap:10px;cursor:pointer;user-select:none}
.switch input{position:absolute;opacity:0;width:0;height:0}
.switch .track{width:38px;height:22px;border-radius:999px;background:var(--surface-3);border:1px solid var(--border-strong);transition:background .15s,border-color .15s;position:relative;flex-shrink:0}
.switch .track::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--text-muted);transition:transform .15s,background .15s}
.switch input:checked + .track{background:var(--ai-soft);border-color:var(--ai)}
.switch input:checked + .track::after{transform:translateX(16px);background:var(--ai)}
.switch input:focus-visible + .track{outline:2px solid var(--ai);outline-offset:2px}
.seg{display:inline-flex;background:var(--surface-2);border:1px solid var(--border);border-radius:999px;padding:3px;flex-wrap:wrap}
.seg button{border:0;background:none;color:var(--text-muted);font-size:13px;font-weight:500;padding:6px 14px;border-radius:999px;transition:background .15s,color .15s}
.seg button.on{background:var(--surface-3);color:var(--text)}
.seg button:hover{color:var(--text)}
.setting{display:flex;justify-content:space-between;align-items:center;gap:18px;padding:14px 0;border-top:1px solid var(--border)}
.setting:first-of-type{border-top:0;padding-top:0}
.setting-text b{display:block;font-weight:600}
.setting-text span{color:var(--text-muted);font-size:13px}

/* ---------- алерты ---------- */
.alerts{display:flex;flex-direction:column;gap:10px;margin-bottom:20px}
.alert{display:flex;align-items:center;gap:14px;justify-content:space-between;padding:12px 16px;border-radius:var(--radius);border:1px solid var(--border);background:var(--surface);flex-wrap:wrap}
.alert .a-text{display:flex;gap:10px;align-items:flex-start;flex:1;min-width:240px}
.alert .a-dot{width:8px;height:8px;border-radius:50%;margin-top:7px;flex-shrink:0;background:var(--ai)}
.alert.warn{border-color:rgba(245,184,76,.35);background:var(--warn-soft)}.alert.warn .a-dot{background:var(--warn)}
.alert.bad{border-color:rgba(242,84,91,.35);background:var(--bad-soft)}.alert.bad .a-dot{background:var(--bad)}
.alert.info{border-color:rgba(79,209,197,.3);background:var(--ai-soft)}

/* ---------- KPI ---------- */
.kpi{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 18px;display:flex;flex-direction:column;gap:6px;min-width:0}
.kpi .k-label{font-family:var(--font-mono);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-muted)}
.kpi .k-value{font-family:var(--font-display);font-size:30px;font-weight:600;line-height:1.1;font-variant-numeric:tabular-nums}
.kpi .k-sub{font-size:12px;color:var(--text-muted)}
.kpi.accent .k-value{color:var(--accent)}
.kpi.ai .k-value{color:var(--ai)}
.kpi.bad .k-value{color:var(--bad)}

/* ---------- графики ---------- */
.chart{width:100%;height:auto;display:block;overflow:visible}
.chart .grid-line{stroke:var(--border);stroke-width:1}
.chart .axis{fill:var(--text-dim);font-family:var(--font-mono);font-size:10px}
.chart .bar{fill:var(--accent);opacity:.55;transition:opacity .15s}
.chart .bar.last{opacity:1}
.chart .bar:hover{opacity:1}
.chart .line{fill:none;stroke:var(--ai);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.chart .area{fill:url(#none)}
.chart .dot{fill:var(--ai);stroke:var(--bg);stroke-width:2}
.chart-wrap{position:relative}
.chart-tip{position:absolute;pointer-events:none;background:var(--surface-3);border:1px solid var(--border-strong);padding:5px 9px;border-radius:6px;font-family:var(--font-mono);font-size:11px;white-space:nowrap;transform:translate(-50%,-110%);opacity:0;transition:opacity .1s;z-index:5}
.chart-tip.on{opacity:1}
.funnel-row{display:grid;grid-template-columns:minmax(150px,220px) 1fr 90px;align-items:center;gap:12px;padding:7px 0}
.funnel-bar{height:10px;background:var(--surface-3);border-radius:999px;overflow:hidden}
.funnel-bar > i{display:block;height:100%;background:linear-gradient(90deg,var(--accent),#FF9A6B);border-radius:999px}
.funnel-val{font-family:var(--font-mono);font-size:12px;text-align:right}
@media (max-width:620px){.funnel-row{grid-template-columns:1fr 70px}.funnel-bar{grid-column:1/-1;order:3}}
.progress{height:6px;background:var(--surface-3);border-radius:999px;overflow:hidden;min-width:70px}
.progress > i{display:block;height:100%;background:var(--ai);border-radius:999px}
.progress.full > i{background:var(--warn)}

/* ---------- таблицы и списки ---------- */
.table-wrap{overflow-x:auto;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface)}
table{width:100%;border-collapse:collapse;font-size:13.5px}
th{font-family:var(--font-mono);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-muted);text-align:left;font-weight:500;padding:11px 16px;border-bottom:1px solid var(--border);white-space:nowrap}
td{padding:12px 16px;border-bottom:1px solid var(--border);vertical-align:middle}
tr:last-child td{border-bottom:0}
tbody tr.click{cursor:pointer;transition:background .12s}
tbody tr.click:hover{background:var(--surface-2)}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}
td .sub{display:block;font-size:12px;color:var(--text-muted)}
.url{font-family:var(--font-mono);font-size:12.5px;word-break:break-all}
.list{display:flex;flex-direction:column;gap:10px}
.item{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 18px}
.item-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;flex-wrap:wrap;margin-bottom:8px}
.item-meta{font-size:12px;color:var(--text-muted);display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.post-body{font-size:14px;line-height:1.55;white-space:pre-wrap;word-break:break-word}
.post-body a{color:var(--ai);text-decoration:underline;text-underline-offset:2px}
.post-body blockquote{border-left:2px solid var(--accent);padding-left:12px;margin:8px 0;color:var(--text-muted)}
.post-body code,.post-body pre{font-family:var(--font-mono);font-size:12.5px;background:var(--surface-3);border-radius:4px;padding:1px 5px}
.post-body tg-spoiler{background:var(--surface-3);color:transparent;border-radius:3px;cursor:pointer;transition:color .15s}
.post-body tg-spoiler.open{color:inherit}
.post-img{max-width:100%;max-height:220px;border-radius:var(--radius-sm);margin-bottom:10px;display:block;object-fit:cover}
.empty{text-align:center;padding:44px 20px;border:1px dashed var(--border-strong);border-radius:var(--radius);color:var(--text-muted)}
.empty h3{color:var(--text);font-size:17px;margin-bottom:6px}
.empty p{max-width:46ch;margin:0 auto 16px}
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);margin-bottom:22px;overflow-x:auto}
.tabs button{background:none;border:0;border-bottom:2px solid transparent;color:var(--text-muted);font-weight:500;padding:10px 16px;white-space:nowrap;margin-bottom:-1px;transition:color .15s}
.tabs button:hover{color:var(--text)}
.tabs button.on{color:var(--text);border-bottom-color:var(--accent)}
.crumb{display:inline-flex;align-items:center;gap:6px;color:var(--text-muted);font-size:13px;margin-bottom:10px}
.crumb:hover{color:var(--text)}

/* ---------- модалка / тосты ---------- */
.overlay{position:fixed;inset:0;background:rgba(5,8,12,.7);backdrop-filter:blur(3px);display:grid;place-items:center;padding:20px;z-index:200;animation:fade .15s ease}
.modal{background:var(--surface);border:1px solid var(--border-strong);border-radius:16px;padding:24px;width:min(560px,100%);max-height:90vh;overflow-y:auto;box-shadow:0 24px 60px rgba(0,0,0,.5)}
.modal.wide{width:min(760px,100%)}
.modal h2{font-size:19px;margin-bottom:6px}
.modal .m-sub{color:var(--text-muted);margin-bottom:18px;font-size:13.5px}
.modal-foot{display:flex;justify-content:flex-end;gap:10px;margin-top:20px;flex-wrap:wrap}
.steps{display:flex;flex-direction:column;gap:12px;margin-bottom:18px;counter-reset:s}
.steps li{list-style:none;display:flex;gap:12px;align-items:flex-start;color:var(--text-muted);font-size:13.5px}
.steps li::before{counter-increment:s;content:counter(s);flex-shrink:0;width:22px;height:22px;border-radius:50%;background:var(--accent-soft);color:var(--accent);font-family:var(--font-mono);font-size:11px;display:grid;place-items:center;margin-top:1px}
.steps b{color:var(--text)}
.toasts{position:fixed;top:18px;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;gap:8px;z-index:300;align-items:center;width:min(92vw,420px)}
.toast{background:var(--surface-3);border:1px solid var(--border-strong);padding:11px 18px;border-radius:12px;font-size:13.5px;box-shadow:0 8px 28px rgba(0,0,0,.4);animation:rise .2s ease;display:flex;gap:10px;align-items:center}
.toast.ok{border-color:rgba(61,214,140,.5)}
.toast.err{border-color:rgba(242,84,91,.55)}
.toast::before{content:'';width:7px;height:7px;border-radius:50%;background:var(--ai);flex-shrink:0}
.toast.ok::before{background:var(--ok)}.toast.err::before{background:var(--bad)}
@keyframes fade{from{opacity:0}to{opacity:1}}
@keyframes rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.view-enter{animation:rise .25s ease}
.skeleton{background:linear-gradient(90deg,var(--surface) 0%,var(--surface-2) 50%,var(--surface) 100%);background-size:200% 100%;animation:shimmer 1.3s infinite;border-radius:var(--radius);min-height:90px}
@keyframes shimmer{from{background-position:200% 0}to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

/* ---------- вход ---------- */
.login{min-height:100vh;display:grid;place-items:center;padding:24px;position:relative}
.login::before{content:'';position:fixed;inset:0;background-image:linear-gradient(rgba(255,255,255,.025) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.025) 1px,transparent 1px);background-size:42px 42px;-webkit-mask-image:radial-gradient(ellipse 70% 55% at 50% 30%,#000 35%,transparent 90%);mask-image:radial-gradient(ellipse 70% 55% at 50% 30%,#000 35%,transparent 90%);pointer-events:none}
.login-card{position:relative;width:min(430px,100%);background:var(--surface);border:1px solid var(--border);border-radius:18px;padding:36px 32px;text-align:center}
.login-card h1{font-size:26px;line-height:1.15;margin:14px 0 10px}
.login-card p{color:var(--text-muted);margin-bottom:22px}
.login-widget{display:flex;justify-content:center;min-height:48px;margin-bottom:6px}
.login-points{list-style:none;text-align:left;border-top:1px solid var(--border);margin-top:24px;padding-top:18px;display:flex;flex-direction:column;gap:9px;color:var(--text-muted);font-size:13px}
.login-points li{display:flex;gap:10px}
.login-points li::before{content:'';width:6px;height:6px;border-radius:50%;background:var(--ai);margin-top:7px;flex-shrink:0}
.login-err{color:var(--bad);font-size:13px;margin-top:12px}

/* ---------- загрузка файлов ---------- */
.asset{display:flex;gap:16px;align-items:center;flex-wrap:wrap;padding:14px 0;border-top:1px solid var(--border)}
.asset:first-of-type{border-top:0}
.asset-prev{width:84px;height:84px;border-radius:var(--radius-sm);border:1px solid var(--border);background:repeating-conic-gradient(var(--surface-2) 0% 25%,var(--surface) 0% 50%) 50%/14px 14px;display:grid;place-items:center;overflow:hidden;flex-shrink:0}
.asset-prev img{max-width:100%;max-height:100%;object-fit:contain}
.asset-text{flex:1;min-width:200px}
.asset-text b{display:block}

.kv{display:grid;grid-template-columns:max-content 1fr;gap:6px 18px;font-size:13.5px}
.kv dt{color:var(--text-muted)}
.copy-field{display:flex;gap:8px}
.copy-field input{font-family:var(--font-mono);font-size:12.5px}
.legal{margin-top:36px;color:var(--text-dim);font-size:12px}

/* ---------- переключатель режима админа ---------- */
.mode-switch{display:grid;grid-template-columns:1fr 1fr;background:var(--surface-2);border:1px solid var(--border);border-radius:999px;padding:3px;margin:0 6px 10px}
.mode-switch button{border:0;background:none;color:var(--text-muted);font-size:12.5px;font-weight:600;padding:6px 8px;border-radius:999px;transition:background .15s,color .15s}
.mode-switch button:hover{color:var(--text)}
.mode-switch button.on{background:var(--surface-3);color:var(--text)}
.shell.is-admin .mode-switch button.on{background:var(--accent);color:#0B0F14}
.shell.is-admin .side{box-shadow:inset 0 3px 0 var(--accent)}
.shell.is-admin .nav a.active{box-shadow:inset 2px 0 0 var(--accent)}
@media (max-width:880px){.mode-switch{margin:0 4px;min-width:150px}.shell.is-admin .side{box-shadow:inset 0 3px 0 var(--accent)}}

/* ---------- студия: положение знака и конструктор рамок ---------- */
.modal.xl{width:min(1180px,100%);padding:22px 24px}
.studio{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:22px;align-items:start}
@media (max-width:900px){.studio{grid-template-columns:1fr}}
.stage{position:relative;width:100%;background:#1a2230 center/cover no-repeat;border:1px solid var(--border-strong);border-radius:10px;overflow:hidden;user-select:none;-webkit-user-select:none;touch-action:none}
.stage canvas,.stage > img.frame-img{position:absolute;inset:0;width:100%;height:100%;display:block;pointer-events:none}
.stage .grid-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.stage .grid-svg line{stroke:rgba(255,255,255,.28);stroke-width:.18;vector-effect:non-scaling-stroke;stroke-width:1}
.stage .grid-svg line.mid{stroke:rgba(79,209,197,.75)}
.wm{position:absolute;cursor:grab;touch-action:none;outline:2px dashed rgba(255,106,61,.9);outline-offset:2px;border-radius:2px;display:block}
.wm:active{cursor:grabbing}
.wm:focus-visible{outline:2px solid var(--ai)}
.wm img{display:block;width:100%;height:auto;pointer-events:none;-webkit-user-drag:none}
.studio-side{display:flex;flex-direction:column;gap:16px}
.ctl{display:flex;flex-direction:column;gap:6px}
.ctl > label,.ctl > .label{font-size:12px;font-weight:600;display:flex;justify-content:space-between;gap:8px}
.ctl .val{font-family:var(--font-mono);font-weight:400;color:var(--text-muted)}
input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:20px;background:transparent;padding:0;border:0}
input[type=range]::-webkit-slider-runnable-track{height:4px;background:var(--surface-3);border-radius:999px}
input[type=range]::-moz-range-track{height:4px;background:var(--surface-3);border-radius:999px}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;margin-top:-6px;border-radius:50%;background:var(--accent);border:2px solid var(--bg)}
input[type=range]::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:var(--accent);border:2px solid var(--bg)}
input[type=color]{width:100%;height:36px;padding:2px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer}
.anchor-grid{display:grid;grid-template-columns:repeat(3,38px);gap:5px}
.anchor-grid button{height:34px;border:1px solid var(--border-strong);background:var(--surface-2);border-radius:8px;color:var(--text-muted);font-size:15px;line-height:1}
.anchor-grid button:hover{border-color:var(--accent);color:var(--accent)}
.tpl-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.tpl{border:1px solid var(--border-strong);background:var(--surface-2);border-radius:10px;padding:6px;color:var(--text-muted);font-size:11.5px;font-weight:500;display:flex;flex-direction:column;gap:5px;align-items:center;transition:border-color .15s,color .15s}
.tpl canvas{width:100%;height:auto;border-radius:5px;background:#2a3446;display:block}
.tpl:hover{border-color:var(--text-muted);color:var(--text)}
.tpl.on{border-color:var(--accent);color:var(--text);box-shadow:0 0 0 1px var(--accent) inset}
.two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.coords{font-family:var(--font-mono);font-size:12px;color:var(--text-muted)}
.lock{display:flex;gap:14px;align-items:center;justify-content:space-between;flex-wrap:wrap;padding:14px 16px;border:1px dashed var(--border-strong);border-radius:var(--radius);background:var(--surface-2)}
.sample-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.sample-row .btn.on{border-color:var(--ai);color:var(--ai)}
.preview-img{width:100%;border-radius:10px;border:1px solid var(--border-strong);display:block}

.ctl > label.switch{justify-content:flex-start;font-weight:500}
@media (min-width:901px){.studio > div:first-child{position:sticky;top:0;align-self:start}}

/* ---------- обрезка чужой рамки и видео ---------- */
.drop{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:4px;min-height:300px;border:2px dashed var(--border-strong);border-radius:12px;padding:24px;background:var(--surface-2)}
.stage.crop-stage{overflow:visible;background:#1a2230}
.shade{position:absolute;background:rgba(5,8,12,.7);pointer-events:none}
.crop-box{position:absolute;border:2px solid var(--accent);box-sizing:border-box;pointer-events:none}
.crop-handle{position:absolute;z-index:3;touch-action:none}
.crop-handle.top,.crop-handle.bottom{height:14px;cursor:ns-resize}
.crop-handle.left,.crop-handle.right{width:14px;cursor:ew-resize}
.crop-handle::after{content:'';position:absolute;background:var(--accent);border-radius:3px;box-shadow:0 0 0 2px rgba(11,15,20,.8)}
.crop-handle.top::after,.crop-handle.bottom::after{left:50%;top:50%;width:46px;height:6px;transform:translate(-50%,-50%)}
.crop-handle.left::after,.crop-handle.right::after{left:50%;top:50%;width:6px;height:46px;transform:translate(-50%,-50%)}
.checks{list-style:none;display:flex;flex-direction:column;gap:6px;margin:14px 0 10px;font-size:13.5px;color:var(--text-dim)}
.checks li.on{color:var(--text)}
.btn.disabled{opacity:.5;pointer-events:none}

/* ---------- гид для новичков, чек-лист, диагностика ---------- */
.onboarding{border-color:rgba(255,106,61,.35);background:linear-gradient(180deg,var(--accent-soft),var(--surface) 70%);margin-bottom:16px}
.checklist{list-style:none;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 18px}
@media (max-width:760px){.checklist{grid-template-columns:1fr}}
.checklist li{display:flex;gap:10px;align-items:flex-start;color:var(--text-muted);font-size:13.5px}
.checklist li.done{color:var(--text-dim)}
.checklist li.next{color:var(--text);font-weight:600}
.cl-mark{width:18px;height:18px;border-radius:50%;border:1.5px solid var(--border-strong);flex-shrink:0;display:grid;place-items:center;font-size:11px;margin-top:1px;color:#0B0F14}
.checklist li.done .cl-mark{background:var(--ok);border-color:var(--ok)}
.checklist li.next .cl-mark{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.guide{display:flex;flex-direction:column;gap:14px;margin-top:16px}
.guide-step{display:grid;grid-template-columns:44px minmax(0,1fr);gap:16px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px}
.guide-step.done{opacity:.78}
.step-no{width:36px;height:36px;border-radius:50%;background:var(--accent-soft);color:var(--accent);font-family:var(--font-mono);font-weight:500;display:grid;place-items:center}
.guide-step.done .step-no{background:var(--ok-soft);color:var(--ok)}
.step-body h2{font-size:18px;margin-bottom:8px}
.step-body p{color:var(--text-muted);margin-bottom:10px;max-width:72ch}
.step-body b{color:var(--text)}
.g-list{margin:0 0 10px 18px;color:var(--text-muted);display:flex;flex-direction:column;gap:6px;max-width:72ch}
.tip{border-left:2px solid var(--ai);background:var(--ai-soft);padding:10px 14px;border-radius:0 8px 8px 0;color:var(--text-muted);font-size:13.5px;max-width:72ch}
.diag{display:flex;flex-direction:column;gap:8px}
.diag-row{display:flex;gap:12px;align-items:center;padding:12px 14px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}
.diag-row.bad{border-color:rgba(242,84,91,.4);background:var(--bad-soft)}
.diag-row.warn{border-color:rgba(245,184,76,.4);background:var(--warn-soft)}
.diag-mark{width:24px;height:24px;border-radius:50%;display:grid;place-items:center;font-weight:700;font-size:13px;flex-shrink:0;color:#0B0F14;background:var(--ok)}
.diag-row.bad .diag-mark{background:var(--bad)}
.diag-row.warn .diag-mark{background:var(--warn)}
.diag-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.diag-text span{font-size:12.5px;color:var(--text-muted)}
