/* Hasset Academy EMIS — css/styles.css */
/* Google Fonts loaded from index.html */
:root{
    --navy:#152238;
    --navy-2:#1f3357;
    --gold:#c9a227;
    --gold-soft:#e9d9a3;
    --paper:#f6f4ef;
    --panel:#ffffff;
    --ink:#1f2530;
    --ink-soft:#5b6270;
    --line:#dfd9c9;
    --error:#a83232;
    --good:#3e7c4f;
  }
  *{box-sizing:border-box;}
  body{
    margin:0;
    background:var(--paper);
    color:var(--ink);
    font-family:'Inter',system-ui,sans-serif;
    -webkit-font-smoothing:antialiased;
  }
  .amharic{ font-family:'Nyala','Inter',sans-serif; }

  :root{
    --header-h: 96px; /* approximate rendered height of the header.top block */
  }

  header.top{
    background:linear-gradient(180deg,var(--navy) 0%,var(--navy-2) 100%);
    color:#fff;
    padding:28px 24px 22px;
    border-bottom:4px solid var(--gold);
    position:sticky;top:0;z-index:300;
  }
  .top-inner{max-width:920px;margin:0 auto;display:flex;align-items:center;gap:16px;}
  .crest{
    width:72px;height:72px;border-radius:50%;
    background:#fff;
    display:flex;align-items:center;justify-content:center;
    flex-shrink:0;
    box-shadow:0 0 0 3px rgba(255,255,255,.15);
    object-fit:contain;
    padding:6px;
  }
  header.top h1{margin:0;font-family:'Lora',serif;font-weight:600;font-size:22px;letter-spacing:.2px;}
  header.top p{margin:3px 0 0;color:var(--gold-soft);font-size:13px;letter-spacing:.4px;}

  main{max-width:920px;margin:0 auto;padding:28px 24px 64px;}

  /* Stepper */
  .stepper{display:flex;gap:0;margin-bottom:26px;counter-reset:step;}
  .step{
    flex:1;text-align:center;position:relative;padding-bottom:12px;
    font-size:12.5px;color:var(--ink-soft);font-weight:600;letter-spacing:.3px;
  }
  .step:not(:last-child)::after{
    content:'';position:absolute;top:13px;left:56%;right:-44%;height:2px;background:var(--line);
  }
  .step.done:not(:last-child)::after{background:var(--gold);}
  .step .dot{
    width:26px;height:26px;border-radius:50%;background:#fff;border:2px solid var(--line);
    display:flex;align-items:center;justify-content:center;margin:0 auto 6px;position:relative;z-index:1;
    font-family:'Lora',serif;font-weight:700;color:var(--ink-soft);font-size:13px;
  }
  .step.active .dot{border-color:var(--navy);color:var(--navy);}
  .step.done .dot{background:var(--gold);border-color:var(--gold);color:var(--navy);}
  .step.active{color:var(--navy);}

  .card{
    background:var(--panel);border:1px solid var(--line);border-radius:10px;
    padding:26px 26px 22px;box-shadow:0 1px 3px rgba(21,34,56,.06);
  }
  .card h2{
    font-family:'Lora',serif;font-size:17px;margin:0 0 4px;color:var(--navy);
  }
  .card .sub{font-size:12.5px;color:var(--ink-soft);margin:0 0 20px;}

  .grid{display:grid;grid-template-columns:1fr 1fr;gap:16px 18px;}
  .field{display:flex;flex-direction:column;gap:6px;}
  .field.full{grid-column:1 / -1;}
  label{font-size:12.5px;font-weight:600;color:var(--ink);}
  label .opt{font-weight:400;color:var(--ink-soft);}
  input,select{
    padding:9px 11px;border:1px solid #cfc9b8;border-radius:6px;font-size:14px;
    font-family:inherit;background:#fff;color:var(--ink);
  }
  input:focus,select:focus{outline:2px solid var(--navy);outline-offset:1px;border-color:var(--navy);}
  .err{font-size:11.5px;color:var(--error);min-height:14px;}
  input.invalid,select.invalid{border-color:var(--error);}

  .photo-row{display:flex;align-items:center;gap:16px;}
  .photo-box{
    width:74px;height:92px;border:1.5px dashed #b9b2a0;border-radius:6px;
    background:#f5f3ec;display:flex;align-items:center;justify-content:center;
    overflow:hidden;flex-shrink:0;
  }
  .photo-box span{font-size:10px;color:var(--ink-soft);text-align:center;padding:0 6px;}
  .photo-box img{width:100%;height:100%;object-fit:cover;}
  .photo-controls{display:flex;flex-direction:column;gap:8px;align-items:flex-start;}
  .photo-controls input[type=file]{border:none;padding:0;font-size:12.5px;}

  .actions{display:flex;justify-content:space-between;margin-top:24px;}
  button{
    font-family:inherit;font-size:13.5px;font-weight:600;border-radius:7px;
    padding:10px 20px;cursor:pointer;border:1px solid transparent;letter-spacing:.2px;
  }
  button:focus-visible{outline:2px solid var(--navy);outline-offset:2px;}
  .btn-primary{background:var(--navy);color:#fff;}
  .btn-primary:hover{background:var(--navy-2);}
  .btn-ghost{background:transparent;color:var(--navy);border-color:var(--line);}
  .btn-ghost:hover{background:#f1efe6;}
  .btn-gold{background:var(--gold);color:var(--navy);}
  .btn-gold:hover{background:#b8931f;}
  button:disabled{opacity:.45;cursor:not-allowed;}

  /* Review */
  .review-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 24px;font-size:13.5px;}
  .review-grid div span.k{display:block;color:var(--ink-soft);font-size:11.5px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;}
  .review-grid div span.v{display:block;margin-top:2px;}

  /* ID card */
  .idcard-wrap{display:flex;justify-content:center;margin:22px 0 6px;}
  .idcard{
    width:440px;border-radius:14px;overflow:hidden;
    box-shadow:0 8px 24px rgba(21,34,56,.18);
    border:1px solid var(--line);
    font-family:'Inter',sans-serif;
  }
  .idcard .band{
    background:linear-gradient(135deg,var(--navy),var(--navy-2));
    color:#fff;padding:16px 20px 12px;display:flex;align-items:center;gap:12px;
  }
  .idcard .band .crest{width:54px;height:54px;font-size:14px;box-shadow:none;padding:4px;object-fit:contain;}
  .idcard .band .name{font-family:'Lora',serif;font-size:15px;font-weight:600;}
  .idcard .band .name small{display:block;color:var(--gold-soft);font-weight:400;font-size:11px;}
  .idcard .body{background:#fff;padding:18px 20px 12px;display:flex;gap:16px;flex-direction:column;}
  .idcard .top-row{display:flex;gap:18px;align-items:flex-start;}
  .idcard .photo-slot{
    width:78px;height:117px;border-radius:6px;border:1px solid var(--line);
    background:#f1efe6;flex-shrink:0;overflow:hidden;display:flex;align-items:center;justify-content:center;
  }
  .idcard .photo-slot img{width:100%;height:100%;object-fit:cover;}
  .idcard .photo-slot span{font-size:10px;color:var(--ink-soft);text-align:center;padding:0 6px;}
  .idcard .sid{
    font-family:'Lora',serif;font-weight:700;color:var(--navy);font-size:21px;letter-spacing:.5px;margin-bottom:6px;
  }
  .idcard .name-line{font-size:20px;font-weight:800;color:var(--ink);margin-bottom:2px;line-height:1.2;}
  .idcard .row{display:flex;justify-content:space-between;font-size:13px;padding:5px 0;border-bottom:1px dashed var(--line);}
  .idcard .row span.k{color:var(--ink-soft);}
  .idcard .row span.v{font-weight:600;text-align:right;}
  .idcard .signature-row{display:flex;justify-content:flex-end;margin-top:14px;padding-top:6px;}
  .idcard .signature-block{width:180px;text-align:center;}
  .idcard .signature-blank{border-bottom:1px solid var(--ink-soft);height:26px;}
  .idcard .signature-label{
    font-size:10px;color:var(--ink-soft);letter-spacing:.3px;padding-top:4px;
  }
  .idcard .foot{background:var(--gold-soft);color:var(--navy);text-align:center;font-size:10px;font-weight:600;padding:6px;letter-spacing:.5px;}

  .banner{
    background:#eef6ef;border:1px solid #bfe0c4;color:var(--good);
    padding:10px 14px;border-radius:7px;font-size:13px;margin-bottom:18px;display:none;
  }
  .banner.show{display:block;}

  /* Register table */
  section.log{max-width:920px;margin:34px auto 0;padding:0 24px;}

  .sync-box{
    background:#fbfaf6;border:1px solid var(--line);border-radius:8px;
    padding:12px 16px;margin-bottom:18px;
  }
  .sync-row{display:flex;align-items:center;justify-content:space-between;gap:12px;}
  .sync-label{display:flex;flex-direction:column;gap:2px;}
  .sync-label strong{font-size:13px;color:var(--navy);}
  .sync-status{font-size:11.5px;color:var(--ink-soft);}
  .sync-status.ok{color:var(--good);font-weight:600;}
  .sync-status.err{color:var(--error);font-weight:600;}
  .sync-panel{margin-top:12px;padding-top:12px;border-top:1px solid var(--line);}
  .sync-help{font-size:12px;color:var(--ink-soft);margin:0 0 10px;line-height:1.5;}
  .help-link{
    color:var(--navy);font-weight:600;text-decoration:underline;text-decoration-color:var(--gold);
    text-underline-offset:2px;
  }
  .help-link:hover{color:var(--navy-2);text-decoration-color:var(--navy-2);}
  .help-link:visited{color:var(--navy);}
  .sync-input-row{display:flex;gap:8px;flex-wrap:wrap;}
  .sync-input-row input{flex:1;min-width:220px;padding:9px 11px;border:1px solid #cfc9b8;border-radius:6px;font-size:13px;font-family:inherit;}
  .log-head{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:10px;}
  .log-head h3{font-family:'Lora',serif;color:var(--navy);margin:0;font-size:16px;}
  .log-head span{font-size:12px;color:var(--ink-soft);}

  /* Sidebar navigation */
  .sidebar{
    position:fixed;top:0;left:0;bottom:0;width:160px;
    background:var(--navy-2);border-right:3px solid var(--gold);
    display:flex;flex-direction:column;gap:4px;
    padding:var(--header-h) 0 16px;
    z-index:200;
  }
  .page-btn{
    background:transparent;border:none;border-left:3px solid transparent;
    color:#cdd6e5;font-family:'Inter',sans-serif;font-size:12.5px;font-weight:600;
    padding:14px 16px;cursor:pointer;text-align:left;
    display:flex;align-items:center;gap:10px;letter-spacing:.2px;
    transition:background .15s;
  }
  .page-btn:hover{color:#fff;background:rgba(255,255,255,.06);}
  .page-btn.active{color:#fff;border-left-color:var(--gold);background:rgba(255,255,255,.08);}
  .page-icon{font-size:15px;}
  .page-wrap{
    margin-left:168px;
    padding: 12px 16px 32px;
    min-height: 60vh;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
  }
  .page-view{display:block; position:relative; z-index:1;}
  .page-view[hidden]{display:none!important;}
  #view-worksheets, #view-materials, #view-messages {
    padding-left: 4px;
    clear: both;
  }
  #view-worksheets .card, #view-materials .card, #view-messages .card {
    margin-left: 0;
    max-width: 100%;
  }
  .mark-filters{
    display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;
    margin:0 0 14px;padding:12px 14px;background:#f7f5ef;border:1px solid var(--line);border-radius:8px;
  }
  .mark-filters .field{margin:0;min-width:130px;flex:1}
  .mark-filters label{font-size:11.5px;font-weight:600;color:var(--navy);display:block;margin-bottom:4px}
  .mark-filters select,.mark-filters input{
    width:100%;padding:8px 10px;border:1px solid #cfc9b8;border-radius:6px;font-size:13px;font-family:inherit;background:#fff;
  }
  #bulkMarksTable input[type=number]{width:72px;padding:6px 8px;border:1px solid #cfc9b8;border-radius:5px;font-size:13px}
  #bulkMarksTable .total-cell{font-weight:700;color:var(--navy)}
  #regBranchGradeSummary strong{color:var(--navy)}


  @media(max-width:640px){
    .sidebar{width:100%;height:56px;flex-direction:row;position:fixed;top:var(--header-h);
             border-right:none;border-bottom:3px solid var(--gold);padding:0;}
    .page-btn{padding:10px 12px;font-size:11px;gap:6px;border-left:none;border-bottom:3px solid transparent;margin-bottom:-3px;}
    .page-btn.active{border-left:none;border-bottom-color:var(--gold);}
    .page-wrap{margin-left:0;margin-top:56px;}
  }

  /* Marks sub-tabs */
  .subtabbar{display:flex;gap:4px;margin-bottom:18px;border-bottom:2px solid var(--line);}
  .subtab-btn{
    background:transparent;border:none;color:var(--ink-soft);font-family:'Inter',sans-serif;
    font-size:13px;font-weight:600;padding:10px 14px;cursor:pointer;
    border-bottom:3px solid transparent;margin-bottom:-2px;letter-spacing:.2px;
  }
  .subtab-btn:hover{color:var(--navy);}
  .subtab-btn.active{color:var(--navy);border-bottom-color:var(--gold);}
  .subview{display:block;}
  .rank-cell{font-weight:700;color:var(--navy);}
  textarea.comment-input{width:100%;min-height:60px;font-family:'Inter',sans-serif;font-size:13px;
    padding:8px;border:1px solid var(--line);border-radius:4px;resize:vertical;}

  /* Typeahead student search */
  .typeahead-results{
    position:absolute;left:0;right:0;z-index:50;background:#fff;border:1px solid var(--line);
    border-radius:0 0 8px 8px;max-height:280px;overflow-y:auto;margin-top:2px;
    box-shadow:0 8px 24px rgba(21,34,56,.14);
  }
  .field{position:relative;}
  .field.full{position:relative;}
  .typeahead-item{padding:9px 12px;cursor:pointer;font-size:13px;border-bottom:1px solid #f0eee5;}
  .typeahead-item:last-child{border-bottom:none;}
  .typeahead-item:hover{background:#f5f3ec;}
  .typeahead-item .th-id{color:var(--ink-soft);font-size:11.5px;}
  .typeahead-empty{padding:10px 12px;font-size:12.5px;color:var(--ink-soft);}

  .selected-student-box{
    background:#f5f3ec;border:1px solid var(--line);border-radius:7px;padding:10px 14px;
    font-size:13px;display:flex;justify-content:space-between;align-items:center;gap:10px;
  }
  .selected-student-box .ssb-name{font-weight:700;color:var(--navy);}
  .selected-student-box .ssb-meta{color:var(--ink-soft);font-size:12px;}
  .selected-student-box button{
    background:transparent;border:1px solid var(--line);border-radius:5px;
    padding:4px 10px;font-size:11.5px;cursor:pointer;color:var(--ink-soft);
  }

  /* Marks table */
  table.marks-table{width:100%;border-collapse:collapse;margin-top:18px;}
  table.marks-table th{
    background:#f1efe6;color:var(--navy);font-size:11px;text-transform:uppercase;
    letter-spacing:.3px;padding:8px 10px;text-align:left;border-bottom:1px solid var(--line);
  }
  table.marks-table td{padding:6px 10px;border-bottom:1px solid var(--line);font-size:13px;}
  table.marks-table input{
    width:70px;padding:6px 8px;border:1px solid #cfc9b8;border-radius:5px;font-size:13px;font-family:inherit;
  }
  table.marks-table input:focus{outline:2px solid var(--navy);outline-offset:1px;}
  table.marks-table td.total-cell{font-weight:700;color:var(--navy);}

  table.marks-table td.roster-name, table.marks-table th:nth-child(2){
    min-width:200px;max-width:320px;white-space:normal;text-align:left;
  }
  table.marks-table th{white-space:nowrap;font-size:10.5px;}


  .table-scroll{overflow-x:auto;margin-top:14px;}
  #rosterTable{width:100%;border-collapse:collapse;font-size:12.5px;min-width:520px;}
  #rosterTable th{background:#f1efe6;color:var(--navy);font-size:10.5px;text-transform:uppercase;
    letter-spacing:.3px;padding:7px 9px;text-align:left;border-bottom:1px solid var(--line);white-space:nowrap;}
  #rosterTable td{padding:7px 9px;border-bottom:1px solid var(--line);white-space:nowrap;}
  #rosterTable td.avg-cell{font-weight:700;color:var(--navy);}

  /* Fee table */
  .fee-paid{color:var(--good);font-weight:600;}
  .fee-due{color:var(--error);font-weight:600;}
  .fee-partial{color:#a67a1f;font-weight:600;}

  .search-row{margin-bottom:12px;}
  .search-row input{
    width:100%;padding:10px 12px;border:1px solid #cfc9b8;border-radius:7px;
    font-size:13.5px;font-family:inherit;background:#fff;
  }
  .search-row input:focus{outline:2px solid var(--navy);outline-offset:1px;border-color:var(--navy);}
  .row-print-btn{
    background:var(--navy);color:#fff;border:none;border-radius:5px;
    padding:5px 10px;font-size:11.5px;font-weight:600;cursor:pointer;font-family:inherit;margin-right:4px;
  }
  .row-print-btn:hover{background:var(--navy-2);}
  .row-edit-btn{
    background:#e8f0fe;color:#152238;border:1px solid #b0c4f0;border-radius:5px;
    padding:5px 10px;font-size:11.5px;font-weight:600;cursor:pointer;font-family:inherit;margin-right:4px;
  }
  .row-edit-btn:hover{background:#c8dafb;}
  .row-delete-btn{
    background:#fdecec;color:#a33;border:1px solid #f0b8b8;border-radius:5px;
    padding:5px 10px;font-size:11.5px;font-weight:600;cursor:pointer;font-family:inherit;
  }
  .row-delete-btn:hover{background:#f9d2d2;}
  tr.no-match td{text-align:center;color:var(--ink-soft);padding:20px;}
  table{width:100%;border-collapse:collapse;background:#fff;border:1px solid var(--line);border-radius:8px;overflow:hidden;font-size:12.5px;}
  th,td{padding:9px 10px;text-align:left;border-bottom:1px solid var(--line);}
  th{background:#f1efe6;color:var(--navy);font-weight:700;font-size:11px;text-transform:uppercase;letter-spacing:.3px;}
  tr:last-child td{border-bottom:none;}
  .empty-row td{color:var(--ink-soft);text-align:center;padding:22px;}

  footer.note{max-width:920px;margin:22px auto 0;padding:0 24px;font-size:11.5px;color:var(--ink-soft);line-height:1.5;}

  @media(max-width:640px){
    .grid,.review-grid{grid-template-columns:1fr;}
    .step .dot{width:22px;height:22px;font-size:11px;}
    .step{font-size:10.5px;}
  }

/* ── Landing / login dashboard ── */
.login-wrap{
  min-height:100vh;
  display:flex;
  align-items:stretch;
  justify-content:center;
  background:linear-gradient(145deg,#0d1b2a 0%,#152238 45%,#1b3a5c 100%);
  padding:0;
}
.landing-shell{
  width:100%;
  max-width:1180px;
  margin:0 auto;
  display:grid;
  grid-template-columns:1.15fr 0.85fr;
  min-height:100vh;
}
@media(max-width:900px){
  .landing-shell{grid-template-columns:1fr;min-height:auto}
}
.landing-hero{
  position:relative;
  color:#f3efe4;
  padding:36px 40px 28px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.landing-hero-bg{
  position:absolute;inset:0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%,rgba(201,162,39,.18),transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 80%,rgba(47,110,180,.15),transparent 50%);
  pointer-events:none;
}
.landing-hero-inner{position:relative;z-index:1;display:flex;flex-direction:column;gap:22px;height:100%}
.landing-brand{display:flex;align-items:center;gap:14px}
.landing-logo{
  width:64px;height:64px;border-radius:50%;
  object-fit:contain;background:#fff;
  border:2px solid #c9a227;padding:4px;
  box-shadow:0 4px 16px rgba(0,0,0,.25);
}
.landing-logo:not([src]),.landing-logo[src=""]{display:none}
.landing-title{
  font-family:'Lora',serif;font-size:28px;font-weight:700;
  margin:0;color:#fff;letter-spacing:.3px;
}
.landing-tagline{margin:4px 0 0;font-size:13px;color:#d9c98a;letter-spacing:.4px}
.landing-photo-wrap{border-radius:14px;overflow:hidden;box-shadow:0 12px 40px rgba(0,0,0,.35)}
.landing-photo{
  position:relative;min-height:180px;
  background:
    linear-gradient(135deg,rgba(13,27,42,.55),rgba(21,34,56,.4)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='400' viewBox='0 0 800 400'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%231f3357'/%3E%3Cstop offset='1' stop-color='%23152238'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23g)' width='800' height='400'/%3E%3Cpath fill='%23c9a227' opacity='.12' d='M0 280 Q200 200 400 260 T800 240 V400 H0Z'/%3E%3Ccircle cx='640' cy='90' r='48' fill='%23c9a227' opacity='.2'/%3E%3Crect x='80' y='120' width='120' height='90' rx='8' fill='%23fff' opacity='.08'/%3E%3Crect x='220' y='140' width='90' height='70' rx='8' fill='%23fff' opacity='.06'/%3E%3C/svg%3E") center/cover no-repeat;
}
.landing-photo-overlay{
  position:absolute;left:0;right:0;bottom:0;
  padding:18px 20px;
  background:linear-gradient(transparent,rgba(8,14,24,.85));
  display:flex;flex-direction:column;gap:4px;
}
.landing-photo-overlay span{font-family:'Lora',serif;font-size:18px;font-weight:600;color:#fff}
.landing-photo-overlay small{font-size:12px;color:#d9c98a}
.landing-cards{
  display:grid;grid-template-columns:1fr 1fr;gap:12px;
}
@media(max-width:560px){.landing-cards{grid-template-columns:1fr}}
.landing-info-card{
  background:rgba(255,255,255,.06);
  border:1px solid rgba(201,162,39,.22);
  border-radius:12px;padding:14px 16px;
  backdrop-filter:blur(6px);
}
.landing-info-card.landing-info-wide{grid-column:1/-1}
.landing-card-icon{font-size:18px;margin-bottom:6px}
.landing-info-card h3{
  font-family:'Lora',serif;font-size:15px;margin:0 0 6px;color:#e8c96b;
}
.landing-info-card p{
  margin:0;font-size:12.5px;line-height:1.55;color:#e8e4d8;opacity:.95;
}
.landing-foot{margin-top:auto;font-size:11px;color:rgba(243,239,228,.45);letter-spacing:.3px}

.landing-login{
  display:flex;align-items:center;justify-content:center;
  padding:28px 24px;
  background:rgba(255,255,255,.03);
  border-left:1px solid rgba(255,255,255,.06);
}
@media(max-width:900px){
  .landing-login{border-left:none;border-top:1px solid rgba(255,255,255,.08);padding-bottom:40px}
}
.login-card{
  width:100%;max-width:400px;
  background:#fffdf8;
  border-radius:16px;
  padding:28px 26px 24px;
  box-shadow:0 24px 60px rgba(0,0,0,.35);
  border:1px solid rgba(201,162,39,.25);
}
.login-card-head{text-align:center;margin-bottom:18px}
.login-ha-mark{
  width:52px;height:52px;border-radius:50%;
  background:linear-gradient(145deg,#152238,#1f3357);
  color:#c9a227;font-family:'Lora',serif;font-weight:700;font-size:18px;
  display:flex;align-items:center;justify-content:center;
  margin:0 auto 10px;
  border:2px solid #c9a227;
  box-shadow:0 0 0 3px rgba(201,162,39,.15);
}
.login-card h2{font-family:'Lora',serif;color:#152238;font-size:22px;margin:0 0 4px}
.login-card .sub{color:#5b6270;font-size:13px;margin:0 0 16px}
.role-select{display:flex;gap:6px;margin-bottom:16px;flex-wrap:wrap}
.role-chip{
  flex:1;min-width:64px;text-align:center;padding:9px 6px;
  border:1px solid #dfd9c9;border-radius:8px;cursor:pointer;
  font-size:12px;font-weight:600;color:#5b6270;
  transition:background .15s,color .15s,border-color .15s;
}
.role-chip:hover{border-color:#152238;color:#152238}
.role-chip.active{background:#152238;color:#fff;border-color:#152238}
.login-card .field{display:flex;flex-direction:column;gap:5px;margin-bottom:12px}
.login-card label{font-size:12px;font-weight:600;color:#152238}
.login-card input{
  padding:10px 12px;border:1px solid #cfc9b8;border-radius:8px;
  font-size:13.5px;font-family:inherit;background:#fff;
}
.login-card input:focus{outline:none;border-color:#152238;box-shadow:0 0 0 3px rgba(21,34,56,.12)}
.login-card .err{font-size:11.5px;color:#a83232;min-height:14px}
.login-card .btn-login{
  font-family:inherit;font-size:14px;font-weight:600;border-radius:8px;
  padding:12px 18px;cursor:pointer;border:none;
  background:linear-gradient(135deg,#152238,#1f3357);color:#fff;
  width:100%;margin-top:6px;
  box-shadow:0 6px 16px rgba(21,34,56,.25);
}
.login-card .btn-login:hover{background:linear-gradient(135deg,#1f3357,#274a78)}
.login-secure-note{
  text-align:center;margin:14px 0 0;font-size:11px;color:#8a9099;
}
.user-pill{display:flex;align-items:center;gap:10px;background:rgba(255,255,255,.1);padding:6px 14px;border-radius:20px;font-size:13px;margin-left:auto}
.user-pill button{background:transparent;border:1px solid rgba(255,255,255,.3);color:#fff;padding:4px 12px;border-radius:4px;cursor:pointer;font-size:12px}
.backup-pill{display:flex;align-items:center;gap:8px;background:rgba(255,255,255,.1);padding:6px 12px;border-radius:20px;font-size:12px;margin-left:16px}
.backup-pill button{background:transparent;border:1px solid rgba(255,255,255,.3);color:#fff;padding:4px 11px;border-radius:4px;cursor:pointer;font-size:11.5px;font-weight:600;white-space:nowrap}
.backup-pill button:hover{background:rgba(255,255,255,.18)}
.badge{font-size:10.5px;font-weight:700;padding:3px 8px;border-radius:12px;text-transform:uppercase}
.badge-admin{background:#e8f0fe;color:#174ea6}
.badge-office{background:#fff4e5;color:#9a5b00}
.badge-teacher{background:#e6f4ea;color:#1e7e3e}
.badge-student{background:#fff4e0;color:#b06000}
.badge-parent{background:#f3e8ff;color:#6b21a8}
.hidden{display:none!important}
.tt-grid{display:grid;grid-template-columns:80px repeat(5,1fr);gap:1px;background:#dfd9c9;border:1px solid #dfd9c9;border-radius:8px;overflow:hidden;font-size:12px}
.tt-cell{background:#fff;padding:8px;min-height:56px}
.tt-header{background:#f1efe6;font-weight:700;color:#152238;text-align:center;padding:8px;font-size:11px;text-transform:uppercase}
.tt-time{background:#fafaf6;font-weight:600;color:#5b6270;display:flex;align-items:center;justify-content:center;font-size:11px}
.tt-subject{font-weight:700;color:#152238;font-size:11.5px}
.tt-teacher{color:#5b6270;font-size:11px}
.tt-empty{color:#bbb;font-style:italic;font-size:11px}
.stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:18px}
@media(max-width:700px){.stat-grid{grid-template-columns:1fr 1fr}}
.stat-card{background:#fff;border:1px solid #dfd9c9;border-radius:10px;padding:16px}
.stat-card .label{font-size:11px;text-transform:uppercase;letter-spacing:.4px;color:#5b6270;font-weight:600}
.stat-card .value{font-size:24px;font-weight:700;color:#152238;font-family:'Lora',serif;margin-top:4px}
#view-timetable,#view-attendance,#view-teachers,#view-overview{max-width:920px;margin:0 auto;padding:28px 24px 64px}
@media(max-width:720px){#ttConstraintsCard div[style*="grid-template-columns"]{grid-template-columns:1fr!important}}
.cloud-box{
  background:#eef4fb;border:1px solid #c5d4e8;border-left:4px solid #152238;
  border-radius:8px;padding:14px 16px;margin-top:16px;font-size:12.5px;line-height:1.5;
}
.cloud-box h3{font-family:'Lora',serif;font-size:14px;color:#152238;margin:0 0 6px;}
.cloud-box input{width:100%;padding:8px 10px;border:1px solid #cfc9b8;border-radius:6px;font-size:13px;margin:4px 0 8px;font-family:inherit;}
.cloud-status{font-size:11.5px;color:#5b6270;margin-top:6px;}
.cloud-status.ok{color:#3e7c4f;font-weight:600;}
.cloud-status.err{color:#a83232;font-weight:600;}
.migration-note{
  background:#f8f6ef;border:1px solid #dfd9c9;border-left:4px solid #c9a227;
  border-radius:8px;padding:14px 16px;margin-top:18px;font-size:12.5px;line-height:1.55;color:#1f2530;
}
.migration-note h3{font-family:'Lora',serif;font-size:14px;color:#152238;margin:0 0 6px;}
.migration-note code{font-size:11.5px;background:#efebe0;padding:1px 5px;border-radius:3px;}
.migration-note ul{margin:6px 0 0 18px;padding:0;}
.migration-note li{margin:3px 0;}



/* Subject trend analysis */
.trend-up{color:#3e7c4f;font-weight:700}
.trend-down{color:#a83232;font-weight:700}
.trend-flat{color:#5b6270;font-weight:600}
.trend-spark{display:inline-flex;align-items:flex-end;gap:2px;height:28px;vertical-align:middle}
.trend-spark i{display:block;width:8px;border-radius:2px 2px 0 0;background:var(--navy);min-height:2px}
.trend-spark i.low{background:#a83232}
.trend-spark i.mid{background:#c9a227}
.trend-spark i.high{background:#3e7c4f}
#anTrendTable th{font-size:10px}

/* Performance heatmap */
.heatmap-wrap{overflow:auto;max-height:480px;border:1px solid var(--line);border-radius:8px;background:#fff}
.heatmap-table{border-collapse:collapse;font-size:11px;min-width:100%}
.heatmap-table th,.heatmap-table td{border:1px solid #e8e4d8;padding:4px 6px;text-align:center;white-space:nowrap}
.heatmap-table th{background:#f1efe6;color:var(--navy);font-size:10px;text-transform:uppercase;letter-spacing:.2px;position:sticky;top:0;z-index:2}
.heatmap-table th.hm-sticky{position:sticky;left:0;z-index:3;background:#f1efe6;text-align:left}
.heatmap-table td.hm-name{position:sticky;left:0;z-index:1;background:#fff;text-align:left;font-weight:600;color:var(--navy);max-width:140px;overflow:hidden;text-overflow:ellipsis}
.heatmap-table td.hm-avg{font-weight:700}
.hm-cell{font-weight:600;min-width:44px}
.hm-legend{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 0;font-size:11.5px;align-items:center}
.hm-legend .swatch{width:18px;height:14px;border-radius:3px;display:inline-block;border:1px solid rgba(0,0,0,.08)}
.hm-note{font-size:11.5px;color:var(--ink-soft);margin:6px 0 0}

/* Dashboard bar charts */
.chart-row{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:14px}
@media(max-width:700px){.chart-row{grid-template-columns:1fr}}
.chart-card{background:#fff;border:1px solid var(--line);border-radius:10px;padding:16px}
.chart-card h3{font-family:'Lora',serif;font-size:14px;color:var(--navy);margin:0 0 4px}
.chart-card .chart-sub{font-size:11.5px;color:var(--ink-soft);margin:0 0 12px}
.bar-chart{display:flex;align-items:flex-end;gap:8px;height:160px;padding:8px 4px 0;border-bottom:2px solid var(--line)}
.bar-col{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;min-width:0}
.bar-fill{width:100%;max-width:42px;border-radius:5px 5px 0 0;background:var(--navy);transition:height .35s ease;min-height:2px}
.bar-fill.gold{background:var(--gold)}
.bar-fill.good{background:var(--good)}
.bar-fill.warn{background:#a67a1f}
.bar-fill.bad{background:var(--error)}
.bar-val{font-size:10px;font-weight:700;color:var(--navy);margin-bottom:4px}
.bar-lbl{font-size:9.5px;color:var(--ink-soft);text-align:center;margin-top:6px;line-height:1.2;word-break:break-word;max-width:100%}
.chart-legend{display:flex;flex-wrap:wrap;gap:10px;margin-top:10px;font-size:11.5px}
.chart-legend span{display:inline-flex;align-items:center;gap:5px}
.chart-legend i{width:10px;height:10px;border-radius:2px;display:inline-block}
.subj-pass-table th.pass{color:var(--good)} .subj-pass-table th.fail{color:var(--error)}

/* ── Landing extras ── */
.landing-clock{
  position:absolute;top:12px;right:14px;z-index:2;
  background:rgba(8,14,24,.55);color:#f3efe4;
  font-size:11px;font-weight:600;letter-spacing:.3px;
  padding:6px 10px;border-radius:20px;border:1px solid rgba(201,162,39,.35);
  backdrop-filter:blur(4px);
}
.landing-values{display:flex;flex-wrap:wrap;gap:8px}
.landing-values span{
  font-size:11px;font-weight:700;letter-spacing:.4px;text-transform:uppercase;
  color:#0d1b2a;background:#e8c96b;padding:5px 10px;border-radius:999px;
}
.landing-portals{display:flex;flex-wrap:wrap;gap:8px}
.landing-portal-pill{
  font-size:12px;color:#e8e4d8;background:rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.12);border-radius:8px;padding:8px 12px;
}
.landing-portal-pill strong{color:#e8c96b;margin-right:4px}

/* ── In-app dashboard polish ── */
.dash-welcome{
  display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:14px;
  margin-bottom:16px;padding:18px 20px;border-radius:14px;
  background:linear-gradient(135deg,#152238 0%,#1f3357 55%,#274a78 100%);
  color:#fff;box-shadow:0 10px 28px rgba(21,34,56,.18);
}
.dash-greet{margin:0 0 4px;font-size:12px;letter-spacing:.5px;text-transform:uppercase;color:#d9c98a;font-weight:700}
.dash-welcome h2{margin:0;font-family:'Lora',serif;font-size:22px;color:#fff}
.dash-welcome .sub{margin:6px 0 0;color:rgba(255,255,255,.75);font-size:13px}
.dash-welcome-meta{text-align:right}
.dash-date{font-size:13px;font-weight:600;color:#f3efe4}
.dash-sync{
  display:inline-block;margin-top:6px;font-size:11px;font-weight:700;
  padding:4px 10px;border-radius:999px;background:rgba(255,255,255,.12);color:#d9c98a;
  border:1px solid rgba(201,162,39,.35);
}
.dash-sync.ok{background:rgba(16,120,60,.25);color:#b8f0c8;border-color:rgba(100,200,140,.4)}
.dash-sync.warn{background:rgba(160,100,20,.25);color:#ffe0a0;border-color:rgba(220,170,60,.4)}
.dash-stat-grid{grid-template-columns:repeat(3,1fr)}
@media(max-width:900px){.dash-stat-grid{grid-template-columns:1fr 1fr}}
.stat-card.accent-navy{border-color:#c5d0e0;background:linear-gradient(180deg,#fff,#f3f6fb)}
.stat-card.accent-gold{border-color:#e8d9a8;background:linear-gradient(180deg,#fffef8,#faf3dc)}
.stat-card.accent-green{border-color:#c5e0cc;background:linear-gradient(180deg,#fff,#f1faf3)}
.stat-card .value.text-sm{font-size:18px}
.stat-hint{font-size:11px;color:#8a9099;margin-top:6px}
.dash-two-col{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media(max-width:800px){.dash-two-col{grid-template-columns:1fr}}
.dash-panel h2{margin-top:0}
.dash-qa-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.dash-qa{
  display:flex;align-items:center;gap:8px;text-align:left;
  padding:12px 12px;border-radius:10px;border:1px solid var(--line);
  background:#fff;cursor:pointer;font-size:13px;font-weight:600;color:var(--navy);
  font-family:inherit;transition:border-color .15s,box-shadow .15s,transform .1s;
}
.dash-qa span{font-size:16px}
.dash-qa:hover{border-color:#152238;box-shadow:0 4px 12px rgba(21,34,56,.08);transform:translateY(-1px)}
.dash-branch-bars{display:flex;flex-direction:column;gap:10px;margin-top:8px}
.dash-branch-row{display:grid;grid-template-columns:120px 1fr 36px;gap:8px;align-items:center;font-size:12px}
.dash-branch-row .name{color:var(--navy);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dash-branch-track{height:10px;background:#efebe0;border-radius:999px;overflow:hidden}
.dash-branch-fill{height:100%;background:linear-gradient(90deg,#152238,#c9a227);border-radius:999px;min-width:2px}
.dash-branch-row .n{text-align:right;font-weight:700;color:var(--navy)}
.dash-tips{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:8px}
@media(max-width:800px){.dash-tips{grid-template-columns:1fr}}
.dash-tip{
  font-size:12.5px;line-height:1.45;color:#3a4150;
  background:#f7f4ea;border:1px solid #e5dcbc;border-radius:10px;padding:12px 14px;
  border-left:3px solid #c9a227;
}

/* Sync PIN */
.sync-pin-box{
  background:#f8f6ef;border:1px solid #e0d8b8;border-radius:10px;
  padding:12px 14px;margin-bottom:14px;
}
.sync-pin-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.sync-pin-badge{
  font-size:11px;font-weight:700;padding:3px 10px;border-radius:999px;
  background:#efe8d0;color:#5b4a1e;border:1px solid #d9c98a;
}
.sync-pin-badge.on{background:#e3f5e8;color:#1f3d28;border-color:#bfe0c4}
.sync-pin-badge.unlocked{background:#e8f0fe;color:#1a3a6b;border-color:#b8cce8}
.sync-pin-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.sync-pin-row input{
  flex:1;min-width:140px;padding:8px 10px;border:1px solid #cfc9b8;border-radius:6px;
  font-size:13px;font-family:inherit;
}
.cloud-controls-wrap.pin-locked{
  opacity:.55;pointer-events:none;user-select:none;
  filter:grayscale(.15);
  position:relative;
}
.cloud-controls-wrap.pin-locked::after{
  content:"Unlock with Sync PIN to change cloud settings";
  position:absolute;left:50%;top:40%;transform:translate(-50%,-50%);
  background:rgba(21,34,56,.9);color:#fff;font-size:12.5px;font-weight:600;
  padding:10px 16px;border-radius:8px;white-space:nowrap;pointer-events:none;
  z-index:2;
}
@media(max-width:600px){
  .cloud-controls-wrap.pin-locked::after{white-space:normal;text-align:center;width:80%;}
}

/* ============================================================
   Mobile safety net — general fixes so every page (not just
   ones already hand-tuned) behaves on small screens.
   ============================================================ */
html, body { overflow-x: hidden; }

/* Any table anywhere becomes horizontally scrollable on small
   screens, even ones not wrapped in .table-scroll. */
@media (max-width: 700px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table thead, table tbody { display: table; width: 100%; }
}

/* Inputs/selects/textareas never overflow their card on narrow screens */
@media (max-width: 700px) {
  input, select, textarea, button { max-width: 100%; }
  .field input, .field select, .field textarea,
  .field input[type="file"] { width: 100%; box-sizing: border-box; }
  .card { padding: 14px; }
  .actions { flex-wrap: wrap; gap: 8px; }
  h1 { font-size: 20px; }
  h2 { font-size: 17px; }
  /* Any element carrying a fixed pixel max-width in an inline style is
     capped to the viewport instead, so it can never push content off-screen */
  [style*="max-width"] { max-width: 100% !important; }
  code { word-break: break-all; white-space: normal; }
}

/* Any leftover 2/3/4-column inline grids collapse to 1 column on phones */
@media (max-width: 640px) {
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

/* Marks fill page — keep filters, table, save button fully visible */
.mark-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
#view-marks .table-scroll,
#bulkMarksTable {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#bulkMarksTable th,
#bulkMarksTable td {
  white-space: nowrap;
  padding: 8px 10px;
}
#bulkMarksTable input.score-input,
#bulkMarksTable input.absent-input,
#bulkMarksTable select.conduct-input {
  min-width: 72px;
  max-width: 110px;
  width: 100%;
  box-sizing: border-box;
}
#classGateBar {
  display: block !important;
  visibility: visible !important;
}
#btnSaveMarks {
  display: inline-flex !important;
  visibility: visible !important;
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .mark-filters { grid-template-columns: 1fr 1fr; }
  #classGateBar > div { flex-direction: column; align-items: stretch !important; }
  #classGateBar .field { min-width: 0 !important; width: 100%; }
  #view-marks .actions {
    flex-direction: column;
    align-items: stretch !important;
  }
  #btnSaveMarks { width: 100%; justify-content: center; }
}

/* ============================================================
   Fix content clipped / hidden to the left (overview, worksheets)
   ============================================================ */
html, body {
  overflow-x: auto; /* was hidden — that cut off left-side content */
  max-width: 100%;
}
.page-wrap {
  box-sizing: border-box;
  padding-left: 16px;
  padding-right: 16px;
  max-width: 100%;
  overflow-x: visible;
}
.page-view,
.page-view .card {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: visible;
}
#view-worksheets .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}
#view-worksheets .table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-left: 0;
  padding-left: 0;
}
#view-worksheets table {
  width: 100%;
  min-width: 520px;
  margin-left: 0;
}
#view-overview,
#view-overview .card,
#view-overview .stat-grid,
#view-overview .dash-two-col {
  max-width: 100%;
  box-sizing: border-box;
}
.dash-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.stat-grid,
.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 640px) {
  .page-wrap {
    padding-left: 10px;
    padding-right: 10px;
    margin-left: 0;
  }
  .sidebar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #view-worksheets .grid {
    grid-template-columns: 1fr;
  }
}
/* Keep branch/teacher role chips never visible on login */
.role-chip[data-role="branch"],
.role-chip[data-role="teacher"] {
  display: none !important;
}


/* Secure portal lock — EMIS UI never visible without Auth.user */
body.emis-locked #appView,
#appView.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
body.emis-locked #loginView {
  display: flex !important;
  visibility: visible !important;
}
body.emis-authenticated #loginView {
  display: none !important;
}


/* Installed Android/iOS app: keep role menu visible */
@media (display-mode: standalone), (display-mode: minimal-ui) {
  .sidebar, #mainSidebar {
    display: flex !important;
    visibility: visible !important;
  }
  body.emis-app .sidebar, body.emis-app #mainSidebar {
    display: flex !important;
  }
}
@media (max-width: 640px) {
  .sidebar, #mainSidebar {
    display: flex !important;
    z-index: 50;
  }
  .page-btn span:not(.page-icon) {
    font-size: 11px;
  }
}


/* Collapsible help / fill instructions — hidden until one click */
.page-view > .card > p.sub:first-of-type,
.page-view .card > h2 + p.sub,
.page-help-body {
  display: none;
}
.page-help-body.is-open,
.page-view > .card > p.sub:first-of-type.is-open,
.page-view .card > h2 + p.sub.is-open {
  display: block;
}
button.hasset-help-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #0B2A4A;
  background: #f0ebe0;
  border: 1px solid #d9d1bc;
  border-radius: 8px;
  cursor: pointer;
}
button.hasset-help-toggle:hover { background: #e8e2d4; }
button.hasset-help-toggle[aria-expanded="true"] { background: #e5eef6; border-color: #9bb8d4; }

/* Admin overview: one-line headers, expand on click */
#view-overview .card.overview-collapsed > *:not(h2) { display: none !important; }
#view-overview .card.overview-collapsed { padding-top: 12px; padding-bottom: 12px; }
#view-overview .card.overview-collapsed h2 { margin: 0; font-size: 15px; }
#view-overview .card.overview-open > *:not(h2) { display: revert; }


/* ===== Mobile bottom nav (school-app style) ===== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1200;
  background: #152238;
  color: #f3efe4;
  border-top: 1px solid rgba(201,162,39,.35);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}
.mobile-bottom-nav .mbn-item {
  appearance: none; border: 0; background: transparent; color: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 6px 2px; font-size: 10px; font-weight: 600;
  border-radius: 10px; cursor: pointer;
}
.mobile-bottom-nav .mbn-item:active { background: rgba(255,255,255,.08); }
.mobile-bottom-nav .mbn-ico { font-size: 18px; line-height: 1; }
.mobile-bottom-nav .mbn-lbl { letter-spacing: .02em; opacity: .9; }
@media (max-width: 900px) {
  body.emis-authenticated .mobile-bottom-nav { display: grid; }
  body.emis-authenticated #appView,
  body.emis-authenticated .app-shell,
  body.emis-authenticated main {
    padding-bottom: 72px !important;
  }
}
/* Larger touch targets on phone */
@media (max-width: 900px) {
  .mark-filters select, .mark-filters input, .mark-filters button,
  #cardFilters select, #cardFilters input, #cardFilters button,
  .subtab-btn, .btn-primary, .btn-gold, .btn-ghost {
    min-height: 44px;
  }
  .subtab-btn { padding: 10px 14px; font-size: 13px; }
}


/* ===== Modern commercial school-app polish (2026) ===== */
.emis-modern-2026 { }
body.emis-android-app {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
body.emis-android-app .login-card,
body.emis-android-app .card {
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
/* Student name cells always readable */
#bulkMarksBody td, #rosterTablesWrap td, .report-card-block td {
  font-size: 14px;
  color: #1a2332;
}
#bulkMarksBody td:nth-child(2),
#rosterTablesWrap td.name-cell {
  font-weight: 600;
  color: #0f1a2a;
}
/* Sticky filter bar on marks */
@media (max-width: 900px) {
  .mark-filters, #cardFilters, .roster-filters {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #f7f4ec;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(21,34,56,.1);
  }
  table.roster-table, table.marks-table {
    font-size: 12px;
  }
  .mobile-bottom-nav .mbn-item.active {
    color: #c9a227;
  }
}
/* Empty states friendlier */
.sub span[style*="b42318"] {
  display: inline-block;
  margin-top: 6px;
}
/* Loading skeleton hint */
.emis-loading-hint {
  padding: 24px;
  text-align: center;
  color: #5a6577;
  font-size: 14px;
}

.reg-sel-chip{display:inline-block;background:#152238;color:#f3efe4;padding:2px 8px;border-radius:999px;font-size:12px;margin:2px 4px 2px 0;cursor:pointer}
.reg-sel-chip:hover{background:#b42318}


/* ===== eskooly-skin-v2 ===== */
body.eskooly-skin {
  background: #f0f4f8 !important;
}
body.eskooly-skin header.top {
  background: linear-gradient(135deg, #0f2744 0%, #1a3a5c 55%, #1e4d6b 100%) !important;
  border-bottom: none !important;
  box-shadow: 0 4px 20px rgba(15,39,68,.25);
  padding: 14px 18px !important;
}
body.eskooly-skin .card {
  border-radius: 16px !important;
  border: 1px solid rgba(15,39,68,.06) !important;
  box-shadow: 0 4px 18px rgba(15,39,68,.08) !important;
}
body.eskooly-skin .stat-card {
  border-radius: 14px !important;
  box-shadow: 0 4px 14px rgba(15,39,68,.07) !important;
  border: none !important;
}
body.eskooly-skin .btn-primary {
  background: linear-gradient(180deg, #1a3a5c, #0f2744) !important;
  border-radius: 12px !important;
  border: none !important;
}
body.eskooly-skin .btn-gold {
  background: linear-gradient(180deg, #e8b923, #d4a017) !important;
  border-radius: 12px !important;
  color: #0f2744 !important;
  font-weight: 700 !important;
}
body.eskooly-skin .subtab-btn {
  border-radius: 999px !important;
  border: 1px solid #d0d7e2 !important;
  background: #fff !important;
  margin: 0 4px 6px 0 !important;
  padding: 8px 16px !important;
}
body.eskooly-skin .subtab-btn.active {
  background: #0f2744 !important;
  color: #fff !important;
  border-color: #0f2744 !important;
}
body.eskooly-skin .dash-welcome {
  background: linear-gradient(135deg, #0f2744, #1e4d6b) !important;
  border-radius: 16px !important;
  color: #fff !important;
}
body.eskooly-skin input, body.eskooly-skin select {
  border-radius: 10px !important;
  min-height: 42px;
}
.teacher-mobile-tools .tmt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.teacher-mobile-tools .tmt-btn {
  min-height: 52px;
  font-size: 14px;
  border-radius: 12px;
  width: 100%;
}
@media (max-width: 900px) {
  .teacher-mobile-tools .tmt-grid { grid-template-columns: 1fr; }
  body.eskooly-skin .page-wrap { padding-bottom: 88px !important; }
}
.rc-rank-row td { background: #f0f7ff !important; }


/* Login background photo (soft school campus look) */
#loginView.login-wrap,
#loginView .landing-shell,
.landing-shell {
  background-color: #0B2A4A !important;
  background-image:
    linear-gradient(135deg, rgba(11,42,74,.82) 0%, rgba(21,34,56,.75) 50%, rgba(15,39,68,.85) 100%),
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="800" height="600"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop stop-color="%231a3a5c"/><stop offset="1" stop-color="%230B2A4A"/></linearGradient></defs><rect fill="url(%23g)" width="800" height="600"/><circle cx="120" cy="80" r="40" fill="%23c9a227" opacity=".15"/><circle cx="700" cy="500" r="80" fill="%23ffffff" opacity=".05"/><rect x="200" y="220" width="400" height="180" rx="12" fill="%23ffffff" opacity=".06"/></svg>') !important;
  background-size: cover !important;
  background-position: center !important;
}
#loginView .login-card {
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,.97) !important;
}
/* Never show remote-update toast blink */
#hassetRemoteUpdateToast { display: none !important; }

/* login-bg-v3 */
#loginView .landing-shell.landing-shell,
#loginView .landing-shell {
  background-color: #0B2A4A !important;
  background-image:
    linear-gradient(160deg, rgba(11,42,74,.88), rgba(21,34,56,.78)),
    radial-gradient(ellipse at 20% 20%, rgba(201,162,39,.25), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(43,108,176,.3), transparent 45%) !important;
  background-size: cover !important;
  min-height: 100vh;
}
#loginView .login-card {
  box-shadow: 0 16px 48px rgba(0,0,0,.35) !important;
}


/* ===== Hasset school look: navy + gold uniform palette ===== */
:root {
  --hasset-navy: #3d4a28;
  --hasset-gold: #C9A227;
  --hasset-cream: #f7f4ec;
}
body.emis-authenticated #appView {
  background-color: #0B2A4A !important;
  background-image: none !important;
  background: linear-gradient(180deg, #f4f1e8 0%, #ebe6da 100%) !important;
}
#view-attendance .card {
  border-color: rgba(11,42,74,.12) !important;
  box-shadow: 0 2px 10px rgba(11,42,74,.06);
}
#view-attendance h2 {
  color: var(--hasset-navy);
}
/* Login: school navy + soft photo layer */
#loginView.login-wrap,
#loginView .landing-shell {
  background-color: #0B2A4A !important;
  background-image:
    linear-gradient(160deg, rgba(11,42,74,.82), rgba(11,42,74,.72)),
    radial-gradient(ellipse at 15% 15%, rgba(201,162,39,.22), transparent 55%),
    var(--hasset-login-photo, none),
    linear-gradient(160deg, #0B2A4A, #152238) !important;
  background-size: cover !important;
  background-position: center !important;
}
/* Feedback / diagnostic panels: admin only (hidden by default for others via class) */
body:not([data-role="admin"]) .admin-only-feedback,
body:not([data-role="admin"]) #attLiveCard .admin-only-feedback,
body:not([data-role="admin"]) [data-feedback-admin="1"] {
  display: none !important;
}


/* solid school uniform colours (navy + gold) — match student uniform branding */
:root {
  --navy: #3d4a28;
  --navy-2: #2f3a1f;
  --gold: #C9A227;
  --gold-soft: #e9d9a3;
  --cream: #f7f4ec;
}
body.emis-authenticated #appMain,
body.emis-authenticated .content,
body.emis-authenticated #appView .page-view {
  background: transparent;
}
#loginView.login-wrap,
#loginView .landing-shell {
  background-color: #0B2A4A !important;
  background-image:
    linear-gradient(160deg, #0B2A4A 0%, #152238 55%, #0B2A4A 100%),
    radial-gradient(ellipse at 20% 15%, rgba(201,162,39,.28), transparent 50%) !important;
}
header.top {
  background: linear-gradient(180deg, #0B2A4A 0%, #152238 100%) !important;
  border-bottom: 4px solid #C9A227 !important;
}
.btn-primary {
  background: #0B2A4A !important;
}
.btn-gold, #btnLogin, .btn-login {
  background: #C9A227 !important;
  color: #0B2A4A !important;
}


/* ===== Hasset school uniform palette (olive green sweater + cream) ===== */
:root {
  --navy: #3d4a28;
  --navy-2: #2f3a1f;
  --gold: #C9A227;
  --gold-soft: #e9d9a3;
  --cream: #f7f4ec;
  --uniform-green: #5B6B3A;
  --uniform-green-deep: #3d4a28;
  --uniform-green-soft: #8a9a5c;
}
body.emis-authenticated #appView {
  background: linear-gradient(180deg, #f4f6ef 0%, #e8ecdf 100%) !important;
  background-image: none !important;
}
header.top {
  background: linear-gradient(180deg, #3d4a28 0%, #2f3a1f 100%) !important;
  border-bottom: 4px solid #C9A227 !important;
}
#loginView.login-wrap,
#loginView .landing-shell {
  background-color: #3d4a28 !important;
  background-image:
    linear-gradient(160deg, #3d4a28 0%, #2f3a1f 55%, #4a5a30 100%),
    radial-gradient(ellipse at 20% 15%, rgba(201,162,39,.22), transparent 50%) !important;
}
.btn-primary {
  background: #3d4a28 !important;
  color: #fff !important;
}
.btn-primary:hover {
  background: #2f3a1f !important;
}
.btn-gold, #btnLogin, .btn-login {
  background: #C9A227 !important;
  color: #2f3a1f !important;
}
.page-btn.active, .role-chip.active {
  background: #3d4a28 !important;
  color: #fff !important;
}
#view-attendance h2,
.card h2 {
  color: #3d4a28;
}

/* ========== Animated Top Scorers (ministry-style ranking cards) ========== */
.top-scorers-card {
  background: linear-gradient(165deg, #f8f6f0 0%, #fff 40%, #f3f0e6 100%);
  border: 1px solid #e0d9c4;
  overflow: hidden;
  position: relative;
}
.top-scorers-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(201,162,39,.18) 0%, transparent 70%);
  pointer-events: none;
  animation: tsGlow 6s ease-in-out infinite alternate;
}
@keyframes tsGlow {
  from { transform: translate(0,0) scale(1); opacity: .7; }
  to { transform: translate(-30px, 20px) scale(1.15); opacity: 1; }
}
.top-scorers-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}
.top-scorers-title {
  margin: 0;
  font-family: Lora, Georgia, serif;
  font-size: 1.25rem;
  color: #2f3a1f;
  letter-spacing: .02em;
}
.top-scorers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  position: relative;
  z-index: 1;
}
.top-scorers-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 12px;
}

/* Individual rank card — photo + uniform reference layout */
.ts-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8e2d4;
  box-shadow: 0 4px 14px rgba(47, 58, 31, .08);
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateY(18px) scale(.97);
  animation: tsCardIn .55s cubic-bezier(.22,1,.36,1) forwards;
  transition: transform .25s ease, box-shadow .25s ease;
  position: relative;
  overflow: hidden;
}
.ts-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 10px 28px rgba(47, 58, 31, .14);
}
.ts-card.rank-1 {
  border-color: #C9A227;
  background: linear-gradient(160deg, #fffef8 0%, #fff 50%, #faf6e8 100%);
  box-shadow: 0 6px 20px rgba(201,162,39,.22);
}
.ts-card.rank-1::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #C9A227, #e8d48a, #C9A227);
  background-size: 200% 100%;
  animation: tsGoldBar 2.5s linear infinite;
}
@keyframes tsGoldBar {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
@keyframes tsCardIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ts-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.ts-photo-wrap {
  position: relative;
  flex-shrink: 0;
}
.ts-photo {
  width: 72px;
  height: 88px;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
  border: 2px solid #e0d9c4;
  background: linear-gradient(180deg, #d4e8f5 0%, #b8d4e8 100%);
  display: block;
}
.ts-card.rank-1 .ts-photo {
  border-color: #C9A227;
  box-shadow: 0 0 0 2px rgba(201,162,39,.25);
}
.ts-photo-placeholder {
  width: 72px;
  height: 88px;
  border-radius: 10px;
  border: 2px solid #e0d9c4;
  background: linear-gradient(160deg, #3d4a28 0%, #5a6b3a 50%, #3d4a28 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.85);
  font-size: 28px;
  font-weight: 700;
  font-family: Lora, serif;
}
.ts-rank-badge {
  position: absolute;
  bottom: -6px;
  left: -6px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #3d4a28;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  border: 2px solid #fff;
}
.ts-card.rank-1 .ts-rank-badge {
  background: linear-gradient(135deg, #C9A227, #a8861a);
  color: #2f3a1f;
  animation: tsPulse 1.8s ease-in-out infinite;
}
@keyframes tsPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.ts-meta {
  flex: 1;
  min-width: 0;
}
.ts-school {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #C9A227;
  text-transform: uppercase;
  margin: 0 0 2px;
}
.ts-branch {
  font-size: 11.5px;
  color: #5a6350;
  margin: 0 0 6px;
  line-height: 1.35;
}
.ts-gender-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: #1e4a8c;
}
.ts-gender-chip.female { background: #1e4a8c; }
.ts-gender-chip.male { background: #1e4a8c; }

.ts-name {
  font-size: 14px;
  font-weight: 700;
  color: #C9A227;
  margin: 2px 0 0;
  letter-spacing: .02em;
  line-height: 1.3;
  word-break: break-word;
}
.ts-name-label {
  font-size: 11px;
  color: #6a7360;
  font-weight: 600;
  margin: 8px 0 0;
}

.ts-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid #eee8da;
}
.ts-stat {
  text-align: center;
}
.ts-stat-val {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: #C9A227;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  animation: tsCountPop .6s ease backwards;
}
.ts-card.rank-1 .ts-stat-val { color: #a8861a; }
.ts-stat-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: #1e4a8c;
  text-transform: none;
  margin-top: 2px;
  letter-spacing: .01em;
}
@keyframes tsCountPop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  .top-scorers-grid { grid-template-columns: 1fr; }
  .ts-photo, .ts-photo-placeholder { width: 64px; height: 80px; }
}

/* ============================================================
   Hasset Academy — School uniform animations & motion system
   Uniform palette from campus photo: green sweater, white collar, gold
   ============================================================ */
:root {
  --uniform-green: #2f5c3a;
  --uniform-green-deep: #1e3d28;
  --uniform-green-mid: #3d6b48;
  --uniform-green-soft: #5a8f66;
  --uniform-collar: #f4f7f5;
  --uniform-gold: #C9A227;
  --uniform-gold-soft: #e8d48a;
}

/* ---- Global smooth motion ---- */
@media (prefers-reduced-motion: no-preference) {
  .card {
    animation: haCardIn .45s cubic-bezier(.22,1,.36,1) both;
  }
  .page-view:not([hidden]) {
    animation: haPageIn .4s ease both;
  }
  .stat-card {
    animation: haCardIn .5s cubic-bezier(.22,1,.36,1) both;
    transition: transform .2s ease, box-shadow .2s ease;
  }
  .stat-card:nth-child(1) { animation-delay: .05s; }
  .stat-card:nth-child(2) { animation-delay: .1s; }
  .stat-card:nth-child(3) { animation-delay: .15s; }
  .stat-card:nth-child(4) { animation-delay: .2s; }
  .stat-card:nth-child(5) { animation-delay: .25s; }
  .stat-card:nth-child(6) { animation-delay: .3s; }
  .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(47,92,58,.12);
  }
  .dash-qa {
    transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
  }
  .dash-qa:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(47,92,58,.15);
  }
  .page-btn {
    transition: background .2s ease, transform .15s ease;
  }
  .page-btn:hover { transform: translateY(-1px); }
  .btn-primary, .btn-gold, .btn-ghost {
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  }
  .btn-primary:hover, .btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
  }
  .btn-primary:active, .btn-gold:active, .btn-ghost:active {
    transform: translateY(0) scale(.98);
  }
}

@keyframes haCardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes haPageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Login: floating school scene ---- */
.ha-school-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
#loginView .landing-shell { position: relative; z-index: 1; }
#loginView .login-card {
  position: relative;
  z-index: 2;
  animation: haCardIn .6s cubic-bezier(.22,1,.36,1) both;
  box-shadow: 0 12px 40px rgba(30,61,40,.35);
  border: 1px solid rgba(201,162,39,.25);
}

/* Student in green uniform (CSS illustration) */
.ha-student {
  position: absolute;
  width: 48px;
  height: 72px;
  animation: haStudentWalk 14s linear infinite;
  opacity: .9;
}
.ha-student .ha-head {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c4a574;
  margin: 0 auto 2px;
  position: relative;
  box-shadow: 0 1px 0 rgba(0,0,0,.1);
}
.ha-student .ha-hair {
  position: absolute;
  top: -3px; left: 2px; right: 2px;
  height: 8px;
  border-radius: 8px 8px 2px 2px;
  background: #2a1f14;
}
.ha-student .ha-body {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border-radius: 6px 6px 4px 4px;
  background: linear-gradient(180deg, var(--uniform-green-soft) 0%, var(--uniform-green) 40%, var(--uniform-green-deep) 100%);
  position: relative;
  box-shadow: inset 0 8px 0 0 var(--uniform-collar);
}
.ha-student .ha-body::before {
  /* white collar V */
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: var(--uniform-collar);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}
.ha-student .ha-legs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 1px;
}
.ha-student .ha-leg {
  width: 8px;
  height: 16px;
  background: #2c3340;
  border-radius: 0 0 3px 3px;
  animation: haLegSwing .6s ease-in-out infinite alternate;
}
.ha-student .ha-leg:nth-child(2) { animation-delay: -.3s; }
.ha-student.girl .ha-hair {
  border-radius: 10px 10px 6px 6px;
  height: 12px;
  background: #1a120c;
}
.ha-student.girl .ha-body {
  border-radius: 6px 6px 10px 10px;
}

@keyframes haStudentWalk {
  0% { transform: translateX(-60px) translateY(0); }
  25% { transform: translateX(25vw) translateY(-6px); }
  50% { transform: translateX(50vw) translateY(0); }
  75% { transform: translateX(75vw) translateY(-4px); }
  100% { transform: translateX(calc(100vw + 60px)) translateY(0); }
}
@keyframes haLegSwing {
  from { transform: rotate(-12deg); }
  to { transform: rotate(12deg); }
}

/* Floating books */
.ha-book {
  position: absolute;
  width: 28px;
  height: 36px;
  border-radius: 2px 4px 4px 2px;
  background: linear-gradient(90deg, #8b2942 0%, #c44569 30%, #e8a0b0 32%, #c44569 34%, #8b2942 100%);
  box-shadow: 2px 3px 8px rgba(0,0,0,.2);
  animation: haBookFloat 8s ease-in-out infinite;
  opacity: .85;
}
.ha-book::before {
  content: '';
  position: absolute;
  left: 3px; top: 4px; bottom: 4px;
  width: 2px;
  background: rgba(255,255,255,.5);
  border-radius: 1px;
}
.ha-book.green {
  background: linear-gradient(90deg, var(--uniform-green-deep) 0%, var(--uniform-green) 30%, #7ab087 32%, var(--uniform-green) 34%, var(--uniform-green-deep) 100%);
}
.ha-book.gold {
  background: linear-gradient(90deg, #8a7020 0%, var(--uniform-gold) 30%, #f0e0a0 32%, var(--uniform-gold) 34%, #8a7020 100%);
}
.ha-book.navy {
  background: linear-gradient(90deg, #152238 0%, #2a4a7a 30%, #7a9cc4 32%, #2a4a7a 34%, #152238 100%);
}

@keyframes haBookFloat {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-18px) rotate(6deg); }
}

/* Open book (for materials / marks icons) */
.ha-book-open {
  display: inline-flex;
  width: 36px;
  height: 24px;
  position: relative;
  vertical-align: middle;
}
.ha-book-open .page-l,
.ha-book-open .page-r {
  width: 17px;
  height: 22px;
  background: #fff;
  border: 1px solid var(--uniform-green);
  box-shadow: inset 0 0 0 1px rgba(47,92,58,.08);
}
.ha-book-open .page-l {
  border-radius: 3px 0 0 3px;
  transform-origin: right center;
  animation: haPageFlip 3s ease-in-out infinite;
  background: linear-gradient(90deg, #f0f4f1, #fff);
}
.ha-book-open .page-r {
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #fff, #f0f4f1);
}
@keyframes haPageFlip {
  0%, 40%, 100% { transform: perspective(80px) rotateY(0deg); }
  20% { transform: perspective(80px) rotateY(-35deg); }
}

/* Pencil / chalk bounce */
.ha-pencil {
  position: absolute;
  width: 6px;
  height: 32px;
  background: linear-gradient(180deg, #f0c14d 0%, #e8b84a 70%, #c9a227 71%, #3d4a28 85%, #1a1a1a 100%);
  border-radius: 1px;
  animation: haPencilBob 4s ease-in-out infinite;
  opacity: .8;
}
@keyframes haPencilBob {
  0%, 100% { transform: translateY(0) rotate(25deg); }
  50% { transform: translateY(-12px) rotate(35deg); }
}

/* Graduation cap float */
.ha-cap {
  position: absolute;
  width: 36px;
  height: 20px;
  animation: haCapFloat 7s ease-in-out infinite;
  opacity: .75;
}
.ha-cap .cap-top {
  width: 36px;
  height: 8px;
  background: var(--uniform-green-deep);
  transform: skewX(-8deg);
  margin: 0 auto;
}
.ha-cap .cap-base {
  width: 22px;
  height: 8px;
  background: var(--uniform-green);
  margin: -1px auto 0;
  border-radius: 0 0 4px 4px;
}
.ha-cap .tassel {
  position: absolute;
  right: 4px;
  top: 6px;
  width: 2px;
  height: 14px;
  background: var(--uniform-gold);
  animation: haTassel 1.2s ease-in-out infinite alternate;
}
@keyframes haCapFloat {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-14px) rotate(5deg); }
}
@keyframes haTassel {
  from { transform: rotate(-15deg); }
  to { transform: rotate(15deg); }
}

/* Soft particle dots (blackboard chalk dust) */
.ha-dust {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--uniform-gold-soft);
  animation: haDust 6s linear infinite;
  opacity: 0;
}
@keyframes haDust {
  0% { opacity: 0; transform: translateY(0) scale(.5); }
  15% { opacity: .7; }
  100% { opacity: 0; transform: translateY(-80px) scale(1.2); }
}

/* ---- Overview decorative strip ---- */
.ha-anim-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 10px 8px 6px;
  margin: 0 0 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(47,92,58,.06), rgba(201,162,39,.08), rgba(47,92,58,.06));
  border: 1px solid rgba(47,92,58,.12);
  overflow: hidden;
  position: relative;
}
.ha-anim-strip .ha-book-open { margin: 0 4px; }
.ha-anim-strip-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--uniform-green-deep);
  letter-spacing: .03em;
}

/* Icon bounce for quick actions */
.dash-qa span:first-child {
  display: inline-block;
  transition: transform .25s ease;
}
.dash-qa:hover span:first-child {
  animation: haIconBounce .5s ease;
}
@keyframes haIconBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px) scale(1.1); }
  70% { transform: translateY(-2px); }
}

/* Marks table rows soft enter */
.marks-table tbody tr {
  animation: haRowIn .35s ease both;
}
@keyframes haRowIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Registration table */
#regStudentsTable tbody tr {
  transition: background .15s ease;
}
#regStudentsTable tbody tr:hover {
  background: rgba(47,92,58,.06);
}

/* Loading pulse (uniform green) */
.ha-pulse {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--uniform-green);
  animation: haPulseDot 1.2s ease-in-out infinite;
  margin-right: 6px;
  vertical-align: middle;
}
@keyframes haPulseDot {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(47,92,58,.4); }
  50% { opacity: .7; transform: scale(1.15); box-shadow: 0 0 0 6px rgba(47,92,58,0); }
}

/* Header crest gentle glow */
header.top .crest {
  animation: haCrestGlow 4s ease-in-out infinite alternate;
}
@keyframes haCrestGlow {
  from { box-shadow: 0 0 0 3px rgba(255,255,255,.15); }
  to { box-shadow: 0 0 0 3px rgba(201,162,39,.35), 0 0 16px rgba(201,162,39,.2); }
}

/* Success flash when saving */
@keyframes haSaveFlash {
  0% { box-shadow: 0 0 0 0 rgba(62,124,79,.5); }
  100% { box-shadow: 0 0 0 12px rgba(62,124,79,0); }
}
.ha-saved-flash {
  animation: haSaveFlash .6s ease;
}

/* Reduced motion: kill decorative loops */
@media (prefers-reduced-motion: reduce) {
  .ha-student, .ha-book, .ha-pencil, .ha-cap, .ha-dust,
  .ha-book-open .page-l, header.top .crest {
    animation: none !important;
  }
  .card, .page-view:not([hidden]), .stat-card, .ts-card {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
