:root {
  --night: #15110c;
  --wall: #1c1711;
  --wall-2: #241d15;
  --seam: #342a1f;
  --seam-2: #4a3c2b;
  --paper: #f3eadb;
  --dust: #a5977f;
  --dust-2: #776a56;
  --amber: #ffbf00;
  --gold: #e8b923;
  --amber-ink: #1f1500;
  --glow: rgba(255, 191, 0, .22);
  --ok: #9fc57d;
  --bad: #f06a4b;
  --info: #86b6d8;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --ui: 'Onest', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --display: 'Unbounded', 'Onest', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font: 15px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.muted { color: var(--dust); }
.small { font-size: 13px; }

/* ---------- Каркас ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 16px 20px;
  border-right: 1px solid var(--seam);
  background: var(--wall);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand b { display: block; font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand small { color: var(--dust); font-size: 12px; }
.brand-phone { width: 22px; height: 33px; flex: none; filter: drop-shadow(0 0 8px rgba(255,191,0,.3)); }
.login-box .brand-phone { width: 28px; height: 42px; }
.brand-mark { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 30px; height: 30px; padding: 4px; background: #0e0b07; border-radius: 6px; }
.brand-mark i { background: #3a2f20; border-radius: 1px; }
.brand-mark i.on { background: var(--amber); box-shadow: 0 0 8px var(--glow); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  color: var(--dust); text-decoration: none; font-weight: 500;
}
.nav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav a:hover { color: var(--paper); background: var(--wall-2); }
.nav a.active { color: var(--amber-ink); background: var(--amber); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 8px; font-size: 13px; color: var(--dust); }
.conn { display: flex; align-items: center; gap: 8px; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--dust-2); }
.conn.on i { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--dust); cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; padding: calc(28px + env(safe-area-inset-top, 0px)) clamp(16px, 3.4vw, 44px) calc(60px + env(safe-area-inset-bottom, 0px)); }
.view { display: none; max-width: 1280px; }
.view.active { display: block; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.head h1 {
  margin: 0; font-family: var(--display); font-weight: 600;
  font-size: clamp(26px, 3.2vw, 38px); letter-spacing: -.025em; line-height: 1.1;
}
.head p { margin: 6px 0 0; color: var(--dust); }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
h2 { font-family: var(--display); font-weight: 500; font-size: 17px; letter-spacing: -.01em; margin: 0 0 14px; }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--seam-2); background: var(--wall-2); color: var(--paper);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #2d251b; border-color: #5c4b35; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 600; }
.btn.primary:hover { background: var(--gold); border-color: var(--gold); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--r-sm); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; color: var(--dust); font-weight: 500; }
.field small { color: var(--dust-2); font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  background: #110d09; border: 1px solid var(--seam); border-radius: var(--r-sm);
  outline: none; transition: border-color .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--amber); }
input::placeholder, textarea::placeholder { color: var(--dust-2); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--amber); }

.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #3a3023; transition: background .15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--dust); transition: transform .15s, background .15s; }
.switch input:checked + span { background: var(--amber); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--amber-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: #110d09; border: 1px solid var(--seam); border-radius: var(--r-md); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 13px; border-radius: 9px; color: var(--dust); cursor: pointer; font-weight: 500; font-size: 14px; }
.seg button.on { background: var(--wall-2); color: var(--paper); box-shadow: inset 0 0 0 1px var(--seam-2); }
.seg button b { font-weight: 600; color: var(--amber); margin-left: 4px; }

/* ---------- Панели ---------- */
.panel { background: var(--wall); border: 1px solid var(--seam); border-radius: var(--r-lg); padding: 22px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; margin-top: 16px; }

/* ---------- Сводка ---------- */
.stats { display: flex; flex-wrap: wrap; border-top: 1px solid var(--seam); border-bottom: 1px solid var(--seam); margin-bottom: 28px; }
.stat { flex: 1 1 150px; padding: 16px 20px 16px 0; }
.stat + .stat { padding-left: 20px; border-left: 1px solid var(--seam); }
.stat b { display: block; font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--dust); font-size: 13px; }
.stat.hot b { color: var(--amber); }
.stat.bad b { color: var(--bad); }

