/* Tempo — мониторинг и аналитика бурения. Тёмная тема платформы мониторинга. */
:root {
  color-scheme: dark;
  --bg: #15161b;
  --panel: #1c1d23;
  --panel-2: #22232a;
  --panel-3: #2a2b33;
  --line: #2a2c34;
  --line-2: #393b45;
  --text: #e9eaee;
  --muted: #9b9daa;
  --faint: #6c6f7c;
  --accent: #5b5ef0;
  --accent-2: #6e71ff;
  --accent-soft: rgba(91, 94, 240, .16);
  --accent-ink: #ffffff;
  --ok: #4ad0a0;
  --warn: #f0a848;
  --crit: #e8684a;
  --c1: #74b1f5; --c2: #f0a848; --c3: #4ad0a0; --c4: #e8684a; --c5: #a78bfa; --c6: #f472b6; --c7: #e7e2cf; --c8: #5b8def;
  --c9: #c8b84a; --c10: #f5a3a3; --c11: #7d8f3f; --c12: #c58bd8;
  --f-body: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "JetBrains Mono", "Consolas", "DejaVu Sans Mono", monospace;
  --line-3: #4a4d59;
  --scroll: #3a3c46;
  --grid: rgba(255,255,255,.07);
  --track: #4a4c56;
  --stripe: rgba(255,255,255,.12);
  --row-hover: rgba(255,255,255,.025);
  --tip-bg: rgba(28,29,35,.97);
  --shadow: 0 8px 22px rgba(0,0,0,.45); --sh-c: rgba(0,0,0,.45);
  --danger-line: #6b3a35; --danger-ink: #ffb4a6; --crit-ink: #ffcfc5;
  --accent-text: #c7c8ff;
  --three-1: #23242c; --three-2: #17181d; --label-bg: rgba(20,21,26,.75);
  --casing: #c9cbd3; --casing-plan: #6c6f7c; --band: rgba(255,255,255,.08); --band-line: #8d909c;
  --r: 6px;
  --r2: 10px;
  --rail: 52px;
  --tab: 30px;
  --top: 52px;
}
/* светлая тема (переключатель в шапке и на входе; без выбора — как в системе) */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4f8; --panel: #ffffff; --panel-2: #eff0f5; --panel-3: #e4e6ee;
  --line: #e0e2ea; --line-2: #ccd0db; --line-3: #b4b8c6;
  --text: #1a1c23; --muted: #5b5f6e; --faint: #8b8f9f;
  --accent: #4b4ee0; --accent-2: #5d60f0; --accent-soft: rgba(75,78,224,.11); --accent-ink: #fff;
  --ok: #17a673; --warn: #d4860f; --crit: #d24a2c;
  --c1: #2f80d9; --c2: #e08a12; --c3: #12a676; --c4: #d6492b; --c5: #7c5ce6; --c6: #db3f8f; --c7: #6b6455; --c8: #3567d6;
  --c9: #a3921a; --c10: #d86b6b; --c11: #61722a; --c12: #9a52b3;
  --scroll: #c3c7d2; --grid: rgba(20,24,40,.08); --track: #dfe1e8; --stripe: rgba(20,24,40,.10);
  --row-hover: rgba(20,24,40,.035); --tip-bg: rgba(255,255,255,.98); --shadow: 0 10px 28px rgba(30,34,60,.16); --sh-c: rgba(30,34,60,.18);
  --danger-line: #f0b9ad; --danger-ink: #b6361b; --crit-ink: #a8321a; --accent-text: #3b3ec9;
  --three-1: #ffffff; --three-2: #e9ebf2; --label-bg: rgba(255,255,255,.85);
  --casing: #4a4e5c; --casing-plan: #a8acb9; --band: rgba(20,24,40,.07); --band-line: #7a7e8c;
}
.theme-t { position: relative; overflow: hidden; }
.theme-t svg { transition: transform .5s cubic-bezier(.5,1.6,.4,1), opacity .3s; }
.theme-t .sun { position: absolute; transform: translateY(26px) rotate(90deg); opacity: 0; }
:root[data-theme="light"] .theme-t .sun { transform: none; opacity: 1; }
:root[data-theme="light"] .theme-t .moon { transform: translateY(-26px) rotate(-90deg); opacity: 0; }
html.theme-anim, html.theme-anim * { transition: background-color .35s, border-color .35s, color .35s, fill .35s !important; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--f-body); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 600; margin: 0; text-wrap: balance; letter-spacing: -0.005em; }
h1 { font-size: 19px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
a { color: var(--accent-2); }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.eyebrow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.lbl { font-size: 11px; color: var(--muted); }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 9px; height: 9px; } ::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 9px; border: 2px solid var(--bg); } ::-webkit-scrollbar-track { background: transparent; }

