/* Darajat · Hifz — one calm look: the Darajat logo's deep blue and gold on warm paper, large touch targets,
   Arabic first. Fonts are kept on this site (Cairo, and the King Fahd Hafs font for Quran text). */
@font-face { font-family: 'Cairo'; src: url('../fonts/cairo-ar.woff2') format('woff2'); font-weight: 200 1000; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Cairo'; src: url('../fonts/cairo-lat.woff2') format('woff2'); font-weight: 200 1000; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Hafs'; src: url('../fonts/UthmanicHafs1Ver18.woff2') format('woff2'); font-display: swap; }

:root {
  --navy: #184070; --navy-2: #24578f; --gold: #e0b33c; --gold-2: #f3d27a;
  --bg: #f7f5ef; --card: #ffffff; --ink: #1d2433; --muted: #667085; --line: #e7e2d6; --soft: #f1ede3;
  --ok: #1f9d6b; --ok-bg: #e5f6ee; --warn: #c27a06; --warn-bg: #fdf3dd; --bad: #d14343; --bad-bg: #fde8e8; --info-bg: #e9f0fa;
  --l0: #d14343; --l1: #e29a1d; --l2: #2f74c0; --l3: #1f9d6b; --l-none: #e9e5da;
  --radius: 16px; --shadow: 0 1px 2px rgba(24, 64, 112, .06), 0 6px 18px rgba(24, 64, 112, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1726; --card: #172238; --ink: #e8ecf4; --muted: #9aa6bd; --line: #26344f; --soft: #1d2a44;
    --navy: #8fb4ec; --navy-2: #a9c6f2; --ok-bg: #12352a; --warn-bg: #3a2c0c; --bad-bg: #3d1a1a; --info-bg: #1b2b47; --l-none: #2a3854;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.7 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif; }
a { color: var(--navy); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .4em; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: .3em 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .center { text-align: center; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top bar */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 14px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; white-space: nowrap; }
.brand img { height: 34px; width: auto; }
.brand small { display: block; font-size: .72rem; color: var(--muted); font-weight: 700; line-height: 1; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 700; padding: 8px 12px; border-radius: 10px; white-space: nowrap; }
.nav a.on, .nav a:hover { color: var(--navy); background: var(--soft); }
.me { display: flex; align-items: center; gap: 8px; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; padding: 6px; }
@media (max-width: 640px) {
  .top .wrap { flex-wrap: wrap; gap: 6px 10px; padding-top: 6px; }
  .top .nav { order: 3; flex-basis: 100%; padding-bottom: 6px; }
  .top .me { margin-inline-start: auto; }
}
main { padding: 22px 0 60px; }
.foot { border-top: 1px solid var(--line); padding: 18px 0 28px; color: var(--muted); font-size: .85rem; }
.foot a { color: var(--muted); }

/* cards, buttons, fields */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.tight { padding: 12px 14px; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--navy-2); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0f1726; } }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1d2433; }
.btn.soft { background: var(--soft); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; border-radius: 10px; }
.btn.big { min-height: 54px; font-size: 1.08rem; padding: 10px 24px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-weight: 700; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  font: inherit; color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px; min-height: 44px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(36, 87, 143, .15); }
textarea { min-height: 80px; resize: vertical; }
input[type=number] { max-width: 110px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--navy); }
.error { color: var(--bad); font-size: .88rem; font-weight: 700; }
.flash { border-radius: 12px; padding: 10px 14px; font-weight: 700; margin-bottom: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.note { background: var(--info-bg); border-radius: 12px; padding: 10px 14px; }
.warnbox { background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; }

/* chips, badges, avatars */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--soft); font-size: .82rem; font-weight: 700; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.info { background: var(--info-bg); color: var(--navy); }
.lvl { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.lvl-0 { background: var(--l0); } .lvl-1 { background: var(--l1); } .lvl-2 { background: var(--l2); } .lvl-3 { background: var(--l3); }
.av { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
  color: #fff; font-weight: 800; background: hsl(var(--h, 210), 45%, 45%); }
.av.big { width: 64px; height: 64px; font-size: 1.4rem; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--soft); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.45rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; font-weight: 700; }
.bar { height: 8px; border-radius: 99px; background: var(--l-none); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--navy-2)); border-radius: 99px; }

