/* ============ المتابعة والإنتاجية ============ */
.trk { padding-top: 18px; }
.trk-head { display: flex; align-items: center; gap: 10px; }
.trk-head h1 { margin: 0; font-family: var(--classic); font-size: 32px; color: var(--strong); }
.trk-sync { width: 9px; height: 9px; border-radius: 50%; background: var(--green); transition: background 0.3s; }
.trk-sync[data-s="wait"] { background: var(--gold); animation: dot 1s infinite; }
.trk-sync[data-s="err"] { background: var(--red); }

.trk-tabs { display: flex; gap: 6px; margin: 14px 0 16px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--soft-6); border-radius: 16px; }
.trk-tabs::-webkit-scrollbar { display: none; }
.trk-tabs a { flex: 1 0 auto; text-align: center; padding: 9px 14px; border-radius: 12px; text-decoration: none; font-weight: 700; font-size: 14px; color: var(--muted); white-space: nowrap; transition: background 0.25s var(--e-out), color 0.25s, transform var(--t-press); }
.trk-tabs a.on { background: var(--strong); color: var(--gold-2); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
[data-theme="night"] .trk-tabs a.on { background: var(--gold); color: var(--ink); }
.trk-tabs a:active { transform: scale(0.95); }

.trk-panel { display: grid; gap: 14px; }
.trk-panel.swap { animation: panelIn 0.42s var(--e-out); }
@keyframes panelIn { from { opacity: 0; transform: translateX(calc(var(--dir, 0) * -28px)); } }
.trk-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.trk-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.trk-title h3 { margin: 0; font-size: 17px; color: var(--strong); }
.trk-empty { text-align: center; padding: 8px 0; color: var(--muted); }
.trk-empty p { margin: 0 0 10px; }
.trk-empty.sm { padding: 0; }

/* البطل */
.trk-hero { background: linear-gradient(160deg, var(--ink-2), var(--ink)); color: #fff; border: 0; position: relative; overflow: hidden; }
.trk-hero::before { content: ""; position: absolute; inset: 0; background: var(--pattern); opacity: 0.07; pointer-events: none; }
.trk-hero > * { position: relative; }
.trk-hero .muted { color: rgba(255, 255, 255, 0.6); }
.trk-hero h2 { margin: 4px 0 0; font-size: 22px; }
.trk-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: rgba(255, 255, 255, 0.1); }
.ring-fg { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 0.7s var(--e-out); }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; direction: ltr; font-size: 18px; color: var(--gold-2); }
.trk-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 12px; }
.st-chip { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 14px; padding: 10px; text-align: center; }
.st-chip b { display: block; font-size: 22px; color: var(--gold-2); line-height: 1.2; }
.st-chip small { font-size: 11.5px; color: rgba(255, 255, 255, 0.65); }
.streak-chip .flame { display: block; height: 18px; color: rgba(255, 255, 255, 0.3); }
.streak-chip.lit .flame, .sb-flame.lit, .th-flame.lit { color: #f2a33a; }
.streak-chip.lit .flame svg, .sb-flame.lit svg, .th-flame.lit svg { animation: flicker 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.08, 0.96) rotate(-3deg); } 60% { transform: scale(0.96, 1.06) rotate(2deg); } }
.tq-start { border-top: 1px dashed rgba(240, 207, 133, 0.25); padding-top: 12px; margin: 0; }
.trk-hero .tq blockquote, .trk-hero .tq-verse { color: #f3e3b8; }
.trk-hero .tq figcaption { color: rgba(255, 255, 255, 0.55); }

/* الاقتباس */
.tq { margin: 0; }
.tq blockquote { margin: 0; font-family: var(--classic); font-size: 18px; line-height: 1.9; color: var(--strong); }
.tq-verse { display: grid; gap: 2px; font-family: var(--classic); font-size: 19px; color: var(--strong); text-align: center; }
.tq-verse span:last-child { padding-inline-start: 2.5em; }
.tq figcaption { margin-top: 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
.tq figcaption small { font-weight: 500; }

/* خانة الإنجاز: دائرة تمتلئ وعلامة ترسم نفسها */
.hrow, .top-row, .task { display: flex; align-items: center; gap: 12px; padding: 10px; margin: 0 -10px; border-radius: 14px; transition: background 0.3s; }
.hrow + .hrow { border-top: 1px solid var(--line); }
.hname { flex: 1; min-width: 0; display: grid; }
.hname small { color: var(--muted); font-size: 12.5px; }
.hchk { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 2px solid var(--line); background: var(--field); color: transparent; display: grid; place-items: center; padding: 0; transition: background 0.25s var(--e-out), border-color 0.25s, color 0.2s, transform var(--t-press); }
.hchk.sm { width: 28px; height: 28px; }
.hchk.sm svg { width: 15px; height: 15px; }
.hchk svg path { stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 0.32s var(--e-out) 0.05s; }
.hchk:active { transform: scale(0.88); }
.hchk[disabled] { opacity: 0.4; }
.done > .hchk, .hchk[aria-pressed="true"], .auto.done .hchk { background: var(--green); border-color: var(--green); color: #fff; }
.done > .hchk svg path, .hchk[aria-pressed="true"] svg path, .auto.done .hchk svg path { stroke-dashoffset: 0; }
.half > .hchk { background: linear-gradient(90deg, var(--field) 50%, var(--green) 50%); border-color: var(--green); color: #fff; }
.done .hname b, .task.done span { color: var(--muted); }
.task.done span { text-decoration: line-through; text-decoration-color: var(--gold); }
.just { animation: justDone 0.6s var(--e-out); }
.just > .hchk, .just .hchk { animation: chkPop 0.45s var(--e-spring); }
@keyframes justDone { 0% { background: var(--green-soft); } 100% { background: transparent; } }
@keyframes chkPop { 0% { transform: scale(0.6); } 100% { transform: scale(1); } }
.undo > .hchk { animation: undo 0.3s var(--e-soft); }
@keyframes undo { 40% { transform: scale(0.85) rotate(-8deg); } }
.auto-chk { pointer-events: none; }
.hrow.auto { background: var(--gold-soft); margin-bottom: 4px; }
.mini-btn { flex: none; }
.top-in { flex: 1; }
.top-row.done .top-in { text-decoration: line-through; text-decoration-color: var(--gold); color: var(--muted); }
.side-tasks { margin-top: 10px; }
.side-tasks summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 700; padding: 4px 0; }
.task { padding: 6px 10px; }
.task span { flex: 1; }
.task .x { border: 0; background: none; color: var(--muted); font-size: 20px; padding: 0 6px; }
.task-add { display: flex; gap: 8px; margin-top: 6px; }
.task-add .input { flex: 1; }
.weekly-today { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wk-chip { border: 1.5px solid var(--line); background: var(--field); border-radius: 14px; padding: 8px 12px; display: grid; text-align: start; transition: transform var(--t-press), background 0.25s; }
.wk-chip small { color: var(--muted); font-size: 12px; }
.wk-chip.on { background: var(--green-soft); border-color: var(--green); }
.wk-chip:active { transform: scale(0.95); }

/* التقييم */
.stars { display: flex; gap: 4px; margin-bottom: 12px; direction: rtl; }
.stars button { border: 0; background: none; font-size: 32px; line-height: 1; padding: 2px; color: var(--soft-8); color: color-mix(in srgb, var(--muted) 35%, transparent); transition: transform var(--t-press), color 0.2s; }
.stars button.on { color: var(--gold); }
.stars button:active { transform: scale(0.85); }
.stars button.pop { animation: chkPop 0.42s var(--e-spring) both; }
.rest-tg { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; cursor: pointer; }

/* الأيام والسجل */
.week7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.w7 i { display: block; aspect-ratio: 1; border-radius: 10px; margin-bottom: 4px; }
.w7 small { font-size: 11px; color: var(--muted); }
.k-on { background: var(--green) !important; }
.k-grace { background: repeating-linear-gradient(45deg, var(--gold), var(--gold) 4px, var(--gold-2) 4px, var(--gold-2) 8px) !important; }
.k-rest { background: var(--soft-8) !important; outline: 1.5px dashed var(--muted); outline-offset: -3px; }
.k-miss { background: var(--red-soft) !important; }
.k-now { background: var(--soft-6) !important; outline: 2px solid var(--gold); outline-offset: -2px; }
.k-future, .k-none { background: var(--soft-4) !important; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.hm-wrap { display: flex; gap: 6px; }
.hm-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.hm-days small { font-size: 10px; color: var(--muted); line-height: 1; display: flex; align-items: center; }
.hm-grid { flex: 1; display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 4px; }
.hm-grid i { aspect-ratio: 1; border-radius: 4px; }
.cells-in i { animation: cellIn 0.38s var(--e-spring) both; animation-delay: calc(var(--i) * 18ms); }
.ch-grid.cells-in i { animation-delay: calc(var(--i) * 6ms); }
@keyframes cellIn { from { opacity: 0; transform: scale(0.3); } }

/* العادات */
.hcard { padding: 12px 0; }
.hcard + .hcard { border-top: 1px solid var(--line); }
.hc-name { font-size: 16px; }
.h14 { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; margin-top: 8px; }
.h14 i { height: 18px; border-radius: 4px; background: var(--soft-6); }
.h14 i.on { background: var(--green); }
.h14 i.half { background: linear-gradient(0deg, var(--green) 50%, var(--soft-6) 50%); }
.h14 i.off { background: transparent; border: 1px dashed var(--line); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tpl { border: 1.5px solid var(--line); background: var(--field); border-radius: 14px; padding: 10px; display: grid; justify-items: start; gap: 2px; text-align: start; font-weight: 700; font-size: 14px; transition: transform var(--t-press), border-color 0.2s; }
.tpl span { font-size: 20px; }
.tpl small { color: var(--muted); font-weight: 500; }
.tpl:hover { border-color: var(--gold); }
.tpl:active { transform: scale(0.95); }
.arch { padding: 8px 0; }
.wd-pick, .hab-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wd-pick label, .hab-pick label { cursor: pointer; }
.wd-pick input, .hab-pick input { position: absolute; opacity: 0; pointer-events: none; }
.wd-pick span, .hab-pick span { display: inline-block; padding: 6px 11px; border-radius: 10px; border: 1.5px solid var(--line); font-size: 13px; font-weight: 700; transition: 0.2s; }
.wd-pick input:checked + span, .hab-pick input:checked + span { background: var(--strong); border-color: var(--strong); color: var(--gold-2); }
[data-theme="night"] .wd-pick input:checked + span, [data-theme="night"] .hab-pick input:checked + span { background: var(--gold); color: var(--ink); }
.wd-pick input:focus-visible + span, .hab-pick input:focus-visible + span { outline: 3px solid var(--gold); }

/* الأهداف */
.goals-intro { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.goal { padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--warm); display: grid; gap: 6px; }
.goal + .goal { margin-top: 10px; }
.goal.done { opacity: 0.75; }
.g-title { font-size: 16px; }
.g-why { font-size: 13.5px; color: var(--muted); border-inline-start: 3px solid var(--gold); padding-inline-start: 8px; }
.late { color: var(--red); font-weight: 700; }
.g-habits { display: flex; flex-wrap: wrap; gap: 6px; }
.g-habits span { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--soft-6); }
.g-habits span.on { background: var(--green-soft); color: var(--green); font-weight: 700; }

/* السلسلة */
.streak-big { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; }
.sb-flame { width: 64px; height: 64px; border-radius: 20px; background: var(--soft-6); display: grid; place-items: center; color: var(--muted); }
.sb-flame svg { width: 34px; height: 34px; }
.sb-n { font-size: 46px; line-height: 1; color: var(--strong); font-family: var(--classic); }
.sb-l { color: var(--muted); font-size: 14px; }
.sb-meta, .streak-big .bar, .streak-big .rules { grid-column: 1 / -1; }
.sb-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.sb-meta b { color: var(--strong); }
.rules summary { cursor: pointer; font-weight: 700; color: var(--strong-2); font-size: 14px; padding: 6px 0; }
.rules p { font-size: 14px; margin: 6px 0; }
.trk-risk { border-color: var(--gold); background: var(--gold-soft); }
.trk-stumble { border-color: color-mix(in srgb, var(--red) 40%, transparent); }

/* تحدي التسعين */
.ch-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin-bottom: 12px; }
.ch-top > div { background: var(--soft-4); border-radius: 14px; padding: 10px 4px; }
.big-n { font-size: 26px; color: var(--strong); font-family: var(--classic); }
.ch-top small { display: block; font-size: 12px; color: var(--muted); }
.phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.phase { padding: 8px 10px; border-radius: 12px; border: 1.5px solid var(--line); font-size: 13px; }
.phase.cur { border-color: var(--gold); background: var(--gold-soft); }
.phase.past { opacity: 0.8; }
.phase .bar { margin: 6px 0 2px; }
.phase small { color: var(--muted); }
.ph-hint { font-size: 14px; color: var(--muted); margin: 10px 0; }
.ch-grid { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; margin-bottom: 10px; }
.ch-grid i { aspect-ratio: 1; border-radius: 5px; }
.ch-grid i.ph-end { box-shadow: -3px 0 0 -1px var(--gold); }
.ch-grid i.today { outline: 2px solid var(--gold); outline-offset: 1px; animation: todayPulse 1.8s ease-in-out infinite; }
@keyframes todayPulse { 50% { outline-color: transparent; } }
.ch-empty { text-align: center; }
.ch-empty h3 { margin: 8px 0 4px; font-size: 20px; }
.ch-art { display: flex; justify-content: center; gap: 8px; }
.ch-art span { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-weight: 700; font-size: 20px; color: var(--ink); background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 4px 0 #a97f2c; animation: stIn 0.5s var(--e-spring) both; animation-delay: calc(var(--i) * 90ms); }
.ch-art span:nth-child(2) { transform: translateY(-8px); }

/* الرسائل */
.q-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.q-chips button { border: 1.5px solid var(--line); background: var(--field); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; color: var(--muted); transition: 0.2s; }
.q-chips button.on { background: var(--strong); color: var(--gold-2); border-color: var(--strong); }
[data-theme="night"] .q-chips button.on { background: var(--gold); color: var(--ink); }
.q-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.q-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.q-tags span { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--gold-soft); }
.q-tags span.t { background: var(--soft-6); }
.fav { border: 0; background: none; font-size: 24px; color: color-mix(in srgb, var(--muted) 40%, transparent); padding: 2px 6px; transition: transform var(--t-press), color 0.2s; }
.fav.on { color: var(--gold); animation: chkPop 0.4s var(--e-spring); }

/* الرسالة المنبثقة */
.tq-pop { position: fixed; z-index: 80; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); width: min(460px, calc(100vw - 28px)); background: var(--card); border: 1px solid var(--gold); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 12px 16px 14px; animation: popUp 0.7s var(--e-land) both; }
.tq-pop.out { animation: popDown var(--t-exit) var(--e-exit) forwards; }
.tq-pop-h { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--strong-2); font-size: 13px; margin-bottom: 4px; }
.tq-pop-h button { border: 0; background: none; font-size: 20px; color: var(--muted); line-height: 1; }
.tq-pop .tq blockquote { font-size: 16.5px; }
.tq-pop .tq-verse { font-size: 17px; }
@keyframes popUp { from { opacity: 0; transform: translate(-50%, 24px) scale(0.95); } }
@keyframes popDown { to { opacity: 0; transform: translate(-50%, 16px); } }

/* معلم السلسلة */
.ms { text-align: center; display: grid; gap: 10px; }
.ms-n { width: 96px; height: 96px; margin: 0 auto; border-radius: 30px; display: grid; place-items: center; font-size: 42px; font-weight: 700; color: var(--ink); background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 6px 0 #a97f2c; animation: chkPop 0.6s var(--e-spring); }
.ms h2 { margin: 0; }

/* بطاقة الرئيسية */
.trk-home { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; margin-top: 16px; padding: 14px 18px; }
.th-flame { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 14px; background: var(--soft-6); color: var(--muted); }
.th-flame b { font-size: 20px; color: var(--strong); }
.th-txt { flex: 1; min-width: 0; display: grid; }
.th-txt small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-go { color: var(--muted); }

@media (max-width: 560px) {
  .trk-card { padding: 15px; }
  .ring { width: 72px; height: 72px; }
  .goals-intro { flex-direction: column; align-items: stretch; }
  .phases { grid-template-columns: 1fr; }
  .ch-grid { grid-template-columns: repeat(10, 1fr); }
  .st-chip b { font-size: 19px; }
}
@media (min-width: 900px) {
  .ch-grid { grid-template-columns: repeat(30, 1fr); gap: 5px; }
  .ch-grid i.ph-end { box-shadow: none; }
}

/* التذكيرات */
.rem-off, .rem-on { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--gold-soft); font-size: 14px; font-weight: 700; }
.rem-on { background: var(--green-soft); color: var(--green); }
.rem-sec { display: grid; margin: 16px 0 8px; }
.rem-sec small { font-size: 12.5px; }
.rem-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.rem-row.off { opacity: 0.55; }
.rem-row input[type="time"] { width: 140px; direction: ltr; padding-inline: 8px; font-size: 14.5px; }
.rem-row select { min-width: 0; padding-inline: 10px; font-size: 14.5px; }
.rem-row .x { border: 0; background: none; color: var(--muted); font-size: 22px; padding: 0 4px; }
.rem-text { grid-column: 1 / -1; }
.rem-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rem-habits { display: flex; flex-wrap: wrap; gap: 6px; }
.rem-h { border: 1.5px solid var(--line); background: var(--field); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; }
.rem-h b { color: var(--strong-2); margin-inline-start: 4px; }
.rem-row.just { animation: justDone 0.6s var(--e-out); }

/* قائمة المهام الشائعة */
.pick-list { display: grid; gap: 14px; }
.pick-grp h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.pick { cursor: pointer; position: relative; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--field); font-size: 14px; font-weight: 700; transition: transform var(--t-press, .12s), border-color .2s, background .2s; }
.pick span i { font-style: normal; font-size: 17px; }
.pick span small { color: var(--muted); font-weight: 500; font-size: 11px; }
.pick:active span { transform: scale(0.95); }
.pick input:checked + span { border-color: var(--strong-2); background: color-mix(in srgb, var(--strong-2) 12%, var(--field)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--strong-2) 25%, transparent); }
.pick input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.pick.added { cursor: default; }
.pick.added span { opacity: .6; border-style: dashed; }
.pk-ok { color: var(--strong-2); font-size: 13px; }
.pick-bar { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; justify-content: space-between; padding-top: 12px; margin-top: 6px; background: linear-gradient(transparent, var(--card, var(--bg)) 30%); }
.pick-bar .btn-primary:disabled { opacity: .5; }
#pick-card .pick-bar { bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 2; }
