:root {
      --bg: #0a0e1a;
      --surface: #111827;
      --surface2: #1a2235;
      --primary: #4FC3F7;
      --border: rgba(255,255,255,0.08);
      --text1: #e2e8f0;
      --text2: #94a3b8;
      --green: #22c55e;
      --red: #ef4444;
      --orange: #f59e0b;
      --r: 8px;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body { background: var(--bg); color: var(--text1); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; min-height: 100vh; font-size: 14px; }

    .header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; height: 54px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
    .logo { font-size: 16px; font-weight: 800; letter-spacing: 2px; color: var(--primary); }
    .logo span { color: var(--text1); }
    .user-info { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text2); }
    .user-info img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
    .btn-out { background: transparent; border: 1px solid var(--border); color: var(--text2); padding: 5px 12px; border-radius: var(--r); cursor: pointer; font-size: 12px; transition: .15s; }
    .btn-out:hover { border-color: var(--primary); color: var(--primary); }

    .center-screen { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 54px); padding: 24px; }
    .auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 40px 36px; max-width: 380px; width: 100%; }
    .auth-title { font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: 2px; margin-bottom: 4px; text-align: center; }
    .auth-sub { color: var(--text2); font-size: 12px; text-align: center; margin-bottom: 28px; }
    .auth-tabs { display: flex; background: var(--surface2); border-radius: var(--r); padding: 3px; gap: 3px; margin-bottom: 22px; }
    .auth-tab { flex: 1; padding: 7px; border: none; background: transparent; color: var(--text2); border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; transition: .15s; }
    .auth-tab.active { background: var(--primary); color: #fff; }
    .btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #fff; color: #111; border: none; padding: 12px; border-radius: var(--r); font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity .15s; margin-bottom: 8px; }
    .btn-google:hover { opacity: .88; }
    .btn-google:disabled { opacity: .4; cursor: default; }
    .btn-yandex { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #FC3F1D; color: #fff; border: none; padding: 12px; border-radius: var(--r); font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity .15s; }
    .btn-yandex:hover { opacity: .88; }
    .btn-yandex:disabled { opacity: .4; cursor: default; }
    .y-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; background: #fff; color: #FC3F1D; border-radius: 50%; font-weight: 800; font-size: 13px; }
    .g-icon { font-size: 15px; font-weight: 900; color: #4285F4; }
    .field-group { margin-bottom: 14px; }
    .flabel { display: block; color: var(--text2); font-size: 11px; font-weight: 700; letter-spacing: .5px; margin-bottom: 5px; }
    .finput { width: 100%; background: var(--surface2); border: 1px solid var(--border); color: var(--text1); padding: 10px 12px; border-radius: var(--r); font-size: 13px; outline: none; transition: border-color .15s; }
    .finput:focus { border-color: var(--primary); }
    .btn-primary { width: 100%; background: var(--primary); color: #fff; border: none; padding: 12px; border-radius: var(--r); font-size: 14px; font-weight: 700; cursor: pointer; transition: opacity .15s; }
    .btn-primary:hover { opacity: .88; }
    .btn-primary:disabled { opacity: .4; cursor: default; }
    .auth-err { color: var(--red); font-size: 12px; margin-top: 10px; text-align: center; display: none; }

    .section-title { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--primary); margin-bottom: 8px; margin-top: 24px; }
    .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
    select.finput { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }

    /* Agents grid */
    .agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; justify-items: center; }
    .agent-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer; transition: border-color .15s, background .15s; width: 100%; aspect-ratio: 1; max-width: 90px; }
    .agent-card:hover { border-color: var(--primary); }
    .agent-card.selected { border-color: var(--primary); background: rgba(79,195,247,0.1); }
    .agent-card img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
    .agent-card span { font-size: 10px; color: var(--text2); text-align: center; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .agent-card.selected span { color: var(--primary); }

    /* Abilities */
    .abilities-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
    .ability-btn { background: var(--surface2); border: 1.5px solid var(--border); border-radius: var(--r); padding: 6px; cursor: pointer; transition: border-color .15s, background .15s; display: flex; flex-direction: column; align-items: center; }
    .ability-btn:hover { border-color: var(--primary); }
    .ability-btn.selected { border-color: var(--primary); background: rgba(79,195,247,0.12); }
    .ability-btn img { width: 32px; height: 32px; object-fit: contain; }
    .ability-btn span { font-size: 11px; color: var(--text2); margin-top: 3px; display: block; text-align: center; max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Pills */
    .pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
    .pill-btn { background: var(--surface2); border: 1.5px solid var(--border); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text2); transition: .15s; white-space: nowrap; }
    .pill-btn:hover { border-color: var(--primary); color: var(--text1); }
    .pill-btn.selected { border-color: var(--primary); background: rgba(79,195,247,0.12); color: var(--primary); }
    .selected-mode { border-color: var(--primary) !important; color: var(--primary) !important; }

    .input-wrap { position: relative; }
    .char-counter { position: absolute; bottom: 8px; right: 10px; font-size: 11px; color: var(--text2); pointer-events: none; }
    textarea.finput { resize: vertical; min-height: 80px; padding-bottom: 24px; }

    /* Video */
    .drop-zone { border: 2px dashed var(--border); border-radius: var(--r); padding: 32px 16px; text-align: center; cursor: pointer; transition: border-color .15s; color: var(--text2); font-size: 13px; }
    .drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary); color: var(--text1); }
    .drop-icon { font-size: 32px; margin-bottom: 8px; }
    .progress-wrap { margin-top: 12px; background: var(--surface2); border-radius: 20px; overflow: hidden; height: 8px; }
    .progress-bar { height: 100%; background: var(--primary); border-radius: 20px; transition: width .2s; }
    .vid-player { width: 100%; border-radius: var(--r); background: #000; display: block; max-height: 300px; }
    .vid-controls { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
    .scrubber { flex: 1; min-width: 120px; accent-color: var(--primary); cursor: pointer; }
    .time-display { font-size: 12px; color: var(--text2); white-space: nowrap; }
    .btn-sm { background: var(--surface2); border: 1px solid var(--border); color: var(--text1); padding: 6px 12px; border-radius: var(--r); cursor: pointer; font-size: 12px; transition: .15s; }
    .btn-sm:hover { border-color: var(--primary); color: var(--primary); }
    .btn-sm:disabled { opacity: .4; cursor: default; }
    .btn-frame { background: rgba(79,195,247,0.12); border: 1px solid var(--primary); color: var(--primary); padding: 6px 14px; border-radius: var(--r); cursor: pointer; font-size: 12px; font-weight: 700; transition: .15s; }
    .btn-frame:hover { background: rgba(79,195,247,0.22); }
    .btn-frame:disabled { opacity: .4; cursor: default; }

    /* Screenshots */
    .shots-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
    .shot-item { position: relative; }
    .shot-item img { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
    .shot-item .rm { position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; border-radius: 50%; background: var(--red); border: none; color: #fff; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }
    .btn-add-shot { width: 80px; height: 80px; border: 2px dashed var(--border); border-radius: 6px; background: var(--surface2); color: var(--text2); font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color .15s; }
    .btn-add-shot:hover { border-color: var(--primary); }

    /* Map */
    .map-wrap { position: relative; cursor: crosshair; border-radius: var(--r); overflow: hidden; background: #0a0e1a; border: 1px solid var(--border); user-select: none; }
    .map-wrap > img.map-img { width: 100%; display: block; }
    .map-hint { color: var(--text2); font-size: 12px; margin-top: 6px; }

    /* Submit */
    .btn-submit { width: 100%; background: var(--primary); color: #fff; border: none; padding: 14px; border-radius: var(--r); font-size: 16px; font-weight: 800; cursor: pointer; letter-spacing: 1px; transition: opacity .15s; margin-top: 24px; }
    .btn-submit:hover { opacity: .88; }
    .btn-submit:disabled { opacity: .4; cursor: default; }

    /* Success modal */
    .success-overlay { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 24px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); background: rgba(10,14,26,.55); animation: fadeIn .22s ease; }
    .success-card { background: var(--surface); border: 1px solid rgba(34,197,94,.25); border-radius: 16px; padding: 44px 36px; max-width: 400px; width: 100%; text-align: center; box-shadow: 0 24px 64px rgba(0,0,0,.6); }
    .success-icon { font-size: 56px; margin-bottom: 16px; }
    .success-title { font-size: 22px; font-weight: 800; color: var(--green); margin-bottom: 8px; }
    .success-sub { color: var(--text2); font-size: 14px; margin-bottom: 28px; line-height: 1.6; }

    /* Toasts */
    #toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
    .toast { padding: 10px 16px; border-radius: var(--r); font-size: 13px; font-weight: 600; animation: fadeIn .2s; pointer-events: none; max-width: 300px; }
    .toast.s { background: #14532d; color: #bbf7d0; border: 1px solid #16a34a; }
    .toast.e { background: #450a0a; color: #fca5a5; border: 1px solid #b91c1c; }
    .toast.i { background: var(--surface2); color: var(--text1); border: 1px solid var(--border); }
    .toast.w { background: #451a03; color: #fed7aa; border: 1px solid #c2410c; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

    /* Two-column layout: form + stats sidebar */
    .form-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; max-width: 980px; margin: 0 auto; padding: 0 16px; }
    .main { flex: 1; min-width: 0; padding: 24px 0 60px; }

    /* Stats sidebar */
    .stats-sidebar { padding-top: 24px; position: sticky; top: 20px; }
    .stats-sidebar-title { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--primary); margin-bottom: 10px; }
    .sidebar-row { display: flex; flex-direction: column; gap: 8px; }
    .stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 11px 12px; }
    .stat-counts-row { display: flex; gap: 7px; align-items: stretch; }
    .stat-counts-row .stat-card { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
    .stat-label { font-size: 9px; color: var(--text2); font-weight: 700; letter-spacing: 0; text-transform: uppercase; min-height: 22px; display: flex; align-items: flex-start; }
    .stat-count { font-size: 22px; font-weight: 800; line-height: 1; color: var(--text); margin-top: auto; }
    .stat-card.s-approved .stat-count { color: var(--green); }
    .stat-card.s-pending  .stat-count { color: var(--orange); }
    .stat-card.s-rejected .stat-count { color: var(--red); }
    .stats-loader { text-align: center; color: var(--text2); font-size: 12px; padding: 20px 0; }

    @media (max-width: 720px) {
      .form-layout { grid-template-columns: 1fr; gap: 0; padding: 0 10px; }
      .stats-sidebar { position: static; padding-top: 16px; padding-bottom: 0; }
      .stats-sidebar-title { margin-bottom: 8px; }
      .stat-counts-row .stat-card { padding: 9px 8px; }
      .stat-count { font-size: 18px; }
      .main { padding: 16px 0 60px; width: 100%; }
    }
    @media (max-width: 500px) {
      .auth-card { padding: 28px 18px; }
    }
