/* ---------- login ---------- */
.login { max-width: 380px; margin: 12vh auto; padding: 30px; }
.login h1 { margin: 18px 0 6px; font-size: 22px; }
.err { color: #fca5a5; font-size: 12px; }
.sm { font-size: 13px; }
.big { font-size: 28px; font-weight: 500; letter-spacing: -.02em; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 22px 14px;
  background: linear-gradient(180deg, rgba(14,18,34,.92), rgba(8,11,22,.92)); border-right: 1px solid var(--line); backdrop-filter: blur(14px); }
.side .brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.side .brand small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.side .brand span { font-weight: 600; }
.side nav, .side-foot { display: flex; flex-direction: column; gap: 4px; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.side a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; color: #aab1cc; font-size: 14px; position: relative; transition: .15s; }
.side a svg { width: 20px; height: 20px; flex: none; }
.side a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.side a.on { color: #fff; background: linear-gradient(90deg, rgba(47,107,255,.28), rgba(47,107,255,.06)); box-shadow: inset 0 0 0 1px rgba(77,139,255,.3); }
.side a.on::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent-2); box-shadow: 0 0 12px var(--accent-2); }
.pill { margin-left: auto; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(77,139,255,.2); color: #b9d0ff; }
.pill.red { background: rgba(239,68,68,.2); color: #fca5a5; }
.main { padding: 28px 34px 60px; min-width: 0; max-width: 1280px; }
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.phead h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.phead p { margin: 4px 0 0; font-size: 14px; }
.pact { display: flex; gap: 10px; }

/* ---------- blocks ---------- */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.stat { padding: 18px; display: flex; gap: 14px; align-items: flex-start; }
.stat .ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.stat .ic svg { width: 21px; height: 21px; }
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 500; margin-top: 4px; letter-spacing: -.02em; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; margin-bottom: 14px; }
.box { padding: 20px; }
.box h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.box-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.box-h h3 { margin: 0; }
.seg.mini { width: auto; } .seg.mini button { padding: 8px 12px; font-size: 13px; }
.mini-site { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mini-site:last-child { border-bottom: 0; }
.mini-site .av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 600; background: linear-gradient(145deg, #2f6bff, #1a3fa8); flex: none; }
.mini-site .meta { min-width: 0; flex: 1; } .mini-site .meta small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; flex: none; }
.dot.off { background: #6b7280; box-shadow: none; } .dot.warn { background: #f87171; box-shadow: 0 0 8px #f87171; }

.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar input { width: 260px; padding: 9px 14px; } .toolbar select { width: auto; min-width: 160px; padding: 9px 14px; }
.chk { margin: 0; display: flex; gap: 6px; align-items: center; white-space: nowrap; } .chk input { width: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
tbody tr { cursor: pointer; transition: background .15s; } tbody tr:hover { background: rgba(77,139,255,.06); }
.tbl { overflow-x: auto; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 8px; background: rgba(255,255,255,.06); color: #c9d2ee; max-width: 160px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.url { max-width: 240px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }

/* ---------- sites ---------- */
.howto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-bottom: 16px; padding: 6px; }
.step { display: flex; gap: 12px; align-items: center; padding: 12px 14px; }
.step + .step { border-left: 1px solid var(--line); }
.step b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(47,107,255,.2); color: #b9d0ff; flex: none; font-size: 14px; }
.step strong { display: block; font-size: 14px; font-weight: 500; } .step span { font-size: 12px; color: var(--muted); }
.sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 16px; }
.site { padding: 0; overflow: hidden; }
.site.off { opacity: .6; }
.site-h { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(47,107,255,.10), transparent); }
.site-h .av { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 600; font-size: 18px; background: linear-gradient(145deg, #2f6bff, #1a3fa8); box-shadow: 0 8px 22px rgba(47,107,255,.35); flex: none; }
.site-h .av.env { background: linear-gradient(145deg, #3a4160, #232840); box-shadow: none; }
.site-h h3 { margin: 0; font-size: 16px; font-weight: 600; } .site-h small { color: var(--muted); font-size: 12px; }
.site-h .r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sw { position: relative; width: 40px; height: 22px; border-radius: 999px; background: #3a4058; border: 0; cursor: pointer; transition: .2s; flex: none; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.sw.on { background: var(--accent); box-shadow: 0 0 14px var(--accent-glow); } .sw.on::after { left: 21px; }
.site-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.site-stats div { padding: 12px 16px; } .site-stats div + div { border-left: 1px solid var(--line); }
.site-stats b { display: block; font-size: 17px; font-weight: 500; } .site-stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.site-b { padding: 16px 20px 20px; display: grid; gap: 12px; }
.fld label { margin-bottom: 5px; font-size: 12px; display: flex; justify-content: space-between; }
.secret { display: flex; gap: 6px; align-items: center; }
.secret code { flex: 1; min-width: 0; font: 12.5px var(--mono); padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.28); border: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cfe0ff; }
.ib { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); color: #b9c2e2; cursor: pointer; display: grid; place-items: center; flex: none; }
.ib:hover { color: #fff; border-color: rgba(77,139,255,.5); background: rgba(77,139,255,.12); }
.ib svg { width: 17px; height: 17px; }
.inline { display: flex; gap: 6px; } .inline input { padding: 9px 12px; font-size: 13px; border-radius: 12px; }
.site-f { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.test-out { font: 12px var(--mono); padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.28); word-break: break-all; }
.test-out.ok { color: #86efac; border: 1px solid rgba(74,222,128,.3); } .test-out.bad { color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }

/* ---------- webhooks ---------- */
.hk-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }

/* ---------- system ---------- */
.wallet { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.wallet:last-child { border-bottom: 0; } .wallet .mono { font-size: 12px; word-break: break-all; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }

/* ---------- drawer & modal ---------- */
.drawer-bg, .modal-bg { position: fixed; inset: 0; background: rgba(2,4,12,.6); backdrop-filter: blur(3px); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 21; overflow-y: auto; padding: 24px;
  background: #0d1120; border-left: 1px solid var(--line-strong); animation: slide .25s ease; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer h2, .modal h2 { margin: 0; font-size: 18px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px; font-size: 13px; margin: 18px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.hook { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
pre.json { font: 12px/1.6 var(--mono); padding: 14px; border-radius: 14px; background: rgba(0,0,0,.35); border: 1px solid var(--line); overflow: auto; max-height: 420px; color: #cfe0ff; }
.modal { position: fixed; z-index: 21; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow-y: auto;
  padding: 24px; border-radius: 24px; background: #0f1426; border: 1px solid var(--line-strong); box-shadow: 0 40px 100px rgba(0,0,0,.6); animation: pop .25s ease; }
.modal .form { display: grid; gap: 12px; margin-top: 18px; } .modal .g2 { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.modal .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.link-out { display: flex; gap: 8px; margin-top: 12px; } .link-out input { font-family: var(--mono); font-size: 12px; }

@media (max-width: 1100px) { .grid4 { grid-template-columns: repeat(2, 1fr); } .row2 { grid-template-columns: 1fr; } .sites { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; overflow-x: auto; gap: 4px; }
  .side .brand { padding: 0 8px 0 0; } .side .brand > div:last-child { display: none; }
  .side nav, .side-foot { flex-direction: row; } .side-foot { margin: 0; padding: 0 0 0 6px; border: 0; border-left: 1px solid var(--line); }
  .side a { padding: 9px 11px; white-space: nowrap; } .side a.on::before { display: none; } .side a span { font-size: 13px; }
  .side-foot a span { display: none; }
  .main { padding: 20px 16px 50px; } .phead h1 { font-size: 22px; }
  .howto { grid-template-columns: 1fr; } .step + .step { border-left: 0; border-top: 1px solid var(--line); }
  .site-stats { grid-template-columns: repeat(2, 1fr); } .site-stats div:nth-child(3) { border-left: 0; } .site-stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .toolbar input, .toolbar select { width: 100%; } .hk-stats { grid-template-columns: 1fr; }
}
@media (max-width: 520px) { .grid4 { grid-template-columns: 1fr; } }
.inline .btn, .site-f .btn { white-space: nowrap; }