/* student list */
.students { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.scard { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.scard .grow b { display: block; }
.scard:hover { border-color: var(--navy-2); }

/* today plan */
.plan { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plan .box { border-radius: 14px; padding: 12px; background: var(--soft); }
.plan .box h3 { font-size: .98rem; display: flex; gap: 6px; align-items: center; }
.ritem { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ritem:last-child { border-bottom: 0; }
.ritem b { font-weight: 800; }

/* the 114-surah map */
.map { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.tile { border-radius: 10px; padding: 6px 6px 5px; background: var(--l-none); font-size: .8rem; line-height: 1.3; position: relative; overflow: hidden; min-height: 52px; }
.tile b { display: block; font-size: .86rem; }
.tile .fill { position: absolute; inset: auto 0 0 0; height: 4px; background: rgba(0, 0, 0, .18); }
.tile .fill i { display: block; height: 100%; background: var(--gold); }
.tile.l0 { background: #f7d4d4; } .tile.l1 { background: #f8e3bd; } .tile.l2 { background: #d5e4f6; } .tile.l3 { background: #cfeedd; }
@media (prefers-color-scheme: dark) { .tile.l0 { background: #4a2222; } .tile.l1 { background: #4a3a14; } .tile.l2 { background: #1d3557; } .tile.l3 { background: #163d2e; } }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); font-weight: 700; }

/* memorised-map editor */
.juzbar { display: flex; flex-wrap: wrap; gap: 6px; }
.juzbar button { min-width: 44px; }
.sedit { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.sedit .s { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--soft); }
.sedit .s b { flex: 1; }
.sedit .s input[type=number] { width: 76px; min-height: 38px; }
.sedit .s.full { background: var(--ok-bg); }

/* homework form */
.items .item { display: grid; grid-template-columns: 1.6fr .7fr .7fr .7fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
@media (max-width: 640px) { .items .item { grid-template-columns: 1fr 1fr; } .items .item .sur { grid-column: 1 / -1; } }
.types { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.types label { border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; display: flex; gap: 8px; align-items: flex-start; }
.types label:has(input:checked) { border-color: var(--navy-2); background: var(--info-bg); }
.types input { margin-top: 5px; accent-color: var(--navy); }
.types small { display: block; color: var(--muted); }

/* Quran text, for reading and for marking words */
.quran { font-family: 'Hafs', serif; font-size: 1.75rem; line-height: 2.3; direction: rtl; text-align: justify; background: #fffdf6; color: #1d2433;
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
@media (prefers-color-scheme: dark) { .quran { background: #f8f3e3; } }
.quran .w { cursor: default; border-radius: 6px; padding: 0 1px; }
.quran.marking .w { cursor: pointer; }
.quran .w.m-hifz { background: #f7caca; box-shadow: inset 0 -3px 0 var(--l0); }
.quran .w.m-tajweed { background: #f9e2b7; box-shadow: inset 0 -3px 0 var(--l1); }
.quran .w.m-pron { background: #d8e6f8; box-shadow: inset 0 -3px 0 var(--l2); }
.quran .end { font-size: .8em; color: #8a6a12; }
.quran .sname { display: block; text-align: center; font-family: 'Cairo', sans-serif; font-size: 1rem; font-weight: 800; color: #8a6a12; }
.marktype { display: flex; gap: 6px; flex-wrap: wrap; }
.marktype label { display: inline-flex; gap: 6px; align-items: center; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line); cursor: pointer; font-weight: 700; }
.marktype label:has(input:checked) { border-color: var(--navy-2); background: var(--info-bg); }

/* recorder */
.rec { text-align: center; padding: 16px; border-radius: 18px; background: var(--soft); }
.rec .time { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.recdot { display: inline-block; width: 12px; height: 12px; background: var(--bad); border-radius: 50%; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
audio { width: 100%; }
.progress { height: 6px; background: var(--l-none); border-radius: 99px; overflow: hidden; } .progress i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .2s; }

/* homework cards for students */
.hw { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.hw .ico { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--info-bg); flex: none; }
.big-hello { font-size: 1.6rem; font-weight: 800; }
.stars { color: var(--gold); font-weight: 800; }

/* tables */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: start; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { color: var(--muted); font-size: .85rem; }

/* landing */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; padding: 18px 0 8px; }
.hero h1 { font-size: 2.1rem; }
.hero .lead { font-size: 1.12rem; color: var(--muted); }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; } .hero h1 { font-size: 1.7rem; } }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.feature .ico { font-size: 1.6rem; }
.free { display: inline-block; background: var(--gold); color: #1d2433; font-weight: 800; border-radius: 999px; padding: 2px 14px; }

/* dialogs */
dialog { border: 0; border-radius: 18px; padding: 0; max-width: min(560px, 94vw); width: 100%; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(15, 23, 38, .45); }
dialog .card { border: 0; box-shadow: none; }
details.more > summary { cursor: pointer; font-weight: 800; color: var(--navy); list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '＋ '; }
details.more[open] > summary::before { content: '－ '; }

/* tabs (links) */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 14px; text-decoration: none; font-weight: 800; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--navy); border-color: var(--gold); }

/* certificate (print) */
.cert { max-width: 980px; margin: 18px auto; background: #fffdf6; color: #1d2433; border-radius: 14px; padding: 46px 56px; text-align: center;
  border: 3px solid var(--gold); outline: 10px solid #184070; outline-offset: -26px; box-shadow: var(--shadow); }
.cert img { height: 96px; }
.cert h1 { font-size: 2.3rem; color: #184070; margin-top: 8px; }
.cert .name { font-size: 2.2rem; font-weight: 800; color: #8a6a12; margin: 6px 0; }
.cert .what { font-size: 1.4rem; font-weight: 800; }
.cert .sig { display: flex; justify-content: space-between; margin-top: 40px; font-weight: 700; }
.cert .code { font-size: .8rem; color: #667085; margin-top: 22px; direction: ltr; }
@media print {
  @page { size: A4 landscape; margin: 0; }
  body { background: #fff; } .top, .foot, .noprint, .flash { display: none !important; } main { padding: 0; }
  .cert { box-shadow: none; margin: 8mm auto; border-radius: 0; }
}
