
      :root {
        color-scheme: dark;
        --bg: #09111f;
        --border: #263854;
        --text: #edf4ff;
        --muted: #8ea3bf;
        --blue: #62a7ff;
        --green: #37d39b;
        --yellow: #f4bd54;
        --red: #ff6d78;
        --shadow: 0 22px 70px rgb(0 0 0 / 24%);
      }

      * { box-sizing: border-box; }

      body {
        margin: 0;
        min-width: 320px;
        color: var(--text);
        background:
          radial-gradient(circle at 8% 0%, #18365a 0, transparent 34%),
          radial-gradient(circle at 100% 12%, #1e3154 0, transparent 30%),
          var(--bg);
        font: 15px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
          "PingFang SC", "Microsoft YaHei", sans-serif;
      }

      button, input, select { font: inherit; }
      button { cursor: pointer; }

      .app-shell {
        display: grid;
        grid-template-columns: 250px minmax(0, 1fr);
        min-height: 100vh;
      }

      .sidebar {
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        height: 100vh;
        padding: 24px 16px;
        border-right: 1px solid var(--border);
        background: rgb(6 14 27 / 76%);
        backdrop-filter: blur(18px);
      }

      .nav {
        display: grid;
        gap: 8px;
      }

      .nav button {
        display: flex;
        align-items: center;
        gap: 11px;
        width: 100%;
        padding: 12px 13px;
        border: 1px solid transparent;
        border-radius: 12px;
        color: var(--muted);
        background: transparent;
        text-align: left;
        transition: .18s ease;
      }

      .nav button:hover,
      .nav button.active {
        border-color: #477dcc66;
        color: var(--text);
        background: linear-gradient(90deg, #21426eaa, #182c49aa);
      }

      .sidebar-foot {
        margin-top: auto;
        padding: 14px 12px;
        border: 1px solid #2f4563;
        border-radius: 14px;
        background: #0e1b2e;
      }

      .mode-line {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 6px;
      }

      .status-dot {
        display: inline-block;
        width: 8px;
        height: 8px;
        margin-right: 6px;
        border-radius: 50%;
        background: var(--green);
        box-shadow: 0 0 0 4px #37d39b1c;
      }

      .muted { color: var(--muted); }
      .small { font-size: 12px; }

      main {
        width: min(1260px, 100%);
        padding: 30px clamp(18px, 4vw, 54px) 60px;
        margin: 0 auto;
      }

      h1, h2, h3, p { margin-top: 0; }
      h1 { margin-bottom: 4px; font-size: clamp(21px, 3vw, 28px); }
      h2 { margin-bottom: 4px; font-size: 16px; }
      h3 { margin-bottom: 5px; font-size: 15px; }
      p { color: var(--muted); }

      .pill {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        min-height: 34px;
        padding: 7px 11px;
        border: 1px solid var(--border);
        border-radius: 999px;
        color: var(--muted);
        background: #0e1a2c;
        white-space: nowrap;
      }

      .pill.green { color: #a8f6d8; border-color: #2ca77e66; }
      .pill.yellow { color: #ffe1a2; border-color: #d7963e66; }

      .page { display: none; }
      .page.active { display: block; animation: fade-in .2s ease-out; }
      @keyframes fade-in { from { opacity: .2; transform: translateY(4px); } to { opacity: 1; transform: none; } }

      .grid {
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 16px;
      }

      .service-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
        margin-bottom: 16px;
      }

      .service-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        min-height: 154px;
        padding: 17px 12px 13px;
        border: 1px solid var(--border);
        border-radius: 17px;
        background: linear-gradient(155deg, rgb(20 35 57 / 96%), rgb(13 23 40 / 96%));
        box-shadow: var(--shadow);
        text-align: center;
      }

      .service-icon {
        display: grid;
        width: 54px;
        height: 54px;
        margin-bottom: 9px;
        place-items: center;
        border: 1px solid #477dcc88;
        border-radius: 17px;
        color: #d9eaff;
        background: linear-gradient(145deg, #24518e, #172d4e);
        box-shadow: 0 10px 25px #0b1a2eaa;
        font-size: 26px;
        font-weight: 800;
      }

      .service-icon svg {
        display: block;
        width: 34px;
        height: 34px;
      }

      .service-icon.discord-logo {
        border-color: #5865f2;
        background: #5865f2;
      }

      .service-icon.discord-logo svg {
        width: 35px;
        height: 35px;
        fill: #fff;
      }

      .service-icon.bybit-logo {
        width: 92px;
        border-color: #fff;
        background: #fff;
      }

      .service-icon.bybit-logo svg {
        width: 78px;
        height: auto;
      }

      .service-card.live .service-icon {
        border-color: #bd576777;
        color: #ffd5d9;
        background: linear-gradient(145deg, #7b3343, #3d2130);
      }

      .service-card.live .service-icon.bybit-logo {
        border-color: #fff;
        background: #fff;
      }

      .service-card strong { font-size: 14px; }
      .service-card small { min-height: 18px; color: var(--muted); font-size: 11px; }

      .service-actions {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 7px;
        width: 100%;
        margin-top: auto;
      }

      .service-connect-pill {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 78px;
        min-height: 27px;
        padding: 4px 12px;
        border: 1px solid #42658f;
        border-radius: 999px;
        color: #b9d6ff;
        background: #142943;
        font-size: 11px;
        transition: .18s ease;
      }

      .service-connect-pill::before {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #8da4bd;
        content: "";
      }

      .service-connect-pill:hover {
        border-color: #8bc8ff;
        color: #eaf4ff;
        background: #1a395c;
      }

      .service-connect-pill.is-connected {
        border-color: #3d9b7d;
        color: #a8f6d8;
        background: #12362f;
      }

      .service-connect-pill.is-connected::before {
        background: var(--green);
        box-shadow: 0 0 0 3px #36d4a21f;
      }

      .service-card.live .service-connect-pill:hover {
        border-color: #dc7181;
        background: #4a2633;
      }

      .service-card .btn {
        min-height: 34px;
        margin-top: 0;
        padding: 6px 18px;
        font-size: 13px;
      }

      .card {
        grid-column: span 12;
        padding: 17px;
        border: 1px solid var(--border);
        border-radius: 17px;
        background: linear-gradient(155deg, rgb(20 35 57 / 96%), rgb(13 23 40 / 96%));
        box-shadow: var(--shadow);
      }

      .card-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 18px;
        margin-bottom: 17px;
      }

      .card-head p { display: none; }

      .heading {
        display: inline-flex;
        align-items: center;
        gap: 8px;
      }

      .heading-icon {
        display: inline-grid;
        width: 27px;
        height: 27px;
        place-items: center;
        border: 1px solid #477dcc66;
        border-radius: 8px;
        color: #b9d6ff;
        background: #204b8550;
        font-size: 14px;
      }

      .form-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
      }

      .field { min-width: 0; }
      .field.full { grid-column: 1 / -1; }

      label {
        display: block;
        margin-bottom: 6px;
        color: #d5e3f7;
        font-size: 13px;
        font-weight: 650;
      }

      label span {
        margin-left: 5px;
        color: var(--muted);
        font-weight: 400;
      }

      input, select {
        width: 100%;
        min-height: 43px;
        padding: 10px 12px;
        border: 1px solid #304765;
        border-radius: 10px;
        outline: none;
        color: var(--text);
        background: #0a1526;
        transition: border-color .18s, box-shadow .18s;
      }

      input::placeholder { color: #647b99; }
      input:focus, select:focus {
        border-color: var(--blue);
        box-shadow: 0 0 0 3px #4f9aff24;
      }

      .secret-wrap { position: relative; }
      .secret-wrap input { padding-right: 72px; }
      .show-secret {
        position: absolute;
        top: 6px;
        right: 6px;
        min-height: 31px;
        padding: 4px 8px;
        border: 0;
        border-radius: 7px;
        color: #9fb6d3;
        background: #1d304a;
        font-size: 12px;
      }

      .hint {
        margin: 6px 0 0;
        color: #7890ae;
        font-size: 12px;
      }

      .notice-icon {
        display: inline-grid;
        flex: 0 0 auto;
        width: 22px;
        height: 22px;
        place-items: center;
        border: 1px solid currentColor;
        border-radius: 50%;
        font-size: 12px;
        font-weight: 800;
      }

      .toggle-line {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        padding: 12px 13px;
        border: 1px solid #304765;
        border-radius: 11px;
        background: #0b1729;
      }

      .toggle {
        position: relative;
        display: inline-flex;
        flex: 0 0 auto;
        width: 46px;
        height: 25px;
      }

      .toggle input {
        width: 0;
        height: 0;
        opacity: 0;
      }

      .slider {
        position: absolute;
        inset: 0;
        border-radius: 999px;
        background: #31445e;
        cursor: pointer;
        transition: .2s;
      }

      .slider::before {
        position: absolute;
        bottom: 4px;
        left: 4px;
        width: 17px;
        height: 17px;
        border-radius: 50%;
        background: #d9e5f5;
        content: "";
        transition: .2s;
      }

      .toggle input:checked + .slider { background: #bd4e5e; }
      .toggle input:checked + .slider::before { transform: translateX(21px); }

      .channel {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 11px 12px;
        border: 1px solid #2f4562;
        border-radius: 10px;
        background: #0b1729;
      }

      .channel input { width: 17px; min-height: 17px; accent-color: var(--blue); }
      .channel strong { display: block; font-size: 13px; }
      .channel small { color: var(--muted); font-size: 11px; }

      .channel-note-icon {
        display: grid;
        flex: 0 0 auto;
        width: 28px;
        height: 28px;
        place-items: center;
        border-radius: 7px;
        color: #b9d6ff;
        background: #17365d;
        font-weight: 800;
      }

      .actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 9px;
        margin-top: 18px;
      }

      .btn {
        min-height: 40px;
        padding: 9px 14px;
        border: 1px solid #345174;
        border-radius: 10px;
        color: #cfe2fb;
        background: #142842;
      }

      .btn:hover { border-color: var(--blue); background: #1a3559; }
      .btn.primary { border-color: #4089ee; color: #fff; background: linear-gradient(135deg, #2764be, #3688d8); }
      .btn.danger { border-color: #9a4857; color: #ffc4ca; background: #632d38; }
      .btn-icon { margin-right: 5px; font-size: 15px; }

      .placeholder {
        display: grid;
        min-height: 210px;
        place-items: center;
        padding: 30px;
        border: 1px dashed #3e5a7c;
        border-radius: 15px;
        color: var(--muted);
        background: #0b1729aa;
        text-align: center;
      }

      .placeholder strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 16px; }

      .placeholder-icon {
        display: grid;
        width: 52px;
        height: 52px;
        margin: 0 auto 12px;
        place-items: center;
        border: 1px solid #477dcc88;
        border-radius: 16px;
        color: #b9d6ff;
        background: #204b8550;
        font-size: 24px;
      }

      .toast {
        position: fixed;
        right: 22px;
        bottom: 22px;
        z-index: 20;
        max-width: min(380px, calc(100vw - 44px));
        padding: 13px 15px;
        border: 1px solid #4b79aa;
        border-radius: 11px;
        color: #eaf3ff;
        background: #102746f2;
        box-shadow: 0 16px 40px #0005;
        opacity: 0;
        pointer-events: none;
        transform: translateY(10px);
        transition: .2s ease;
      }

      .toast.show { opacity: 1; transform: none; }

      .modal {
        position: fixed;
        inset: 0;
        z-index: 30;
        display: none;
        place-items: center;
        padding: 18px;
        background: rgb(2 8 17 / 72%);
        backdrop-filter: blur(8px);
      }

      .modal.open { display: grid; }

      .modal-panel {
        width: min(560px, 100%);
        max-height: min(720px, calc(100vh - 36px));
        overflow: auto;
        padding: 20px;
        border: 1px solid #42658f;
        border-radius: 18px;
        background: linear-gradient(155deg, #172943, #0c1729);
        box-shadow: 0 28px 100px #0009;
      }

      .modal-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        margin-bottom: 16px;
      }

      .modal-head h2 { margin: 0; }
      .modal-head p { margin: 3px 0 0; font-size: 12px; }

      .modal-close {
        display: grid;
        width: 32px;
        height: 32px;
        place-items: center;
        border: 1px solid #3a5577;
        border-radius: 9px;
        color: #c9dbf3;
        background: #13253d;
        font-size: 18px;
      }

      .modal-close:hover { border-color: var(--blue); }
      .modal-actions { margin-top: 17px; }
      .modal-save-status {
        flex: 1 1 100%;
        display: none;
        color: var(--green);
        font-size: 12px;
        line-height: 18px;
        text-align: left;
      }
      .modal-save-status:not(:empty) { display: block; }
      .modal-save-status.is-saving { color: var(--yellow); }
      .modal-save-status.is-error { color: var(--red); }
      body.modal-open { overflow: hidden; }

      .modal-note {
        display: flex;
        align-items: flex-start;
        gap: 9px;
        padding: 10px 11px;
        margin-bottom: 15px;
        border: 1px solid #c58e3866;
        border-radius: 10px;
        color: #ffe0a1;
        background: #774e1a26;
        font-size: 12px;
      }

      .modal-note .notice-icon {
        margin-top: 1px;
      }

      .modal-note strong {
        color: inherit;
        font-weight: 600;
      }

      .confirm-panel {
        width: min(470px, 100%);
      }

      .confirm-modal-body {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 11px 12px;
        align-items: start;
        padding: 13px;
        border: 1px solid #3b5270;
        border-radius: 13px;
        background: #0b1729aa;
      }

      .confirm-modal-icon {
        display: grid;
        width: 30px;
        height: 30px;
        place-items: center;
        border: 1px solid #9a6b2d;
        border-radius: 10px;
        color: #ffd98a;
        background: #6a461d55;
        font-weight: 800;
      }

      .confirm-modal-message {
        align-self: center;
        margin: 2px 0 0;
        color: var(--text);
        font-size: 14px;
        line-height: 1.6;
      }

      .confirm-modal-note {
        grid-column: 2;
        margin: 0;
        color: var(--muted);
        font-size: 11px;
        line-height: 1.55;
      }

      .confirm-modal-note[hidden] {
        display: none;
      }

      .confirm-modal-actions {
        margin-top: 16px;
      }

      .bybit-test-row {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 9px;
        margin-top: 4px;
      }

      .bybit-test-status {
        color: var(--muted);
        font-size: 12px;
      }

      .bybit-test-status.is-testing { color: var(--yellow); }
      .bybit-test-status.is-success { color: var(--green); }
      .bybit-test-status.is-failed { color: var(--red); }

      @media (max-width: 980px) {
        .app-shell { grid-template-columns: 1fr; }
        .sidebar {
          position: sticky;
          z-index: 10;
          top: 0;
          height: auto;
          padding: 10px 12px;
          border-right: 0;
          border-bottom: 1px solid var(--border);
        }
        .nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
        .nav button { justify-content: center; padding: 9px 5px; font-size: 12px; }
        .sidebar-foot { display: none; }
      }

      @media (max-width: 760px) {
        main { padding: 22px 13px 36px; }
        .form-grid { grid-template-columns: 1fr; }
        .field.full { grid-column: auto; }
        .card { padding: 16px; }
        .service-row { gap: 9px; }
        .service-card { min-height: 140px; padding-inline: 7px; }
        .service-icon { width: 46px; height: 46px; margin-bottom: 6px; font-size: 22px; }
        .service-icon.discord-logo svg { width: 29px; height: 29px; }
        .service-icon.bybit-logo { width: 68px; }
        .service-icon.bybit-logo svg { width: 58px; }
        .service-card .btn { padding-inline: 13px; }
        .service-connect-pill { min-width: 72px; }
      }

      @media (max-width: 430px) {
        .nav button { flex-direction: column; gap: 3px; }
        .service-card small { display: none; }
      }
