:root{
  --bg: #f5f8ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;

  --blue: #1d4ed8;
  --blue2: #2563eb;
  --blueSoft: #eaf2ff;

  --border: rgba(15, 23, 42, 0.10);
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
  --radius: 18px;

  --container: 1120px;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; color:var(--text); background:var(--bg); }
a{ color:inherit; text-decoration:none; }

.container{
  width: min(100% - 32px, var(--container));
  margin: 0 auto;
}

/* Topbar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 0;
  gap: 12px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
}

.logo{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  background: linear-gradient(135deg, var(--blue2), #60a5fa);
  color: #fff;
  box-shadow: 0 10px 18px rgba(37,99,235,0.25);
  font-size: 18px;
}

.brand-name{ font-weight: 800; letter-spacing: -0.2px; }
.brand-tag{ font-size: 12px; color: var(--muted); margin-top: 2px; }

.nav{
  display:flex;
  align-items:center;
  gap: 12px;
}

.nav-link{
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  padding: 8px 10px;
  border-radius: 10px;
}

.nav-link:hover{
  background: rgba(37,99,235,0.08);
  color: var(--blue);
}

.nav-link.active{
  background: rgba(37,99,235,0.10);
  color: var(--blue);
}

.hamburger{
  display:none;
  border: 1px solid var(--border);
  background:#fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 18px;
  cursor:pointer;
}

.mobile-nav{
  display:none;
  border-top: 1px solid var(--border);
  padding: 10px 0 14px 0;
}

.mobile-nav.open{ display:block; }

.mobile-link{
  display:block;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  color: #1f2937;
}

.mobile-link:hover{
  background: rgba(37,99,235,0.08);
  color: var(--blue);
}

.mobile-cta{
  background: rgba(37,99,235,0.10);
  color: var(--blue);
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid transparent;
  cursor:pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  user-select:none;
}

.btn:active{ transform: translateY(1px); }

.btn-primary{
  background: linear-gradient(135deg, var(--blue2), var(--blue));
  color:#fff;
  box-shadow: 0 12px 24px rgba(37,99,235,0.25);
}

.btn-primary:hover{
  box-shadow: 0 16px 30px rgba(37,99,235,0.30);
}

.btn-secondary{
  background:#fff;
  border-color: rgba(37,99,235,0.25);
  color: var(--blue);
}

.btn-secondary:hover{
  background: rgba(37,99,235,0.06);
}

.btn-outline{
  background:#fff;
  border-color: var(--border);
  color:#111827;
}

.btn-outline:hover{
  background: rgba(2,6,23,0.03);
}

.btn-block{ width:100%; }

/* Hero */
.hero{
  padding: 44px 0 26px;
}

.hero-grid{
  display:grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 22px;
  align-items: stretch;
}

