:root {
  --bg:#f3f4f9; --card:#fff; --ink:#1b2033; --muted:#6a7287; --line:#e6e8f0; --soft:#f6f7fb;
  --accent:#4f46e5; --accent-soft:#eceafd; --ok:#13875a; --ok-soft:#e3f6ec; --bad:#c8343f; --bad-soft:#fdeaec; --warn:#a66a00; --warn-soft:#fff3d9;
  --radius:12px; --shadow:0 1px 2px rgba(20,25,50,.05), 0 4px 14px rgba(20,25,50,.05);
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; font:14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; background:var(--bg); color:var(--ink); -webkit-font-smoothing:antialiased; }
h1, h2, h3, p { margin:0; }

/* top bar */
header { position:sticky; top:0; z-index:5; display:flex; align-items:center; gap:28px; padding:0 32px; height:62px; background:var(--card); border-bottom:1px solid var(--line); }
.brand { display:flex; align-items:center; gap:10px; font-weight:700; font-size:16px; letter-spacing:-.01em; }
.logo { width:30px; height:30px; border-radius:9px; background:linear-gradient(135deg, #6c63ff, #3b82f6); display:grid; place-items:center; color:#fff; font-size:15px; }
.role { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--accent); background:var(--accent-soft); padding:2px 8px; border-radius:20px; }
nav { display:flex; gap:6px; flex:1; }
nav button { border:0; background:transparent; color:var(--muted); font:inherit; font-weight:500; padding:8px 14px; border-radius:8px; cursor:pointer; }
nav button:hover { background:var(--soft); color:var(--ink); }
nav button.on { background:var(--accent-soft); color:var(--accent); font-weight:600; }
.who { display:flex; align-items:center; gap:14px; color:var(--muted); }
.avatar { width:32px; height:32px; border-radius:50%; background:var(--accent-soft); color:var(--accent); display:grid; place-items:center; font-weight:700; text-transform:uppercase; }

main { max-width:1200px; margin:0 auto; padding:30px 32px 60px; }
.page-head { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
.page-head h1 { font-size:22px; letter-spacing:-.02em; }
.page-head p { color:var(--muted); margin-top:2px; }

/* cards */
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); padding:24px; margin-bottom:22px; }
.card > h2, .card-head h2 { font-size:15px; font-weight:650; letter-spacing:-.01em; }
.card > h2 { margin-bottom:18px; }
.card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; flex-wrap:wrap; }
.card.flush { padding:0; overflow:hidden; }
.card.flush .card-head { padding:20px 24px 0; }
.hint { color:var(--muted); font-size:13px; }

