/* Стиль по мотивам ИТД: чёрный фон, Inter, светлые кнопки-пилюли, тонкие границы */
:root {
  --bg: #000;
  --text: #f5f5f5;
  --text2: rgba(255, 255, 255, .5);
  --accent: #0080FF;
  --link: #6a9fd4;
  --ok: #00ba7c;
  --bad: #f91880;
  --warn: #ff7663;
  --border: rgba(255, 255, 255, .15);
  --border-subtle: rgba(255, 255, 255, .05);
  --block: #1C1C1C;
  --block2: #2a2a2c;
  --hover: rgba(255, 255, 255, .08);
  --glass: rgba(35, 35, 35, .8);
  --r: 14px;
  --gap: 12px;
  --nav-h: 64px;
  --font: Inter, -apple-system, system-ui, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }

#app { max-width: 650px; margin: 0 auto; min-height: 100vh; }
#view { padding: 20px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }

h1 { font-size: 24px; font-weight: 600; margin: 4px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 500; color: var(--text2); margin: 26px 2px 10px; text-transform: uppercase; letter-spacing: .06em; }
.sub { color: var(--text2); margin: 0 0 18px; }
.muted { color: var(--text2); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* карточки */
.card { background: var(--block); border: 1px solid var(--border-subtle); border-radius: var(--r); padding: 16px; margin-bottom: var(--gap); }
.card.warn { border-color: rgba(255, 118, 99, .45); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title { font-weight: 600; word-break: break-word; }

.list > .item { padding: 14px 0; border-top: 1px solid var(--border-subtle); }
.list > .item:first-child { border-top: 0; padding-top: 0; }
.list > .item:last-child { padding-bottom: 0; }

/* плитки */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-bottom: var(--gap); }
.tile { background: var(--block); border: 1px solid var(--border-subtle); border-radius: var(--r); padding: 14px 16px; }
.tile .v { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.tile .k { color: var(--text2); font-size: 13px; margin-top: 2px; }

/* бейджи и индикаторы */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 9999px; background: var(--hover); color: var(--text); white-space: nowrap; }
.badge.live { background: rgba(249, 24, 128, .15); color: var(--bad); }
.badge.ok { background: rgba(0, 186, 124, .15); color: var(--ok); }
.badge.warn { background: rgba(255, 118, 99, .15); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text2); flex: none; }
.dot.ok { background: var(--ok); }
.dot.live { background: var(--bad); box-shadow: 0 0 0 0 rgba(249, 24, 128, .6); animation: pulse 1.8s infinite; }
.dot.warn { background: var(--warn); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(249, 24, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(249, 24, 128, 0); } }

.bar { height: 6px; border-radius: 9999px; background: var(--hover); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 9999px; transition: width .4s ease; }
.bar.indeterminate > i { width: 35%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* кнопки */
.btn { appearance: none; border: 0; cursor: pointer; font: 500 15px var(--font); height: 44px; padding: 0 22px; border-radius: 9999px; background: #fff; color: #000; transition: opacity .2s, transform .1s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.98); opacity: .85; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(249, 24, 128, .35); }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* формы */
label { display: block; font-size: 14px; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
.hint { color: var(--text2); font-size: 12px; margin-top: 4px; }
input { width: 100%; height: 46px; padding: 0 16px; background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: var(--r); font: 15px var(--font); outline: none; }
input:focus { border-color: var(--accent); }
.bf-row { margin-top: 8px; gap: 8px; }
.bf-input { width: 64px; height: 34px; padding: 0 10px; }
select.sel { width: 100%; height: 46px; padding: 0 16px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r); font: 15px var(--font); outline: none; }
select.sel:focus { border-color: var(--accent); }
input::placeholder { color: var(--text2); }

/* логи */
.logs { background: var(--block); border: 1px solid var(--border-subtle); border-radius: var(--r); padding: 12px; font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; max-height: calc(100vh - 230px); overflow: auto; white-space: pre-wrap; word-break: break-word; }
.logs .l { display: block; padding: 1px 0; }
.logs .WARNING { color: var(--warn); }
.logs .ERROR, .logs .CRITICAL { color: var(--bad); }

/* нижняя навигация */
#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, .3) 30%, rgba(0, 0, 0, .8) 100%); pointer-events: none; }
#nav .bar-wrap { pointer-events: auto; display: flex; gap: 2px; margin: 0 12px 10px; padding: 6px; border-radius: 9999px; background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--border-subtle); box-shadow: 0 4px 16px rgb(0 0 0 / 20%); width: min(100% - 24px, 460px); }
#nav button { flex: 1; border: 0; background: transparent; color: var(--text2); border-radius: 9999px; height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 500 10.5px var(--font); cursor: pointer; transition: background .2s, color .2s; }
#nav button svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#nav button.active { background: rgba(255, 255, 255, .1); color: var(--text); }
#nav .count { position: absolute; }

/* стадии обработки */
.steps { display: flex; gap: 6px; margin-top: 14px; }
.step { flex: 1; min-width: 0; }
.step i { display: block; height: 4px; border-radius: 9999px; background: var(--hover); }
.step span { display: block; margin-top: 6px; font-size: 10.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done i { background: var(--ok); }
.step.active i { background: var(--accent); }
.step.active span { color: var(--text); }
.dot.bad { background: var(--bad); }

/* архив: поиск и фильтры */
input.search { margin-bottom: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; appearance: none; border: 1px solid var(--border); background: transparent; color: var(--text2); border-radius: 9999px; height: 34px; padding: 0 14px; font: 500 13px var(--font); cursor: pointer; }
.chip.on { background: #fff; color: #000; border-color: #fff; }

/* меню «Ещё» */
.menu { margin: -6px 0; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; appearance: none; border: 0; background: transparent; color: var(--text); padding: 14px 0; border-top: 1px solid var(--border-subtle); font: inherit; cursor: pointer; }
.menu-item:first-child { border-top: 0; }
.menu-item:active { opacity: .6; }
.chev { color: var(--text2); font-size: 22px; line-height: 1; }

/* баннер без связи */
.banner { background: rgba(255, 118, 99, .15); color: var(--warn); border: 1px solid rgba(255, 118, 99, .35); border-radius: var(--r); padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }

/* уведомления */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 26px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--border); padding: 10px 18px; border-radius: 9999px; font-size: 14px; transition: .25s ease; z-index: 20; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { color: var(--bad); }

/* экран без доступа */
.center { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 0 24px; }
.center .logo { font-weight: 800; font-size: 28px; letter-spacing: -.04em; margin-bottom: 12px; }
.skeleton { height: 76px; border-radius: var(--r); background: linear-gradient(90deg, var(--block) 0%, var(--block2) 50%, var(--block) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; margin-bottom: var(--gap); }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
