/* PureCore UI — тёмная сине-голубая тема, mobile-first */
:root {
  --bg: #050b18;
  --bg2: #081226;
  --surface: #0c1a33;
  --surface2: #112243;
  --line: #1a3158;
  --text: #e8f1ff;
  --muted: #7f98c0;
  --blue: #2f7bff;
  --cyan: #22d3ee;
  --grad: linear-gradient(135deg, #2f7bff 0%, #22d3ee 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --nav-h: 62px;
  --top-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 500px at 50% -200px, #0f2a5c55, transparent), var(--bg);
  color: var(--text);
  font: 14px/1.4 -apple-system, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- каркас ---------- */
.shell { display: flex; height: 100%; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.topbar {
  height: var(--top-h); flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border-bottom: 1px solid var(--line);
  background: #07112299; backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 650; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 8px; }
.content { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px calc(var(--nav-h) + var(--safe-b) + 14px); }
.content.flush { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: #071122ee; backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; font-weight: 500; cursor: pointer; position: relative;
  background: none; border: 0; font-family: inherit;
}
.tab.on { color: var(--cyan); }
.tab.on::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--grad); }

.rail { display: none; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .content { padding-bottom: 20px; }
  .rail {
    display: flex; flex-direction: column; width: 220px; flex: none; padding: 14px 10px; gap: 4px;
    border-right: 1px solid var(--line); background: #060e1f;
  }
  .rail .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; font-weight: 700; font-size: 16px; }
  .rail .nav {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted);
    cursor: pointer; font-weight: 500; background: none; border: 0; font-family: inherit; font-size: 14px; text-align: left; width: 100%;
  }
  .rail .nav:hover { background: var(--surface); color: var(--text); }
  .rail .nav.on { background: var(--surface2); color: var(--cyan); }
  .rail .sp { flex: 1; }
}
.logo {
  width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center;
  color: #04122b; font-weight: 800; font-size: 15px; flex: none;
}

