/**
 * DS4K Parent Dashboard — Design System (Guide v1.0)
 * Calm + Smart + Trustworthy
 */
:root {
  --pd-bg: #f7f8fa;
  --pd-surface: #ffffff;
  --pd-text: #111827;
  --pd-muted: #667085;
  --pd-primary: #2563eb;
  --pd-primary-deep: #1d4ed8;
  --pd-success: #16a34a;
  --pd-attention: #f59e0b;
  --pd-danger: #dc2626;
  --pd-border: #e5e7eb;
  --pd-radius: 16px;
  --pd-radius-sm: 12px;
  --pd-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  --pd-sidebar: 240px;
}

.mk-app.is-dashboard {
  max-width: 1280px;
  padding-bottom: 88px;
}

.mk-mp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}
.mk-mp-tabs button {
  border: 1.5px solid var(--pd-border);
  background: var(--pd-surface);
  color: var(--pd-text);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.mk-mp-tabs button.is-active {
  background: var(--pd-primary);
  border-color: var(--pd-primary);
  color: #fff;
}

.pd-shell {
  display: grid;
  grid-template-columns: var(--pd-sidebar) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-height: 640px;
}

.pd-sidebar {
  position: sticky;
  top: 72px;
  background: var(--pd-surface);
  border: 1px solid var(--pd-border);
  border-radius: var(--pd-radius);
  padding: 20px 16px;
  box-shadow: var(--pd-shadow);
}
.pd-side-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 18px;
}
.pd-logo {
  font-family: var(--font-display, Comfortaa, sans-serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--pd-primary);
}
.pd-side-brand span:last-child {
  font-size: 12px;
  color: var(--pd-muted);
  font-weight: 600;
}
.pd-child {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #f8fafc;
  border-radius: var(--pd-radius-sm);
  margin-bottom: 16px;
}
.pd-child-av {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #93c5fd, #2563eb);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}
.pd-child strong {
  display: block;
  font-size: 14px;
}
.pd-side-nav {
  display: grid;
  gap: 4px;
}
.pd-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--pd-muted);
  padding: 11px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.pd-nav-btn:hover,
.pd-nav-btn:focus-visible {
  background: #eff6ff;
  color: var(--pd-primary);
  outline: none;
}
.pd-nav-btn.is-active {
  background: #eff6ff;
  color: var(--pd-primary);
}
.pd-side-link {
  display: block;
  margin-top: 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--pd-primary);
  text-decoration: none;
  padding: 8px 12px;
}
.pd-side-link:hover {
  text-decoration: underline;
}

.pd-main {
  min-width: 0;
}
.pd-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.pd-topbar-left {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.pd-topbar-child {
  display: none;
  width: 100%;
}
.pd-child-box-compact {
  margin-bottom: 0;
}
.pd-top-child {
  font-weight: 800;
  font-size: 14px;
  color: var(--pd-text);
}

.pd-hero,
.pd-view-head {
  margin-bottom: 20px;
}
.pd-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 55%, #f0fdf4 100%);
  border: 1px solid var(--pd-border);
  border-radius: 20px;
  padding: 24px;
}
.pd-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pd-primary);
}
.pd-hero h1,
.pd-view-head h1 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--pd-text);
  line-height: 1.25;
}
.pd-insight {
  margin: 0;
  color: var(--pd-muted);
  font-size: 15px;
  max-width: 42rem;
  line-height: 1.55;
}

.pd-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.pd-stat {
  background: var(--pd-surface);
  border: 1px solid var(--pd-border);
  border-radius: var(--pd-radius);
  padding: 16px 18px;
  box-shadow: var(--pd-shadow);
}
.pd-stat-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--pd-muted);
  margin-bottom: 6px;
}
.pd-stat-value {
  display: block;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--pd-text);
}

.pd-grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
  margin-bottom: 14px;
}
.pd-grid-cal {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 14px;
}

