:root{
    --slate-900:#16241F;
    --slate-800:#1E332C;
    --slate-700:#2C483D;
    --slate-600:#3B5C4E;
    --chalk-100:#F4F2E9;
    --chalk-200:#ECE8D9;
    --panel:#FFFFFF;
    --ink:#22302B;
    --ink-soft:#5C6D65;
    --line:#DFDACA;
    --gold:#CC9A34;
    --gold-dark:#A87D26;
    --correction:#B8453B;
    --correction-dark:#973A31;
    --shadow:0 10px 28px rgba(18,28,24,.14);
    --shadow-sm:0 2px 8px rgba(18,28,24,.10);
    --radius:12px;
    --font-display:Georgia,'Iowan Old Style','Palatino Linotype','Times New Roman',serif;
    --font-body:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  }
  *{box-sizing:border-box;}
  html,body{height:100%;}
  body{
    margin:0;
    font-family:var(--font-body);
    background:var(--chalk-100);
    color:var(--ink);
    -webkit-tap-highlight-color:transparent;
    overscroll-behavior:none;
  }
  h1,h2,h3,.display{font-family:var(--font-display); margin:0; font-weight:400;}
  button,input{font-family:inherit; color:inherit;}
  button{cursor:pointer;}
  #root{height:100vh; display:flex; flex-direction:column; overflow:hidden;}
  :focus-visible{outline:2px solid var(--gold); outline-offset:2px;}

  /* ---------- Landing / login screens ---------- */
  .screen{
    flex:1; display:flex; align-items:center; justify-content:center;
    background:radial-gradient(circle at 30% 20%, var(--slate-700), var(--slate-900) 70%);
    padding:clamp(12px,4vh,24px) 20px; overflow:auto;
  }
  .hero{max-width:520px; width:100%; text-align:center;}
  .hero h1{color:var(--chalk-100); font-size:clamp(1.6rem,7vh,2.6rem); letter-spacing:.01em;}
  .hero .tagline{color:#CBD9CE; margin-top:8px; font-size:.96rem; line-height:1.4;}
  .role-grid{display:grid; grid-template-columns:repeat(auto-fit, minmax(180px,1fr)); gap:12px; margin-top:clamp(14px,4vh,34px);}
  @media (max-width:560px){ .role-grid{grid-template-columns:1fr;} .hero h1{font-size:clamp(1.5rem,6.5vh,2.1rem);} }
  .role-card{
    background:var(--panel); border-radius:var(--radius); padding:clamp(16px,3vh,26px) 20px; text-align:left;
    box-shadow:var(--shadow); border:1px solid transparent; transition:transform .15s ease, box-shadow .15s ease;
  }
  .role-card:hover{transform:translateY(-2px); box-shadow:0 14px 32px rgba(18,28,24,.22);}
  .role-card h2{font-size:1.3rem; color:var(--ink);}
  .role-card p{color:var(--ink-soft); font-size:.92rem; margin:8px 0 clamp(10px,2vh,18px); line-height:1.4;}

  .pwa-install-btn{margin-top:clamp(12px,3vh,20px);}

  .card{background:var(--panel); border-radius:var(--radius); box-shadow:var(--shadow); padding:30px 28px; max-width:400px; width:100%; text-align:left;}
  .card h2{font-size:1.4rem; margin-bottom:6px;}
  .card .sub{color:var(--ink-soft); font-size:.92rem; margin-bottom:20px; line-height:1.45;}
  .back-link{display:inline-flex; align-items:center; gap:6px; color:#D8C48C; background:none; border:none; font-size:.88rem; margin-bottom:18px; padding:4px 0;}
  .back-link:hover{color:var(--gold);}

  .field{margin-bottom:16px;}
  .field label{display:block; font-size:.85rem; color:var(--ink-soft); margin-bottom:6px;}
  .field input[type=text],.field input[type=password],.field input[type=date]{
    width:100%; padding:12px 14px; border:1px solid var(--line); border-radius:8px; font-size:1.05rem;
    background:var(--chalk-100); letter-spacing:.03em;
  }
  .field select{
    width:100%; padding:12px 14px; border:1px solid var(--line); border-radius:8px; font-size:1rem;
    background:var(--chalk-100); color:var(--ink); appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235C6D65' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat:no-repeat; background-position:right 12px center;
  }
  .card-wide{max-width:460px;}
  .field-row{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
  @media (max-width:480px){ .field-row{grid-template-columns:1fr;} }
  .verify-banner{border-radius:8px; padding:12px 16px; font-size:.9rem; margin-bottom:20px; text-align:left;}
  .verify-banner.ok{background:rgba(30,122,76,.18); color:#BEE6CE; border:1px solid rgba(30,122,76,.4);}
  .verify-banner.err{background:rgba(184,69,59,.18); color:#F0C7C2; border:1px solid rgba(184,69,59,.4);}
  .modal.modal-wide{max-width:560px; text-align:left;}
  .modal.modal-group-details{max-width:820px;}
  .pending-badge{font-size:.66rem; background:rgba(212,148,54,.22); color:#E8B96B; padding:1px 7px; border-radius:99px; font-weight:600; margin-left:6px; white-space:nowrap;}

  .platform-shell{flex:1; overflow:auto; background:var(--chalk-100); padding:26px 20px;}
  .platform-section{max-width:900px; margin:0 auto 32px;}
  .platform-section h2{font-size:1.15rem; margin-bottom:4px;}
  .platform-section .section-sub{color:var(--ink-soft); font-size:.85rem; margin-bottom:16px;}
  .platform-card{background:var(--panel); border-radius:var(--radius); box-shadow:var(--shadow-sm); overflow:hidden;}
  .platform-row{display:flex; align-items:center; gap:14px; padding:14px 18px; border-bottom:1px solid var(--line); flex-wrap:wrap;}
  .session-row{display:flex; align-items:center; gap:18px; padding:12px 4px; border-bottom:1px solid var(--line); flex-wrap:nowrap;}
  .session-row .session-col{font-size:.85rem; white-space:nowrap;}
  .session-date{font-weight:600; flex:0 0 auto;}
  .session-students{color:var(--ink-soft); flex:1;}
  .session-duration{font-weight:600; color:var(--gold-dark); flex:0 0 auto; text-align:right;}
  .platform-row:last-child{border-bottom:none;}
  .platform-row .pr-main{flex:1; min-width:180px;}
  .platform-row .pr-name{font-weight:600; font-size:.95rem;}
  .platform-row .pr-meta{color:var(--ink-soft); font-size:.8rem; margin-top:3px; line-height:1.4;}
  .platform-empty{padding:26px 18px; text-align:center; color:var(--ink-soft); font-size:.9rem;}
  .verified-tag{font-size:.68rem; padding:1px 7px; border-radius:99px; font-weight:600; margin-left:6px; vertical-align:middle;}
  .verified-tag.yes{background:rgba(30,122,76,.15); color:#1E7A4C;}
  .verified-tag.no{background:rgba(184,69,59,.15); color:var(--correction);}
  .count-pill{font-size:.72rem; padding:3px 10px; border-radius:99px; font-weight:600; white-space:nowrap;}
  .count-pill.pending{background:rgba(212,148,54,.18); color:#A87D26;}
  .count-pill.active{background:rgba(30,122,76,.15); color:#1E7A4C;}
  .count-pill.funds{background:rgba(44,87,166,.12); color:#2457A6;}
  .count-pill.low-funds{background:rgba(184,69,59,.15); color:var(--correction);}
  .platform-filter-select, .platform-teacher-filter-select{
    padding:8px 30px 8px 12px; border:1px solid var(--line); border-radius:8px; font-size:.86rem;
    background:var(--panel); color:var(--ink); appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235C6D65' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat:no-repeat; background-position:right 10px center;
  }

  .gestion-main{flex:1; overflow:auto; padding:20px; background:var(--chalk-100);}
  .gestion-header{display:flex; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap;}
  .expirations-table{width:100%; border-collapse:collapse; font-size:.88rem;}
  .expirations-table th{text-align:left; padding:10px 12px; border-bottom:2px solid var(--line); color:var(--ink-soft); font-weight:600; font-size:.8rem;}
  .expirations-table td{padding:10px 12px; border-bottom:1px solid var(--line);}
  .expirations-table tbody tr:hover{background:var(--chalk-100);}
  .gestion-header h2{font-size:1.2rem; margin-right:auto;}
  .gestion-student-list{background:var(--panel); border-radius:var(--radius); box-shadow:var(--shadow-sm); overflow:hidden;}
  .gestion-student-list .platform-row{gap:12px;}

  .stat-grid{display:grid; grid-template-columns:repeat(auto-fit, minmax(120px,1fr)); gap:12px; margin-bottom:14px;}
  .stat-card{background:var(--panel); border-radius:var(--radius); box-shadow:var(--shadow-sm); padding:16px 10px; text-align:center;}
  .stat-value{font-family:var(--font-display); font-size:1.5rem; color:var(--ink);}
  .stat-label{font-size:.76rem; color:var(--ink-soft); margin-top:4px;}

  .detail-grid{display:flex; flex-direction:column;}
  .detail-row{display:flex; justify-content:space-between; align-items:baseline; gap:14px; padding:9px 0; border-bottom:1px solid var(--line); font-size:.88rem;}
  .detail-row:last-child{border-bottom:none;}
  .detail-label{color:var(--ink-soft); white-space:nowrap;}
  .detail-value{font-weight:600; text-align:right; word-break:break-word;}
  .funds-amount-input{width:110px; padding:9px 10px; border:1px solid var(--line); border-radius:8px; font-size:.9rem; background:var(--chalk-100);}
  .field input:focus{border-color:var(--gold);}
  .field input:disabled{background:var(--chalk-200); color:var(--ink-soft); cursor:not-allowed;}
  .error-text{color:var(--correction); font-size:.86rem; margin:-6px 0 14px; min-height:1.1em;}
  .hint-text{color:var(--ink-soft); font-size:.8rem; margin-top:14px; line-height:1.4;}

  .btn{border:none; border-radius:8px; padding:11px 18px; font-size:.95rem; font-weight:600; display:inline-flex; align-items:center; justify-content:center; gap:8px;}
  .btn-block{width:100%;}
  .btn-primary{background:var(--gold); color:#2A1E05;}
  .btn-primary:hover{background:var(--gold-dark);}
  .btn-dark{background:var(--slate-800); color:#fff;}
  .btn-dark:hover{background:var(--slate-900);}
  .btn-ghost{background:transparent; color:var(--ink-soft); border:1px solid var(--line);}
  .btn-ghost-dark{background:transparent; color:#C9D6CC; border:1px solid rgba(255,255,255,.35);}
  .btn-ghost:hover{background:var(--chalk-200);}
  .btn-danger{background:var(--correction); color:#fff;}
  .btn-danger:hover{background:var(--correction-dark);}
  .btn-sm{padding:7px 12px; font-size:.82rem;}
  .btn:disabled{opacity:.5; cursor:default;}

  /* ---------- App shells ---------- */
  .topbar{
    background:var(--slate-900); color:#fff; display:flex; align-items:center; justify-content:space-between;
    padding:10px 16px; flex:0 0 auto; gap:10px;
  }
  .topbar .brand{display:flex; align-items:center; gap:9px; font-family:var(--font-display); font-size:1.15rem;}
  .topbar .brand .dot{width:9px; height:9px; border-radius:50%; background:var(--gold);}
  .topbar .who{font-size:.85rem; color:#C9D6CC; display:flex; align-items:center; gap:12px;}
  .topbar .who b{color:#fff; font-weight:600;}
  .icon-btn{
    background:transparent; border:1px solid rgba(255,255,255,.22); color:#EFEDE2; border-radius:8px;
    padding:7px 9px; display:inline-flex; align-items:center; justify-content:center;
  }
  .icon-btn:hover{background:rgba(255,255,255,.1);}
  .icon-btn.light{border-color:var(--line); color:var(--ink-soft);}
  .icon-btn.live-mic-active{background:var(--correction); border-color:var(--correction); color:#fff;}
  .icon-btn.light:hover{background:var(--chalk-200);}
  .icon-btn.active{background:var(--gold); color:#2A1E05; border-color:var(--gold);}
  .icon{display:inline-flex; line-height:0;}

  .toolbar{
    background:var(--panel); border-bottom:1px solid var(--line); padding:9px 14px;
    display:flex; align-items:center; gap:14px; flex-wrap:wrap; flex:0 0 auto;
  }
  .tool-group{display:flex; align-items:center; gap:8px; padding-right:14px; border-right:1px solid var(--line); position:relative;}
  .shapes-menu{
    position:absolute; top:calc(100% + 6px); left:0; z-index:60;
    background:var(--panel); border:1px solid var(--line); border-radius:10px; box-shadow:var(--shadow-md);
    padding:6px; display:flex; flex-direction:column; gap:2px; min-width:170px;
  }
  .shapes-menu-item{
    display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:6px; border:none;
    background:transparent; color:var(--ink); font-size:.86rem; text-align:left; cursor:pointer; white-space:nowrap;
  }
  .shapes-menu-item:hover{background:var(--chalk-100);}
  .shapes-menu-item.active{background:var(--chalk-200); font-weight:600;}
  .shapes-menu-clear{border-top:1px solid var(--line); margin-top:4px; padding-top:10px; color:var(--ink-soft); font-size:.8rem;}
  .group-online-label{font-size:.8rem; color:var(--ink-soft); white-space:nowrap; margin-left:10px;}
  .viewed-student-online-label{font-size:.8rem; color:var(--ink-soft); white-space:nowrap; margin-left:10px;}
  .tool-group:last-child{border-right:none;}
  .tool-group .glabel{font-size:.76rem; color:var(--ink-soft); margin-right:2px; white-space:nowrap;}
  .swatch{width:22px; height:22px; border-radius:50%; border:2px solid transparent; padding:0; box-shadow:0 0 0 1px var(--line) inset;}
  .swatch.active{border-color:var(--slate-900); box-shadow:0 0 0 2px var(--panel), 0 0 0 3px var(--slate-900);}
  input[type=color]{width:26px; height:26px; border:none; border-radius:6px; padding:0; background:none; cursor:pointer;}
  input[type=range]{width:90px; accent-color:var(--gold-dark);}
  .save-status{font-size:.78rem; color:var(--ink-soft); display:flex; align-items:center; gap:5px; margin-left:auto; white-space:nowrap;}
  .save-status.err{color:var(--correction);}
  .badge{font-size:.72rem; padding:3px 9px; border-radius:99px; background:var(--correction); color:#fff; font-weight:600; letter-spacing:.02em;}

  .page-nav{display:flex; align-items:center; gap:8px; background:var(--panel); border-bottom:1px solid var(--line); padding:8px 14px; flex:0 0 auto; flex-wrap:wrap;}
  .page-nav .ptitle{font-size:.85rem; color:var(--ink-soft); min-width:90px; text-align:center;}

  .canvas-wrap{flex:1; overflow:auto; display:flex; align-items:flex-start; justify-content:center; padding:22px; background:var(--chalk-100);}
  .canvas-inner{position:relative; display:inline-block; line-height:0;}
  .remote-cursor{
    position:absolute; left:0; top:0; width:18px; height:18px; border-radius:50%;
    background:currentColor; border:2px solid #fff;
    box-shadow:0 0 0 2px currentColor, 0 2px 8px rgba(0,0,0,.3);
    pointer-events:none; z-index:5; transform:translate(-50%,-50%);
    transition:left .08s linear, top .08s linear, opacity .15s ease;
  }
  .remote-cursor::after{
    content:''; position:absolute; inset:-8px; border-radius:50%;
    background:currentColor; opacity:.16;
  }
  .remote-cursor.is-drawing{width:22px; height:22px;}
  .remote-cursor.is-drawing::after{opacity:.28;}
  .live-bar-wrap:empty{display:none;}
  .live-bar{
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    padding:10px 16px; background:var(--correction); color:#fff; font-size:.9rem; font-weight:600;
  }
  .live-bar.live-bar-active{background:var(--slate-800);}
  .live-bar .btn{flex:0 0 auto;}
  .live-bar.live-bar-speak{background:var(--slate-700);}
  .canvas-wrap canvas{background:#fff; box-shadow:var(--shadow); touch-action:none; border-radius:3px;}
  .empty-canvas-note{color:var(--ink-soft); font-size:.85rem; text-align:center; margin-top:60px;}

  /* ---------- Admin shell ---------- */
  .admin-shell{flex:1; display:flex; min-height:0;}
  .sidebar{
    width:270px; flex:0 0 270px; background:var(--slate-900); color:#fff; display:flex; flex-direction:column; min-height:0;
  }
  .sidebar-head{padding:14px; border-bottom:1px solid rgba(255,255,255,.1);}
  .sidebar-search{width:100%; padding:9px 10px 9px 32px; border-radius:8px; border:1px solid rgba(255,255,255,.18); background:rgba(255,255,255,.07); color:#fff; font-size:.88rem;}
  .sidebar-search::placeholder{color:#93A69A;}
  .search-wrap{position:relative;}
  .search-wrap .icon{position:absolute; left:9px; top:50%; transform:translateY(-50%); color:#93A69A;}
  .add-student-form{display:flex; gap:6px; margin-top:10px;}
  .add-student-form input{flex:1; padding:9px 10px; border-radius:8px; border:1px solid rgba(255,255,255,.18); background:rgba(255,255,255,.07); color:#fff; font-size:.86rem;}

  .group-add-form{display:flex; gap:6px; margin-bottom:10px;}
  .group-add-form input{flex:1; padding:8px 10px; border-radius:8px; border:1px solid rgba(255,255,255,.18); background:rgba(255,255,255,.07); color:#fff; font-size:.84rem;}
  .group-list{display:flex; overflow-x:auto; flex-wrap:nowrap; gap:6px; margin-bottom:16px; padding-bottom:4px; -webkit-overflow-scrolling:touch;}
  .group-pill{
    display:flex; align-items:center; gap:5px; background:var(--chalk-100); border:1px solid var(--line);
    color:var(--ink-soft); font-size:.8rem; padding:6px 7px 6px 12px; border-radius:99px; cursor:pointer; white-space:nowrap; flex:0 0 auto;
  }
  .group-pill:hover{background:var(--chalk-200);}
  .group-pill.active{background:var(--gold); color:var(--slate-900); border-color:var(--gold); font-weight:600;}
  .group-del, .group-edit{background:none; border:none; color:inherit; opacity:.55; padding:3px; display:flex; border-radius:50%;}
  .group-del:hover, .group-edit:hover{opacity:1; background:rgba(0,0,0,.18);}
  .group-pill-add{color:var(--ink-soft); font-weight:700; padding:6px 12px;}
  .group-pill-add:hover{color:var(--ink); background:var(--chalk-200);}
  .group-tabs-wrap{display:flex; overflow-x:auto; gap:2px; padding:0 20px; background:var(--panel); border-bottom:1px solid var(--line); flex:0 0 auto; -webkit-overflow-scrolling:touch;}
  .group-tab{
    display:flex; align-items:center; gap:4px; padding:13px 6px 13px 14px; cursor:pointer;
    font-size:.86rem; font-weight:600; color:var(--ink-soft); white-space:nowrap; border-bottom:2px solid transparent; flex:0 0 auto;
  }
  .group-tab.active{color:var(--ink); border-bottom-color:var(--gold);}
  .group-tab-edit, .group-tab-del{
    display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; border-radius:5px;
    color:var(--ink-soft); opacity:.5; background:none; border:none; cursor:pointer; flex:0 0 auto;
  }
  .group-tab-edit:hover, .group-tab-del:hover{opacity:1; background:var(--chalk-200);}
  .group-tab-add{color:var(--ink-soft); font-weight:700; padding:13px 18px;}
  .group-tab-add:hover{color:var(--ink);}
  .sidebar-divider{border-top:1px solid rgba(255,255,255,.12); margin:2px 0 12px;}
  .funds-card{margin:14px 10px 0; padding:12px; background:var(--slate-700); border-radius:8px;}
  .funds-card-title{font-size:.76rem; color:#C9D6CC; margin-bottom:10px; font-weight:600;}
  .funds-row{display:flex; align-items:center; gap:10px; margin-bottom:9px;}
  .funds-icon{width:32px; height:32px; border-radius:8px; background:var(--gold); color:var(--slate-900); display:flex; align-items:center; justify-content:center; flex:0 0 auto;}
  .funds-label{font-size:.72rem; color:#9FB3A5;}
  .funds-value{font-family:var(--font-display); font-size:1.2rem; color:#fff; line-height:1.2;}
  .funds-help{font-size:.86rem; color:#C9D6CC; line-height:1.6; margin:0;}
  .whatsapp-float-btn{position:fixed; right:22px; bottom:22px; width:56px; height:56px; border-radius:50%; background:#25D366; display:flex; align-items:center; justify-content:center; box-shadow:0 4px 14px rgba(0,0,0,.28); z-index:100; transition:transform .15s;}
  .whatsapp-float-btn:hover{transform:scale(1.07);}
  .roster-list{flex:1; overflow:auto; padding:6px;}
  .student-item{
    display:flex; align-items:center; gap:10px; padding:10px 10px; border-radius:8px; cursor:pointer; margin-bottom:2px;
  }
  .student-item:hover{background:rgba(255,255,255,.06);}
  .student-item.active{background:var(--slate-700);}
  .student-avatar{width:30px; height:30px; border-radius:50%; background:var(--slate-700); display:flex; align-items:center; justify-content:center; font-size:.8rem; font-weight:700; color:var(--gold); flex:0 0 auto;}
  .student-item.active .student-avatar{background:var(--gold); color:var(--slate-900);}
  .student-meta{flex:1; min-width:0;}
  .student-meta .name{font-size:.9rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .student-meta .code{font-size:.74rem; color:#9FB3A5; letter-spacing:.05em;}
  .student-item .del-btn{opacity:0; background:none; border:none; color:#C9AFAF; padding:5px;}
  .student-item:hover .del-btn{opacity:1;}
  .student-online-dot{display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--correction); margin-right:5px; vertical-align:middle;}
  .student-online-dot.online{background:#3DBE7C;}
  .roster-empty{color:#93A69A; font-size:.85rem; padding:16px 10px; text-align:center; line-height:1.5;}
  .code-banner{
    margin:10px; padding:12px; background:var(--slate-700); border-radius:8px; font-size:.85rem;
  }
  .code-banner .cb-name{color:#fff; font-weight:600; margin-bottom:4px;}
  .code-banner .cb-code{display:flex; align-items:center; justify-content:space-between; background:rgba(255,255,255,.08); padding:7px 9px; border-radius:6px;}
  .code-banner .cb-val{font-family:var(--font-display); font-size:1.1rem; letter-spacing:.12em; color:var(--gold);}

  .admin-main{flex:1; display:flex; flex-direction:column; min-width:0; background:var(--chalk-100);}
  .admin-welcome{flex:1; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:10px; padding:24px; text-align:center;}
  .admin-welcome h2{color:var(--ink); font-size:1.3rem;}
  .admin-welcome p{color:var(--ink-soft); max-width:340px; line-height:1.5; font-size:.92rem;}

  .mode-toggle{display:flex; background:var(--chalk-200); border-radius:8px; padding:3px; gap:2px; margin-left:auto;}
  .mode-btn{border:none; background:transparent; color:var(--ink-soft); font-size:.82rem; font-weight:600; padding:6px 13px; border-radius:6px; white-space:nowrap;}
  .mode-btn.active{background:var(--panel); color:var(--ink); box-shadow:var(--shadow-sm);}
  .mode-btn:hover:not(.active){color:var(--ink);}

  .sidebar-toggle{display:none;}
  @media (max-width:860px){
    .sidebar-toggle{display:inline-flex;}
    .topbar:has(.sidebar-toggle) .brand{display:none;}
    .admin-shell{position:relative;}
    .sidebar{
      position:absolute; inset:0 auto 0 0; z-index:40; transform:translateX(-102%);
      transition:transform .22s ease; box-shadow:0 0 0 2000px rgba(0,0,0,0); width:82vw; max-width:300px;
    }
    .sidebar.open{transform:translateX(0); box-shadow:0 0 40px rgba(0,0,0,.35);}
  }

  /* Plein écran (prof) : mêmes règles que mobile, mais déclenchées par
     .is-fullscreen (posée sur <body> par syncFullscreenButton), quelle que
     soit la largeur réelle de l'écran. */
  body.is-fullscreen .sidebar-toggle{display:inline-flex;}
  body.is-fullscreen .topbar:has(.sidebar-toggle) .brand{display:none;}
  body.is-fullscreen .admin-shell{position:relative;}
  body.is-fullscreen .sidebar{
    position:absolute; inset:0 auto 0 0; z-index:40; transform:translateX(-102%);
    transition:transform .22s ease; box-shadow:0 0 0 2000px rgba(0,0,0,0); width:82vw; max-width:300px;
  }
  body.is-fullscreen .sidebar.open{transform:translateX(0); box-shadow:0 0 40px rgba(0,0,0,.35);}

  /* ---------- Modal / toast / busy ---------- */
  .modal-overlay{position:fixed; inset:0; background:rgba(18,26,22,.5); display:flex; align-items:center; justify-content:center; z-index:200; padding:20px;}
  .modal{background:#fff; border-radius:var(--radius); padding:22px; max-width:360px; width:100%; max-height:90vh; overflow-y:auto; box-shadow:var(--shadow);}
  .modal-text{margin:0 0 18px; font-size:.96rem; line-height:1.5; color:var(--ink);}
  .modal-actions{display:flex; justify-content:flex-end; gap:10px;}

  .toast{
    position:fixed; left:50%; bottom:26px; transform:translate(-50%,20px); background:var(--slate-900); color:#fff;
    padding:11px 18px; border-radius:99px; font-size:.86rem; box-shadow:var(--shadow); opacity:0; pointer-events:none;
    transition:opacity .2s ease, transform .2s ease; z-index:300; max-width:86vw; text-align:center;
  }
  .toast.show{opacity:1; transform:translate(-50%,0);}
  .toast.toast-error{background:var(--correction-dark);}

  .connection-banner{
    position:fixed; top:0; left:0; right:0; background:var(--correction-dark); color:#fff;
    padding:10px 16px; font-size:.86rem; text-align:center; z-index:500;
    transform:translateY(-100%); transition:transform .25s ease;
  }
  .connection-banner.show{transform:translateY(0);}

  .update-banner{
    position:fixed; top:0; left:0; right:0; background:var(--gold-dark); color:#fff;
    padding:9px 16px; font-size:.86rem; z-index:500;
    display:flex; align-items:center; justify-content:center; gap:12px; flex-wrap:wrap;
    transform:translateY(-100%); transition:transform .25s ease;
  }
  .update-banner.show{transform:translateY(0);}
  .update-banner-dismiss{background:none; border:none; color:#fff; font-size:.9rem; opacity:.75; padding:2px 6px; line-height:1;}
  .update-banner-dismiss:hover{opacity:1;}

  .busy-overlay{position:fixed; inset:0; background:rgba(244,242,233,.82); display:none; align-items:center; justify-content:center; z-index:400; flex-direction:column;}
  .busy-box{display:flex; flex-direction:column; align-items:center; gap:14px;}
  .spinner{width:34px; height:34px; border-radius:50%; border:3px solid var(--line); border-top-color:var(--gold-dark); animation:spin .8s linear infinite;}
  @keyframes spin{to{transform:rotate(360deg);}}
  .busy-msg{color:var(--ink-soft); font-size:.9rem;}

  .add-group{display:flex; align-items:center; gap:4px;}
  .visually-hidden{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap;}

  /* ---------- Camera capture ---------- */
  .camera-overlay{position:fixed; inset:0; background:rgba(10,14,12,.86); display:flex; align-items:center; justify-content:center; z-index:250; padding:16px;}
  .camera-box{background:#111612; border-radius:var(--radius); overflow:hidden; max-width:520px; width:100%; max-height:100%; height:100%; box-shadow:var(--shadow); position:relative; display:flex; flex-direction:column;}
  .camera-stage{position:relative; background:#000; aspect-ratio:9/16; flex:1 1 auto; min-height:0; max-width:100%; display:flex; align-items:center; justify-content:center; margin:0 auto;}
  .camera-stage video, .camera-stage img{width:100%; height:100%; object-fit:cover; display:block;}
  .camera-hint{flex:0 0 auto; color:#C9D6CC; font-size:.82rem; text-align:center; padding:12px 16px 0;}
  .camera-actions{flex:0 0 auto; display:flex; gap:10px; padding:14px 16px; justify-content:center; flex-wrap:wrap;}
  .camera-close{position:absolute; top:8px; right:8px; background:rgba(0,0,0,.55); border:none; color:#fff; border-radius:50%; width:32px; height:32px; display:flex; align-items:center; justify-content:center; z-index:2;}
  .camera-close:hover{background:rgba(0,0,0,.75);}
