/* ================================================================
   BARRAS — REMOTE.HTML DEDICATED STYLESHEET
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      font-family: 'Lexend', system-ui, -apple-system, sans-serif;
      background: #f0f2f5;
      color: #111;
      min-height: 100dvh;
      overscroll-behavior: none;
    }

    /* ── Overlay (auth / connecting) ───────────────────────── */
    #overlay {
      position: fixed; inset: 0;
      background: #1e293b;
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 18px; z-index: 999; padding: 24px;
    }
    #overlay h1 { color: #f8fafc; font-size: 1.5rem; font-weight: 700; text-align: center; }
    #overlay p  { color: #94a3b8; font-size: 0.9rem; text-align: center; }
    #overlay .spinner {
      width: 40px; height: 40px;
      border: 4px solid #334155;
      border-top-color: #60a5fa;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    #token-form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
    #token-input {
      font-size: 2rem; font-weight: 700; letter-spacing: 0.25em; text-align: center;
      text-transform: uppercase;
      padding: 12px; border: 2px solid #475569; border-radius: 10px;
      background: #0f172a; color: #f8fafc;
      outline: none;
    }
    #token-input:focus { border-color: #60a5fa; }
    #token-submit {
      padding: 14px; border: none; border-radius: 10px;
      background: #2563eb; color: #fff;
      font-size: 1rem; font-weight: 700; cursor: pointer;
    }
    #token-submit:active { background: #1d4ed8; }
    #overlay-msg { color: #f87171; font-size: 0.85rem; text-align: center; min-height: 1.2em; }
    #overlay-hint { color: #94a3b8; font-size: 0.78rem; text-align: center; line-height: 1.5; display: none; max-width: 320px; }

    /* ── Top bar ───────────────────────────────────────────── */
    #top-bar {
      background: #1e293b;
      color: #f8fafc;
      padding: 8px 12px;
      display: flex; align-items: center; gap: 8px;
      position: sticky; top: 0; z-index: 10;
    }
    #top-bar .app-name { font-weight: 700; font-size: 0.95rem; flex: 1; }
    #conn-dot {
      width: 10px; height: 10px; border-radius: 50%;
      background: #6b7280; flex-shrink: 0;
      transition: background 0.3s;
    }
    #conn-dot.connected    { background: #22c55e; }
    #conn-dot.disconnected { background: #ef4444; }
    #conn-label { font-size: 0.75rem; color: #94a3b8; }

    /* ── Group tabs ─────────────────────────────────────────── */
    #group-tabs-wrap {
      background: #fff;
      border-bottom: 1px solid #e2e8f0;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    #group-tabs-wrap::-webkit-scrollbar { display: none; }
    #group-tabs {
      display: flex; gap: 0;
      white-space: nowrap;
      padding: 0 8px;
    }
    .group-tab {
      padding: 8px 12px;
      font-size: 0.82rem; font-weight: 600;
      color: #64748b; cursor: pointer;
      border-bottom: 3px solid transparent;
      flex-shrink: 0;
      transition: color 0.15s, border-color 0.15s;
      user-select: none;
    }
    .group-tab.active {
      color: #2563eb;
      border-bottom-color: #2563eb;
    }

    /* ── Student list ──────────────────────────────────────── */
    #student-list {
      padding: 6px 8px;
      display: flex; flex-direction: column; gap: 4px;
    }

    .student-card {
      background: #fff;
      border-radius: 8px;
      box-shadow: 0 1px 2px rgba(0,0,0,.06);
      overflow: hidden;
    }
    .student-card.absent { opacity: 0.45; }

    .student-main {
      display: flex; align-items: center; gap: 6px;
      padding: 5px 8px;
      min-height: 38px;
    }
    .student-info { flex: 1; min-width: 0; }
    .student-name {
      font-size: 0.85rem; font-weight: 600;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      line-height: 1.2;
    }
    .score-pill {
      padding: 1px 6px; border-radius: 999px; font-weight: 700; font-size: 0.68rem;
      flex-shrink: 0;
    }
    .score-pill.plus  { background: #dcfce7; color: #16a34a; }
    .score-pill.minus { background: #fee2e2; color: #dc2626; }

    .btn-score {
      width: 36px; height: 36px;
      font-size: 1.35rem; font-weight: 700; line-height: 1;
      border: none; border-radius: 8px;
      cursor: pointer; user-select: none; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      transition: transform 0.08s, opacity 0.08s;
    }
    .btn-score:active { transform: scale(0.9); opacity: 0.8; }
    .btn-plus  { background: #dcfce7; color: #15803d; }
    .btn-minus { background: #fee2e2; color: #b91c1c; }

    /* Badge row: tiny chips under the name */
    .badge-row {
      display: flex; flex-wrap: wrap; align-items: center; gap: 3px;
      margin-top: 2px;
    }
    .badge-chip {
      display: inline-flex; align-items: center;
      background: #f1f5f9; border-radius: 999px;
      padding: 1px 5px; font-size: 0.62rem; font-weight: 600;
      cursor: pointer; user-select: none; line-height: 1.5;
    }
    .badge-chip:active { background: #e2e8f0; }
    .badge-chip.pos { background: #fef9c3; color: #854d0e; }
    .badge-chip.neg { background: #fee2e2; color: #991b1b; }
    .badge-add-btn {
      display: inline-flex; align-items: center; justify-content: center;
      width: 15px; height: 15px;
      font-size: 0.65rem; font-weight: 700; line-height: 1;
      background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 50%;
      color: #64748b; cursor: pointer; padding: 0; flex-shrink: 0;
    }
    .badge-add-btn:active { background: #e2e8f0; }

    /* Badge picker (expands below card) */
    .badge-picker { display: none; flex-wrap: wrap; gap: 5px; padding: 0 8px 8px; }
    .badge-picker.open { display: flex; }
    .badge-btn {
      padding: 6px 10px; border-radius: 8px; border: 1.5px solid #e2e8f0;
      background: #fff; font-size: 0.8rem; cursor: pointer; user-select: none;
    }
    .badge-btn:active { background: #f1f5f9; }
    .badge-btn.pos { border-color: #fde68a; background: #fef9c3; }
    .badge-btn.neg { border-color: #fca5a5; background: #fee2e2; }

    /* ── Toast feedback ─────────────────────────────────────── */
    #toast {
      position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
      background: #1e293b; color: #f8fafc;
      padding: 10px 20px; border-radius: 20px;
      font-size: 0.9rem; font-weight: 600;
      opacity: 0; pointer-events: none;
      transition: opacity 0.25s;
      z-index: 100; white-space: nowrap;
    }
    #toast.show { opacity: 1; }
    #toast.err  { background: #dc2626; }

    /* ── Empty state ────────────────────────────────────────── */
    #empty-state {
      display: none;
      text-align: center; padding: 48px 24px;
      color: #94a3b8; font-size: 0.95rem;
    }

    /* ── Reconnect banner ───────────────────────────────────── */
    #reconnect-banner {
      display: none;
      background: #fef2f2;
      border-bottom: 1px solid #fca5a5;
      padding: 10px 16px;
      text-align: center;
      font-size: 0.85rem; color: #991b1b; font-weight: 600;
    }
