/* ============================================================================
   IRNSCA Nutrition Application — personal dashboard ("My Dashboard")
   Same identity as the app: dark neon glass, ADLaM Display / El Messiri,
   RTL-aware (logical properties only), ≥ 44 px touch targets, bento layout,
   compositor-only motion, prefers-reduced-motion respected.
   ============================================================================ */

.pd-root {
  --pd-kcal: #00c2ff;
  --pd-pro: #a855f7;
  --pd-carb: #ff3fb4;
  --pd-fat: #ff7a1a;
  --pd-ok: #22c55e;
  --pd-warn: #f59e0b;
  --pd-bad: #ff4d6d;
  --pd-extra: #8b5cf6;
  --pd-card: var(--glass-bg);
  --pd-line: var(--glass-border);
  --pd-soft: rgba(255, 255, 255, 0.05);
  --pd-gap: 16px;
  min-height: 60vh;
}
[data-theme="light"] .pd-root { --pd-soft: rgba(15, 23, 42, 0.045); --pd-kcal: #0284c7; --pd-pro: #7c3aed; --pd-carb: #db2777; --pd-fat: #ea580c; }

/* Grid / flex items default to min-width:auto → the wide tab bar and charts would
   stretch the 1fr content column past the viewport. Let the column shrink instead. */
#nutrition-app-root .dashboard-container > .content-area,
#nutrition-app-root .content-area > .app-section { min-width: 0; }
.pd { display: flex; flex-direction: column; gap: var(--pd-gap); min-width: 0; }
.pd-root h2, .pd-root h3, .pd-root h4 { margin: 0; }
.pd-muted { color: var(--text-muted); }
.pd-sub { color: var(--text-secondary); font-size: 0.85rem; }
.pd-num { font-variant-numeric: tabular-nums; }

/* ── entrance animation (stagger) ─────────────────────────────────────── */
.pd-reveal { animation: pd-in 0.45s var(--nutri-ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes pd-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ── gate (signed-out) ────────────────────────────────────────────────── */
.pd-gate { display: grid; gap: var(--pd-gap); }
.pd-gate__hero {
  position: relative; overflow: hidden; padding: 34px 26px; border-radius: var(--radius-lg);
  border: 1px solid rgba(66, 133, 244, 0.35);
  background:
    radial-gradient(80% 90% at 0% 0%, rgba(157, 0, 255, 0.25), transparent 60%),
    radial-gradient(70% 90% at 100% 100%, rgba(0, 243, 255, 0.18), transparent 60%),
    var(--glass-bg);
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
}
.pd-gate__hero h2 { font-size: 1.6rem; font-weight: 800; line-height: 1.3; margin-bottom: 8px; }
.pd-gate__hero p { color: var(--text-secondary); line-height: 1.8; margin-bottom: 18px; max-width: 520px; }
.pd-gate__art { width: 160px; height: 160px; position: relative; }
.pd-gate__art svg { width: 100%; height: 100%; }
.pd-gate__art .pd-spin { transform-origin: 80px 80px; animation: pd-spin 14s linear infinite; }
@keyframes pd-spin { to { transform: rotate(360deg); } }
.pd-gate__features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pd-feature { padding: 16px; border-radius: var(--radius-md); background: var(--glass-bg); border: 1px solid var(--pd-line); display: flex; flex-direction: column; gap: 8px; }
.pd-feature__ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--a, #9d00ff), var(--b, #00bfd6)); box-shadow: 0 6px 16px -6px var(--a, #9d00ff); }
.pd-feature__ico svg { width: 22px; height: 22px; }
.pd-feature b { font-size: 0.95rem; }
.pd-feature span { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.6; }

/* ── header + tabs ────────────────────────────────────────────────────── */
.pd-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pd-hello { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pd-avatar { width: 52px; height: 52px; border-radius: 16px; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, #9d00ff, #00bfd6); box-shadow: 0 8px 22px -8px rgba(157, 0, 255, 0.7); }
.pd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pd-hello small { color: var(--text-muted); font-size: 0.8rem; display: block; }
.pd-hello h2 { font-size: 1.35rem; font-weight: 800; overflow-wrap: anywhere; }
.pd-head__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.pd-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; border: 1px solid var(--pd-line); background: var(--pd-soft); color: var(--text-primary); white-space: nowrap; }
.pd-chip svg { width: 16px; height: 16px; }
.pd-chip--flame { border-color: rgba(255, 122, 26, 0.5); background: linear-gradient(135deg, rgba(255, 122, 26, 0.2), rgba(255, 63, 180, 0.12)); }
.pd-chip--target { border-color: rgba(0, 194, 255, 0.45); background: rgba(0, 194, 255, 0.12); }

.pd-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px; border-radius: 18px; background: var(--pd-card); border: 1px solid var(--pd-line); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pd-tabs::-webkit-scrollbar { display: none; }
.pd-tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 14px; border: 0; background: transparent; color: var(--text-secondary); font-family: inherit; font-weight: 700; font-size: 0.88rem; cursor: pointer; transition: background 0.2s, color 0.2s; white-space: nowrap; }
.pd-tab svg { width: 18px; height: 18px; }
.pd-tab:hover { color: var(--text-primary); background: var(--pd-soft); }
.pd-tab[aria-selected="true"] { color: #fff; background: linear-gradient(135deg, #9d00ff, #ff00ea); box-shadow: 0 6px 18px -6px rgba(255, 0, 234, 0.6); }
.pd-tab:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }

/* ── cards / bento ────────────────────────────────────────────────────── */
.pd-bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--pd-gap); }
.pd-card { position: relative; padding: 18px; border-radius: var(--radius-lg); background: var(--pd-card); border: 1px solid var(--pd-line); box-shadow: var(--glass-shadow); min-width: 0; }
.pd-card--span2 { grid-column: span 2; }
.pd-card--span3 { grid-column: span 3; }
.pd-card--full { grid-column: 1 / -1; }
.pd-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pd-card__title { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 800; color: var(--text-primary); }
.pd-card__title svg { width: 20px; height: 20px; color: var(--neon-cyan); }
.pd-card__hint { font-size: 0.78rem; color: var(--text-muted); }
.pd-card--glow::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(90% 70% at 100% 0%, rgba(0, 243, 255, 0.12), transparent 60%); }

