/*
 * يومي (My Day) and the bell, in the House's dress: cream cards on the cream page, black ink, the sand-gold where
 * the eye should rest, Amiri for what is read as a title. Two columns on a wide screen, one on a phone.
 */
.md { max-width: none; margin: 0; }
.md-hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.md-hello .page-title { margin: 0; font-family: var(--ui-serif); }
.md-hello .page-sub { margin: 10px 0 0; }
.md-other { margin-bottom: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.md-other a { margin-inline-start: auto; }

/* The four counts: each a door to its list. */
.md-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.md-count { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 12px 16px 14px; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: var(--ui-card); cursor: pointer; font: inherit; color: var(--ui-ink); text-align: start; transition: border-color .15s, box-shadow .15s; }
.md-count:hover { border-color: var(--ui-gold-2); box-shadow: 0 0 0 3px rgba(189, 183, 151, .22); }
.md-count b { font-family: var(--ui-serif); font-size: 30px; line-height: 1.7; font-weight: 700; }
.md-count span { font-size: 13px; color: var(--ui-ink-2); }
.md-count.zero b { color: var(--ui-muted); }
.md-count.bad { border-color: rgba(180, 50, 40, .35); }
.md-count.bad b { color: #a3302a; }
.md-count.gold { border-color: var(--ui-gold); }
.md-count.gold b { color: var(--ui-gold-2); }

.md-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.md-main, .md-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* A section of work. */
.md-sec { background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 14px 16px 10px; scroll-margin-top: calc(var(--top-h) + 12px); transition: box-shadow .3s; }
.md-sec.flash, .md-card.flash { box-shadow: 0 0 0 3px var(--ui-gold); }
.md-sec-h, .md-card-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.md-sec-h h2, .md-card-h h2 { margin: 0; font-family: var(--ui-serif); font-size: 20px; font-weight: 700; }
.md-sec-hint { font-size: 12.5px; color: var(--ui-muted); flex-basis: 100%; }
.md-n { font-size: 12px; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--ui-cream); color: var(--ui-ink-2); text-align: center; }
.md-n.gold { background: var(--ui-ink); color: #f4eee0; }
.md-late { border-color: rgba(180, 50, 40, .35); box-shadow: inset 3px 0 0 #a3302a; }
[dir=rtl] .md-late { box-shadow: inset -3px 0 0 #a3302a; }
.md-late .md-sec-h h2 { color: #a3302a; }
.md-quiet { display: flex; gap: 10px; align-items: baseline; padding: 10px 16px; background: transparent; border-style: dashed; color: var(--ui-muted); font-size: 13.5px; }
.md-quiet b { font-weight: 600; color: var(--ui-ink-2); }
.md-hint-line { margin: 4px 0 6px; font-size: 13px; color: var(--ui-muted); }
.md-main > .md-hint-line { padding-inline: 4px; }

.md-list { list-style: none; margin: 0; padding: 0; }
.md-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--ui-line); cursor: pointer; min-width: 0; }
.md-list > .md-row:first-child { border-top: 0; }
.md-row:hover .md-r-name { text-decoration: underline; text-decoration-color: var(--ui-gold); text-underline-offset: 3px; }
.md-row.ticked { opacity: .45; }
.md-row.dragging { opacity: .5; background: var(--ui-cream); }
.md-row[draggable=true] { cursor: grab; }
.md-tick { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--ui-line-2); background: #fffefa; cursor: pointer; padding: 0; position: relative; }
.md-tick:hover:not(:disabled) { border-color: var(--ui-ink); }
.md-tick:hover:not(:disabled)::after, .md-row.ticked .md-tick::after { content: '✓'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--ui-ink); }
.md-tick:disabled { opacity: .4; cursor: default; }
.md-r-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.md-r-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.md-r-name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.md-r-sub { font-size: 12.5px; color: var(--ui-muted); display: flex; gap: 6px; flex-wrap: wrap; }
.md-r-sub i { font-style: normal; }
.md-code { flex: none; font: 600 10.5px/1.6 ui-monospace, Menlo, monospace; letter-spacing: .02em; color: var(--ui-ink-2); background: var(--ui-cream); border-radius: 4px; padding: 0 5px; }
.md-r-end { flex: none; display: flex; align-items: center; gap: 8px; }
.md-due { font-size: 12.5px; color: var(--ui-ink-2); white-space: nowrap; }
.md-due.bad { color: #a3302a; font-weight: 600; }
.md-flag { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.md-flag.urgent { background: rgba(163, 48, 42, .1); color: #a3302a; }
.md-flag.high { background: rgba(189, 183, 151, .25); color: #6b6440; }
.md-flag.low { color: var(--ui-muted); }
.md-mini { border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; padding: 4px 5px; border-radius: 6px; color: var(--ui-muted); }
.md-mini:hover { background: var(--ui-cream); color: var(--ui-ink); }
#md-pins > .md-row:first-child [data-up] { visibility: hidden; }
.md-star.on { color: var(--ui-gold-2); }
.md-more { margin: 6px 0 2px; border: 0; background: transparent; color: var(--ui-ink-2); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 0; text-decoration: underline; text-decoration-color: var(--ui-gold); text-underline-offset: 3px; }
.md-next { border-color: var(--ui-gold); }

/* The right column: cards with their own margin, so no line touches an edge. */
.md-card { padding: 14px 16px 12px; margin: 0; scroll-margin-top: calc(var(--top-h) + 12px); transition: box-shadow .3s; }
.md-card h3 { margin: 12px 0 4px; font-size: 13px; font-weight: 600; color: var(--ui-ink-2); }
.md-card-f { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ui-line); font-size: 13px; color: var(--ui-ink); text-decoration: underline; text-decoration-color: var(--ui-gold); text-underline-offset: 3px; }
.md-notes { list-style: none; margin: 0; padding: 0; }
.md-note { padding: 8px 0; border-top: 1px solid var(--ui-line); display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; line-height: 1.55; }
.md-notes > .md-note:first-child { border-top: 0; }
.md-note.new .md-note-t::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ui-gold-2); margin-inline-end: 6px; vertical-align: 2px; }
.md-note-t { overflow-wrap: anywhere; }
.md-note-t .md-code { margin-inline-end: 6px; }
.md-note-t i { font-style: normal; }
.md-note-f { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.md-note-f .btn.small { padding: 3px 9px; font-size: 12px; }
.md-when { font-size: 12px; color: var(--ui-muted); margin-inline-end: auto; }

/* My week: Sunday to Saturday, the weekend shaded. */
.md-week { list-style: none; margin: 0; padding: 0; }
.md-week li { display: flex; gap: 12px; align-items: flex-start; padding: 7px 8px; border-radius: 8px; }
.md-week li + li { margin-top: 2px; }
.md-week li.off { background: rgba(189, 183, 151, .16); }
.md-week li.now { box-shadow: inset 0 0 0 1.5px var(--ui-ink); }
.md-week li.past .md-wd { opacity: .55; }
.md-wd { flex: none; width: 58px; display: flex; flex-direction: column; line-height: 1.25; }
.md-wd b { font-size: 13px; }
.md-wd small { font-size: 11.5px; color: var(--ui-muted); }
.md-wl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.md-wl a { color: var(--ui-ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-wl a:hover { text-decoration: underline; }
.md-wl a.bad { color: #a3302a; }
.md-wl small { color: var(--ui-muted); font-size: 12px; }

.md-clock { border-color: var(--ui-ink); }
.md-clock-b { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.md-clock-b a { flex: 1 1 100%; color: var(--ui-ink); font-weight: 600; overflow-wrap: anywhere; }
.md-elapsed { font: 600 22px/1 ui-monospace, Menlo, monospace; letter-spacing: .03em; margin-inline-end: auto; }

.md-plain { list-style: none; margin: 0; padding: 0; }
.md-plain li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13.5px; border-top: 1px solid var(--ui-line); }
.md-plain li:first-child { border-top: 0; }
.md-plain li a { color: var(--ui-ink); }
.md-plain .md-when { margin: 0; white-space: nowrap; }
.md-late-n { color: #a3302a; font-size: 12.5px; white-space: nowrap; }

/* ---------------------------------------------------------------- the bell in the header */
.md-bell { flex: none; position: relative; width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(189, 183, 151, .32); background: transparent; color: #d9d3c3; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.md-bell:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.md-bell.on { color: var(--ui-gold); border-color: var(--ui-gold); }
.md-bell svg { width: 18px; height: 18px; display: block; }
.md-bell-n { position: absolute; top: -5px; inset-inline-end: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--ui-gold); color: #141210; font: 700 11px/18px var(--ui-font, sans-serif); text-align: center; }
.md-bell[hidden], .md-bell-n[hidden], .md-bell-panel[hidden] { display: none; }
.top .bar { position: relative; }
.md-bell-panel { position: absolute; top: calc(100% + 6px); inset-inline-end: 16px; z-index: 90; width: min(380px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow: auto; background: var(--ui-card); color: var(--ui-ink); border: 1px solid var(--ui-line-2); border-radius: var(--ui-radius); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .35); padding: 12px 16px; }
.md-bp-h { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--ui-line); }
.md-bp-h b { font-family: var(--ui-serif); font-size: 18px; }

/* ---------------------------------------------------------------- narrower screens and a phone */
@media (max-width: 1080px) {
  .md-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .md-hello { margin-bottom: 12px; }
  .md-counts { display: flex; gap: 8px; margin-bottom: 16px; }
  .md-count { flex: 1 1 0; min-width: 0; padding: 8px 6px 10px; border-radius: 14px; align-items: center; justify-content: center; gap: 2px; text-align: center; }
  .md-count b { font-size: 20px; line-height: 1.7; }
  .md-count span { font-size: 11.5px; line-height: 1.3; }
  .md-sec, .md-card { padding: 12px 12px 8px; }
  .md-quiet { padding: 9px 12px; }
  .md-row { gap: 10px; align-items: flex-start; flex-wrap: wrap; }
  .md-tick { margin-top: 2px; }
  .md-r-main { flex-basis: calc(100% - 32px); }
  .md-r-name { white-space: normal; }
  .md-r-end { flex-basis: 100%; padding-inline-start: 30px; flex-wrap: wrap; }
  .md-flag-t { display: none; }
  .md-due { margin-inline-end: auto; }
  .md-bell { width: 34px; height: 34px; }
  .md-bell-panel { inset-inline: 16px; width: auto; }
}
/* A quiet section on a phone: its name on one line and what it says beside or under it, not two squeezed columns. */
@media (max-width: 760px) {
  .md-quiet { flex-wrap: wrap; row-gap: 2px; }
  .md-quiet b { flex: none; }
  .md-quiet span { flex: 1 1 160px; min-width: 0; }
}

/* The review of 2026-10-24, second pass: an English name or room inside an Arabic notice stays whole, taking a line of
   its own where it does not fit, rather than tearing with its brackets and «» at the wrong ends. */
html[dir=rtl] .md-note-t bdi:not(.md-code) { display: inline-block; max-width: 100%; }
