/* SynForge mini app — dark industrial theme */
:root {
  --bg: #07090c;
  --bg2: #0b0e13;
  --card: rgba(255, 255, 255, 0.03);
  --card2: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.09);
  --line2: rgba(255, 255, 255, 0.16);
  --txt: #eef1f5;
  --mut: #8b93a1;
  --dim: #5d6570;
  --acc: #6ea8ff;
  --acc2: #9db9ff;
  --ok: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --r: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 40% at 50% -5%, rgba(110, 168, 255, 0.10), transparent 70%),
    radial-gradient(50% 35% at 90% 110%, rgba(110, 168, 255, 0.05), transparent 70%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; opacity: .5;
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(80% 60% at 50% 0%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(80% 60% at 50% 0%, #000 30%, transparent 100%);
}
#app { max-width: 560px; margin: 0 auto; padding: 0 14px 88px; }

/* header */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 2px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line2);
  box-shadow: 0 0 18px rgba(110, 168, 255, .18);
}
.brand-txt { font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.brand-sub { font-size: 10.5px; color: var(--dim); letter-spacing: .22em; text-transform: uppercase; margin-top: 1px; }
.hpill {
  font-size: 11px; color: var(--mut); border: 1px solid var(--line);
  border-radius: 99px; padding: 5px 11px; background: var(--card);
  display: flex; align-items: center; gap: 6px;
}
.hpill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* cards */
.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.card.hero {
  border-color: rgba(110, 168, 255, .25);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(110, 168, 255, .12), transparent 55%),
    linear-gradient(180deg, var(--card2), var(--card));
}
.ctitle { font-weight: 600; font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.clabel { font-size: 10.5px; color: var(--dim); letter-spacing: .2em; text-transform: uppercase; margin-bottom: 6px; }
.csub { font-size: 12.5px; color: var(--mut); }

/* rows / stats */
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: 13.5px;
}
.row:last-child { border-bottom: 0; }
.row .k { color: var(--mut); }
.row .v { text-align: right; font-weight: 500; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: rgba(255,255,255,.025); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; text-align: center;
}
.stat .sv { font-size: 21px; font-weight: 700; }
.stat .sk { font-size: 11px; color: var(--mut); margin-top: 2px; }
.stat .si { margin-bottom: 5px; }
.stat .si .icn { width: 17px; height: 17px; margin: 0; stroke: var(--acc2); opacity: .85; }
.row .k .icn { stroke: var(--dim); }

/* buttons */
.btn {
  display: block; width: 100%; text-align: center; cursor: pointer;
  background: linear-gradient(180deg, #f4f6f9, #d9dee6);
  color: #0a0c10; border: 0; border-radius: 12px;
  padding: 13px 16px; font-size: 14px; font-weight: 600; font-family: inherit;
  margin-top: 12px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; }
.btn.sm { padding: 10px 14px; font-size: 13px; }
.btn.ghost {
  background: var(--card2); color: var(--txt); border: 1px solid var(--line2);
}
.btn.accent {
  background: linear-gradient(180deg, #7cb0ff, #4f8cff); color: #061224;
  box-shadow: 0 4px 18px rgba(79, 140, 255, .25);
}
.btn.danger { background: rgba(248, 113, 113, .12); color: var(--bad); border: 1px solid rgba(248,113,113,.3); }
.btnrow { display: flex; gap: 8px; }
.btnrow .btn { flex: 1; }

/* inputs */
.inp {
  width: 100%; background: rgba(0,0,0,.35); border: 1px solid var(--line2);
  border-radius: 12px; padding: 12px 13px; color: var(--txt);
  font-size: 14px; font-family: inherit; outline: none;
}
.inp:focus { border-color: rgba(110,168,255,.5); }
textarea.inp { resize: none; min-height: 84px; }
input[type="range"] { width: 100%; accent-color: var(--acc); }

/* badges */
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; border-radius: 99px;
  padding: 3px 10px; border: 1px solid var(--line2); color: var(--mut);
}
.badge.ok { color: var(--ok); border-color: rgba(74,222,128,.3); background: rgba(74,222,128,.07); }
.badge.bad { color: var(--bad); border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.07); }
.badge.acc { color: var(--acc2); border-color: rgba(110,168,255,.35); background: rgba(110,168,255,.08); }
.badge.warn { color: var(--warn); border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.07); }

/* skeleton loading */
.skel-wrap .loader { padding: 24px 0; }
.skel {
  border-radius: var(--r); margin-bottom: 12px; border: 1px solid var(--line);
  background: linear-gradient(100deg, rgba(255,255,255,.03) 40%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 60%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -70% 0; } }

/* provider avatar */
.pavatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px; margin-right: 8px;
  font-size: 13px; font-weight: 700; border: 1px solid; vertical-align: middle;
}

/* bottom sheet */
.sheet-bg {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55);
  opacity: 0; transition: opacity .25s ease;
}
.sheet-bg.show { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh;
  background: var(--bg2); border: 1px solid var(--line2); border-bottom: 0;
  border-radius: 20px 20px 0 0; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.3,.9,.3,1);
  box-shadow: 0 -12px 40px rgba(0,0,0,.5);
}
.sheet-bg.show .sheet { transform: none; }
.sheet-grab {
  flex: none; padding: 10px 0 6px; cursor: pointer;
}
.sheet-grab::before {
  content: ""; display: block; width: 42px; height: 4px; margin: 0 auto;
  border-radius: 99px; background: var(--line2);
}
.sheet-body { overflow-y: auto; padding: 6px 18px calc(20px + env(safe-area-inset-bottom)); }