.pd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pd-kpi { padding: 12px 14px; border-radius: 16px; background: var(--pd-soft); border: 1px solid var(--pd-line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pd-kpi__lbl { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.pd-kpi__val { font-size: 1.35rem; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.pd-kpi__val small { font-size: 0.72rem; color: var(--text-secondary); font-weight: 700; margin-inline-start: 3px; }
.pd-kpi__foot { font-size: 0.72rem; color: var(--text-secondary); }
.pd-kpi--kcal { box-shadow: inset 0 -3px 0 var(--pd-kcal); }
.pd-kpi--pro { box-shadow: inset 0 -3px 0 var(--pd-pro); }
.pd-kpi--carb { box-shadow: inset 0 -3px 0 var(--pd-carb); }
.pd-kpi--fat { box-shadow: inset 0 -3px 0 var(--pd-fat); }

/* Calorie ring */
.pd-today { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.pd-ring { position: relative; width: 168px; height: 168px; }
.pd-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pd-ring__track { stroke: var(--pd-soft); }
.pd-ring__val { transition: stroke-dashoffset 1s var(--nutri-ease-out, ease); }
.pd-ring__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.pd-ring__center b { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.pd-ring__center span { font-size: 0.75rem; color: var(--text-secondary); }
.pd-ring--sm { width: 92px; height: 92px; }
.pd-ring--sm .pd-ring__center b { font-size: 1.05rem; }
.pd-ring--sm .pd-ring__center span { font-size: 0.66rem; }

/* Progress bars */
.pd-bars { display: flex; flex-direction: column; gap: 10px; }
.pd-bar__top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8rem; margin-bottom: 4px; }
.pd-bar__top b { font-weight: 800; }
.pd-bar__track { position: relative; height: 10px; border-radius: 999px; background: var(--pd-soft); overflow: hidden; }
.pd-bar__fill { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--c1, #00c2ff), var(--c2, #9d00ff)); transition: width 0.9s var(--nutri-ease-out, ease); }
.pd-bar__plan { position: absolute; inset-block: -2px; width: 2px; background: var(--text-primary); opacity: 0.7; }
.pd-bar--over .pd-bar__fill { background: linear-gradient(90deg, var(--pd-warn), var(--pd-bad)); }

/* Segmented control / chips */
.pd-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pd-seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--pd-soft); border: 1px solid var(--pd-line); flex-wrap: wrap; }
.pd-seg button { min-height: 38px; padding: 6px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text-secondary); font-family: inherit; font-weight: 700; font-size: 0.82rem; cursor: pointer; transition: background 0.2s, color 0.2s; }
.pd-seg button[aria-pressed="true"] { background: linear-gradient(135deg, #0088ff, #00c2ff); color: #fff; box-shadow: 0 4px 12px -4px rgba(0, 136, 255, 0.6); }
.pd-seg button:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 1px; }

.pd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 14px; border: 1px solid var(--pd-line); background: var(--pd-soft); color: var(--text-primary); font-family: inherit; font-weight: 700; font-size: 0.86rem; cursor: pointer; transition: transform 0.15s, background 0.2s, border-color 0.2s; }
.pd-btn svg { width: 18px; height: 18px; }
.pd-btn:hover { border-color: var(--neon-cyan); }
.pd-btn:active { transform: scale(0.97); }
.pd-btn:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }
.pd-btn--primary { border: 0; color: #fff; background: linear-gradient(135deg, #00c2ff, #0066ff); box-shadow: 0 6px 18px -6px rgba(0, 102, 255, 0.7); }
.pd-btn--ok { border: 0; color: #fff; background: linear-gradient(135deg, #22c55e, #10b981); }
.pd-btn--danger { color: var(--pd-bad); border-color: rgba(255, 77, 109, 0.45); }
.pd-btn--ghost { background: transparent; }
.pd-btn--sm { min-height: 36px; padding: 6px 12px; font-size: 0.8rem; border-radius: 12px; }
.pd-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.pd-iconbtn { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; border: 1px solid var(--pd-line); background: var(--pd-soft); color: var(--text-secondary); display: inline-grid; place-items: center; cursor: pointer; transition: color 0.2s, border-color 0.2s, background 0.2s; }
.pd-iconbtn svg { width: 18px; height: 18px; }
.pd-iconbtn:hover { color: var(--text-primary); border-color: var(--neon-cyan); }
.pd-iconbtn--danger:hover { color: var(--pd-bad); border-color: rgba(255, 77, 109, 0.5); }
.pd-iconbtn:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }

.pd-chipset { display: flex; gap: 8px; flex-wrap: wrap; }
.pd-fchip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--pd-line); background: var(--pd-soft); color: var(--text-secondary); font-family: inherit; font-weight: 700; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; }
.pd-fchip i { font-style: normal; font-size: 0.7rem; padding: 1px 7px; border-radius: 99px; background: rgba(0, 0, 0, 0.25); color: var(--text-primary); }
.pd-fchip .pd-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #00f3ff); }
.pd-fchip[aria-pressed="true"] { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--c1, #9d00ff), var(--c2, #ff00ea)); }
.pd-fchip:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }

.pd-input, .pd-select { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--pd-line); background: rgba(0, 0, 0, 0.25); color: var(--text-primary); font-family: inherit; font-size: 0.95rem; }
[data-theme="light"] .pd-input, [data-theme="light"] .pd-select { background: rgba(255, 255, 255, 0.85); }
.pd-input:focus, .pd-select:focus { outline: none; border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(0, 243, 255, 0.15); }
.pd-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pd-field label { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); }
.pd-field small { font-size: 0.72rem; color: var(--text-muted); }
.pd-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

