      @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');
      
      :root {
        --bg: #fcfdfd;
        --surface: #ffffff;
        --surface-soft: #f8fafc;
        --text: #090d16;
        --muted: #64748b;
        --border: #e2e8f0;
        --primary: #1d4ed8;
        --primary-dark: #1e40af;
        --success: #10b981;
        --success-bg: #ecfdf5;
        --danger: #ef4444;
        --danger-bg: #fef2f2;
        --warning: #f59e0b;
        --warning-bg: #fffbeb;
        --shadow: 0 12px 32px rgb(0 0 0 / 0.06), 0 4px 12px rgb(0 0 0 / 0.03);
        --radius: 16px;
      }
      [data-theme="dark"] {
        --bg: #06080d;
        --surface: #121826;
        --surface-soft: #192233;
        --text: #f8fafc;
        --muted: #94a3b8;
        --border: #212c40;
        --primary: #3b82f6;
        --primary-dark: #60a5fa;
        --success: #10b981;
        --success-bg: rgba(16,185,129,0.15);
        --danger: #ef4444;
        --danger-bg: rgba(239,68,68,0.15);
        --warning: #f59e0b;
        --warning-bg: rgba(245,158,11,0.15);
        --shadow: 0 12px 32px rgb(0 0 0 / 0.4);
      }
      * { box-sizing: border-box; margin: 0; padding: 0; }
      html { scroll-behavior: smooth; }
      body {
        font-family: 'Inter', system-ui, -apple-system, sans-serif;
        background: var(--bg);
        color: var(--text);
        min-height: 100vh;
        line-height: 1.55;
      }
      .admin-header {
        position: sticky; top: 0; z-index: 50;
        background: rgb(255 255 255 / 88%);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--border);
        padding: 0 24px;
      }
      [data-theme="dark"] .admin-header { background: rgb(19 27 46 / 90%); }
      .admin-header-inner {
        max-width: 1280px; margin: 0 auto;
        height: 60px; display: flex; align-items: center;
        justify-content: space-between; gap: 16px;
      }
      .admin-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
      .admin-brand-badge {
        background: var(--primary); color: #fff;
        font-size: 0.7rem; font-weight: 800;
        padding: 2px 7px; border-radius: 5px;
      }
      .admin-brand-name { font-weight: 800; font-size: 1.1rem; }
      .header-actions { display: flex; align-items: center; gap: 10px; }
      .theme-btn {
        width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
        background: transparent; color: var(--text); cursor: pointer; font-size: 1rem;
        display: flex; align-items: center; justify-content: center; transition: all 0.2s;
      }
      .theme-btn:hover { background: var(--surface-soft); border-color: var(--primary); }
      .back-link {
        font-size: 0.88rem; color: var(--muted); text-decoration: none;
        display: flex; align-items: center; gap: 5px;
        padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); transition: all 0.15s;
      }
      .back-link:hover { color: var(--primary); border-color: var(--primary); background: var(--surface-soft); }
      .admin-layout {
        max-width: 1280px; margin: 0 auto; padding: 28px 24px;
        display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start;
      }
      @media (max-width: 900px) { .admin-layout { grid-template-columns: 1fr; } .admin-sidebar { order: -1; } }
      .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
      .panel-header {
        padding: 16px 20px; border-bottom: 1px solid var(--border);
        display: flex; align-items: center; gap: 10px;
      }
      .panel-icon { font-size: 1.2rem; }
      .panel-title { font-size: 1rem; font-weight: 700; }
      .panel-body { padding: 20px; }
      .panel + .panel { margin-top: 16px; }
      .field { display: grid; gap: 6px; margin-bottom: 14px; }
      .field:last-child { margin-bottom: 0; }
      label { font-size: 0.88rem; font-weight: 700; color: var(--muted); }
      input[type="text"], input[type="url"], textarea, select {
        width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
        background: var(--surface); color: var(--text); font: inherit; font-size: 0.92rem;
        transition: border-color 0.15s, box-shadow 0.15s; outline: none; resize: vertical;
      }
      input[type="text"]:focus, input[type="url"]:focus, textarea:focus, select:focus {
        border-color: var(--primary); box-shadow: 0 0 0 3px rgb(40 85 217 / 10%);
      }
      .field-hint { font-size: 0.8rem; color: var(--muted); }
      .btn {
        display: inline-flex; align-items: center; justify-content: center; gap: 6px;
        padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
        font: inherit; font-size: 0.9rem; font-weight: 700;
        cursor: pointer; transition: all 0.15s; white-space: nowrap;
      }
      .btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgb(40 85 217 / 18%); }
      .btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
      .btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
      .btn-secondary:hover { background: var(--surface-soft); }
      .btn-success { background: var(--success); color: #fff; }
      .btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }
      .btn-danger { background: var(--danger); color: #fff; }
      .btn-danger:hover { filter: brightness(1.1); }
      .btn-ghost { background: transparent; color: var(--muted); border: none; padding: 6px 8px; }
      .btn-ghost:hover { color: var(--danger); background: var(--danger-bg); border-radius: 6px; }
      .btn-sm { padding: 6px 12px; font-size: 0.82rem; }
      .btn-full { width: 100%; }
      .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
      .affiliate-status {
        display: flex; align-items: center; gap: 8px; padding: 10px 12px;
        border-radius: 8px; margin-bottom: 12px; font-size: 0.88rem; font-weight: 600;
      }
      .affiliate-status.active { background: var(--success-bg); color: var(--success); }
      .affiliate-status.inactive { background: var(--surface-soft); color: var(--muted); }
      .status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
      .status-dot.active { background: var(--success); animation: pulse 2s infinite; }
      .status-dot.inactive { background: var(--muted); }
      @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
      .prob-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
      .prob-row input[type="range"] { flex: 1; padding: 0; accent-color: var(--primary); }
      .prob-badge {
        min-width: 52px; padding: 4px 8px; border-radius: 6px;
        background: var(--primary); color: #fff; font-size: 0.8rem; font-weight: 800; text-align: center;
      }
      .quiz-meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
      @media (max-width: 600px) { .quiz-meta-row { grid-template-columns: 1fr; } }
      .questions-list { display: grid; gap: 12px; }
      .question-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); overflow: hidden; transition: box-shadow 0.2s; }
      .question-card:hover { box-shadow: 0 2px 10px rgb(23 32 51 / 6%); }
      .question-card-header {
        display: flex; align-items: center; gap: 10px; padding: 12px 16px;
        cursor: pointer; user-select: none; background: var(--surface); border-bottom: 1px solid var(--border);
      }
      .question-card-header:hover { background: var(--surface-soft); }
      .q-number {
        width: 28px; height: 28px; border-radius: 50%;
        background: var(--primary); color: #fff;
        display: flex; align-items: center; justify-content: center;
        font-size: 0.78rem; font-weight: 800; flex-shrink: 0;
      }
      .q-preview { flex: 1; font-size: 0.88rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .q-preview.has-content { color: var(--text); font-weight: 600; }
      .q-toggle { color: var(--muted); font-size: 0.75rem; flex-shrink: 0; transition: transform 0.2s; }
      .q-toggle.open { transform: rotate(180deg); }
      .question-card-body { padding: 16px; display: none; }
      .question-card-body.open { display: grid; gap: 12px; }
      .options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
      @media (max-width: 560px) { .options-grid { grid-template-columns: 1fr; } }
      .option-field { display: grid; gap: 4px; }
      .option-label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 700; color: var(--muted); }
      .option-badge {
        width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff;
        font-size: 0.7rem; display: flex; align-items: center; justify-content: center; font-weight: 800;
      }
      .answer-select-row { display: flex; align-items: center; gap: 10px; }
      .answer-select-row label { white-space: nowrap; }
      .q-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
      .server-subject-item {
        display: flex; align-items: center; justify-content: space-between; gap: 10px;
        padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
        background: var(--surface-soft); cursor: pointer; transition: all 0.2s;
      }
      .server-subject-item:hover { border-color: var(--primary); background: var(--surface); box-shadow: 0 2px 8px rgb(40 85 217 / 10%); transform: translateY(-1px); }
      .server-subject-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
      .server-subject-title { font-size: 0.85rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .server-subject-desc { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .server-subject-badge { flex-shrink: 0; font-size: 0.72rem; font-weight: 800; background: var(--primary); color: #fff; padding: 2px 6px; border-radius: 4px; opacity: 0.9; }
      
      .empty-questions {
        text-align: center; padding: 40px 20px; color: var(--muted);
        border: 2px dashed var(--border); border-radius: 10px;
      }
      .empty-questions p { margin-top: 8px; font-size: 0.9rem; }
      .output-area { display: none; flex-direction: column; gap: 12px; margin-top: 14px; }
      .output-area.show { display: flex; }
      .output-box {
        background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
        font-family: 'Courier New', monospace; font-size: 0.8rem; max-height: 220px; overflow-y: auto;
        white-space: pre-wrap; word-break: break-all; color: var(--text); line-height: 1.7;
      }
      .copy-success { font-size: 0.82rem; color: var(--success); font-weight: 600; opacity: 0; transition: opacity 0.3s; text-align: center; }
      .copy-success.show { opacity: 1; }
      .drop-zone {
        border: 2px dashed var(--border); border-radius: 10px; padding: 24px 16px;
        text-align: center; color: var(--muted); cursor: pointer; transition: all 0.2s; font-size: 0.88rem;
      }
      .drop-zone:hover, .drop-zone.dragover {
        border-color: var(--primary); background: rgb(40 85 217 / 4%); color: var(--primary);
      }
      .drop-zone-icon { font-size: 1.8rem; margin-bottom: 6px; }
      .drop-zone input[type="file"] { display: none; }
      .toast-container {
        position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
        z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
      }
      .toast {
        background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
        padding: 10px 20px; font-size: 0.88rem; font-weight: 600;
        box-shadow: 0 6px 24px rgb(23 32 51 / 12%);
        display: flex; align-items: center; gap: 8px;
        animation: toast-in 0.3s ease both; pointer-events: all;
      }
      @keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
      .toast.success { border-left: 4px solid var(--success); }
      .toast.error { border-left: 4px solid var(--danger); }
      .toast.info { border-left: 4px solid var(--primary); }
      .validation-row {
        display: flex; align-items: center; gap: 6px; padding: 8px 12px;
        border-radius: 8px; font-size: 0.82rem; font-weight: 600;
      }
      .validation-row.ok { background: var(--success-bg); color: var(--success); }
      .validation-row.warn { background: var(--warning-bg); color: var(--warning); }
      hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
      .count-badge {
        background: var(--primary); color: #fff; font-size: 0.72rem; font-weight: 800;
        padding: 2px 7px; border-radius: 20px; margin-left: 6px;
      }
      ::-webkit-scrollbar { width: 6px; }
      ::-webkit-scrollbar-track { background: transparent; }
      ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

      /* ── LOGIN OVERLAY ── */
      #login-overlay {
        position: fixed; inset: 0; z-index: 9999;
        display: flex; align-items: center; justify-content: center;
        padding: 24px;
        background: var(--bg);
        animation: fade-in 0.35s ease both;
      }
      #login-overlay.hidden { display: none; }
      @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
      .login-card {
        width: 100%; max-width: 420px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 18px;
        box-shadow: 0 24px 64px rgb(23 32 51 / 14%);
        overflow: hidden;
        animation: login-pop 0.4s cubic-bezier(0.22,1,0.36,1) both;
      }
      @keyframes login-pop {
        from { opacity: 0; transform: translateY(16px) scale(0.97); }
        to   { opacity: 1; transform: translateY(0)   scale(1); }
      }
      .login-header {
        padding: 32px 32px 24px;
        text-align: center;
        background: linear-gradient(135deg, var(--primary) 0%, #436ce3 100%);
        color: #fff;
      }
      .login-logo { font-size: 2.4rem; margin-bottom: 8px; }
      .login-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; }
      .login-sub   { font-size: 0.86rem; opacity: 0.82; }
      .login-body  { padding: 28px 32px; }
      .login-field { display: grid; gap: 6px; margin-bottom: 16px; }
      .login-field label { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
      .login-input-wrap { position: relative; }
      .login-input-wrap input {
        width: 100%; padding: 11px 42px 11px 14px;
        border: 1px solid var(--border); border-radius: 9px;
        background: var(--surface); color: var(--text);
        font: inherit; font-size: 0.95rem; outline: none;
        transition: border-color 0.15s, box-shadow 0.15s;
      }
      .login-input-wrap input:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgb(40 85 217 / 12%);
      }
      .toggle-pw {
        position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
        background: none; border: none; cursor: pointer;
        color: var(--muted); font-size: 1rem; padding: 0; line-height: 1;
      }
      .toggle-pw:hover { color: var(--text); }
      .login-error {
        display: none; align-items: center; gap: 8px;
        padding: 10px 14px; border-radius: 8px;
        background: var(--danger-bg); color: var(--danger);
        font-size: 0.86rem; font-weight: 600; margin-bottom: 14px;
      }
      .login-error.show { display: flex; }
      .login-btn {
        width: 100%; padding: 12px;
        background: var(--primary); color: #fff;
        border: none; border-radius: 9px;
        font: inherit; font-size: 1rem; font-weight: 700;
        cursor: pointer; transition: all 0.15s;
        box-shadow: 0 4px 14px rgb(40 85 217 / 22%);
      }
      .login-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
      .login-btn:active { transform: translateY(1px); }
      .login-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
      .login-shake { animation: shake 0.38s ease; }
      @keyframes shake {
        0%,100% { transform: translateX(0); }
        20%      { transform: translateX(-6px); }
        40%      { transform: translateX(6px); }
        60%      { transform: translateX(-4px); }
        80%      { transform: translateX(4px); }
      }
      .login-footer { padding: 0 32px 24px; text-align: center; font-size: 0.8rem; color: var(--muted); }
      .login-attempts { color: var(--warning); font-weight: 600; }
      /* Lockout countdown */
      .lockout-msg {
        display: none; text-align: center; padding: 12px;
        background: var(--warning-bg); border-radius: 8px;
        color: var(--warning); font-weight: 600; font-size: 0.9rem;
        margin-bottom: 14px;
      }
      .lockout-msg.show { display: block; }
      /* Change-password panel */
      .change-pw-form { display: grid; gap: 10px; }