/* ---------- компоненты ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 10px; }
.card h2, .h {
  margin: 0 0 8px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card h2 .r, .h .r { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 400; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.g2 { grid-template-columns: repeat(2, 1fr); }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
.stat .k { color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.bar { height: 6px; border-radius: 6px; background: #0a1731; margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--grad); transition: width .5s; }
.bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }

.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #12264a; min-width: 0; cursor: default;
}
.item:last-child { border-bottom: 0; }
.item.tap { cursor: pointer; border-radius: 10px; padding: 10px 8px; }
.item.tap:active, .item.sel { background: var(--surface2); }
.item .ic { width: 38px; height: 38px; border-radius: 11px; background: var(--surface2); color: var(--cyan); display: grid; place-items: center; flex: none; }
.item .tx { flex: 1; min-width: 0; }
.item .t { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .end { color: var(--muted); font-size: 12px; flex: none; text-align: right; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface2); color: var(--text);
  font: 600 13.5px/1 inherit; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.pri { background: var(--grad); border: 0; color: #04122b; }
.btn.bad { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn.ico { width: 38px; padding: 0; }
.btn.sm.ico { width: 32px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nw { flex-wrap: nowrap; }
.sp { flex: 1; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface2); color: var(--muted); }
.chip.ok { background: #0b3a30; color: var(--ok); } .chip.bad { background: #3f1b24; color: var(--bad); }
.chip.warn { background: #3e3213; color: var(--warn); } .chip.blue { background: #11306a; color: #8fb8ff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); } .dot.bad { background: var(--bad); }

.field { display: block; margin-bottom: 10px; }
.field > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=email], input[type=search], textarea, select, .input {
  width: 100%; height: 42px; padding: 0 12px; background: #07122a; border: 1px solid var(--line); border-radius: 11px;
  color: var(--text); font: inherit; outline: none;
}
textarea { height: auto; padding: 10px 12px; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #2f7bff33; }
input[type=file] { color: var(--muted); width: 100%; font: inherit; }
input[type=file]::file-selector-button { background: var(--surface2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; margin-right: 10px; font: inherit; cursor: pointer; }

.seg { display: flex; background: #07122a; border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; height: 34px; border: 0; background: none; color: var(--muted); border-radius: 8px; font: 600 13px inherit; font-family: inherit; cursor: pointer; }
.seg button.on { background: var(--surface2); color: var(--cyan); }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.msg { padding: 9px 12px; border-radius: 10px; font-size: 13px; margin-top: 8px; display: none; }
.msg.show { display: block; } .msg.ok { background: #0b3a30; color: var(--ok); } .msg.bad { background: #3f1b24; color: var(--bad); }
pre.log { margin: 8px 0 0; background: #030813; border: 1px solid var(--line); border-radius: 10px; padding: 8px; max-height: 200px; overflow: auto; font: 11px/1.45 ui-monospace, Consolas, monospace; color: #8fe9c4; white-space: pre-wrap; word-break: break-word; }

.crumbs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; align-items: center; flex: 1; min-width: 0; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs button { background: none; border: 0; color: var(--muted); font: 500 13px inherit; font-family: inherit; padding: 6px 7px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.crumbs button:last-child { color: var(--text); font-weight: 650; }
.crumbs .sep { color: #34507f; }

/* ---------- шторка / диалог ---------- */
.scrim { position: fixed; inset: 0; background: #020611b0; backdrop-filter: blur(3px); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 20px 20px 0 0; padding: 8px 14px calc(14px + var(--safe-b)); max-height: 88dvh; overflow-y: auto; animation: up .2s;
}
.sheet .grab { width: 38px; height: 4px; border-radius: 4px; background: #2a4372; margin: 2px auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 16px; }
.sheet p { color: var(--muted); margin: 0 0 12px; }
@media (min-width: 900px) { .scrim { align-items: center; } .sheet { border-radius: 20px; border-bottom: 1px solid var(--line); } }
.editor { position: fixed; inset: 0; z-index: 55; background: var(--bg); display: flex; flex-direction: column; animation: fade .15s; }
.editor textarea { flex: 1; border: 0; border-radius: 0; background: #040a17; font: 13px/1.5 ui-monospace, Consolas, monospace; resize: none; padding: 12px; tab-size: 2; white-space: pre; overflow: auto; }
.editor textarea:focus { box-shadow: none; }
.toast-box { position: fixed; left: 0; right: 0; top: 10px; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: 0 8px 30px #0008; animation: down .2s; max-width: 90vw; }
.toast.ok { border-color: #1c6b55; } .toast.bad { border-color: #8a3043; }
@keyframes fade { from { opacity: 0 } } @keyframes up { from { transform: translateY(40px); opacity: 0 } } @keyframes down { from { transform: translateY(-14px); opacity: 0 } }
.drop { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; background: #04122bdd; font-size: 18px; font-weight: 650; color: var(--cyan); border: 3px dashed var(--blue); }
.drop.on { display: grid; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--cyan); border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg) } }
.center { min-height: 100%; display: grid; place-items: center; padding: 20px; }

/* ---------- терминал ---------- */
.term-tabs { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); background: #060e1f; flex: none; }
.term-tabs::-webkit-scrollbar { display: none; }
.ttab { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; height: 32px; border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.ttab.on { background: var(--surface2); color: var(--cyan); }
.ttab b { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; font-weight: 400; opacity: .7; }
.tsess { flex: 1; min-height: 0; background: #030813; padding: 4px 0 0 6px; }
.tsess > div { width: 100%; height: 100%; display: none; } .tsess > div.on { display: block; }
.keys { display: flex; gap: 6px; padding: 7px 8px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); background: #060e1f; flex: none; }
.keys::-webkit-scrollbar { display: none; }
.keys button { flex: none; min-width: 42px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 12.5px ui-monospace, Consolas, monospace; cursor: pointer; }
.keys button.on { background: var(--blue); border-color: var(--blue); }
.keys button:active { background: var(--surface2); }

@media (max-width: 899px) { .content.flush { padding-bottom: calc(var(--nav-h) + var(--safe-b)); } }

/* фирменный знак вместо буквы */
.logo.mark { background: #070c10 url(/assets/favicon-96.png?v=3) center/cover no-repeat; color: transparent; font-size: 0; }

/* кнопка «на сайт» в верхней панели нужна на телефоне; на ПК есть боковая панель */
@media (min-width: 900px) { .topbar > a[aria-label="На сайт PureCore"] { display: none; } }