/* ── planner ──────────────────────────────────────────────────────────── */
.pd-daychips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.pd-daychip { min-height: 64px; padding: 8px 4px; border-radius: 16px; border: 1px solid var(--pd-line); background: var(--pd-soft); color: var(--text-secondary); font-family: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: all 0.2s; }
.pd-daychip b { font-size: 0.85rem; color: var(--text-primary); }
.pd-daychip span { font-size: 0.68rem; }
.pd-daychip.is-today { border-color: rgba(0, 243, 255, 0.55); }
.pd-daychip[aria-pressed="true"] { background: linear-gradient(160deg, rgba(157, 0, 255, 0.35), rgba(0, 194, 255, 0.25)); border-color: rgba(157, 0, 255, 0.6); box-shadow: 0 8px 20px -10px rgba(157, 0, 255, 0.8); }
.pd-daychip[aria-pressed="true"] b, .pd-daychip[aria-pressed="true"] span { color: #fff; }
.pd-daychip.has-plan::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--pd-ok); margin-top: 2px; }

.pd-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pd-cal__dow { text-align: center; font-size: 0.7rem; color: var(--text-muted); font-weight: 700; padding: 4px 0; }
.pd-cal__day { min-height: 54px; padding: 6px 4px; border-radius: 12px; border: 1px solid var(--pd-line); background: var(--pd-soft); color: var(--text-primary); font-family: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.85rem; font-weight: 700; }
.pd-cal__day small { font-size: 0.62rem; color: var(--text-muted); font-weight: 600; }
.pd-cal__day.is-out { opacity: 0.35; }
.pd-cal__day.is-today { border-color: var(--neon-cyan); }
.pd-cal__day.is-dated { background: linear-gradient(160deg, rgba(34, 197, 94, 0.22), rgba(0, 194, 255, 0.12)); }
.pd-cal__day[aria-pressed="true"] { background: linear-gradient(160deg, #9d00ff, #00a8e8); color: #fff; border-color: transparent; }
.pd-cal__day[aria-pressed="true"] small { color: rgba(255, 255, 255, 0.85); }

.pd-daybar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pd-daybar__main { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 10px; }
.pd-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; background: var(--pd-soft); border: 1px solid var(--pd-line); color: var(--text-secondary); }
.pd-badge--date { color: #fff; border-color: transparent; background: linear-gradient(135deg, #22c55e, #0ea5e9); }
.pd-badge--week { color: #fff; border-color: transparent; background: linear-gradient(135deg, #9d00ff, #6366f1); }

.pd-meals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pd-gap); }
.pd-meal { border-radius: var(--radius-lg); background: var(--pd-card); border: 1px solid var(--pd-line); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.pd-meal__head { display: flex; align-items: center; gap: 10px; padding: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--mc, #00f3ff) 22%, transparent), transparent 70%); border-bottom: 1px solid var(--pd-line); }
.pd-meal__icon { width: 42px; height: 42px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--mc, #00c2ff); box-shadow: 0 6px 16px -6px var(--mc, #00c2ff); }
.pd-meal__icon svg { width: 22px; height: 22px; }
.pd-meal__title { flex: 1; min-width: 0; }
.pd-meal__title b { display: block; font-size: 1rem; overflow-wrap: anywhere; }
.pd-meal__title small { color: var(--text-muted); font-size: 0.75rem; }
.pd-meal__kcal { font-weight: 800; font-size: 0.95rem; color: var(--pd-kcal); white-space: nowrap; }
.pd-meal__body { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pd-meal__foot { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.pd-macrostrip { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--pd-soft); }
.pd-macrostrip i { display: block; height: 100%; transition: flex-grow 0.6s; }
.pd-macrolegend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-secondary); }
.pd-macrolegend span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-inline-end: 5px; vertical-align: middle; }

.pd-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: var(--pd-soft); border: 1px solid transparent; transition: border-color 0.2s; min-width: 0; }
.pd-item:hover { border-color: var(--pd-line); }
.pd-item__thumb { width: 46px; height: 46px; flex-shrink: 0; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3)); }
.pd-item__thumb--none { display: grid; place-items: center; font-size: 1.4rem; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.pd-item__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pd-item__name { font-weight: 800; font-size: 0.9rem; overflow-wrap: anywhere; line-height: 1.35; }
.pd-item__meta { font-size: 0.74rem; color: var(--text-secondary); display: flex; gap: 8px; flex-wrap: wrap; }
.pd-item__meta b { color: var(--text-primary); }
.pd-item__kcal { font-weight: 800; color: var(--pd-kcal); font-size: 0.88rem; white-space: nowrap; }
.pd-item__acts { display: flex; gap: 6px; flex-shrink: 0; }
.pd-item--missing { opacity: 0.6; }
.pd-addfood { width: 100%; justify-content: center; border-style: dashed; }

.pd-addslots { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pd-addslot { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px dashed color-mix(in srgb, var(--mc, #00c2ff) 60%, transparent); background: color-mix(in srgb, var(--mc, #00c2ff) 10%, transparent); color: var(--text-primary); font-family: inherit; font-weight: 700; font-size: 0.8rem; cursor: pointer; }
[dir="rtl"] .pd-addslot { padding: 6px 6px 6px 12px; }
.pd-addslot i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--mc, #00c2ff); }
.pd-addslot i svg { width: 16px; height: 16px; }
.pd-addslot:hover { border-style: solid; }

/* Analysis panel */
.pd-analysis { border-top: 1px dashed var(--pd-line); padding-top: 12px; display: grid; gap: 14px; }
.pd-analysis[hidden] { display: none; }
.pd-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.pd-table th, .pd-table td { padding: 8px 6px; text-align: start; border-bottom: 1px solid var(--pd-line); }
.pd-table th { color: var(--text-muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.3px; }
.pd-table td.pd-r, .pd-table th.pd-r { text-align: end; font-variant-numeric: tabular-nums; }
.pd-table tr:last-child td { border-bottom: 0; }
.pd-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pd-cover { display: grid; gap: 10px; }
.pd-cover__row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 10px; align-items: center; font-size: 0.8rem; }
.pd-cover__row b { font-weight: 800; }
.pd-cover__pct { font-weight: 800; min-width: 48px; text-align: end; font-variant-numeric: tabular-nums; }
.pd-cover__row .pd-bar__fill { --c1: #00c2ff; --c2: #22c55e; }
.pd-cover__row.is-limit .pd-bar__fill { --c1: #22c55e; --c2: #f59e0b; }
.pd-cover__lim { display: block; font-size: 0.66rem; font-weight: 700; color: var(--text-muted); }
.pd-cover__row.is-over .pd-cover__pct, .pd-cover__row.is-over .pd-cover__lim { color: var(--pd-bad); }
.pd-cover__row.is-over .pd-bar__fill { --c1: #f59e0b; --c2: #ff4d6d; }
.pd-note { font-size: 0.72rem; color: var(--text-muted); line-height: 1.6; }

.pd-chart { width: 100%; height: 300px; }
.pd-chart--sm { height: 220px; }
.pd-chart--lg { height: 380px; }

/* ── checklist ────────────────────────────────────────────────────────── */
.pd-datenav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pd-datenav__label { flex: 1; min-width: 180px; text-align: center; }
.pd-datenav__label b { display: block; font-size: 1.15rem; font-weight: 800; }
.pd-datenav__label small { color: var(--text-muted); font-size: 0.78rem; }
.pd-datenav input[type="date"] { max-width: 170px; }
.pd-check { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--pd-soft); border: 1px solid var(--pd-line); transition: background 0.25s, border-color 0.25s; }
.pd-check__btn { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--pd-line); background: transparent; display: grid; place-items: center; cursor: pointer; color: transparent; transition: all 0.25s var(--nutri-ease-spring, ease); }
.pd-check__btn svg { width: 22px; height: 22px; }
.pd-check__btn:hover { border-color: var(--pd-ok); color: rgba(34, 197, 94, 0.5); }
.pd-check__btn:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }
.pd-check.is-done { border-color: rgba(34, 197, 94, 0.45); background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), transparent 70%); }
.pd-check.is-done .pd-check__btn { background: var(--pd-ok); border-color: var(--pd-ok); color: #fff; transform: scale(1.04); }
.pd-check.is-partial { border-color: rgba(245, 158, 11, 0.5); background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), transparent 70%); }
.pd-check.is-partial .pd-check__btn { background: var(--pd-warn); border-color: var(--pd-warn); color: #fff; }
.pd-check.is-skipped { opacity: 0.7; }
.pd-check.is-skipped .pd-item__name { text-decoration: line-through; }
.pd-check.is-skipped .pd-check__btn { border-color: var(--pd-bad); color: var(--pd-bad); }
.pd-check.is-extra { border-color: rgba(139, 92, 246, 0.5); background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), transparent 70%); }
.pd-check.is-extra .pd-check__btn { background: var(--pd-extra); border-color: var(--pd-extra); color: #fff; }
.pd-plan-vs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 0.74rem; }
.pd-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.22); color: var(--text-secondary); font-weight: 700; }
.pd-pill--actual { background: rgba(34, 197, 94, 0.2); color: var(--text-primary); }
.pd-status { font-size: 0.68rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.3px; }
.pd-status--done { background: rgba(34, 197, 94, 0.2); color: var(--pd-ok); }
.pd-status--partial { background: rgba(245, 158, 11, 0.2); color: var(--pd-warn); }
.pd-status--skipped { background: rgba(255, 77, 109, 0.18); color: var(--pd-bad); }
.pd-status--extra { background: rgba(139, 92, 246, 0.2); color: #b69cff; }
.pd-status--pending { background: var(--pd-soft); color: var(--text-muted); }

.pd-stepper { display: inline-flex; align-items: center; gap: 6px; }
.pd-stepper button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--pd-line); background: var(--pd-soft); color: var(--text-primary); font-size: 1.2rem; font-weight: 800; cursor: pointer; }
.pd-stepper input { width: 88px; text-align: center; font-weight: 800; }
.pd-quick { display: flex; gap: 6px; flex-wrap: wrap; }