/* buttons */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; border:1px solid var(--line); background:var(--card); color:var(--ink); padding:9px 16px; border-radius:9px; cursor:pointer; font:inherit; font-weight:550; line-height:1.2; transition:background .12s, border-color .12s, box-shadow .12s; white-space:nowrap; }
.btn:hover { background:var(--soft); border-color:#d5d9e6; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; box-shadow:0 1px 2px rgba(79,70,229,.3); }
.btn.primary:hover { background:#4338ca; }
.btn.danger { color:var(--bad); }
.btn.danger:hover { background:var(--bad-soft); border-color:#f3c3c8; }
.btn.sm { padding:6px 12px; font-size:13px; }
.btn:disabled { opacity:.55; cursor:default; }
.actions { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }

/* forms */
input, select { font:inherit; color:var(--ink); padding:9px 12px; border:1px solid #d9dce8; border-radius:9px; background:#fff; width:100%; min-height:40px; }
input:focus, select:focus { outline:2px solid var(--accent-soft); border-color:var(--accent); }
.field { display:flex; flex-direction:column; gap:6px; min-width:0; }
.field > span { font-size:12px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.fields { display:grid; grid-template-columns:repeat(auto-fit, minmax(190px, 1fr)); gap:16px 18px; margin-bottom:20px; }
.seg { display:inline-flex; background:var(--soft); border:1px solid var(--line); border-radius:10px; padding:3px; gap:2px; flex-wrap:wrap; }
.seg button { border:0; background:transparent; font:inherit; font-weight:550; color:var(--muted); padding:7px 14px; border-radius:8px; cursor:pointer; }
.seg button.on { background:#fff; color:var(--accent); box-shadow:0 1px 3px rgba(20,25,50,.12); }
.chips { display:flex; flex-wrap:wrap; gap:8px; }
.chip { display:inline-flex; align-items:center; gap:8px; padding:8px 14px; border:1px solid #d9dce8; border-radius:20px; cursor:pointer; user-select:none; background:#fff; }
.chip input { width:auto; min-height:0; margin:0; accent-color:var(--accent); }
.chip:has(input:checked) { border-color:var(--accent); background:var(--accent-soft); color:var(--accent); font-weight:550; }

/* stats */
.stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(190px, 1fr)); gap:18px; margin-bottom:22px; }
.stat { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px 22px; border-top:3px solid var(--line); }
.stat span { display:block; color:var(--muted); font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; }
.stat b { display:block; font-size:30px; letter-spacing:-.02em; margin-top:6px; }
.stat.good { border-top-color:var(--ok); } .stat.bad { border-top-color:var(--bad); } .stat.accent { border-top-color:var(--accent); }
.ok { color:var(--ok); } .bad { color:var(--bad); } .muted { color:var(--muted); }

/* chart */
.chart { display:flex; align-items:flex-end; gap:14px; height:190px; padding-top:10px; }
.day { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; gap:6px; font-size:12px; color:var(--muted); }
.day .num { font-weight:600; color:var(--ink); }
.stack { width:100%; max-width:56px; display:flex; flex-direction:column-reverse; border-radius:7px 7px 0 0; overflow:hidden; background:var(--soft); }
.stack .okb { background:var(--ok); } .stack .badb { background:var(--bad); }
.legend { display:flex; gap:16px; font-size:12px; color:var(--muted); }
.legend i { display:inline-block; width:9px; height:9px; border-radius:3px; margin-right:6px; }

/* tables */
.scroll { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th { text-align:left; padding:12px 24px; color:var(--muted); font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.05em; background:var(--soft); border-top:1px solid var(--line); border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:15px 24px; border-bottom:1px solid var(--line); vertical-align:middle; }
tr:last-child td { border-bottom:0; }
tbody tr:hover td { background:#fafbfe; }
td.right, th.right { text-align:right; }
.sub { color:var(--muted); font-size:12.5px; margin-top:2px; }
.empty { padding:34px 24px; text-align:center; color:var(--muted); }
.rate { display:flex; align-items:center; gap:10px; min-width:130px; }
.rate .track { flex:1; height:6px; border-radius:6px; background:var(--bad-soft); overflow:hidden; }
.rate .fill { height:100%; background:var(--ok); }

.tag { display:inline-block; padding:3px 10px; border-radius:20px; font-size:12px; font-weight:600; background:var(--soft); color:var(--muted); }
.tag.s-active, .tag.success { background:var(--ok-soft); color:var(--ok); }
.tag.s-expired, .tag.s-exhausted, .tag.failed { background:var(--bad-soft); color:var(--bad); }
.tag.admin { background:var(--accent-soft); color:var(--accent); }
.tag.warn { background:var(--warn-soft); color:var(--warn); }

/* messages */
.msg { padding:12px 16px; border-radius:10px; margin-bottom:20px; background:var(--bad-soft); color:var(--bad); border:1px solid #f6ccd0; word-break:break-word; }
.msg.good { background:var(--ok-soft); color:var(--ok); border-color:#bfe6d1; }
code { background:var(--soft); padding:2px 6px; border-radius:5px; font-size:12.5px; word-break:break-all; }
.keybox { display:flex; gap:10px; }
.keybox input { font-family:ui-monospace, Menlo, monospace; font-size:13px; }

/* login */
.login-wrap { min-height:100vh; display:grid; place-items:center; padding:20px; background:linear-gradient(160deg, #e9e7ff 0%, #f3f4f9 45%, #e6f0ff 100%); }
.login { width:100%; max-width:380px; background:var(--card); border-radius:16px; box-shadow:0 10px 40px rgba(40,40,100,.14); padding:36px 32px; }
.login .logo { width:46px; height:46px; font-size:22px; border-radius:13px; margin-bottom:18px; }
.login h1 { font-size:22px; letter-spacing:-.02em; }
.login p { color:var(--muted); margin:4px 0 24px; }
.login .field { margin-bottom:16px; }
.login .btn { width:100%; padding:11px; margin-top:6px; }

/* modal */
.overlay { position:fixed; inset:0; background:rgba(20,24,45,.45); display:grid; place-items:center; z-index:20; padding:20px; backdrop-filter:blur(2px); }
.modal { background:var(--card); border-radius:16px; width:100%; max-width:560px; max-height:90vh; overflow:auto; box-shadow:0 20px 60px rgba(20,24,60,.3); }
.modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:22px 26px; border-bottom:1px solid var(--line); }
.modal-head h2 { font-size:17px; }
.x { border:0; background:var(--soft); width:32px; height:32px; border-radius:50%; cursor:pointer; font-size:18px; color:var(--muted); }
.x:hover { background:var(--line); }
.modal-body { padding:8px 26px 26px; }
.section { padding:20px 0; border-bottom:1px solid var(--line); }
.section:last-child { border-bottom:0; padding-bottom:0; }
.section h3 { font-size:13px; font-weight:650; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:14px; }
.section .fields { margin-bottom:16px; }
.kv { display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center; margin-bottom:16px; }

/* run */
.thumbs { display:grid; grid-template-columns:repeat(auto-fill, minmax(96px, 1fr)); gap:10px; margin:18px 0; }
.thumbs img { width:100%; aspect-ratio:1; object-fit:cover; border-radius:9px; background:var(--line); }
pre { background:#12172a; color:#d7def0; padding:18px; border-radius:10px; overflow:auto; max-height:520px; margin:18px 0 0; font-size:12.5px; line-height:1.55; }
.plan-card { display:flex; align-items:center; gap:34px; flex-wrap:wrap; }
.plan-card .item span { display:block; color:var(--muted); font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; }
.plan-card .item b { font-size:18px; }
@media (max-width:760px) { header { padding:0 16px; gap:12px; flex-wrap:wrap; height:auto; padding-block:10px; } main { padding:20px 16px 40px; } th, td { padding-inline:14px; } }
.dot-ok { background:var(--ok); } .dot-bad { background:var(--bad); }
.mt { margin-top:16px; }
.hint-gap { height:14px; }
.hint + .fields, .hint + .actions { margin-top:14px; }
.hint-gap { height:10px; }
.section .hint { margin-bottom:0; }
.card > .actions { margin-top:22px; }
.card > .chips { margin-bottom:4px; }
.album-table { margin:0 0 18px; box-shadow:none; }
.thumbs a { display:block; }
.thumbs img.broken { opacity:.35; }
.card > .stats { margin-bottom:18px; }

/* photo gallery + full-screen viewer */
.gallery { max-height:560px; overflow-y:auto; padding:12px; border:1px solid var(--line); border-radius:12px; background:var(--soft); }
.gallery .thumbs { margin:0; }
.thumb { padding:0; border:0; background:none; cursor:zoom-in; border-radius:9px; overflow:hidden; display:block; }
.thumb img { display:block; transition:transform .15s; }
.thumb:hover img { transform:scale(1.06); }
.thumb:focus-visible { outline:3px solid var(--accent); }
body.noscroll { overflow:hidden; }
.lightbox { position:fixed; inset:0; z-index:50; background:#080a14; display:flex; flex-direction:column; color:#fff; }
.lb-bar { display:flex; align-items:center; gap:18px; padding:14px 22px; }
.lb-count { font-weight:650; } .lb-meta { color:#9aa3bd; flex:1; }
.lb-close { border:0; background:rgba(255,255,255,.12); color:#fff; width:42px; height:42px; border-radius:50%; font-size:26px; cursor:pointer; line-height:1; }
.lb-close:hover, .lb-nav:hover { background:rgba(255,255,255,.25); }
.lb-stage { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; position:relative; padding:0 80px 30px; }
.lb-img { height:100%; max-width:100%; object-fit:contain; border-radius:6px; box-shadow:0 10px 50px rgba(0,0,0,.6); transition:opacity .15s; background:#1a1f33; min-width:120px; min-height:120px; }
.lb-img.loading { opacity:.35; }
.lb-nav { position:absolute; top:50%; transform:translateY(-50%); border:0; background:rgba(255,255,255,.12); color:#fff; width:52px; height:52px; border-radius:50%; font-size:34px; cursor:pointer; line-height:1; padding-bottom:4px; }
.lb-prev { left:18px; } .lb-next { right:18px; }

/* colourful code */
pre.code { background:#0f1424; color:#cdd6f4; border:1px solid #1d2540; tab-size:2; }
.t-key { color:#7dcfff; } .t-str { color:#a6e3a1; } .t-num { color:#fab387; } .t-bool { color:#cba6f7; font-weight:600; } .t-null { color:#f38ba8; font-style:italic; }

/* details page */
.details { display:flex; flex-direction:column; gap:18px; margin-bottom:18px; }
.d-profile { display:flex; align-items:center; gap:20px; padding:20px; border:1px solid var(--line); border-radius:12px; background:linear-gradient(135deg, #f5f4ff, #eef6ff); flex-wrap:wrap; }
.d-avatar { width:64px; height:64px; border-radius:50%; background:var(--accent); color:#fff; display:grid; place-items:center; font-size:28px; font-weight:700; text-transform:uppercase; flex:none; }
.d-who { flex:1; min-width:220px; display:flex; flex-direction:column; gap:8px; }
.d-who h2 { font-size:22px; letter-spacing:-.02em; }
.pills { display:flex; flex-wrap:wrap; gap:6px; }
.pill { display:inline-block; padding:3px 11px; border-radius:20px; font-size:12.5px; font-weight:550; background:#fff; border:1px solid var(--line); color:var(--ink); }
.pill.blue { background:var(--accent-soft); border-color:transparent; color:var(--accent); }
.pill.green { background:var(--ok-soft); border-color:transparent; color:var(--ok); }
.pill.red { background:var(--bad-soft); border-color:transparent; color:var(--bad); }
.d-stats { margin:0; }
.d-cols { display:grid; grid-template-columns:repeat(auto-fit, minmax(340px, 1fr)); gap:18px; }
.d-card { border:1px solid var(--line); border-radius:12px; padding:18px 20px; background:#fff; min-width:0; }
.d-head { display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.d-head h3 { font-size:14px; font-weight:650; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }
.d-badge { background:var(--accent-soft); color:var(--accent); font-weight:700; font-size:12px; padding:2px 9px; border-radius:20px; }
.d-item { padding:12px 0; border-bottom:1px solid var(--line); display:flex; flex-direction:column; gap:3px; align-items:flex-start; }
.d-item:last-child { border-bottom:0; padding-bottom:0; } .d-item:first-child { padding-top:0; }
.d-row { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); }
.d-row:last-child { border-bottom:0; }
.d-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:0 28px; }
.d-meta { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:4px; font-size:13px; }
.d-tools { display:flex; align-items:center; gap:14px; margin-bottom:12px; flex-wrap:wrap; }
.d-tools input { max-width:320px; }
.d-scroll { max-height:420px; overflow:auto; border:1px solid var(--line); border-radius:10px; }
.d-scroll th { position:sticky; top:0; z-index:1; } .d-scroll td, .d-scroll th { padding:10px 16px; }
details.raw { margin-top:18px; } details.raw summary { cursor:pointer; font-weight:600; color:var(--muted); padding:6px 0; }
.details a, .d-card a { color:var(--accent); text-decoration:none; font-weight:550; } .details a:hover, .d-card a:hover { text-decoration:underline; }
.btn.sm[href] { text-decoration:none; color:var(--ink); }
.d-grid { gap:18px 28px; } .d-grid .d-item { padding:0 0 14px; }

/* profile header (search) page */
.s-card { border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#fff; }
.s-cover { display:block; width:100%; height:220px; border:0; padding:0; cursor:zoom-in; background:linear-gradient(135deg, #6c63ff, #3b82f6); }
.s-cover img { width:100%; height:100%; object-fit:cover; display:block; }
.s-cover.empty { cursor:default; }
.s-body { display:flex; gap:22px; padding:0 24px 22px; align-items:flex-start; flex-wrap:wrap; }
.s-avatar { width:124px; height:124px; border-radius:50%; border:5px solid #fff; margin-top:-62px; overflow:hidden; padding:0; background:var(--accent); cursor:zoom-in; flex:none; box-shadow:0 2px 10px rgba(20,25,50,.2); color:#fff; font-size:44px; font-weight:700; display:grid; place-items:center; text-transform:uppercase; }
.s-avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.s-avatar.empty { cursor:default; }
.s-main { flex:1; min-width:240px; padding-top:14px; display:flex; flex-direction:column; gap:8px; }
.s-main h2 { font-size:24px; letter-spacing:-.02em; }
.s-ctx { color:var(--muted); font-size:13.5px; display:flex; flex-direction:column; gap:2px; }
.s-body > .btn { margin-top:16px; }
.facts { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:14px 24px; }
.facts > div { display:flex; flex-direction:column; gap:2px; }
.facts span { color:var(--muted); font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; }
.facts b { word-break:break-all; font-weight:600; }

/* report layout */
.card.report { padding:0; overflow:hidden; border:0; box-shadow:0 2px 6px rgba(20,25,50,.08), 0 14px 40px rgba(20,25,50,.08); }
.rep-head { background:linear-gradient(120deg, #1e1b4b 0%, #3730a3 55%, #2563eb 100%); color:#fff; padding:28px 32px 22px; }
.rep-top { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; flex-wrap:wrap; }
.rep-kicker { text-transform:uppercase; letter-spacing:.14em; font-size:11px; font-weight:700; opacity:.75; }
.rep-head h2 { font-size:28px; letter-spacing:-.02em; margin:2px 0 4px; }
.rep-head p { opacity:.85; margin:0; }
.rep-meta { display:flex; flex-wrap:wrap; gap:10px 36px; margin-top:22px; padding-top:16px; border-top:1px solid rgba(255,255,255,.2); }
.rep-meta-item span { display:block; text-transform:uppercase; letter-spacing:.08em; font-size:10.5px; font-weight:600; opacity:.7; }
.rep-meta-item b { font-size:14px; }
.btn.light { background:rgba(255,255,255,.14); border-color:rgba(255,255,255,.28); color:#fff; }
.btn.light:hover { background:rgba(255,255,255,.26); border-color:rgba(255,255,255,.4); }
.rep-body { padding:26px 32px 8px; background:#fafbfe; }
.rep-foot { padding:16px 32px; border-top:1px solid var(--line); color:var(--muted); font-size:12.5px; text-align:center; background:#fff; }
.d-num { width:26px; height:26px; border-radius:8px; background:var(--accent); color:#fff; font-size:12px; font-weight:700; display:grid; place-items:center; flex:none; }
.d-card { box-shadow:0 1px 2px rgba(20,25,50,.04); }
.d-scroll.flat { border:0; max-height:none; border-radius:0; }
.d-scroll.flat th, .d-scroll.flat td { padding-inline:6px; }
tbody tr:nth-child(even) td { background:#fafbfe; }
.rep-body .stat { box-shadow:none; }
.rep-body .s-card, .rep-body .d-profile { box-shadow:0 1px 2px rgba(20,25,50,.04); }
.rep-body > .msg { margin-bottom:24px; }

@media print {
  body { background:#fff; }
  body * { visibility:hidden; }
  .card.report, .card.report * { visibility:visible; }
  .card.report { position:absolute; left:0; top:0; width:100%; box-shadow:none; }
  .no-print, .lightbox { display:none !important; }
  .rep-head { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .d-num, .d-badge, .pill, .tag { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .d-card, .stat, .d-item, tr { break-inside:avoid; }
  .gallery, .d-scroll { max-height:none !important; overflow:visible !important; }
  .thumbs { grid-template-columns:repeat(8, 1fr); }
}
.s-ctx { flex-direction:row !important; gap:22px !important; font-size:15px !important; } .s-stat a { color:var(--ink) !important; font-weight:650 !important; }

.about-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:14px; }
.about-block { border:1px solid var(--line); border-radius:10px; padding:14px 16px; background:var(--soft); }
.about-block h4 { font-size:12.5px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin:0 0 8px; }
.about-empty { color:var(--muted); font-style:italic; margin:0; }

/* integration page */
.snip { border:1px solid #1d2540; border-radius:10px; overflow:hidden; margin-top:14px; background:#0f1424; }
.snip-bar { display:flex; justify-content:space-between; align-items:center; padding:8px 12px 8px 16px; background:#171d36; color:#9aa6cf; font-size:12px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; }
.snip-bar .btn.sm { background:rgba(255,255,255,.1); border-color:rgba(255,255,255,.2); color:#fff; }
.snip-bar .btn.sm:hover { background:rgba(255,255,255,.2); }
.snip pre.code { margin:0; border:0; border-radius:0; max-height:none; white-space:pre-wrap; word-break:break-all; }
.param-list { display:flex; flex-direction:column; gap:6px; margin:6px 0 4px; }
.param { display:flex; gap:14px; align-items:baseline; font-size:13.5px; }
.param code { min-width:110px; flex:none; text-align:center; background:var(--accent-soft); color:var(--accent); font-weight:600; }
.param span { color:var(--muted); }
.card-head code { background:var(--soft); }

/* profile report tabs */
.tabbar { align-self:flex-start; margin:2px 0; }
.tab-host { display:flex; flex-direction:column; gap:18px; }
.load-prompt { background:linear-gradient(135deg, #f5f4ff, #eef6ff); }
.load-prompt h3 { margin-bottom:6px; }
.load-prompt .actions { margin:12px 0 4px; }
@media print { .tab-host > * { display:block; } }