/* кнопки, поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 5px 12px; cursor: pointer; font-size: 12.5px; font-weight: 500; white-space: nowrap; min-height: 32px; text-decoration: none; color: var(--text); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-3); border-color: var(--line-3); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .rail a:focus-visible, .toc a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary, .btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover, .btn.on:hover { background: var(--accent-2); }
.btn.danger { border-color: var(--danger-line); color: var(--danger-ink); }
.btn.sm { padding: 2px 9px; min-height: 26px; font-size: 12px; }
.btn.xs { padding: 1px 7px; min-height: 22px; font-size: 11px; border-radius: 5px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.icon { padding: 0; width: 32px; }
.btn.icon.sm { width: 26px; }
.btn svg { width: 15px; height: 15px; flex: none; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; gap: 2px; }
.seg .btn { border: 0; background: transparent; min-height: 26px; border-radius: 6px; }
.seg .btn.on { background: var(--accent); color: #fff; }
.seg.sm .btn { min-height: 22px; padding: 1px 8px; font-size: 11px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], input[type=date], input[type=datetime-local], input[type=time], input[type=url], select, textarea {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); padding: 5px 9px; min-height: 32px; width: 100%; }
textarea { min-height: 64px; resize: vertical; }
input[type=checkbox] { accent-color: var(--accent); }
label.field { display: grid; gap: 4px; }
label.field > span { font-size: 11.5px; color: var(--muted); }
.form { display: grid; gap: 12px; }
.form2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

/* каркас */
.shell { display: grid; grid-template-columns: var(--tab) var(--rail) 1fr; grid-template-rows: var(--top) 1fr; height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 14px 0 0; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 30; min-width: 0; }
.brand { width: calc(var(--tab) + var(--rail)); height: 100%; display: flex; align-items: center; justify-content: center; gap: 0; flex: none; text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.orgsel { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text); background: transparent; border: 0; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.orgsel:hover { background: var(--panel-2); }
.crumbs { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted); font-size: 13px; overflow: hidden; }
.crumbs a { color: var(--muted); text-decoration: none; white-space: nowrap; } .crumbs a:hover { color: var(--text); }
.crumbs b { color: var(--text); font-weight: 500; white-space: nowrap; }
.crumbs .sep { color: var(--faint); }
.toptools { display: flex; align-items: center; gap: 6px; margin-left: 10px; }
.spacer { flex: 1; }
.topstats { display: flex; gap: 22px; align-items: center; }
.topstats div { display: grid; line-height: 1.2; }
.topstats .lbl { font-size: 10.5px; }
.topstats b { font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.bell { position: relative; }
.bell .badge { position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px; border-radius: 8px; background: var(--crit); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; padding: 0 3px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; cursor: pointer; border: 0; }
.wtab { background: var(--bg); border-right: 1px solid var(--line); display: flex; justify-content: center; align-items: flex-start; padding-top: 10px; cursor: pointer; color: var(--muted); }
.wtab:hover { color: var(--text); background: var(--panel); }
.wtab span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.rail { background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; overflow-y: auto; }
.rail a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); text-decoration: none; position: relative; font-size: 11px; font-weight: 700; letter-spacing: .02em; flex: none; }
.rail a:hover { background: var(--panel-2); color: var(--text); }
.rail a.on { background: var(--accent); color: #fff; }
.rail a.off { opacity: .35; }
.rail a svg { width: 17px; height: 17px; }
.rail a .txt { font-size: 11.5px; }
.rail a .txt.big { font-size: 15px; font-weight: 800; }
.rail .sep { width: 24px; height: 1px; background: var(--line); margin: 5px 0; flex: none; }
.tipbox { position: fixed; background: var(--panel-3); border: 1px solid var(--line-2); padding: 5px 10px; border-radius: 6px; white-space: nowrap; color: var(--text); font-size: 12px; z-index: 200; pointer-events: none; box-shadow: 0 6px 18px var(--sh-c); }
.main { min-width: 0; min-height: 0; overflow: auto; position: relative; }
.page { padding: 12px 14px 32px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.pagehead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 10px 14px; }
.pagehead .ico { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); border: 1px solid rgba(110,113,255,.45); display: grid; place-items: center; color: var(--accent-text); flex: none; }
.pagehead .ico svg { width: 18px; height: 18px; }
.pagehead .ttl { display: grid; gap: 1px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 14px; min-width: 0; }
.card > h3 { margin-bottom: 10px; }
.card.flat { padding: 0; overflow: hidden; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 11.5px; white-space: nowrap; }
.chip.ok { border-color: rgba(74,208,160,.5); color: var(--ok); } .chip.warn { border-color: rgba(240,168,72,.5); color: var(--warn); } .chip.crit { border-color: rgba(232,104,74,.55); color: var(--crit); }
.pill { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 700; color: #fff; }
.pill.r { background: #4f8fe0; } .pill.s { background: #e0553f; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--panel-3); font-size: 10.5px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex: none; }
.dot.round { border-radius: 50%; }
.live { background: var(--accent-2); border-radius: 50%; box-shadow: 0 0 0 0 rgba(110,113,255,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(110,113,255,.55); } 70% { box-shadow: 0 0 0 7px rgba(110,113,255,0); } 100% { box-shadow: 0 0 0 0 rgba(110,113,255,0); } }
@media (prefers-reduced-motion: reduce) { .live { animation: none; } }
.note { border-left: 3px solid var(--line-2); padding: 7px 11px; background: var(--panel-2); color: var(--muted); font-size: 12.5px; border-radius: 0 6px 6px 0; }
.note.warn { border-left-color: var(--warn); } .note.crit { border-left-color: var(--crit); color: var(--crit-ink); }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.stripe { background-image: repeating-linear-gradient(135deg, var(--stripe) 0 3px, transparent 3px 7px); }

/* таблицы */
.tblwrap { overflow: auto; min-width: 0; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
table.t th { text-align: center; font-weight: 500; font-size: 11px; color: var(--muted); padding: 8px 10px; background: var(--panel-2); border-bottom: 1px solid var(--line-2);
  position: sticky; top: 0; z-index: 2; vertical-align: middle; line-height: 1.25; }
table.t th small { display: block; font-size: 10px; color: var(--faint); font-weight: 400; }
table.t td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.t td.l, table.t th.l { text-align: left; }
table.t tr:hover td { background: var(--row-hover); }
table.t tr.sel td { background: var(--accent-soft); }
table.t tr.daysep td { border-top: 1px solid var(--accent); }
table.t td.ed { padding: 2px 4px; }
table.t td.ed input, table.t td.ed select { min-height: 26px; padding: 2px 6px; border-color: transparent; background: transparent; text-align: center; }
table.t td.ed input:hover, table.t td.ed input:focus { border-color: var(--line-2); background: var(--bg); }
table.t .bad { color: var(--crit); } table.t .good { color: var(--ok); }
table.t.first-sticky td:first-child, table.t.first-sticky th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; border-right: 1px solid var(--line-2); }
table.t.first-sticky th:first-child { z-index: 3; background: var(--panel-2); }

/* список скважин (выезжающий слева) */
.drawer-bg { position: fixed; inset: var(--top) 0 0 0; background: rgba(5,6,10,.55); z-index: 40; }
.drawer { position: fixed; left: 0; top: var(--top); bottom: 0; width: min(380px, 92vw); background: var(--panel); border-right: 1px solid var(--line-2); z-index: 41; display: grid; grid-template-rows: auto auto 1fr; box-shadow: 10px 0 40px var(--sh-c); }
.drawer .hd { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer .sr { padding: 10px 14px; }
.drawer .lst { overflow: auto; padding: 0 8px 12px; display: grid; gap: 4px; align-content: start; }
.witem { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--text); border: 1px solid transparent; }
.witem:hover { background: var(--panel-2); }
.witem.on { border-color: var(--accent); background: var(--accent-soft); }
.witem .sub { grid-column: 2 / 4; font-size: 11.5px; color: var(--muted); }

/* скважины (стартовая) */
.wells { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.wcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 14px; display: grid; gap: 10px; text-decoration: none; color: var(--text); transition: border-color .12s; }
.wcard:hover { border-color: var(--accent); }
.wcard .top { display: flex; align-items: flex-start; gap: 8px; }
.wcard .kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.kv .v { font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kv .v small { font-size: 11px; color: var(--muted); margin-left: 3px; }

/* мониторинг по времени */
.mon { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr; padding: 8px; }
.mon-body { position: relative; min-height: 0; }
.mon-body canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.tip { position: absolute; pointer-events: none; background: var(--tip-bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 11px; font-size: 11.5px; min-width: 210px; z-index: 5; box-shadow: var(--shadow); }
.tip .r { display: flex; justify-content: space-between; gap: 14px; } .tip .r b { font-weight: 500; font-variant-numeric: tabular-nums; }

/* приборная панель */
.dash { display: grid; grid-template-columns: 250px 1fr; gap: 12px; align-items: start; }
.inds { position: sticky; top: 0; max-height: calc(100vh - var(--top) - 100px); display: grid; grid-template-rows: auto auto 1fr auto; }
.inds .lst { overflow: auto; display: grid; align-content: start; margin: 8px -6px 0; }
.ind { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; font-size: 12px; }
.ind:hover { background: var(--panel-2); }
.ind span { flex: 1; }
.ind .add { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line-2); display: grid; place-items: center; cursor: pointer; background: transparent; color: var(--muted); padding: 0; }
.ind .add.on { background: rgba(74,208,160,.12); border-color: rgba(74,208,160,.35); color: var(--ok); }
.gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.gcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); display: grid; grid-template-rows: auto 1fr auto; min-height: 230px; }
.gcard.drag { opacity: .5; } .gcard.over { border-color: var(--accent); }
.gcard .gh { display: flex; align-items: center; gap: 8px; padding: 11px 12px 0; font-size: 12.5px; font-weight: 500; }
.gcard .gh .n { font-size: 10.5px; font-weight: 600; }
.gcard .gb { display: grid; place-items: center; padding: 6px 10px; }
.gcard .gf { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.gcard canvas { width: 180px; height: 160px; }
.bigval { text-align: center; display: grid; gap: 6px; justify-items: center; }
.bigval .v { font-size: 34px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1; }
.bigval .bar { width: 150px; height: 3px; background: var(--panel-3); border-radius: 2px; overflow: hidden; }
.bigval .bar i { display: block; height: 100%; }

/* разделы отчёта */
.report { display: grid; grid-template-columns: 240px 1fr; gap: 12px; align-items: start; }
.toc { position: sticky; top: 0; display: grid; gap: 2px; align-content: start; }
.toc a { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 7px 9px; border-radius: 7px; font-size: 12px; text-decoration: none; color: var(--text); border: 1px solid transparent; line-height: 1.3; }
.toc a span { color: var(--faint); font-size: 11px; }
.toc a:hover { background: var(--panel-2); }
.toc a.on { border-color: var(--accent); background: var(--accent-soft); }
.sec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); }
.sec > .sh { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.sec > .sh .no { width: 24px; height: 22px; border-radius: 5px; background: var(--panel-3); display: grid; place-items: center; font-size: 10.5px; color: var(--accent-2); font-weight: 600; }
.sec > .sh h3 { font-size: 13px; font-weight: 600; flex: 1; }
.sec > .sb { border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 12px; }
.chev { transition: transform .15s; color: var(--muted); }
.sec.open .chev { transform: rotate(180deg); }

/* баланс времени */
.balance { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 18px; align-items: start; }
.stackbox { display: grid; grid-template-columns: 34px 1fr; gap: 6px; height: 280px; }
.stackax { display: flex; flex-direction: column-reverse; justify-content: space-between; font-size: 10.5px; color: var(--faint); text-align: right; }
.stackplot { position: relative; border-left: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), var(--grid) calc(25% - 1px) 25%); }
.stack { position: absolute; left: 25%; right: 25%; top: 0; bottom: 0; display: flex; flex-direction: column-reverse; }
.stack div { display: grid; place-items: center; font-size: 11px; color: #fff; min-height: 0; text-shadow: 0 1px 2px rgba(0,0,0,.6); cursor: default; }
.stack div:hover { outline: 2px solid #fff; outline-offset: -2px; }
.timeline { height: 30px; border: 1px solid var(--line); border-radius: 6px; position: relative; overflow: hidden; background: var(--panel-2); }
.timeline div { position: absolute; top: 0; bottom: 0; }
.tl-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); margin-top: 4px; }