.pill{
  display:inline-flex;
  align-items:center;
  padding: 8px 12px;
  background: var(--blueSoft);
  border: 1px solid rgba(37,99,235,0.18);
  color: #1e40af;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

h1{
  margin: 14px 0 8px;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -1.0px;
  line-height: 1.08;
}

.accent{ color: var(--blue); }

.subtitle{
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 62ch;
}

.cta-row{
  display:flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.hero-note{
  margin-top: 12px;
  color: #475569;
  font-size: 13px;
}

.hero-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.hero-card-title{
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}

.stat-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat{
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.stat-label{
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-value{
  font-size: 22px;
  font-weight: 900;
  margin-top: 4px;
  letter-spacing: -0.6px;
}

.mini-muted{
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

/* Sections */
.section{
  padding: 28px 0;
}

.section-alt{
  background: rgba(37,99,235,0.05);
  border-top: 1px solid rgba(37,99,235,0.12);
  border-bottom: 1px solid rgba(37,99,235,0.12);
}

h2{
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.6px;
}

.section-sub{
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

/* Cards */
.cards{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 24px rgba(15,23,42,0.06);
}

.card-icon{
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: rgba(37,99,235,0.10);
  color: var(--blue);
  font-weight: 900;
  margin-bottom: 10px;
}

.card h3{
  margin: 0 0 6px;
  font-size: 16px;
  letter-spacing: -0.3px;
}

.card p{
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

/* Steps */
.steps{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.step{
  background: var(--card);
  border: 1px solid rgba(37,99,235,0.18);
  border-radius: var(--radius);
  padding: 14px;
  display:flex;
  gap: 12px;
  align-items:flex-start;
}

.step-num{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  background: linear-gradient(135deg, var(--blue2), var(--blue));
  color:#fff;
  font-weight: 900;
}

.step-title{
  font-weight: 900;
  letter-spacing: -0.3px;
}

.step-text{
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

/* CTA banner */
.cta-banner{
  margin-top: 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid rgba(37,99,235,0.18);
  box-shadow: 0 12px 28px rgba(37,99,235,0.10);
}

.cta-title{
  font-weight: 900;
  letter-spacing: -0.3px;
}

.cta-text{
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

/* Auth */
.auth-body{
  background: radial-gradient(1200px 600px at 20% -10%, rgba(37,99,235,0.22), transparent),
              radial-gradient(900px 500px at 90% 10%, rgba(96,165,250,0.20), transparent),
              var(--bg);
}

.auth-main{
  min-height: calc(100vh - 160px);
  display:grid;
  place-items:center;
  padding: 26px 0 40px;
}

.auth-card{
  width: min(520px, 100%);
  background:#fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-card h1{
  font-size: 28px;
  margin: 0 0 6px;
}

.muted{ color: var(--muted); line-height: 1.6; margin: 0 0 14px; }

.form label{
  display:block;
  font-weight: 800;
  font-size: 13px;
  margin: 12px 0 6px;
}

.form input{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,0.14);
  outline:none;
  font-size: 14px;
  background:#fff;
}

.form input:focus{
  border-color: rgba(37,99,235,0.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}

.form-row{
  display:flex;
  justify-content:space-between;
  margin-top: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.link{
  color: var(--blue);
  font-weight: 800;
  font-size: 13px;
}

.link:hover{ text-decoration: underline; }

.msg{
  margin-top: 12px;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 14px;
  display:none;
}

.msg-info{
  display:block;
  background: rgba(37,99,235,0.10);
  color: var(--blue);
  border: 1px solid rgba(37,99,235,0.18);
}

/* Admin shell */
.admin-wrap{ display:flex; }
.sidebar{
  width: 240px;
  position: fixed;
  top: 68px;
  left: 0;
  bottom: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  padding: 14px;
}
.side-title{ font-weight: 900; margin-bottom: 10px; }
.side-link{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 800;
  color: #111827;
}
.side-link:hover{ background: rgba(37,99,235,0.08); color: var(--blue); }
.side-link.active{ background: rgba(37,99,235,0.10); color: var(--blue); }
.side-ico{ width: 22px; text-align:center; }
.side-divider{ height: 1px; background: var(--border); margin: 12px 0; }

.admin-main{ margin-left: 260px; padding: 22px 0 40px; width: min(100% - 292px, var(--container)); margin-right:auto; }
.admin-header{ display:flex; align-items:flex-end; justify-content: space-between; gap: 14px; margin: 18px 0; flex-wrap: wrap; }
.admin-h1{ margin:0; font-size: 26px; letter-spacing: -0.6px; }
.admin-tools{ display:flex; gap: 10px; align-items:center; flex-wrap: wrap; }

.text-muted{ color: var(--muted); }

/* Tables */
.table-wrap{ overflow:auto; }
.table{ width: 100%; border-collapse: collapse; }
.table th, .table td{ padding: 10px 10px; border-bottom: 1px solid var(--border); }
.table th{ font-size: 12px; color: var(--muted); text-align:left; }
.table td.sticky{ font-weight: 900; }

.cell{ cursor: pointer; text-align:center; font-weight: 900; border-radius: 12px; }
.cell.green{ background: rgba(16,185,129,0.14); color: #065f46; }
.cell.orange{ background: rgba(245,158,11,0.14); color: #92400e; }
.cell.red{ background: rgba(239,68,68,0.14); color: #7f1d1d; }
.cell.blue{ background: rgba(59,130,246,0.14); color: #1e40af; }
.cell.gray{ background: rgba(15,23,42,0.06); color: #334155; }

.badge{ display:inline-block; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; border: 1px solid var(--border); }
.badge.ok{ background: rgba(16,185,129,0.12); color: #065f46; }
.badge.warn{ background: rgba(245,158,11,0.12); color: #92400e; }
.badge.bad{ background: rgba(239,68,68,0.12); color: #7f1d1d; }
.badge.off{ background: rgba(15,23,42,0.05); color: #334155; }

.grid-2{ display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.list{ display:grid; gap: 10px; }
.list-item{ display:flex; align-items:center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--border); background: linear-gradient(180deg, #ffffff, #fbfdff); }
.list-title{ font-weight: 900; }

.codeblock{ background: rgba(2,6,23,0.04); border: 1px solid var(--border); padding: 12px; border-radius: 16px; }

/* Modal */
.modal{ position: fixed; inset:0; background: rgba(2,6,23,0.55); display:grid; place-items:center; padding: 18px; z-index: 80; }
.modal-card{ width: min(560px, 96vw); background:#fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; }
.modal-title{ font-weight: 900; letter-spacing: -0.3px; }

@media (max-width: 980px){
  .sidebar{ position: static; width: auto; top: auto; border-right: none; }
  .admin-main{ margin-left: 0; width: min(100% - 32px, var(--container)); }
  .grid-2{ grid-template-columns: 1fr; }
}

/* Footer */
.footer{
  padding: 22px 0 30px;
  color: #64748b;
  font-size: 13px;
}

.footer-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links{
  display:flex;
  gap: 12px;
}

.footer-links a:hover{
  color: #1e40af;
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 980px){
  .hero-grid{ grid-template-columns: 1fr; }
  .cards{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px){
  .nav{ display:none; }
  .hamburger{ display:inline-flex; }
  .mobile-nav{ display:none; }
  .steps{ grid-template-columns: 1fr; }
  .cards{ grid-template-columns: 1fr; }
  .cta-banner{ flex-direction: column; align-items:flex-start; }
}

/* =========================================================
   Admin Inputs + Modal polish (ADD AT END OF styles.css)
   This will NOT affect login, because login uses .form input
   ========================================================= */

/* Shared input style used by admin pages */
.input{
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,0.14);
  outline: none;
  font-size: 15px;
  background: #fff;
  min-height: 44px;
}

select.input{
  padding-right: 36px;
}

.input:focus{
  border-color: rgba(37,99,235,0.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}

/* Field wrapper + label style (used in modals) */
.field{
  display: block;
  margin-top: 14px;
}

.field .label{
  font-weight: 900;
  font-size: 13px;
  margin-bottom: 6px;
  color: #111827;
}

/* Checkbox row (used in Add Student modal) */
.checkbox{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: #111827;
}

.checkbox input{
  width: 18px;
  height: 18px;
  accent-color: var(--blue2);
}

/* Row helpers */
.row-between{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Alerts (you reference these classes in HTML) */
.alert{
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid var(--border);
}

.alert-error{
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.25);
  color: #7f1d1d;
}

/* Modal polish */
.modal-card{
  width: min(680px, 96vw);
  padding: 24px;
  border-radius: 22px;
}

.modal-title{
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.modal-card .mini-muted{
  margin-top: 6px;
}

.modal-card .btn{
  padding: 11px 16px; /* slightly larger buttons in modals */
}

/* Make modal inputs feel less cramped */
.modal-card .input{
  font-size: 16px;
  min-height: 46px;
}

/* If you ever use textarea later */
textarea.input{
  min-height: 110px;
  resize: vertical;
}

/* =========================================================
   Dashboard alignment fix (headers + cells)
   ========================================================= */

#dashTable{
  table-layout: fixed; /* makes headers line up with cells */
}

#dashTable th{
  text-align: center;
}

#dashTable th:first-child{
  text-align: left;
}

#dashTable th:nth-child(1),
#dashTable td:nth-child(1){
  width: 260px; /* student column fixed width */
}

/* Make the status pills visually centered & consistent */
.cell{
  padding: 12px 10px;
  vertical-align: middle;
}

/* Monthly dashboard */
.monthly-dash-table {
  min-width: 1680px;
}

.monthly-dash-table th {
  text-align: center;
  white-space: nowrap;
}

.monthly-dash-table td {
  text-align: center;
  white-space: nowrap;
}

.monthly-dash-table td:first-child,
.monthly-dash-table th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}

.monthly-dash-table thead th:first-child {
  z-index: 3;
}

.count-present {
  color: #065f46;
  font-weight: 800;
}

.count-late {
  color: #92400e;
  font-weight: 800;
}

.count-missed {
  color: #7f1d1d;
  font-weight: 800;
}

.count-notmarked {
  color: #475569;
  font-weight: 800;
}

.btn-xs {
  padding: 7px 10px;
  font-size: 12px;
}

/* Compact monthly dashboard */
.compact-monthly-table {
  width: 100%;
  table-layout: fixed;
}

.compact-monthly-table th,
.compact-monthly-table td {
  vertical-align: middle;
}

.compact-monthly-table thead th {
  text-align: center;
}

.compact-monthly-table .salah-head {
  text-align: center;
  font-weight: 900;
}

.student-name-cell {
  font-weight: 900;
  text-align: left !important;
  width: 190px;
}

.summary-cell {
  text-align: center;
  padding: 14px 10px !important;
}

.salah-divider {
  border-left: 1px solid rgba(15, 23, 42, 0.10);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: center;
  justify-items: center;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-label {
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.summary-value {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.summary-label.present {
  color: #065f46;
}

.summary-label.late {
  color: #92400e;
}

.summary-label.missed {
  color: #7f1d1d;
}

.summary-label.notmarked {
  color: #475569;
}

.btn-xs {
  padding: 8px 10px;
  font-size: 12px;
}

/* Large modal with internal scroll */
.modal-card-large {
  width: min(980px, 96vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.modal-sticky-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 12px 18px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.modal-scroll-body {
  overflow: auto;
  padding: 0 18px 18px 18px;
  max-height: calc(88vh - 92px);
}

.student-class-cell {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}