.pd-editor { display: grid; gap: 12px; padding: 12px; margin-top: 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--pd-line); }
[data-theme="light"] .pd-editor { background: rgba(255, 255, 255, 0.7); }
.pd-editor__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pd-preview { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── saved items ──────────────────────────────────────────────────────── */
.pd-filters { display: grid; gap: 12px; }
.pd-filters__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pd-filters__row > .pd-input { flex: 1; min-width: 200px; }
.pd-filters__row > .pd-select { width: auto; min-width: 170px; }
.pd-saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.pd-scard { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 20px; background: var(--pd-card); border: 1px solid var(--pd-line); overflow: hidden; transition: transform 0.2s, border-color 0.2s; min-width: 0; }
.pd-scard:hover { transform: translateY(-2px); border-color: rgba(255, 61, 127, 0.45); }
.pd-scard::before { content: ''; position: absolute; inset-inline-end: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, var(--gc, rgba(0, 243, 255, 0.25)), transparent 70%); pointer-events: none; }
.pd-scard__top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.pd-scard__img { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)); }
.pd-scard__names { flex: 1; min-width: 0; }
.pd-scard__names b { display: block; font-size: 0.95rem; overflow-wrap: anywhere; }
.pd-scard__names small { color: var(--text-muted); font-size: 0.74rem; }
.pd-scard__metric { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--pd-soft); }
.pd-scard__metric span { font-size: 0.8rem; color: var(--text-secondary); font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.pd-scard__metric b { font-size: 1.25rem; font-weight: 800; white-space: nowrap; }
.pd-scard__metric b small { font-size: 0.7rem; color: var(--text-muted); margin-inline-start: 3px; }
.pd-scard__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.pd-scard__note { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.6; padding: 8px 10px; border-radius: 12px; border: 1px dashed var(--pd-line); }
.pd-scard__acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.pd-type { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; padding: 3px 8px; border-radius: 999px; color: #fff; background: var(--tc, #6366f1); }

/* ── history ──────────────────────────────────────────────────────────── */
.pd-timeline { display: flex; flex-direction: column; gap: 18px; }
.pd-tl-day > b { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.pd-tl-list { display: flex; flex-direction: column; gap: 8px; border-inline-start: 2px solid var(--pd-line); padding-inline-start: 14px; }
.pd-tl-item { position: relative; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--pd-soft); }
.pd-tl-item::before { content: ''; position: absolute; inset-inline-start: -21px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--ec, #00c2ff); box-shadow: 0 0 0 3px var(--bg-dark); }
.pd-tl-ico { width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--ec, #00c2ff); }
.pd-tl-ico svg { width: 16px; height: 16px; }
.pd-tl-txt { flex: 1 1 150px; min-width: 0; font-size: 0.85rem; line-height: 1.5; overflow-wrap: break-word; }
.pd-tl-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; margin-inline-start: auto; }

/* ── empty / loading ──────────────────────────────────────────────────── */
.pd-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 34px 16px; color: var(--text-secondary); }
.pd-empty svg { width: 64px; height: 64px; color: var(--neon-cyan); opacity: 0.8; }
.pd-empty b { color: var(--text-primary); font-size: 1rem; }
.pd-skel { position: relative; overflow: hidden; border-radius: 16px; background: var(--pd-soft); min-height: 80px; }
.pd-skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent); animation: pd-shimmer 1.3s infinite; }
@keyframes pd-shimmer { to { transform: translateX(100%); } }
.pd-error { padding: 16px; border-radius: 16px; border: 1px solid rgba(255, 77, 109, 0.45); background: rgba(255, 77, 109, 0.1); color: var(--text-primary); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ── food picker (modal) ──────────────────────────────────────────────── */
.pd-modal-content { max-width: 620px; }
.pd-picker { display: grid; gap: 12px; }
.pd-picker__list { max-height: 44vh; overflow-y: auto; display: grid; gap: 6px; -webkit-overflow-scrolling: touch; }
.pd-picker__opt { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 10px; border-radius: 14px; border: 1px solid var(--pd-line); background: var(--pd-soft); color: var(--text-primary); font-family: inherit; text-align: start; cursor: pointer; }
.pd-picker__opt img { width: 40px; height: 40px; object-fit: contain; }
.pd-picker__opt span { flex: 1; min-width: 0; }
.pd-picker__opt span b { display: block; font-size: 0.9rem; }
.pd-picker__opt span small { color: var(--text-muted); font-size: 0.74rem; }
.pd-picker__opt em { font-style: normal; font-weight: 800; color: var(--pd-kcal); font-size: 0.8rem; white-space: nowrap; }
.pd-picker__opt:hover, .pd-picker__opt:focus-visible { border-color: var(--neon-cyan); outline: none; }
.pd-picker__sel { display: grid; gap: 12px; padding: 12px; border-radius: 16px; border: 1px solid rgba(0, 243, 255, 0.35); background: linear-gradient(135deg, rgba(0, 243, 255, 0.08), rgba(157, 0, 255, 0.06)); }

/* ── responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .pd-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pd-card--span3 { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .pd-meals { grid-template-columns: 1fr; }
  .pd-gate__features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .pd-root { --pd-gap: 12px; }
  .pd-bento { grid-template-columns: 1fr; }
  .pd-card--span2, .pd-card--span3 { grid-column: auto; }
  .pd-card { padding: 14px; }
  .pd-gate__hero { grid-template-columns: 1fr; padding: 24px 18px; text-align: center; }
  .pd-gate__hero p { margin-inline: auto; }
  .pd-gate__art { margin: 0 auto; width: 120px; height: 120px; }
  .pd-today { grid-template-columns: 1fr; justify-items: center; }
  .pd-daychips { grid-template-columns: repeat(7, minmax(40px, 1fr)); gap: 4px; overflow-x: auto; }
  .pd-daychip { min-height: 56px; border-radius: 12px; }
  .pd-grid2 { grid-template-columns: 1fr; }
  .pd-chart { height: 260px; }
  .pd-chart--lg { height: 300px; }
  .pd-cover__row { grid-template-columns: minmax(80px, 110px) 1fr auto; }
  .pd-item__acts .pd-iconbtn { width: 36px; height: 36px; }
  .pd-datenav__label { order: -1; flex-basis: 100%; }
}
@media (max-width: 420px) {
  .pd-gate__features { grid-template-columns: 1fr; }
  .pd-kpi__val { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pd-reveal, .pd-gate__art .pd-spin, .pd-skel::after { animation: none !important; }
  .pd-ring__val, .pd-bar__fill, .pd-macrostrip i, .pd-check__btn { transition: none !important; }
}