/* графики svg */
svg.chart { width: 100%; display: block; overflow: visible; }
svg.chart text { fill: var(--muted); font-size: 10.5px; font-family: var(--f-body); }
svg.chart .grid line { stroke: var(--grid); }
svg.chart .ax { stroke: var(--line-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

/* модальное окно */
.modal-bg { position: fixed; inset: 0; background: rgba(5,6,10,.7); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: grid; gap: 14px; padding: 18px; box-shadow: 0 20px 60px var(--sh-c); }
.modal.wide { width: min(1000px, 100%); }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.tokenbox { font-family: var(--f-mono); background: var(--bg); border: 1px dashed var(--accent-2); padding: 10px; border-radius: 6px; word-break: break-all; color: var(--accent-text); }
pre.code { font-family: var(--f-mono); font-size: 12px; background: var(--bg); border: 1px solid var(--line); padding: 10px; border-radius: 6px; overflow: auto; margin: 0; white-space: pre; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 8px 13px; font-size: 13px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs a:hover { color: var(--text); }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--panel-3); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; z-index: 200; max-width: 420px; box-shadow: 0 8px 24px var(--sh-c); }
.toast.err { border-left-color: var(--crit); }
.pop { position: fixed; z-index: 90; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 14px 40px var(--sh-c); width: min(420px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; }
.pop .it { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; font-size: 12.5px; }
.three { position: relative; height: 470px; border-radius: 8px; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, var(--three-1), var(--three-2)); }
.three canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.three .lbl3 { position: absolute; font-size: 10.5px; padding: 1px 5px; border-radius: 3px; pointer-events: none; white-space: nowrap; transform: translate(-50%, -50%); }

/* вход */

@media (max-width: 900px) {
  .topstats, .toptools .hide-s { display: none; }
  .dash, .report, .balance { grid-template-columns: 1fr; }
  .inds, .toc { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: var(--top) 1fr 52px; }
  .wtab { display: none; }
  .rail { grid-row: 3; flex-direction: row; justify-content: flex-start; border-right: 0; border-top: 1px solid var(--line); padding: 0 8px; overflow-x: auto; }
  .rail .sep { display: none; }
  .brand { width: 52px; }
  .crumbs > :not(:last-child) { display: none; }
}

/* ============================================================ вход */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.lg { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }
.lg-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
.lg-brand { position: absolute; left: 22px; top: 18px; display: flex; align-items: center; gap: 10px; color: #fff; pointer-events: none; animation: lgIn .8s .1s both; }
.lg-brand svg { width: 30px; height: 30px; filter: drop-shadow(0 4px 14px rgba(91,94,240,.55)); }
.lg-brand span { font-weight: 700; letter-spacing: .18em; font-size: 14px; }
.lg-brand small { font-size: 11px; opacity: .6; letter-spacing: .04em; padding-left: 10px; border-left: 1px solid currentColor; }
:root[data-theme="light"] .lg-brand { color: #1d2340; }
.lg-theme { position: absolute; right: 18px; top: 16px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent); background: color-mix(in srgb, var(--panel) 55%, transparent); color: var(--text);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .2s, background .2s; animation: lgIn .8s .2s both; }
.lg-theme:hover { transform: rotate(18deg) scale(1.06); background: var(--panel); }
.lg-theme:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.lg-side { position: absolute; top: 0; right: 0; bottom: 0; width: min(500px, 42vw); display: grid; place-items: center; padding: 70px 40px 40px; pointer-events: none; }
.lg-card { pointer-events: auto; position: relative; width: 100%; max-width: 390px; display: grid; gap: 14px; padding: 26px 26px 20px; border-radius: 18px;
  background: radial-gradient(420px 260px at var(--mx, 30%) var(--my, 0%), color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%), color-mix(in srgb, var(--panel) 74%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent); box-shadow: 0 30px 80px var(--sh-c), inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent);
  backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .25s ease-out; animation: lgCard .9s cubic-bezier(.2,.9,.25,1) backwards; }
.lg-card::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--ang), transparent 0 62%, var(--accent-2) 76%, #4ad0f0 82%, transparent 92%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: lgSpin 7s linear infinite; opacity: .9; }
.lg-card > * { animation: lgUp .7s cubic-bezier(.2,.9,.25,1) both; }
.lg-card > :nth-child(2) { animation-delay: .12s; } .lg-card > :nth-child(3) { animation-delay: .18s; } .lg-card > :nth-child(4) { animation-delay: .24s; }
.lg-card > :nth-child(7) { animation-delay: .3s; } .lg-card > :nth-child(8) { animation-delay: .36s; } .lg-card > :nth-child(9) { animation-delay: .42s; }
.lg-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.lg-logo svg { width: 44px; height: 44px; display: block; filter: drop-shadow(0 6px 18px rgba(91,94,240,.45)); }
.lg-logo .wave { stroke-dasharray: 1; stroke-dashoffset: 1; animation: lgDraw 1.4s .35s cubic-bezier(.6,0,.2,1) forwards; }
.lg-name { font-size: 21px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.lg-sub { font-size: 12px; color: var(--muted); }
.lg-live { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); padding: 4px 9px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--panel-2); }
.lg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
.lg-dot.rx { animation: lgRx .45s ease-out; }
.lg-hello h1 { font-size: 22px; letter-spacing: -.015em; }
.lg-hello p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.lg-f { position: relative; }
.lg-f input { width: 100%; height: 52px; border-radius: 11px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--bg) 55%, transparent); padding: 18px 44px 4px 42px; font-size: 14.5px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s; }
.lg-f input:hover { border-color: var(--line-3); }
.lg-f input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); background: color-mix(in srgb, var(--bg) 35%, transparent); }
.lg-f label { position: absolute; left: 42px; top: 16px; font-size: 14px; color: var(--muted); pointer-events: none; transform-origin: left top; transition: transform .2s cubic-bezier(.2,.9,.25,1), color .2s; }
.lg-f input:focus + label, .lg-f input:not(:placeholder-shown) + label { transform: translateY(-9px) scale(.76); color: var(--accent-text); }
.lg-f .ic { position: absolute; left: 14px; top: 16px; width: 19px; height: 19px; color: var(--faint); transition: color .2s, transform .3s; pointer-events: none; }
.lg-f .ic svg, .lg-f .eye svg { width: 100%; height: 100%; display: block; }
.lg-f:focus-within .ic { color: var(--accent-2); transform: scale(1.1); }
.lg-f .eye { position: absolute; right: 8px; top: 10px; width: 32px; height: 32px; padding: 6px; border: 0; background: none; border-radius: 8px; color: var(--faint); cursor: pointer; }
.lg-f .eye:hover { color: var(--text); background: var(--panel-2); }
.lg-f .eye .slash { stroke-dasharray: 23; stroke-dashoffset: 0; transition: stroke-dashoffset .3s; }
.lg-f .eye.on .slash { stroke-dashoffset: 23; }
.lg-caps { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--warn); margin-top: -6px; animation: lgUp .3s both; }
.lg-caps svg { width: 15px; height: 15px; }
.lg-err { font-size: 12.5px; color: var(--crit-ink); background: color-mix(in srgb, var(--crit) 12%, transparent); border: 1px solid color-mix(in srgb, var(--crit) 40%, transparent); border-radius: 9px; padding: 8px 11px; animation: lgUp .3s both; }
.lg-btn { position: relative; height: 50px; border-radius: 12px; border: 0; cursor: pointer; color: #fff; font-weight: 600; font-size: 14.5px; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(110deg, var(--accent) 0%, #7a5cf5 45%, var(--accent-2) 55%, var(--accent) 100%); background-size: 220% 100%; background-position: 100% 0;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 45%, transparent); transition: background-position .6s, transform .15s, box-shadow .2s; }
.lg-btn:hover { background-position: 0 0; box-shadow: 0 14px 34px color-mix(in srgb, var(--accent) 55%, transparent); }
.lg-btn:active { transform: scale(.98); }
.lg-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.lg-btn .ar { width: 18px; height: 18px; transition: transform .25s; } .lg-btn .ar svg, .lg-btn .ok svg { width: 100%; height: 100%; display: block; }
.lg-btn:hover .ar { transform: translateX(4px); }
.lg-btn .sp, .lg-btn .ok { position: absolute; inset: 0; margin: auto; opacity: 0; }
.lg-btn .sp { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; }
.lg-btn .ok { width: 24px; height: 24px; }
.lg-btn .ok .ck { stroke-dasharray: 24; stroke-dashoffset: 24; }
.lg-card.busy .lg-btn .tx, .lg-card.busy .lg-btn .ar, .lg-card.done .lg-btn .tx, .lg-card.done .lg-btn .ar { opacity: 0; }
.lg-card.busy .lg-btn .sp { opacity: 1; animation: lgSpin2 .7s linear infinite; }
.lg-card.done .lg-btn { background: linear-gradient(110deg, #18b07c, #3fd19b); box-shadow: 0 10px 30px rgba(40,190,130,.45); }
.lg-card.done .lg-btn .ok { opacity: 1; } .lg-card.done .lg-btn .ok .ck { animation: lgCk .45s .05s forwards; }
.lg-card.bad { animation: lgShake .5s cubic-bezier(.36,.07,.19,.97); }
.lg-card.bad .lg-f input { border-color: color-mix(in srgb, var(--crit) 70%, transparent); }
.lg-btn:disabled { cursor: default; }
.lg-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lg-foot b { color: var(--text); font-weight: 600; }
.lg-chips { display: flex; gap: 5px; } .lg-chips em { font-style: normal; font-size: 10.5px; padding: 2px 7px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.lg-note { font-size: 11.5px; color: var(--faint); text-align: center; margin-top: -4px; }
.lg-hud { position: absolute; left: 22px; top: 70px; display: grid; gap: 9px; padding: 13px 15px; border-radius: 14px; pointer-events: none; min-width: 330px;
  background: color-mix(in srgb, var(--panel) 62%, transparent); border: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 14px 40px var(--sh-c); animation: lgIn .9s .5s both; }
.lg-hud .op { display: flex; align-items: center; gap: 10px; font-size: 11.5px; }
.lg-hud .chip { padding: 2px 9px; border-radius: 20px; font-weight: 600; font-size: 11px; background: var(--accent-soft); color: var(--accent-text); transition: background .3s, color .3s; }
.lg-hud .chip.slide { background: color-mix(in srgb, var(--c2) 20%, transparent); color: var(--c2); }
.lg-hud .chip.ok { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.lg-hud .chip.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.lg-hud .chip.crit { background: color-mix(in srgb, var(--crit) 22%, transparent); color: var(--crit); }
.lg-hud .lay { color: var(--muted); }
.lg-hud .vals { display: grid; grid-template-columns: repeat(5, auto); gap: 4px 18px; justify-content: start; }
.lg-hud .vals div { display: grid; }
.lg-hud .vals span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.lg-hud .vals b { font-size: 17px; font-weight: 600; line-height: 1.2; }
.lg-hud .vals small { font-size: 10.5px; color: var(--muted); }
.lg-hud .hint { font-size: 11px; color: var(--faint); }
.lg-warp { position: fixed; z-index: 1000; border-radius: 50%; transform: translate(-50%, -50%) scale(0); pointer-events: none;
  background: radial-gradient(circle, var(--bg) 55%, var(--accent) 70%, var(--bg) 75%); transition: transform .6s cubic-bezier(.6,0,.3,1), opacity .45s; }
.lg-warp.go { transform: translate(-50%, -50%) scale(1); }
.lg-warp.out { opacity: 0; }
@keyframes lgSpin { to { --ang: 360deg; } }
@keyframes lgSpin2 { to { transform: rotate(360deg); } }
@keyframes lgDraw { to { stroke-dashoffset: 0; } }
@keyframes lgCk { to { stroke-dashoffset: 0; } }
@keyframes lgIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes lgUp { from { opacity: 0; transform: translateY(10px); } }
@keyframes lgCard { from { opacity: 0; transform: perspective(1000px) translateY(26px) rotateX(8deg) scale(.97); } }
@keyframes lgRx { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 70%, transparent); transform: scale(1.35); } 100% { box-shadow: 0 0 0 9px transparent; transform: scale(1); } }
@keyframes lgShake { 10%, 90% { translate: -1px 0; } 20%, 80% { translate: 3px 0; } 30%, 50%, 70% { translate: -7px 0; } 40%, 60% { translate: 7px 0; } }
@media (max-width: 1100px) { .lg-hud .vals { grid-template-columns: repeat(3, auto); } .lg-hud { min-width: 0; } }
@media (max-width: 819px) {
  .lg-side { width: 100%; padding: 76px 16px 24px; place-items: end center; }
  .lg-side::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 20%, color-mix(in srgb, var(--bg) 70%, transparent) 60%); pointer-events: none; }
  .lg-card { padding: 22px 18px 16px; }
  .lg-hud { display: none; }
  .lg-brand small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lg *, .lg *::before, .lg-card, .lg-warp { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .01s !important; }
}
