  :root {
    --bg: #0a0a0a; --surface: #111111; --surface-2: #161616; --line: #232323; --line-soft: #1a1a1a;
    --text: #f2f2f2; --text-2: #cfcfcf; --muted: #7a7a7a; --accent: #ffffff; --accent-ink: #0a0a0a;
    --mono: "JetBrains Mono", monospace; --chip-bg: #151515; --input-bg: #0f0f0f; --table-head: #111;
    --btn-r: 999px; --input-r: 12px; --row-hover: #151515; --toast-bg: #141414;
  }
  body { background: var(--bg); color: var(--text); font-family: "Inter Tight", Inter, system-ui, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
  ::selection { background: #fff; color: #000; }
  .grain { position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .05; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

  /* ---------- Сцены ---------- */
  .scene { position: fixed; inset: 0; transition: opacity .7s var(--ease), transform .9s var(--ease), filter .7s; }
  .scene.off { opacity: 0; pointer-events: none; transform: scale(.97); filter: blur(8px); }
  #waves { position: absolute; inset: 0; width: 100%; height: 100%; }

  /* Лендинг */
  .land { display: grid; place-items: center; text-align: center; }
  .land-nav { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 22px 36px; z-index: 2; }
  .logo { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
  .logo-mark { width: 28px; height: 28px; border-radius: 8px; background: #fff; color: #000; display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -.04em; }
  .land-inner { position: relative; z-index: 2; }
  .eyebrow { font-family: var(--mono); font-size: 11.5px; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; }
  .land h1 { font-size: clamp(56px, 9vw, 120px); line-height: .92; letter-spacing: -.055em; margin: 22px 0 30px; font-weight: 600; }
  .land h1 .o { color: transparent; -webkit-text-stroke: 1.2px #6a6a6a; }
  .land h1 .w { display: inline-block; animation: rise 1s var(--ease) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(40px); filter: blur(10px); } }
  .cta { display: inline-flex; align-items: center; gap: 12px; padding: 15px 18px 15px 26px; border-radius: 999px; background: #fff; color: #000; border: 0; font-weight: 600; font-size: 15px;
    box-shadow: 0 0 0 0 rgba(255,255,255,.4); transition: .35s var(--ease); animation: rise 1s .35s var(--ease) both; }
  .cta i { width: 30px; height: 30px; border-radius: 50%; background: #000; color: #fff; display: grid; place-items: center; font-style: normal; transition: .35s var(--ease); }
  .cta:hover { box-shadow: 0 0 0 8px rgba(255,255,255,.08); } .cta:hover i { transform: rotate(-45deg); }
  .land-foot { position: absolute; bottom: 24px; left: 36px; right: 36px; display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: #555; letter-spacing: .1em; z-index: 2; }
  .live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: 8px; animation: ch-pulse 1.6s infinite; }

  /* Вход */
  .auth { display: grid; grid-template-columns: 1.1fr 1fr; }
  .auth-art { position: relative; border-right: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; }
  .auth-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
  .auth-art h2 { position: relative; font-size: 48px; letter-spacing: -.045em; line-height: 1; margin: 0; font-weight: 600; }
  .auth-art p { position: relative; color: var(--muted); max-width: 340px; }
  .auth-form-wrap { display: grid; place-items: center; padding: 40px; }
  .auth-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
  .auth-form h3 { font-size: 28px; letter-spacing: -.03em; margin: 0 0 4px; font-weight: 600; }
  .auth-form .ch-input { padding: 14px 16px; font-size: 15px; }
  .auth-form .ch-btn-primary { padding: 14px; font-size: 15px; margin-top: 6px; }
  .roster { display: flex; flex-wrap: wrap; gap: 6px; }
  .back { position: absolute; top: 24px; left: 24px; z-index: 3; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; color: var(--muted); }
  .back:hover { color: #fff; border-color: #fff; }
  .remember { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
  .note { font-size: 12px; color: #555; font-family: var(--mono); }

  /* ---------- Приложение ---------- */
  .app { display: grid; grid-template-columns: 232px 1fr; position: fixed; overflow: hidden; }
  .side { border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; background: #0a0a0a; }
  .side .logo { padding: 6px 10px 22px; }
  .nav-btn { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 0; background: none; color: var(--muted); text-align: left; position: relative; transition: color .2s, background .2s; }
  .nav-btn svg { width: 18px; height: 18px; flex: none; }
  .nav-btn b { margin-left: auto; font-weight: 500; font-size: 11.5px; font-family: var(--mono); color: #555; }
  .nav-btn:hover { color: #fff; background: #121212; }
  .nav-btn.on { color: #fff; background: #161616; }
  .nav-btn.on::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 2px; background: #fff; border-radius: 2px; }
  .side-sep { font-family: var(--mono); font-size: 10.5px; color: #4a4a4a; letter-spacing: .14em; padding: 18px 12px 6px; }
  .side-user { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
  .side-user .ch-avatar { width: 34px; height: 34px; background: #fff; color: #000; border-radius: 10px; }
  .side-user small { display: block; color: var(--muted); font-size: 11.5px; }
  .side-user button { margin-left: auto; background: none; border: 0; color: var(--muted); }

  .main { overflow-y: auto; overflow-x: hidden; height: 100vh; }
  .top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 16px 32px; background: rgba(10,10,10,.8); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  .top h1 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
  .search { margin-left: auto; position: relative; width: 320px; }
  .search input { width: 100%; padding-left: 36px; padding-right: 60px; border-radius: 999px; }
  .search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; color: var(--muted); }
  .search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; }
  .conn { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; }
  .conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--t-clean); box-shadow: 0 0 10px var(--t-clean); }
  .conn.demo i { background: var(--t-warn); box-shadow: 0 0 10px var(--t-warn); }
  .icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: none; display: grid; place-items: center; color: var(--text-2); transition: .3s var(--ease); }
  .icon-btn:hover { border-color: #fff; color: #fff; }
  .icon-btn.spin svg { animation: spin .8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  .view { padding: 28px 32px 60px; display: none; }
  .view.on { display: block; animation: view-in .55s var(--ease); }
  @keyframes view-in { from { opacity: 0; transform: translateY(14px); } }

  /* Обзор — bento */
  .bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
  .tile { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; position: relative; overflow: hidden; transition: border-color .3s, transform .4s var(--ease); }
  .tile:hover { border-color: #3a3a3a; }
  .tile.click { cursor: pointer; } .tile.click:hover { transform: translateY(-3px); }
  .tile-label { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; display: flex; justify-content: space-between; }
  .tile-val { font-size: clamp(30px, 3.2vw, 46px); font-weight: 600; letter-spacing: -.05em; line-height: 1; margin: 20px 0 8px; }
  .tile-sub { font-size: 13px; color: var(--muted); }
  .tile.hero { grid-column: span 2; grid-row: span 2; background: #fff; color: #000; display: flex; flex-direction: column; }
  .tile.hero .tile-label, .tile.hero .tile-sub { color: #666; }
  .tile.hero .tile-val { font-size: clamp(72px, 8vw, 110px); margin-top: auto; }
  .tile.hero .ch-btn { margin-top: 16px; background: #000; color: #fff; border-color: #000; align-self: flex-start; }
  .tile.k { grid-column: span 1; }
  .tile.wide { grid-column: span 4; }
  .tile.half { grid-column: span 3; }
  .tile.third { grid-column: span 2; }
  .spark { position: absolute; right: 0; bottom: 0; left: 0; height: 40px; opacity: .3; }
  .tile-sub { position: relative; z-index: 1; }
  .card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .card-h h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
  .q-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); animation: ch-row-in .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
  .q-item:last-child { border-bottom: 0; }
  .q-reason { flex: 1; font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .q-src { font-size: 12px; color: var(--muted); }
  .q-take { opacity: 0; transform: translateX(6px); transition: .25s var(--ease); padding: 6px 12px; font-size: 12px; }
  .q-item:hover .q-take { opacity: 1; transform: none; }
  .bars .row { display: grid; grid-template-columns: 1fr 60px; gap: 10px; align-items: center; margin-bottom: 12px; }
  .bars .track { grid-column: 1 / -1; height: 3px; background: #1c1c1c; border-radius: 3px; overflow: hidden; margin-top: -4px; }
  .bars .track i { display: block; height: 100%; background: var(--c); animation: ch-grow 1.2s var(--ease) both; transform-origin: left; }
  .bars b { text-align: right; font-family: var(--mono); font-size: 13px; }
  .lb { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
  .lb-n { font-family: var(--mono); color: #555; width: 18px; font-size: 12px; }
  .lb-bar { flex: 1; height: 26px; border-radius: 8px; background: #161616; position: relative; overflow: hidden; }
  .lb-bar i { position: absolute; inset: 0 auto 0 0; background: #232323; animation: ch-grow 1.2s var(--ease) both; transform-origin: left; }
  .lb-bar span { position: relative; padding: 0 10px; line-height: 26px; font-size: 13px; }
  .lb b { font-family: var(--mono); font-size: 13px; width: 40px; text-align: right; }
  .feed-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; animation: ch-row-in .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
  .feed-kind { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; color: var(--muted); width: 70px; text-transform: uppercase; }
  .feed-who { color: var(--text-2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
  .toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
  .toolbar .grow { flex: 1; min-width: 220px; }
  .pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
  .pay-total { display: flex; align-items: baseline; gap: 12px; }
  .pay-total b { font-size: 34px; letter-spacing: -.04em; font-weight: 600; }

  /* Drawer & Modal */
  .veil { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .35s; }
  .veil.on { opacity: 1; pointer-events: auto; }
  .drawer { position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(560px, 94vw); background: #0e0e0e; border: 1px solid var(--line); border-radius: 22px; z-index: 60;
    transform: translateX(110%); transition: transform .55s var(--ease); display: flex; flex-direction: column; overflow: hidden; }
  .drawer.on { transform: none; }
  .d-head { padding: 26px 28px 20px; border-bottom: 1px solid var(--line); }
  .d-cid { font-family: var(--mono); font-size: 52px; font-weight: 600; letter-spacing: .04em; margin: 8px 0 16px; line-height: 1; }
  .d-stats { display: flex; gap: 28px; }
  .d-stats div span { display: block; font-size: 11px; font-family: var(--mono); color: var(--muted); letter-spacing: .1em; }
  .d-stats div b { font-size: 22px; font-weight: 600; }
  .risk { flex: 1; } .risk-bar { height: 6px; border-radius: 6px; background: #1a1a1a; margin-top: 10px; overflow: hidden; }
  .risk-bar i { display: block; height: 100%; background: linear-gradient(90deg, #fff, var(--t-ban)); animation: ch-grow 1.2s var(--ease) both; transform-origin: left; }
  .d-body { padding: 22px 28px; overflow-y: auto; flex: 1; }
  .x { position: absolute; top: 18px; right: 18px; }
  .modal { position: fixed; left: 50%; top: 50%; width: min(620px, 94vw); max-height: 90vh; overflow: auto; background: #0e0e0e; border: 1px solid var(--line); border-radius: 24px;
    z-index: 60; transform: translate(-50%, -46%) scale(.96); opacity: 0; pointer-events: none; transition: .45s var(--ease); padding: 26px; }
  .modal.on { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
  .modal h3 { margin: 0; font-size: 22px; letter-spacing: -.03em; font-weight: 600; }
  .seg { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; margin: 18px 0; position: relative; }
  .seg button { position: relative; z-index: 1; border: 0; background: none; padding: 8px 16px; border-radius: 999px; color: var(--muted); font-size: 13px; transition: color .3s; }
  .seg button.on { color: #000; }
  .seg .knob { position: absolute; top: 4px; bottom: 4px; background: #fff; border-radius: 999px; transition: .45s var(--ease); }
  .m-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
  .m-err { color: var(--t-ban); font-size: 13px; margin-top: 12px; }

  @media (max-width: 1180px) { .bento { grid-template-columns: repeat(4, 1fr); } .tile.hero { grid-row: span 1; } .tile.third { grid-column: span 4; } .tile.wide { grid-column: span 4 !important; } }
  @media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
    .app { grid-template-columns: 1fr; } .side { display: none; }
    .bento { grid-template-columns: repeat(2, 1fr); } .tile.hero, .tile.wide, .tile.third, .tile.half { grid-column: span 2; } .search { width: auto; flex: 1; }
  }

  /* Подключение Apps Script */
  a.nav-btn { text-decoration: none; }
  button.conn { background: none; font: inherit; font-size: 12.5px; cursor: pointer; transition: border-color .2s, color .2s; }
  button.conn:hover { border-color: #fff; color: #fff; }
  .conn.warn i { background: var(--t-warn); box-shadow: 0 0 10px var(--t-warn); }
  .banner { margin: 20px 32px 0; padding: 14px 16px; border: 1px solid #3a2f12; background: linear-gradient(90deg, rgba(245,158,11,.08), transparent 70%); border-radius: 16px;
    display: flex; align-items: center; gap: 14px; font-size: 13.5px; color: var(--text-2); animation: view-in .5s var(--ease); }
  .banner > i { width: 8px; height: 8px; border-radius: 50%; background: var(--t-warn); box-shadow: 0 0 10px var(--t-warn); flex: none; animation: ch-pulse 1.6s infinite; }
  .banner b { color: var(--text); } .banner .ch-btn { margin-left: auto; }
  .modal-lg { width: min(760px, 94vw); }
  .steps { list-style: none; padding: 0; margin: 20px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; font-size: 13.5px; color: var(--text-2); line-height: 1.55; }
  .steps li { display: flex; gap: 14px; min-width: 0; } .steps li > div { flex: 1; min-width: 0; }
  .steps li > span { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; height: fit-content; }
  .steps code, .steps b { color: var(--text); } .steps code { font-family: var(--mono); font-size: 12px; background: #161616; padding: 1px 6px; border-radius: 5px; }
  .code-head { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 6px; font-size: 12px; color: var(--muted); }
  .code-head .ch-btn { padding: 6px 12px; font-size: 12px; }
  .code { margin: 0; max-height: 180px; overflow: auto; background: #080808; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-family: var(--mono); font-size: 11.5px; color: #9a9a9a; white-space: pre; }
  .c-msg { font-size: 13px; padding: 10px 12px; border-radius: 10px; border: 1px solid; }
  .c-msg.ok { color: var(--t-clean); border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.06); }
  .c-msg.err { color: var(--t-ban); border-color: rgba(244,63,94,.3); background: rgba(244,63,94,.06); }

  /* Discord-вход */
  .discord-btn { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 15px; border-radius: 999px; background: #fff; color: #000; font-weight: 600; font-size: 15px;
    text-decoration: none; transition: .3s var(--ease); box-shadow: 0 0 0 0 rgba(255,255,255,.3); }
  .discord-btn:hover { box-shadow: 0 0 0 6px rgba(255,255,255,.08); transform: translateY(-1px); }
  .discord-btn svg { transition: transform .4s var(--ease); } .discord-btn:hover svg { transform: rotate(-8deg) scale(1.1); }
  .discord-btn.disabled { opacity: .35; pointer-events: none; }
  .auth-err { font-size: 13px; color: var(--t-ban); border: 1px solid rgba(244,63,94,.3); background: rgba(244,63,94,.06); padding: 10px 12px; border-radius: 12px; line-height: 1.5; }
  .auth-setup { font-size: 12.5px; color: var(--text-2); border: 1px solid #3a2f12; background: rgba(245,158,11,.06); padding: 12px; border-radius: 12px; line-height: 1.6; }
  .auth-setup code { font-family: var(--mono); font-size: 11.5px; color: var(--text); }
  .side-user .ch-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