/* ---------- Фасад: каждый аккаунт — окно ---------- */
.facade-wrap {
  position: relative; padding: 26px 22px 22px;
  background: linear-gradient(180deg, #120e0a, #19140e);
  border: 1px solid var(--seam); border-radius: var(--r-lg);
  overflow: hidden;
}
.facade-wrap::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 79px, rgba(255,255,255,.018) 79px 80px);
}
.facade-head { position: relative; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.facade-head h2 { margin: 0; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--dust); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.facade { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 20px 12px; }
.win { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; background: none; border: 0; padding: 0; }
.win .phone {
  position: relative; width: 100%; max-width: 74px; aspect-ratio: 9 / 17;
  padding: 3px; border-radius: 13px;
  background: linear-gradient(150deg, #3d3228, #19140e 70%);
  box-shadow: inset 0 0 0 1px #56462f, 0 3px 0 #0b0805;
  transition: transform .15s, box-shadow .2s;
}
.win .phone::before, .win .phone::after { content: ''; position: absolute; width: 2px; border-radius: 2px; background: #4e4030; }
.win .phone::before { right: -2px; top: 24%; height: 13%; }
.win .phone::after { left: -2px; top: 20%; height: 20%; }
.win .scr { position: relative; height: 100%; border-radius: 10px; overflow: hidden; background: #0b0906; transition: background .3s; }
.win .isl { position: absolute; top: 5px; left: 50%; transform: translateX(-50%); width: 32%; height: 6px; border-radius: 99px; background: #000; z-index: 2; }
.win .bar { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 36%; height: 2px; border-radius: 2px; background: rgba(255,255,255,.18); z-index: 2; }
.win[data-lvl="1"] .scr { background: linear-gradient(180deg, #2e2310, #120e08); }
.win[data-lvl="2"] .scr { background: linear-gradient(180deg, #7a5708 0%, #3b2b0a 55%, #150f07 100%); }
.win[data-lvl="3"] .scr { background: linear-gradient(180deg, #ffd760, #f2ab00 60%, #b97c00); }
.win[data-lvl="3"] .phone { box-shadow: inset 0 0 0 1px #8a6718, 0 3px 0 #0b0805, 0 0 26px rgba(255,191,0,.35); }
.win[data-lvl="3"] .bar { background: rgba(40,25,0,.35); }
.win.off .phone { opacity: .35; }
.win.fail .phone { box-shadow: inset 0 0 0 1.5px var(--bad), 0 3px 0 #0b0805, 0 0 16px rgba(240,106,75,.25); }
.win:hover .phone { transform: translateY(-3px); }
.win .dots { position: absolute; left: 6px; right: 6px; bottom: 11px; display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; z-index: 1; }
.win .dots i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid rgba(255, 220, 140, .85); background: transparent; }
.win .dots i.done { background: #fff1c4; border-color: #fff1c4; }
.win[data-lvl="3"] .dots i, .win[data-lvl="3"] .dots i.done { background: #2a1a00; border-color: #2a1a00; }
.win .dots i.failed { background: var(--bad); border-color: var(--bad); }
.win .dots i.run { background: var(--amber); border-color: #111; }
.win .nm { font-size: 12px; color: var(--dust); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center; }
.win .nm b { color: var(--paper); font-weight: 500; }

/* ---------- Списки ---------- */
.list { display: flex; flex-direction: column; }
.row-item { display: grid; grid-template-columns: 62px 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--seam); font-size: 14px; }
.row-item:first-child { border-top: 0; }
.row-item time { font-variant-numeric: tabular-nums; font-weight: 600; }
.row-item .sub { color: var(--dust); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item > div { min-width: 0; }
.log { font-size: 13px; padding: 8px 0; border-top: 1px solid var(--seam); display: grid; grid-template-columns: 48px 1fr; gap: 10px; }
.log:first-child { border-top: 0; }
.log time { color: var(--dust-2); font-variant-numeric: tabular-nums; }
.log.error span { color: #ff9a82; }
.log.warn span { color: #f2cf7a; }
.log.debug span { color: var(--dust-2); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; word-break: break-all; }
.logs-all { max-height: 62vh; overflow: auto; }
.empty { padding: 26px 0; color: var(--dust); text-align: center; }
.empty b { display: block; color: var(--paper); font-weight: 600; margin-bottom: 4px; }

.pl { display: inline-grid; place-items: center; width: 28px; height: 22px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.pl.tiktok { background: #2a2a2a; color: #fff; box-shadow: inset 2px 0 0 #25f4ee, inset -2px 0 0 #fe2c55; }
.pl.instagram { background: linear-gradient(135deg, #8a3ab9, #e95950 60%, #fccc63); color: #fff; }
.pl.youtube { background: #e2231a; color: #fff; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #2b2319; color: var(--dust); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.planned { color: var(--dust); }
.badge.sent { color: var(--info); background: rgba(134,182,216,.1); }
.badge.running { color: var(--amber); background: rgba(255,191,0,.1); }
.badge.done { color: var(--ok); background: rgba(159,197,125,.1); }
.badge.failed { color: var(--bad); background: rgba(240,106,75,.1); }
.badge.cancelled { color: var(--dust-2); }

/* ---------- Таблицы ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1; }
.bulk {
  position: sticky; top: 10px; z-index: 5;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  background: #2a2116; border: 1px solid #5c4513; border-radius: var(--r-md);
}
.bulk b { color: var(--amber); margin-right: 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--seam); border-radius: var(--r-lg); background: var(--wall); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--dust); font-size: 12.5px; padding: 12px 14px; border-bottom: 1px solid var(--seam); white-space: nowrap; background: #1a150f; }
td { padding: 11px 14px; border-bottom: 1px solid var(--seam); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 191, 0, .03); }
tr.sel td { background: rgba(255, 191, 0, .06); }
td.cb, th.cb { width: 42px; padding-right: 0; }
td.cb input, th.cb input { width: 17px; height: 17px; accent-color: var(--amber); cursor: pointer; }
.cell-name b { display: block; font-weight: 600; }
.cell-name small { color: var(--dust); }
.clip { max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dust); }
.clickable { cursor: pointer; }
.chips { display: flex; gap: 5px; }
.chip { border: 1px solid var(--seam-2); background: transparent; color: var(--dust-2); border-radius: 7px; padding: 3px 8px; font-size: 12px; font-weight: 700; cursor: pointer; }
.chip.on.tiktok { background: #2a2a2a; color: #fff; border-color: #555; }
.chip.on.instagram { background: #b3386f; color: #fff; border-color: #b3386f; }
.chip.on.youtube { background: #e2231a; color: #fff; border-color: #e2231a; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dust-2); margin-right: 6px; vertical-align: 1px; }
.dot.on { background: var(--ok); }
.inline-input { background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 6px 8px; min-height: 34px; width: 100%; min-width: 180px; }
.inline-input:hover { border-color: var(--seam); }
.inline-input:focus { border-color: var(--amber); background: #110d09; outline: none; }
.num-input { width: 64px !important; min-height: 32px !important; padding: 4px 8px !important; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; color: var(--dust); font-size: 13px; flex-wrap: wrap; }
.pager div { display: flex; gap: 6px; }

/* ---------- Загрузка ---------- */
.drop {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 22px; margin-bottom: 18px;
  border: 1.5px dashed var(--seam-2); border-radius: var(--r-lg);
  background: #17120d; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--amber); background: #1d170f; }
.drop .ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--wall-2); color: var(--amber); flex: none; }
.drop .ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop b { display: block; font-weight: 600; }
.drop small { color: var(--dust); }
.progress { height: 6px; border-radius: 99px; background: #2c241a; overflow: hidden; flex: 1 1 200px; }
.progress i { display: block; height: 100%; background: var(--amber); width: 0; transition: width .2s; }

/* ---------- План ---------- */
.plan-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; align-items: start; }
.choice { display: flex; flex-direction: column; gap: 8px; }
.choice label { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--seam); border-radius: var(--r-md); cursor: pointer; background: #17120d; }
.choice label:has(input:checked) { border-color: var(--amber); background: #221a0f; }
.choice input { accent-color: var(--amber); margin-top: 3px; }
.choice small { display: block; color: var(--dust); }
.forecast { position: sticky; top: 20px; }
.forecast .big { font-family: var(--display); font-weight: 600; font-size: 44px; letter-spacing: -.03em; line-height: 1; color: var(--amber); }
.forecast dl { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 20px 0; font-size: 14px; }
.forecast dt { color: var(--dust); }
.forecast dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.note { font-size: 13px; color: var(--dust); padding: 12px 14px; border-radius: var(--r-md); background: #17120d; border: 1px solid var(--seam); }
.note.warn { color: #f2cf7a; border-color: #5c4513; }

/* ---------- Настройки ---------- */
.set-sec { display: grid; grid-template-columns: 240px 1fr; gap: 28px; padding: 26px 0; border-top: 1px solid var(--seam); }
.set-sec:first-of-type { border-top: 0; padding-top: 0; }
.set-sec h2 { margin-bottom: 6px; }
.set-sec p { margin: 0; color: var(--dust); font-size: 14px; }
.set-body { display: flex; flex-direction: column; gap: 14px; }
.set-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sample { white-space: pre-wrap; font-size: 13px; background: #110d09; border: 1px solid var(--seam); border-radius: var(--r-sm); padding: 12px; color: var(--paper); }
.savebar { position: sticky; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: flex-end; margin-top: 10px; }
.savebar .btn { box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* ---------- Модалка ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-back { position: absolute; inset: 0; background: rgba(8, 6, 3, .72); }
.modal-box {
  position: relative; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--wall); border: 1px solid var(--seam-2); border-radius: var(--r-lg);
  padding: 26px; animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-box h3 { margin: 0 0 4px; font-family: var(--display); font-weight: 600; font-size: 20px; letter-spacing: -.02em; }
.modal-box .lead { margin: 0 0 18px; color: var(--dust); font-size: 14px; }
.modal-x { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--dust); font-size: 24px; cursor: pointer; }
.modal-x:hover { background: var(--wall-2); color: var(--paper); }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.modal-foot div { display: flex; gap: 8px; flex-wrap: wrap; }
.modal video { width: 100%; max-height: 60vh; border-radius: var(--r-md); background: #000; }
.counter { font-size: 12px; color: var(--dust-2); text-align: right; }
.fail-box { padding: 12px 14px; border-radius: var(--r-md); background: rgba(240,106,75,.08); border: 1px solid rgba(240,106,75,.35); color: #ffb3a1; font-size: 14px; margin-bottom: 14px; }

/* ---------- Уведомления ---------- */
.toasts { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { padding: 12px 16px; border-radius: var(--r-md); background: #2a2116; border: 1px solid var(--seam-2); box-shadow: 0 12px 30px rgba(0,0,0,.45); font-size: 14px; animation: pop .18s ease-out; }
.toast.ok { border-color: #5c4513; }
.toast.err { border-color: rgba(240,106,75,.6); color: #ffc2b4; }

/* ---------- Вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(600px 400px at 50% 30%, #231a0e, var(--night)); }
.login-box { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 30px; background: var(--wall); border: 1px solid var(--seam); border-radius: var(--r-lg); }
.login-box h1 { margin: 6px 0 0; font-family: var(--display); font-weight: 600; font-size: 26px; letter-spacing: -.02em; }
.login-box p { margin: -8px 0 4px; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; margin: 0; }

/* ---------- Адаптив ---------- */
@media (max-width: 1080px) {
  .cols, .plan-grid { grid-template-columns: 1fr; }
  .forecast { position: static; }
  .set-sec { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20;
    flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    border-right: 0; border-top: 1px solid var(--seam);
  }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-between; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; flex: 1; border-radius: 10px; }
  .main { padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
  .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat + .stat { padding-left: 14px; }
  .stat { flex-basis: 45%; }
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .toasts { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  .facade { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Загрузка архивом и импорт с сервера */
.up-state { flex: 1 1 100%; margin-top: 6px; font-size: 13px; color: var(--amber); display: flex; align-items: center; gap: 8px; }
.up-state::before { content: ''; width: 12px; height: 12px; border: 2px solid var(--amber); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.import-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; padding: 14px 18px; background: var(--wall); border: 1px solid var(--seam); border-radius: var(--r-lg); }
.import-row b { font-weight: 500; }
.import-row small { display: block; margin-top: 3px; color: var(--dust-2); font-size: 12px; }

/* Уникализатор */
.uq { display: inline-block; margin-left: 5px; font-size: 12px; color: var(--dust-2); vertical-align: middle; }
.uq.on { color: var(--amber); }
.uq.wait { color: var(--gold); animation: pulse 1.4s ease-in-out infinite; }
.uq.bad { color: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }
.pv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.pv-grid video { width: 100%; border-radius: var(--r-sm); background: #000; }
.pv-grid b { display: block; margin-bottom: 6px; }
@media (max-width: 520px) { .pv-grid { grid-template-columns: 1fr; } }