.pd-card {
  background: var(--pd-surface);
  border: 1px solid var(--pd-border);
  border-radius: var(--pd-radius);
  padding: 18px 20px;
  box-shadow: var(--pd-shadow);
}
.pd-card h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 800;
}
.pd-card-accent {
  background: linear-gradient(180deg, #eff6ff, #fff);
  border-color: #bfdbfe;
}
.pd-caption {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--pd-muted);
  line-height: 1.45;
}
.pd-rec-skill {
  margin: 8px 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--pd-text);
}

.pd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.pd-btn-primary {
  background: var(--pd-primary);
  color: #fff;
}
.pd-btn-primary:hover {
  background: var(--pd-primary-deep);
}
.pd-btn-ghost {
  background: #fff;
  border-color: var(--pd-border);
  color: var(--pd-text);
}

.pd-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  min-height: 120px;
  margin-top: 8px;
}
.pd-week-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pd-week-bar-wrap {
  width: 100%;
  height: 88px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.pd-week-bar {
  width: 70%;
  max-width: 28px;
  border-radius: 8px 8px 4px 4px;
  min-height: 6px;
  background: #e5e7eb;
}
.pd-week-bar.pd-intensity-light {
  background: #93c5fd;
}
.pd-week-bar.pd-intensity-active {
  background: var(--pd-primary);
}
.pd-week-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--pd-muted);
}
.pd-week-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pd-success);
}
.pd-week-dot.is-off {
  background: #e5e7eb;
}

.pd-chip-stack {
  display: grid;
  gap: 8px;
}
.pd-skill-chip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--pd-border);
  font-size: 14px;
}
.pd-skill-chip.is-strong {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.pd-skill-chip.is-practice {
  background: #fffbeb;
  border-color: #fde68a;
}
.pd-skill-chip strong {
  font-size: 13px;
  white-space: nowrap;
}

.pd-spark {
  margin-top: 8px;
  overflow: hidden;
}
.pd-spark-svg {
  width: 100%;
  height: 96px;
  display: block;
}
.pd-spark-fill {
  fill: rgba(37, 99, 235, 0.12);
}
.pd-spark-line {
  stroke: var(--pd-primary);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.pd-cal-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--pd-muted);
  margin-bottom: 12px;
}
.pd-cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pd-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  background: #f3f4f6;
  border: 1px solid var(--pd-border);
}
.pd-dot.light {
  background: #bfdbfe;
}
.pd-dot.active {
  background: #2563eb;
}
.pd-cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--pd-muted);
}
.pd-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.pd-cal-cell {
  aspect-ratio: 1;
  border: 1px solid var(--pd-border);
  border-radius: 10px;
  background: #fafafa;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  padding: 0;
}
.pd-cal-cell.is-pad {
  border: 0;
  background: transparent;
  cursor: default;
}
.pd-cal-cell.pd-intensity-light {
  background: #dbeafe;
}
.pd-cal-cell.pd-intensity-active {
  background: #93c5fd;
}
.pd-cal-cell.is-selected {
  outline: 2px solid var(--pd-primary);
  outline-offset: 1px;
}
.pd-cal-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--pd-text);
}
.pd-cal-mark {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pd-primary-deep);
}
.pd-day-stats {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 10px;
}
.pd-day-stats li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--pd-border);
}
.pd-day-stats span {
  color: var(--pd-muted);
}

.pd-bar-row {
  margin: 14px 0;
}
.pd-bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 6px;
}
.pd-bar-meta span {
  color: var(--pd-muted);
  font-size: 12px;
}
.pd-bar-track {
  height: 10px;
  background: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
}
.pd-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  border-radius: 999px;
}

.pd-practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.pd-practice-card {
  background: var(--pd-surface);
  border: 1px solid var(--pd-border);
  border-radius: var(--pd-radius);
  padding: 18px;
}
.pd-practice-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.pd-recent {
  display: flex;
  gap: 4px;
  margin: 10px 0 14px;
  flex-wrap: wrap;
}
.pd-recent i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.pd-recent i.ok {
  background: var(--pd-success);
}
.pd-recent i.retry {
  background: var(--pd-attention);
}

