/* Layout: a calm launcher. Date line, then a grid of section cards; ready sections are live links, the rest wait as "قريبًا". */
:root {
  --h-bg: #F3F5F4;
  --h-surface: #FFFFFF;
  --h-surface-2: #E6ECEA;
  --h-text: #15232A;
  --h-muted: #5B6B71;
  --h-border: #B4C3BF;
  --h-accent: #0F5C66;
  --h-accent-ink: #FFFFFF;
  --h-accent-soft: #DCEBEC;
  --h-wait: #C2410C;
  --h-wait-soft: #FCE7DB;
  --h-font-display: "Reem Kufi", "Segoe UI", Tahoma, sans-serif;
  --h-font-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --h-bg: #0E1719; --h-surface: #152226; --h-surface-2: #1D2E33; --h-text: #E6EEEE; --h-muted: #9AAEB2;
    --h-border: #3E555B; --h-accent: #6CC3CC; --h-accent-ink: #0E1719; --h-accent-soft: #17383D;
    --h-wait: #F5965C; --h-wait-soft: #3D261A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --h-bg: #0E1719; --h-surface: #152226; --h-surface-2: #1D2E33; --h-text: #E6EEEE; --h-muted: #9AAEB2;
  --h-border: #3E555B; --h-accent: #6CC3CC; --h-accent-ink: #0E1719; --h-accent-soft: #17383D;
  --h-wait: #F5965C; --h-wait-soft: #3D261A; color-scheme: dark;
}
#view-home { background: var(--h-bg); color: var(--h-text); font: 400 16px/1.6 var(--h-font-body); }
body.home-on { background: var(--h-bg); }
.h-wrap { max-width: 560px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 20px 24px; }
.h-head { display: flex; justify-content: center; margin-bottom: 16px; text-align: center; }
.h-date { color: var(--h-muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.h-title { font: 700 1.8rem/1.2 var(--h-font-display); margin: 0; color: var(--h-text); text-wrap: balance; }
.h-lead { margin: 4px 0 0; color: var(--h-muted); max-width: 52ch; }
.h-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.h-tile { position: relative; min-width: 0; max-width: 100%; background: var(--h-surface); border: 1.5px solid var(--h-border); border-radius: 16px; transition: border-color .15s; }
.h-tile.h-fav { grid-column: 1 / -1; border-color: var(--h-accent); }
.h-tile-in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 98px; height: 100%; padding: 10px 8px; color: inherit; text-decoration: none; text-align: center; border-radius: inherit; box-sizing: border-box; }
.h-tile.h-fav .h-tile-in { min-height: 0; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 14px; text-align: start; }
.h-tile-in:focus-visible { outline: 3px solid var(--h-accent); outline-offset: 3px; }
.h-tile:has(.h-tile-in:hover) { border-color: var(--h-accent); }
.h-txt { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.h-tile:not(.h-has):not(.h-fav) .h-tile-in { min-height: 0; flex-direction: row; justify-content: flex-start; gap: 8px; padding: 8px 10px; text-align: start; }
.h-tile:not(.h-has):not(.h-fav) .h-ico { width: 32px; height: 32px; border-radius: 10px; }
.h-tile:not(.h-has):not(.h-fav) .h-ico svg { width: 18px; height: 18px; }
.h-tile:not(.h-has):not(.h-fav) .h-txt { align-items: flex-start; }
.h-tile:not(.h-has):not(.h-fav) .h-pill { display: none; }
.h-tile.h-fav .h-txt { flex: 1; align-items: flex-start; display: grid; grid-template-columns: auto auto; justify-content: start; column-gap: 8px; row-gap: 2px; }
.h-tile.h-fav .h-txt h2 { grid-column: 1; }
.h-tile.h-fav .h-txt .h-pill { grid-column: 2; grid-row: 1; align-self: center; justify-self: start; }
.h-tile.h-fav .h-desc { grid-column: 1 / -1; }
.h-desc { display: none; margin: 0; color: var(--h-muted); font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.h-tile.h-fav .h-desc { display: block; }
.h-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--h-accent-soft); color: var(--h-accent); }
.h-tile.h-soon .h-ico { background: var(--h-surface-2); color: var(--h-muted); }
.h-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.h-tile .h-name { margin: 0; font: 600 1rem/1.3 var(--h-font-body); text-wrap: balance; }
.h-tile.h-fav h2 { font-size: 1.1rem; }
.h-pill { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; }
.h-pill.h-ready { background: var(--h-accent-soft); color: var(--h-accent); }
.h-pill.h-wait { background: var(--h-wait-soft); color: var(--h-wait); }
.h-star { position: absolute; top: 6px; inset-inline-end: 6px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--h-muted); cursor: pointer; }
.h-tile.h-fav .h-star { top: 50%; transform: translateY(-50%); }
.h-star:hover { background: var(--h-surface-2); }
.h-star:focus-visible { outline: 3px solid var(--h-accent); outline-offset: 1px; }
.h-star svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.h-star[aria-pressed="true"] { color: var(--h-wait); }
.h-star[aria-pressed="true"] svg { fill: currentColor; }
.h-tile.h-has { grid-column: 1 / -1; }
.h-tile.h-has .h-tile-in { flex-direction: row; justify-content: flex-start; align-items: flex-start; gap: 12px; padding: 8px 12px; text-align: start; min-height: 0; }
.h-tile.h-has .h-txt { align-items: flex-start; flex: 1; }
.h-tile.h-has .h-pill { display: none; }
.h-tile.h-has .h-desc, .h-tile.h-has.h-fav .h-desc { display: none; }
.h-tile.h-has .h-info { margin-top: 2px; }
.h-tile.h-alert { border-color: var(--h-wait); border-width: 2px; }
.h-info { list-style: none; margin: 4px 0 0; padding: 0 0 0 4px; display: grid; gap: 3px; font-size: 0.88rem; line-height: 1.45; color: var(--h-text); text-align: start; max-height: 4.6em; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; align-content: start; }
.h-tile.h-fav .h-info { max-height: calc(2.9em + 3px); grid-column: 1 / -1; }
.h-grid.h-capped .h-tile.h-has { box-sizing: border-box; height: var(--h-cap); }
.h-grid.h-capped .h-tile.h-has .h-tile-in { height: 100%; overflow: hidden; }
.h-grid.h-capped .h-tile.h-has .h-txt { align-self: stretch; min-height: 0; display: flex; flex-direction: column; align-items: flex-start; }
.h-grid.h-capped .h-tile.h-has .h-info { flex: 1 1 auto; min-height: 0; max-height: none; }
.h-info li { position: relative; padding-inline-start: 14px; }
.h-info li::before { content: ""; position: absolute; inset-inline-start: 0; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--h-accent); }
.h-info li.w { color: var(--h-wait); font-weight: 600; }
.h-info li.w::before { background: var(--h-wait); }
.h-tile.h-has .h-star { top: 8px; transform: none; }
.h-badge { display: inline-block; margin-inline-start: 8px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #C2410C; color: #fff; font: 700 0.78rem/22px var(--h-font-body); text-align: center; vertical-align: middle; font-variant-numeric: tabular-nums; }
.h-sum { margin: 0 0 14px; padding: 12px 14px; background: var(--h-surface); border: 1.5px solid var(--h-accent); border-radius: 16px; }
.h-sum.h-sum-w { border-color: var(--h-wait); border-width: 2px; }
.h-sum-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 0 0 6px; }
.h-sum-h { margin: 0; justify-self: start; font: 600 1.1rem/1.3 var(--h-font-body); white-space: nowrap; }
.h-sum-date { justify-self: center; color: var(--h-muted); font-size: 0.86rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.h-sum-top > .h-badge { justify-self: end; margin-inline-start: 0; }
.h-sum-list { list-style: none; margin: 0; padding: 0; display: grid; }
.h-sum-list li + li { border-top: 1px solid var(--h-border); }
.h-sum-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px; align-items: baseline; width: 100%; min-height: 40px; padding: 8px 2px; border: 0; background: transparent; color: var(--h-text); font: 400 0.9rem/1.45 var(--h-font-body); text-align: start; cursor: pointer; border-radius: 8px; }
.h-sum-row:focus-visible { outline: 3px solid var(--h-accent); outline-offset: 1px; }
.h-sum-row b { font-weight: 600; color: var(--h-muted); font-size: 0.84rem; }
.h-sum-row.w span { color: var(--h-wait); font-weight: 600; }
.h-sum-row small { color: var(--h-muted); font-weight: 400; font-size: 0.8rem; white-space: nowrap; }
.h-grid > .h-tile .h-name { display: flex; align-items: center; gap: 6px; }
.h-grid > .h-tile .h-tile-in > .h-badge { flex: none; margin-inline-start: auto; }
.h-sum-empty { margin: 0; color: var(--h-muted); font-size: 0.9rem; }
.h-backup { margin-top: 18px; padding: 14px; border: 1px solid var(--h-border); border-radius: 16px; background: var(--h-surface); display: grid; gap: 8px; }
.h-bk-h { margin: 0; font: 600 1.05rem var(--h-font-body); }
.h-bk-sum { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; cursor: pointer; list-style: none; border-radius: 10px; }
.h-bk-sum::-webkit-details-marker { display: none; }
.h-bk-sum:focus-visible { outline: 3px solid var(--h-accent); outline-offset: 3px; }
.h-bk-chev { width: 10px; height: 10px; border-inline-end: 2px solid var(--h-muted); border-bottom: 2px solid var(--h-muted); transform: rotate(45deg); transition: transform .15s; margin-inline-end: 4px; }
.h-backup[open] .h-bk-chev { transform: rotate(-135deg); }
.h-bk-body { display: grid; gap: 8px; margin-top: 8px; }
.h-backup:not([open]) { gap: 0; }
.h-bk-p { margin: 0; color: var(--h-muted); font-size: 0.88rem; }
.h-bk-row { display: flex; gap: 8px; flex-wrap: wrap; }
.h-bk-btn { flex: 1 1 140px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--h-border); border-radius: 12px; background: var(--h-surface); color: var(--h-text); font: 600 0.95rem var(--h-font-body); cursor: pointer; }
.h-bk-go { background: var(--h-accent); color: var(--h-accent-ink); border-color: var(--h-accent); }
.h-bk-confirm { border: 1.5px solid var(--h-wait); border-radius: 12px; padding: 10px; }
.h-bk-confirm p { margin: 0 0 8px; }
.h-bk-list { display: grid; gap: 6px; }
.h-bk-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--h-border); border-radius: 12px; }
.h-bk-item b { font-weight: 600; font-variant-numeric: tabular-nums; }
.h-bk-item span { display: block; color: var(--h-muted); font-size: 0.8rem; }
.h-bk-acts { display: flex; gap: 6px; }
.h-bk-acts button { min-height: 36px; padding: 4px 10px; border: 1.5px solid var(--h-border); border-radius: 10px; background: var(--h-surface); color: var(--h-text); font: 600 0.82rem var(--h-font-body); cursor: pointer; }
.h-bk-acts button.del { color: #C2410C; }
.h-bk-acts button.ico { width: 36px; padding: 0; display: grid; place-items: center; }
.h-bk-acts button.ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.h-bk-acts button.del.ico { font-size: 1.4rem; line-height: 1; }
.h-bk-msg { margin: 0; color: var(--h-muted); font-size: 0.88rem; }
@media (min-width: 640px) { .h-grid { gap: 14px; } }
@media (prefers-reduced-motion: reduce) { .h-tile { transition: none; } }
.h-name { margin: 0; }
button.h-tile-in { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.h-title { margin: 0; }
.backbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 6; display: flex; align-items: center; gap: 10px; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--bg); border-bottom: 1px solid var(--border); }
.backbtn { min-height: 40px; padding: 6px 14px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: 700 0.95rem var(--font-body); cursor: pointer; }
#view-clothes .tabs { top: calc(env(safe-area-inset-top, 0px) + 57px); }
