
  :root{
    --navy:#12163a;
    --navy-2:#1b2159;
    --orange:#f5921e;
    --orange-2:#ffab2e;
    --green:#1fb15a;
    --red:#e0483f;
    --bg:#f4f5fb;
    --border:#e4e6f2;
    --text:#1c2033;
    --muted:#8890a8;
  }
  *{box-sizing:border-box}
  body{
    margin:0;
    font-family:'Segoe UI', Roboto, Arial, sans-serif;
    background:var(--bg);
    color:var(--text);
  }
  a{text-decoration:none;color:inherit}
  button{font-family:inherit;cursor:pointer}
  input,textarea,select{font-family:inherit}

  /* ---------- LOGIN ---------- */
  .login-wrap{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
  }
  .login-card{
    width:100%;
    max-width:960px;
    display:grid;
    grid-template-columns:1fr 1fr;
    background:#fff;
    border-radius:24px;
    overflow:hidden;
    box-shadow:0 20px 60px rgba(20,20,60,.15);
  }
  .login-left{
    background:radial-gradient(circle at 70% 20%, var(--navy-2), var(--navy) 60%);
    color:#fff;
    padding:48px 40px;
    position:relative;
  }
  .brand{display:flex;align-items:center;gap:12px;margin-bottom:60px}
  .brand-badge{
    width:44px;height:44px;border-radius:12px;
    background:var(--orange);
    display:flex;align-items:center;justify-content:center;
    font-size:20px;font-weight:700;color:#fff;flex-shrink:0;
  }
  .brand-title{font-size:20px;font-weight:700}
  .brand-title span{color:#7ee0a0}
  .brand-sub{font-size:11px;letter-spacing:.5px;color:#aab0d6;margin-top:2px}
  .login-illustration{
    display:flex;align-items:center;justify-content:center;
    margin:40px 0;
  }
  .check-circle{
    width:150px;height:150px;border-radius:50%;
    border:2px dashed rgba(255,255,255,.3);
    display:flex;align-items:center;justify-content:center;
  }
  .check-circle-inner{
    width:110px;height:110px;border-radius:50%;
    background:rgba(255,255,255,.08);
    display:flex;align-items:center;justify-content:center;
    font-size:44px;color:#7ee0a0;
  }
  .login-quote{font-size:14px;font-style:italic;color:#dfe2f7;line-height:1.5;margin-bottom:8px}
  .login-quote-sub{font-size:12px;color:#8a92c2}
  .login-right{padding:56px 48px;display:flex;flex-direction:column;justify-content:center}
  .login-right h2{margin:0 0 4px;font-size:24px}
  .login-right p.desc{margin:0 0 28px;color:var(--muted);font-size:14px}
  .field{margin-bottom:18px}
  .field label{display:block;font-size:13px;font-weight:600;margin-bottom:6px}
  .field .input-wrap{position:relative}
  .field input{
    width:100%;padding:12px 14px 12px 40px;
    border:1px solid var(--border);border-radius:10px;
    font-size:14px;background:#fafbff;
  }
  .field input:focus{outline:2px solid var(--orange);outline-offset:1px}
  .field .icon{position:absolute;left:13px;top:50%;transform:translateY(-50%);color:var(--muted)}
  .field .eye{position:absolute;right:13px;top:50%;transform:translateY(-50%);color:var(--muted);cursor:pointer;background:none;border:none;font-size:15px}
  .btn-primary{
    width:100%;padding:13px;border:none;border-radius:10px;
    background:linear-gradient(135deg,var(--orange),var(--orange-2));
    color:#fff;font-weight:700;font-size:15px;
    box-shadow:0 8px 20px rgba(245,146,30,.35);
  }
  .btn-primary:disabled{opacity:.6;cursor:not-allowed}
  .login-error{
    background:#fde7e6;color:#b3352c;border:1px solid #f4b5b0;
    padding:10px 14px;border-radius:8px;font-size:13px;margin-bottom:16px;
  }
  .role-hint{margin-top:22px;font-size:12px;color:var(--muted);line-height:1.6}
  .role-hint b{color:var(--text)}

  /* ---------- APP SHELL ---------- */
  #appShell{display:none}
  .topbar{
    background:#fff;border-bottom:1px solid var(--border);
    padding:16px 32px;display:flex;align-items:center;justify-content:space-between;
  }
  .topbar .brand{margin:0}
  .topbar .brand-badge{width:36px;height:36px;font-size:16px}
  .topbar .brand-title{font-size:16px;color:var(--text)}
  .user-chip{display:flex;align-items:center;gap:10px;font-size:14px}
  .user-avatar{
    width:32px;height:32px;border-radius:50%;background:var(--green);
    color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;
  }
  .user-role-badge{
    font-size:11px;background:#eef0fb;color:var(--navy-2);padding:2px 8px;border-radius:20px;font-weight:600;
    margin-left:6px;text-transform:uppercase;letter-spacing:.3px;
  }
  .logout-link{color:var(--muted);font-size:13px}
  .logout-link:hover{color:var(--red)}

  .main{padding:28px 32px 60px;max-width:1300px;margin:0 auto}
  .tabs{display:flex;gap:10px;margin-bottom:24px;flex-wrap:wrap}
  .tab-btn{
    border:1px solid var(--border);background:#fff;color:var(--text);
    padding:9px 20px;border-radius:20px;font-size:14px;font-weight:500;
  }
  .tab-btn.active{background:var(--navy);color:#fff;border-color:var(--navy)}
  .view{display:none}
  .view.active{display:block}

  .cards-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:20px}
  @media(max-width:900px){.cards-grid{grid-template-columns:repeat(2,1fr)}}
  .stat-card{background:#fff;border-radius:16px;padding:22px;box-shadow:0 2px 10px rgba(20,20,60,.05)}
  .stat-card .num{font-size:30px;font-weight:800;color:var(--navy)}
  .stat-card .label{font-size:13px;color:var(--muted);margin-top:4px}

  .panel{background:#fff;border-radius:16px;padding:24px;box-shadow:0 2px 10px rgba(20,20,60,.05);margin-bottom:20px}
  .panel-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:20px;flex-wrap:wrap;gap:12px}
  .panel-head h3{margin:0 0 4px;font-size:17px}
  .panel-head .sub{font-size:13px;color:var(--muted);margin:0}
  .btn-orange{
    background:linear-gradient(135deg,var(--orange),var(--orange-2));color:#fff;border:none;
    padding:10px 20px;border-radius:22px;font-weight:700;font-size:13px;white-space:nowrap;
  }
  .btn-ghost{background:#fff;border:1px solid var(--border);padding:9px 16px;border-radius:10px;font-size:13px}
  .btn-danger{background:#fde7e6;color:var(--red);border:1px solid #f4b5b0;padding:8px 14px;border-radius:8px;font-size:13px}

  table{width:100%;border-collapse:collapse;font-size:13.5px}
  th{
    text-align:left;color:var(--muted);font-size:11.5px;text-transform:uppercase;letter-spacing:.4px;
    padding:10px 12px;border-bottom:1px solid var(--border);
  }
  td{padding:12px;border-bottom:1px solid #f0f1f8;vertical-align:middle}
  tr:hover td{background:#fafbff}
  .pill-link{
    background:#eef0fb;border-radius:8px;padding:4px 10px;font-size:12px;display:inline-flex;gap:8px;align-items:center;
  }
  .pill-link button{background:var(--navy);color:#fff;border:none;padding:4px 10px;border-radius:14px;font-size:11px;font-weight:700}
  .toggle{
    width:40px;height:22px;border-radius:20px;background:#dcdff0;position:relative;border:none;
  }
  .toggle.on{background:var(--green)}
  .toggle .dot{
    position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:#fff;transition:.2s;
  }
  .toggle.on .dot{left:20px}
  .action-icons{display:flex;gap:10px;color:var(--muted)}
  .action-icons button{background:none;border:none;font-size:15px;color:inherit}
  .action-icons button:hover{color:var(--navy)}
  .empty-state{text-align:center;padding:50px 0;color:var(--muted);font-size:14px}

  .filter-select{padding:9px 14px;border:1px solid var(--border);border-radius:10px;font-size:13px;background:#fff;min-width:200px}

  .settings-form .field input, .settings-form .field textarea{padding:11px 14px}

  /* ---------- MODAL ---------- */
  .modal-overlay{
    display:none;position:fixed;inset:0;background:rgba(15,18,45,.5);
    align-items:flex-start;justify-content:center;padding:40px 16px;overflow:auto;z-index:50;
  }
  .modal-overlay.show{display:flex}
  .modal-box{
    background:#fff;border-radius:16px;max-width:560px;width:100%;padding:28px;max-height:90vh;overflow:auto;
  }
  .modal-box h3{margin:0 0 20px}
  .grid-2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
  .modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
  .checkbox-row{display:flex;align-items:center;gap:8px;font-size:13px;margin-bottom:14px}

  .toast{
    position:fixed;bottom:24px;right:24px;background:var(--navy);color:#fff;padding:14px 20px;border-radius:10px;
    font-size:14px;box-shadow:0 8px 24px rgba(0,0,0,.2);z-index:100;display:none;
  }
  .toast.error{background:var(--red)}
  .toast.success{background:var(--green)}

  /* ---------- ATTENDANCE FORM (public) ---------- */
  .att-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}
  .att-card{
    width:100%;max-width:960px;display:grid;grid-template-columns:340px 1fr;
    background:#fff;border-radius:24px;overflow:hidden;box-shadow:0 20px 60px rgba(20,20,60,.15);
  }
  .att-left{background:linear-gradient(160deg,var(--navy-2),var(--navy) 70%);color:#fff;padding:40px 32px}
  .status-pill{
    display:inline-block;background:rgba(31,177,90,.2);color:#7ee0a0;border:1px solid rgba(126,224,160,.4);
    padding:4px 12px;border-radius:20px;font-size:11.5px;font-weight:700;margin:20px 0 14px;
  }
  .status-pill.closed{background:rgba(224,72,63,.2);color:#ff9d97;border-color:rgba(255,157,151,.4)}
  .att-left h2{margin:0 0 14px;font-size:22px}
  .att-left ul{list-style:none;padding:0;margin:0;font-size:13.5px;line-height:2}
  .att-left ul li::before{content:'•';color:var(--orange);margin-right:8px}
  .att-right{padding:40px 36px}
  .att-right h3{margin:0 0 4px}
  .att-right p.desc{color:var(--muted);font-size:13px;margin:0 0 24px}
  canvas#sigPad{
    width:100%;height:150px;border:2px dashed var(--border);border-radius:12px;touch-action:none;
    background:#fafbff;
  }
  .sig-row{display:flex;justify-content:space-between;align-items:center;margin-top:6px;font-size:12px;color:var(--muted)}
  .sig-row button{background:none;border:none;color:var(--red);font-size:12px}