.pd-seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #f3f4f6;
  border-radius: 12px;
  margin-bottom: 14px;
}
.pd-seg button {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--pd-muted);
}
.pd-seg button.is-on {
  background: #fff;
  color: var(--pd-text);
  box-shadow: var(--pd-shadow);
}
.pd-leaderboard {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.pd-leaderboard li {
  display: grid;
  grid-template-columns: 28px 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--pd-border);
  border-radius: 12px;
}
.pd-leaderboard li.is-you {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.pd-rank-n {
  font-weight: 800;
  color: var(--pd-muted);
}
.pd-rank-av {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #f3f4f6;
  display: grid;
  place-items: center;
}
.pd-rank-xp {
  font-weight: 800;
  font-size: 13px;
  color: var(--pd-primary);
}

.pd-empty {
  text-align: center;
  padding: 40px 20px;
  background: var(--pd-surface);
  border: 1px dashed var(--pd-border);
  border-radius: var(--pd-radius);
}
.pd-empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}
.pd-empty h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}
.pd-empty p {
  margin: 0 0 16px;
  color: var(--pd-muted);
  font-size: 14px;
}

.pd-child-box {
  background: #f8fafc;
  border: 1px solid var(--pd-border);
  border-radius: var(--pd-radius-sm);
  padding: 12px;
  margin-bottom: 14px;
}
.pd-child-select-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--pd-muted);
}
.pd-child-select {
  width: 100%;
  border: 1.5px solid var(--pd-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  color: var(--pd-text);
  background: #fff;
}
.pd-child-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.pd-age-nudge {
  margin: 8px 0 0 !important;
  color: #b45309;
  line-height: 1.4;
}
.pd-link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 800;
  color: var(--pd-accent, #0f766e);
  text-decoration: underline;
  cursor: pointer;
}
.pd-btn-sm {
  padding: 8px 12px !important;
  font-size: 12px !important;
}
.pd-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
}
.pd-modal {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  display: grid;
  gap: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}
.pd-modal h3 {
  margin: 0;
  font-size: 1.15rem;
}
.pd-modal label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--pd-muted);
}
.pd-modal input,
.pd-modal select {
  border: 1.5px solid var(--pd-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 600;
  color: var(--pd-text);
}
.pd-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.pd-demo-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  font-weight: 600;
}
.pd-demo-actions {
  text-align: center;
  margin-top: 14px;
}
.pd-linkish {
  border: 0;
  background: transparent;
  color: var(--pd-primary);
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  padding: 0;
}

.pd-bottom-nav {
  display: none;
}

@media (max-width: 1199px) {
  .pd-shell {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .pd-side-brand span:last-child,
  .pd-child > div,
  .pd-nav-btn span,
  .pd-side-link {
    display: none;
  }
  .pd-child {
    justify-content: center;
  }
  .pd-nav-btn {
    justify-content: center;
  }
  .pd-grid-2,
  .pd-grid-cal,
  .pd-kpi-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .pd-shell {
    grid-template-columns: 1fr;
  }
  .pd-sidebar {
    display: none;
  }
  .pd-topbar-child {
    display: block;
  }
  .pd-top-sub {
    display: none;
  }
  .pd-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--pd-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .pd-bottom-nav .pd-nav-btn {
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    padding: 8px 4px;
    color: var(--pd-muted);
  }
  .pd-bottom-nav .pd-nav-btn span {
    display: block;
  }
  .pd-bottom-nav .pd-nav-btn.is-active {
    background: transparent;
    color: var(--pd-primary);
  }
  .pd-hero {
    padding: 18px;
  }
  .mk-app.is-dashboard {
    padding-bottom: 96px;
  }
}