/* rating bar */
.bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,.07); overflow: hidden; margin: 10px 0 6px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #4f8cff, #9db9ff); border-radius: 4px; }

/* bottom nav */
nav.tabs {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: calc(100% - 24px); max-width: 536px;
  display: flex; z-index: 50;
  background: rgba(10, 12, 17, .88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 18px; padding: 6px;
}
nav.tabs button {
  flex: 1; background: none; border: 0; cursor: pointer;
  color: var(--dim); font-family: inherit; font-size: 10px; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px; border-radius: 12px;
}
nav.tabs button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs button.active { color: var(--txt); background: rgba(110, 168, 255, .12); }
nav.tabs button.active svg { color: var(--acc2); }

/* tickets chat */
.tk-item { cursor: pointer; }
.tk-item:active { background: var(--card2); }
.chat { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 10px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; word-break: break-word; }
.msg img { max-width: 100%; border-radius: 10px; display: block; margin-top: 4px; }
.msg.me { align-self: flex-end; background: rgba(110, 168, 255, .16); border: 1px solid rgba(110,168,255,.25); border-bottom-right-radius: 5px; }
.msg.op { align-self: flex-start; background: var(--card2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg .mt { font-size: 10px; color: var(--dim); margin-top: 3px; text-align: right; }
.chatbar { display: flex; gap: 8px; margin-top: 10px; }
.chatbar .inp { flex: 1; }
.chatbar .btn { width: auto; margin: 0; padding: 0 16px; }

/* gate screens */
.gate { text-align: center; padding: 46px 18px; }
.gate .gicon { margin-bottom: 14px; }
.gate .gicon .icn { width: 44px; height: 44px; }
.icn {
  width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.gicon .icn { stroke: var(--acc2); margin: 0; }
.sendbtn .icn { width: 18px; height: 18px; margin: 0; vertical-align: middle; }
.gate h2 { font-size: 18px; margin-bottom: 8px; }
.gate p { color: var(--mut); font-size: 13.5px; }

.center { text-align: center; }
.muted { color: var(--mut); }
.dimmed { color: var(--dim); }
.spacer { height: 8px; }
.empty { color: var(--dim); font-size: 13px; padding: 10px 0; text-align: center; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: rgba(18, 21, 28, .96); color: var(--txt); z-index: 99;
  padding: 10px 18px; border-radius: 12px; font-size: 13px;
  border: 1px solid var(--line2); box-shadow: 0 8px 30px rgba(0,0,0,.5);
  white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}

/* loader */
.loader { text-align: center; padding: 60px 0; color: var(--dim); }
.loader .ring {
  width: 26px; height: 26px; margin: 0 auto 10px; border-radius: 50%;
  border: 2px solid var(--line2); border-top-color: var(--acc);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Админка */
.subnav {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.pill {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--mut); font-size: 13px; font-weight: 500; font-family: inherit;
}
.pill.active { background: rgba(110,168,255,.14); border-color: rgba(110,168,255,.4); color: var(--acc2); }
select.inp {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--mut) 50%), linear-gradient(135deg, var(--mut) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px;
}
select.inp option { background: var(--bg2); color: var(--txt); }

/* plan card */
.card.plan {
  border-color: rgba(110, 168, 255, .35);
  background:
    radial-gradient(140% 110% at 0% 0%, rgba(110, 168, 255, .16), transparent 55%),
    radial-gradient(120% 90% at 100% 100%, rgba(157, 185, 255, .07), transparent 60%),
    linear-gradient(180deg, var(--card2), var(--card));
}
.card.plan .ctitle .icn { stroke: var(--acc2); }
.card.plan.off {
  border-color: var(--line);
  background: linear-gradient(180deg, var(--card2), var(--card));
}

/* model groups */
.mgroup { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; background: rgba(255,255,255,.015); }
.mghead {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 13px; cursor: pointer; user-select: none; -webkit-user-select: none;
}
.mghead:active { background: var(--card2); }
.mgname { font-weight: 600; font-size: 13.5px; }
.mgcnt { font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 4px; }
.mgcnt .icn { width: 14px; height: 14px; margin: 0; transition: transform .25s ease; }
.mgroup.open .mgcnt .icn { transform: rotate(180deg); }
.mgbody { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.mgroup.open .mgbody { max-height: 900px; }
.mgbody .mrow { border-top: 1px solid rgba(255,255,255,.04); }
.mrow {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 9px 13px; font-size: 13px; cursor: pointer;
}
.mrow:active { background: var(--card2); }
.mrow .k { color: var(--txt); }
.mrow .v { color: var(--dim); text-align: right; }
.mrow .icn { width: 12px; height: 12px; margin: 0 0 0 2px; opacity: .6; }
.row.mrow { padding: 8px 0; }

/* entrance animation */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#view .card, #view .mgroup, #view .subnav { animation: fadeUp .32s ease both; }
#view .card:nth-child(2) { animation-delay: .05s; }
#view .card:nth-child(3) { animation-delay: .1s; }
#view .card:nth-child(4) { animation-delay: .15s; }
@media (prefers-reduced-motion: reduce) {
  #view .card, #view .mgroup, #view .subnav { animation: none; }
  .mgbody { transition: none; }
}
.btn { transition: transform .12s ease, box-shadow .15s ease, opacity .15s ease; }
.btn:active { transform: scale(.97); }
.pill { transition: background .15s ease, color .15s ease, border-color .15s ease; }
nav.tabs button { transition: color .15s ease, background .15s ease; }
