/* Kaleem knowledge base: light, readable, right to left. No scripts. */
:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1d2433; --muted: #5d6677; --line: #e2e5ea;
  --brand: #0f62fe; --late: #b3261e; --late-bg: #fdecea; --due: #8a5a00; --due-bg: #fff4d6; --ok-bg: #e8f1ff;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --card: #1d2128; --ink: #e8eaee; --muted: #a2a9b6; --line: #303643;
    --brand: #78a9ff; --late: #ffb4ab; --late-bg: #3b1f1d; --due: #ffd27a; --due-bg: #3a2f14; --ok-bg: #1b2a44; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 "Noto Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: .4rem 0 .2rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .9rem; margin: .8rem 0 .3rem; color: var(--muted); }
h4 { font-size: .95rem; margin: .6rem 0 .2rem; }
.top { background: var(--card); border-block-end: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.bar { display: flex; align-items: center; justify-content: space-between; max-width: 1200px; margin: 0 auto;
  padding: .55rem 16px; }
.brand { font-weight: 700; color: var(--ink); font-size: 1.1rem; }
.brand span { font-weight: 400; color: var(--muted); font-size: .9rem; margin-inline-start: .3rem; }
.tabs { display: flex; gap: .2rem; overflow-x: auto; max-width: 1200px; margin: 0 auto; padding: 0 12px;
  scrollbar-width: none; }
.tabs a { white-space: nowrap; padding: .45rem .7rem; color: var(--muted); border-block-end: 3px solid transparent; }
.tabs a.on { color: var(--ink); border-color: var(--brand); font-weight: 600; }
main { max-width: 1200px; margin: 0 auto; padding: .6rem 16px 3rem; }
.muted { color: var(--muted); margin: .2rem 0 .8rem; font-size: .92rem; }
.crumbs { margin: .4rem 0 0; font-size: .9rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
  margin: 0 0 14px; min-width: 0; }
.card.late { border-color: var(--late); background: var(--late-bg); }
.card.narrow { max-width: 440px; margin: 2rem auto; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid > .card { margin: 0; }
.grid + .grid, .grid + section { margin-top: 14px; }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
@media (max-width: 700px) { .grid, .grid.two { grid-template-columns: 1fr; } }
table.stats { width: 100%; border-collapse: collapse; font-size: .95rem; }
.stats th, .stats td { padding: .35rem .4rem; border-block-end: 1px solid var(--line); text-align: start; }
.stats th { color: var(--muted); font-weight: 500; font-size: .85rem; }
.stats td + td, .stats th + th { text-align: center; width: 6.5rem; font-variant-numeric: tabular-nums; }
.count { display: inline-block; background: var(--ok-bg); color: var(--ink); border-radius: 999px;
  padding: 0 .55rem; font-size: .8rem; font-weight: 500; }
ul.rows { list-style: none; margin: 0; padding: 0; }
ul.rows li { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; padding: .55rem 0;
  border-block-end: 1px solid var(--line); }
ul.rows li:last-child { border-block-end: 0; }
ul.rows .main { font-weight: 600; overflow-wrap: anywhere; }
ul.rows .when { color: var(--muted); font-size: .88rem; white-space: nowrap; }
ul.rows .sub { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
ul.rows li.late .main { color: var(--late); }
li.empty, p.empty, td.empty { color: var(--muted); }
ul.rows li.empty { display: block; }
ul.plain { margin: 0; padding-inline-start: 1.1rem; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 6px; padding: 0 .45rem;
  background: var(--ok-bg); color: var(--ink); }
.tag.late { background: var(--late-bg); color: var(--late); }
.tag.due { background: var(--due-bg); color: var(--due); }
dl.props { display: grid; grid-template-columns: minmax(7rem, 40%) 1fr; gap: .35rem .8rem; margin: 0; }
dl.props dt { color: var(--muted); font-size: .9rem; }
dl.props dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { dl.props { grid-template-columns: 1fr; } dl.props dd { margin-block-end: .4rem; } }
.note ul { margin: 0; padding-inline-start: 1.1rem; }
.note p { margin: .2rem 0; }
.box { display: inline-block; width: .95rem; height: .95rem; border: 1.5px solid var(--muted); border-radius: 3px;
  vertical-align: -2px; font-size: .7rem; line-height: .9rem; text-align: center; }
.box.done { background: var(--brand); border-color: var(--brand); color: #fff; }
img.photo { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin: .3rem 0; }
form.stack { display: grid; gap: .5rem; }
.filters { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); align-items: end; }
.filters label { display: grid; gap: .2rem; font-size: .85rem; color: var(--muted); }
.filters .wide { grid-column: 1 / -1; }
.filters .actions { display: flex; gap: .8rem; align-items: center; }
input, select, button { font: inherit; }
input, select { width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); min-height: 2.6rem; }
button { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: .55rem 1.2rem;
  min-height: 2.6rem; cursor: pointer; font-weight: 600; }
@media (prefers-color-scheme: dark) { button { color: #0b1220; } }
button.link { background: none; color: var(--brand); padding: .2rem .4rem; min-height: 0; font-weight: 500; }
form.out { margin: 0; }
.msg { background: var(--due-bg); color: var(--due); padding: .5rem .7rem; border-radius: 8px; }
bdi { unicode-bidi: isolate; }
.scroll { overflow-x: auto; }
